diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..53b199cb75 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +.github/workflows/dart.yml linguist-generated=true +tool/ci.sh linguist-generated=true +pkgs/*/.metadata linguist-generated=true diff --git a/.github/ISSUE_TEMPLATE/1--package-http---failing-connection.md b/.github/ISSUE_TEMPLATE/1--package-http---failing-connection.md new file mode 100644 index 0000000000..643f85d534 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1--package-http---failing-connection.md @@ -0,0 +1,37 @@ +--- +name: 1) package:http - Failing Connection +about: You are attempting to make a GET or POST and getting an unexpected exception + or status code. +title: '' +labels: package:http, type-bug +assignees: '' + +--- + +********************************************************** +**This is not the repository you want to file issues in!** +********************************************************** + +Note that a failing HTTP connection is almost certainly not caused by a bug in +package:http. + +This package is a wrapper around the HttpClient from dart:io and HttpRequest +from dart:html. Before filing a bug here verify that the issue is not surfaced +when using those interfaces directly. + +https://api.dart.dev/stable/dart-io/HttpClient-class.html +https://api.dart.dev/stable/dart-html/HttpRequest-class.html + +# Common problems: + +- A security policy prevents the connection. +- Running in an emulator that does not have outside internet access. +- Using Android and not requesting internet access in the manifest. + https://github.com/flutter/flutter/issues/29688 + +None of these problems are influenced by the code in this repo. + +# Diagnosing: + +- Attempt the request outside of Dart, for instance in a browser or with `curl`. +- Attempt the request with the dart:io or dart:html equivalent code paths. diff --git a/.github/ISSUE_TEMPLATE/2--package-http---i-found-a-bug.md b/.github/ISSUE_TEMPLATE/2--package-http---i-found-a-bug.md new file mode 100644 index 0000000000..261f75e9ae --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2--package-http---i-found-a-bug.md @@ -0,0 +1,15 @@ +--- +name: 2) package:http - I found a bug +about: You found that something which is expected to work, doesn't. The same capability + works when using `dart:io` or `dart:html` directly. +title: '' +labels: package:http, type-bug +assignees: '' + +--- + +Please describe the bug and how to reproduce it. + +Note that if the bug can also be reproduced when going through the interfaces provided by `dart:html` or `dart:io` directly the bug should be filed against the Dart SDK: https://github.com/dart-lang/sdk/issues + +A failure to make an HTTP request is more often a problem with the environment than with the client. diff --git a/.github/ISSUE_TEMPLATE/3--package-http---i-d-like-a-new-feature.md b/.github/ISSUE_TEMPLATE/3--package-http---i-d-like-a-new-feature.md new file mode 100644 index 0000000000..db3cba282a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/3--package-http---i-d-like-a-new-feature.md @@ -0,0 +1,11 @@ +--- +name: 3) package:http - I'd like a new feature +about: You are using package:http and would like a new feature to make it easier + to make http requests. +title: '' +labels: package:http, type-enhancement +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/4--package-cronet_http---i-found-a-bug.md b/.github/ISSUE_TEMPLATE/4--package-cronet_http---i-found-a-bug.md new file mode 100644 index 0000000000..806097473a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/4--package-cronet_http---i-found-a-bug.md @@ -0,0 +1,10 @@ +--- +name: 4) package:cronet_http - I found a bug +about: You found that something which is expected to work, doesn't. +title: '' +labels: package:cronet_http, type-bug +assignees: brianquinlan + +--- + + diff --git a/.github/ISSUE_TEMPLATE/5--package-cronet_http---i-d-like-a-new-feature.md b/.github/ISSUE_TEMPLATE/5--package-cronet_http---i-d-like-a-new-feature.md new file mode 100644 index 0000000000..fdd3ce9343 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/5--package-cronet_http---i-d-like-a-new-feature.md @@ -0,0 +1,11 @@ +--- +name: 5) package:cronet_http - I'd like a new feature +about: You are using package:cronet_http and would like a new feature to make it easier + to make http requests. +title: '' +labels: package:cronet_http, type-enhancement +assignees: brianquinlan + +--- + + diff --git a/.github/ISSUE_TEMPLATE/6--package-cupertino_http---i-found-a-bug.md b/.github/ISSUE_TEMPLATE/6--package-cupertino_http---i-found-a-bug.md new file mode 100644 index 0000000000..5ca9387b90 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/6--package-cupertino_http---i-found-a-bug.md @@ -0,0 +1,10 @@ +--- +name: 6) package:cupertino_http - I found a bug +about: You found that something which is expected to work, doesn't. +title: '' +labels: package:cupertino_http, type-bug +assignees: brianquinlan + +--- + + diff --git a/.github/ISSUE_TEMPLATE/7--package-cupertino_http---i-d-like-a-new-feature.md b/.github/ISSUE_TEMPLATE/7--package-cupertino_http---i-d-like-a-new-feature.md new file mode 100644 index 0000000000..1d90495660 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/7--package-cupertino_http---i-d-like-a-new-feature.md @@ -0,0 +1,11 @@ +--- +name: 7) package:cupertino_http - I'd like a new feature +about: You are using package:cupertino_http and would like a new feature to make it + easier to make http requests. +title: '' +labels: package:cupertino_http, type-enhancement +assignees: brianquinlan + +--- + + diff --git a/.github/ISSUE_TEMPLATE/http2.md b/.github/ISSUE_TEMPLATE/http2.md new file mode 100644 index 0000000000..9c982e75a8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/http2.md @@ -0,0 +1,5 @@ +--- +name: "package:http2" +about: "Create a bug or file a feature request against package:http2." +labels: "package:http2" +--- \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/http_parser.md b/.github/ISSUE_TEMPLATE/http_parser.md new file mode 100644 index 0000000000..cf34cdc533 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/http_parser.md @@ -0,0 +1,5 @@ +--- +name: "package:http_parser" +about: "Create a bug or file a feature request against package:http_parser." +labels: "package:http_parser" +--- \ No newline at end of file diff --git a/pkgs/http_parser/.github/dependabot.yaml b/.github/dependabot.yml similarity index 74% rename from pkgs/http_parser/.github/dependabot.yaml rename to .github/dependabot.yml index bf6b38a4d8..7c3a9d9079 100644 --- a/pkgs/http_parser/.github/dependabot.yaml +++ b/.github/dependabot.yml @@ -1,6 +1,7 @@ # Dependabot configuration file. -version: 2 +# See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates +version: 2 updates: - package-ecosystem: github-actions directory: / diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000000..3add1c1717 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,29 @@ +# Configuration for .github/workflows/pull_request_label.yml. + +'type-infra': + - changed-files: + - any-glob-to-any-file: '.github/**' + +'package:cronet_http': + - changed-files: + - any-glob-to-any-file: 'pkgs/cronet_http/**' + +'package:cupertino_http': + - changed-files: + - any-glob-to-any-file: 'pkgs/cupertino_http/**' + +'package:http': + - changed-files: + - any-glob-to-any-file: 'pkgs/http/**' + +'package:http2': + - changed-files: + - any-glob-to-any-file: 'pkgs/http2/**' + +'package:http_parser': + - changed-files: + - any-glob-to-any-file: 'pkgs/http_parser/**' + +'package:http_client_conformance_tests': + - changed-files: + - any-glob-to-any-file: 'pkgs/http_client_conformance_tests/**' diff --git a/.github/workflows/cronet.yml b/.github/workflows/cronet.yml new file mode 100644 index 0000000000..6747d38d79 --- /dev/null +++ b/.github/workflows/cronet.yml @@ -0,0 +1,68 @@ +name: package:cronet_http CI + +on: + push: + branches: + - main + - master + paths: + - '.github/workflows/cronet.yml' + - 'pkgs/cronet_http/**' + - 'pkgs/http_client_conformance_tests/**' + pull_request: + paths: + - '.github/workflows/cronet.yml' + - 'pkgs/cronet_http/**' + - 'pkgs/http_client_conformance_tests/**' + schedule: + - cron: "0 0 * * 0" + +env: + PUB_ENVIRONMENT: bot.github + +jobs: + verify: + name: Format & Analyze & Test + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + cronetHttpNoPlay: ['false', 'true'] + defaults: + run: + working-directory: pkgs/cronet_http + steps: + - name: Delete unnecessary tools 🔧 + uses: jlumbroso/free-disk-space@v1.3.1 + with: + android: false # Don't remove Android tools + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b + with: + distribution: 'zulu' + java-version: '17' + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + channel: 'stable' + - id: install + name: Install dependencies + run: flutter pub get + - name: Check formatting + if: always() && steps.install.outcome == 'success' + run: dart format --output=none --set-exit-if-changed . + - name: Analyze code + if: always() && steps.install.outcome == 'success' + run: flutter analyze --fatal-infos + - name: Run tests + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d + if: always() && steps.install.outcome == 'success' + with: + # api-level/minSdkVersion should be help in sync in: + # - .github/workflows/cronet.yml + # - pkgs/cronet_http/android/build.gradle + # - pkgs/cronet_http/example/android/app/build.gradle + api-level: 21 + arch: x86_64 + target: ${{ matrix.cronetHttpNoPlay == 'true' && 'default' || 'google_apis' }} + script: cd pkgs/cronet_http/example && flutter test --dart-define=cronetHttpNoPlay=${{ matrix.cronetHttpNoPlay }} --timeout=1200s integration_test/ diff --git a/.github/workflows/cupertino.yml b/.github/workflows/cupertino.yml new file mode 100644 index 0000000000..3b52d1a189 --- /dev/null +++ b/.github/workflows/cupertino.yml @@ -0,0 +1,87 @@ +name: package:cupertino_http CI + +on: + push: + branches: + - main + - master + paths: + - '.github/workflows/cupertino.yml' + - 'pkgs/cupertino_http/**' + - 'pkgs/http_client_conformance_tests/**' + pull_request: + paths: + - '.github/workflows/cupertino.yml' + - 'pkgs/cupertino_http/**' + - 'pkgs/http_client_conformance_tests/**' + schedule: + - cron: "0 0 * * 0" + +env: + PUB_ENVIRONMENT: bot.github + +jobs: + macos: + name: "macOS: Format & Analyze & Test" + runs-on: macos-latest + defaults: + run: + working-directory: pkgs/cupertino_http + strategy: + matrix: + # Test on the minimum supported flutter version and the latest + # version. + flutter-version: ["3.24.0", "any"] + # It would be nice to test on older versions of macOS but macOS 13 is + # the oldest supported by GitHub. + os: [macos-13, macos-latest] + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + flutter-version: ${{ matrix.flutter-version }} + channel: 'stable' + - id: install + name: Install dependencies + run: flutter pub get + - name: Check formatting + run: dart format --output=none --set-exit-if-changed . + if: always() && steps.install.outcome == 'success' + - name: Analyze code + run: flutter analyze --fatal-infos + if: always() && steps.install.outcome == 'success' + - name: Run tests + run: | + cd example + flutter pub get + flutter test -d macos integration_test/main.dart --test-randomize-ordering-seed=random + ios: + name: "iOS: Test" + runs-on: macos-latest + defaults: + run: + working-directory: pkgs/cupertino_http + strategy: + fail-fast: false + matrix: + # Test on the minimum supported flutter version and the latest + # version. + flutter-version: ["3.24.0", "any"] + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + flutter-version: ${{ matrix.flutter-version }} + channel: 'stable' + - id: install + name: Install dependencies + run: flutter pub get + - uses: futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd + with: + os: iOS + os_version: '>=13.0' + - name: Run tests + run: | + cd example + flutter pub get + flutter test integration_test/main.dart --test-randomize-ordering-seed=random diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml new file mode 100644 index 0000000000..331256a9b4 --- /dev/null +++ b/.github/workflows/dart.yml @@ -0,0 +1,862 @@ +# Created with package:mono_repo v6.6.2 +name: Dart CI +on: + push: + branches: + - main + - master + pull_request: + schedule: + - cron: "0 0 * * 0" +defaults: + run: + shell: bash +env: + PUB_ENVIRONMENT: bot.github +permissions: read-all + +jobs: + job_001: + name: mono_repo self validate + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: stable + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - name: mono_repo self validate + run: dart pub global activate mono_repo 6.6.2 + - name: mono_repo self validate + run: dart pub global run mono_repo generate --validate + job_002: + name: "analyze_and_format; linux; Dart 3.4.0; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/web_socket, pkgs/web_socket_conformance_tests; `dart analyze --fatal-infos`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket-pkgs/web_socket_conformance_tests;commands:analyze_1" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket-pkgs/web_socket_conformance_tests + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: "3.4.0" + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + - id: pkgs_http_client_conformance_tests_pub_upgrade + name: pkgs/http_client_conformance_tests; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http_client_conformance_tests + - name: "pkgs/http_client_conformance_tests; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_http_client_conformance_tests_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http_client_conformance_tests + - id: pkgs_http_profile_pub_upgrade + name: pkgs/http_profile; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http_profile + - name: "pkgs/http_profile; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http_profile + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket + - id: pkgs_web_socket_conformance_tests_pub_upgrade + name: pkgs/web_socket_conformance_tests; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket_conformance_tests + - name: "pkgs/web_socket_conformance_tests; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_web_socket_conformance_tests_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket_conformance_tests + job_003: + name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/web_socket, pkgs/web_socket_conformance_tests; `dart analyze --fatal-infos`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket-pkgs/web_socket_conformance_tests;commands:analyze_1" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket-pkgs/web_socket_conformance_tests + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + - id: pkgs_http_client_conformance_tests_pub_upgrade + name: pkgs/http_client_conformance_tests; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http_client_conformance_tests + - name: "pkgs/http_client_conformance_tests; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_http_client_conformance_tests_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http_client_conformance_tests + - id: pkgs_http_profile_pub_upgrade + name: pkgs/http_profile; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http_profile + - name: "pkgs/http_profile; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http_profile + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket + - id: pkgs_web_socket_conformance_tests_pub_upgrade + name: pkgs/web_socket_conformance_tests; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket_conformance_tests + - name: "pkgs/web_socket_conformance_tests; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_web_socket_conformance_tests_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket_conformance_tests + job_004: + name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/web_socket, pkgs/web_socket_conformance_tests; `dart format --output=none --set-exit-if-changed .`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket-pkgs/web_socket_conformance_tests;commands:format" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket-pkgs/web_socket_conformance_tests + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + - id: pkgs_http_client_conformance_tests_pub_upgrade + name: pkgs/http_client_conformance_tests; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http_client_conformance_tests + - name: "pkgs/http_client_conformance_tests; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.pkgs_http_client_conformance_tests_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http_client_conformance_tests + - id: pkgs_http_profile_pub_upgrade + name: pkgs/http_profile; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http_profile + - name: "pkgs/http_profile; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http_profile + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket + - id: pkgs_web_socket_conformance_tests_pub_upgrade + name: pkgs/web_socket_conformance_tests; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket_conformance_tests + - name: "pkgs/web_socket_conformance_tests; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.pkgs_web_socket_conformance_tests_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket_conformance_tests + job_005: + name: "analyze_and_format; linux; Flutter stable; PKG: pkgs/flutter_http_example; `dart format --output=none --set-exit-if-changed .`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example;commands:format" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example + os:ubuntu-latest;pub-cache-hosted;sdk:stable + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Flutter SDK + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + channel: stable + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_flutter_http_example_pub_upgrade + name: pkgs/flutter_http_example; flutter pub upgrade + run: flutter pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + - name: "pkgs/flutter_http_example; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + job_006: + name: "analyze_and_format; linux; Flutter stable; PKG: pkgs/flutter_http_example; `flutter analyze --fatal-infos`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example;commands:analyze_0" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example + os:ubuntu-latest;pub-cache-hosted;sdk:stable + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Flutter SDK + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + channel: stable + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_flutter_http_example_pub_upgrade + name: pkgs/flutter_http_example; flutter pub upgrade + run: flutter pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + - name: "pkgs/flutter_http_example; flutter analyze --fatal-infos" + run: flutter analyze --fatal-infos + if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + job_007: + name: "unit_test; linux; Dart 3.4.0; PKG: pkgs/http; `dart run --define=no_default_http_client=true test/no_default_http_client_test.dart`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/http;commands:command_1" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/http + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: "3.4.0" + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart run --define=no_default_http_client=true test/no_default_http_client_test.dart" + run: "dart run --define=no_default_http_client=true test/no_default_http_client_test.dart" + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_008: + name: "unit_test; linux; Dart 3.4.0; PKG: pkgs/http; `dart test --platform chrome`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/http;commands:test_3" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/http + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: "3.4.0" + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart test --platform chrome" + run: dart test --platform chrome + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_009: + name: "unit_test; linux; Dart 3.4.0; PKGS: pkgs/http, pkgs/http_profile; `dart test --platform vm`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/http-pkgs/http_profile;commands:test_2" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/http-pkgs/http_profile + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: "3.4.0" + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart test --platform vm" + run: dart test --platform vm + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + - id: pkgs_http_profile_pub_upgrade + name: pkgs/http_profile; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http_profile + - name: "pkgs/http_profile; dart test --platform vm" + run: dart test --platform vm + if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http_profile + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_010: + name: "unit_test; linux; Dart 3.4.0; PKG: pkgs/web_socket; `dart test --test-randomize-ordering-seed=random -p chrome -c dart2js`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/web_socket;commands:test_6" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/web_socket + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: "3.4.0" + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart test --test-randomize-ordering-seed=random -p chrome -c dart2js" + run: "dart test --test-randomize-ordering-seed=random -p chrome -c dart2js" + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_011: + name: "unit_test; linux; Dart 3.4.0; PKG: pkgs/web_socket; `dart test --test-randomize-ordering-seed=random -p vm`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/web_socket;commands:test_5" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/web_socket + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: "3.4.0" + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart test --test-randomize-ordering-seed=random -p vm" + run: "dart test --test-randomize-ordering-seed=random -p vm" + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_012: + name: "unit_test; linux; Dart dev; PKG: pkgs/http; `dart run --define=no_default_http_client=true test/no_default_http_client_test.dart`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http;commands:command_1" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart run --define=no_default_http_client=true test/no_default_http_client_test.dart" + run: "dart run --define=no_default_http_client=true test/no_default_http_client_test.dart" + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_013: + name: "unit_test; linux; Dart dev; PKG: pkgs/http; `dart test --platform chrome`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http;commands:test_3" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart test --platform chrome" + run: dart test --platform chrome + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_014: + name: "unit_test; linux; Dart dev; PKGS: pkgs/http, pkgs/http_profile; `dart test --platform vm`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_profile;commands:test_2" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_profile + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart test --platform vm" + run: dart test --platform vm + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + - id: pkgs_http_profile_pub_upgrade + name: pkgs/http_profile; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http_profile + - name: "pkgs/http_profile; dart test --platform vm" + run: dart test --platform vm + if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http_profile + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_015: + name: "unit_test; linux; Dart dev; PKG: pkgs/http; `dart test --test-randomize-ordering-seed=random -p chrome -c dart2wasm`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http;commands:test_4" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/http + - name: "pkgs/http; dart test --test-randomize-ordering-seed=random -p chrome -c dart2wasm" + run: "dart test --test-randomize-ordering-seed=random -p chrome -c dart2wasm" + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_016: + name: "unit_test; linux; Dart dev; PKG: pkgs/web_socket; `dart test --test-randomize-ordering-seed=random -p chrome -c dart2js`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/web_socket;commands:test_6" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/web_socket + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart test --test-randomize-ordering-seed=random -p chrome -c dart2js" + run: "dart test --test-randomize-ordering-seed=random -p chrome -c dart2js" + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_017: + name: "unit_test; linux; Dart dev; PKG: pkgs/web_socket; `dart test --test-randomize-ordering-seed=random -p vm`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/web_socket;commands:test_5" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/web_socket + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart test --test-randomize-ordering-seed=random -p vm" + run: "dart test --test-randomize-ordering-seed=random -p vm" + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_018: + name: "unit_test; linux; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test --platform chrome`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example;commands:test_1" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example + os:ubuntu-latest;pub-cache-hosted;sdk:stable + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Flutter SDK + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + channel: stable + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_flutter_http_example_pub_upgrade + name: pkgs/flutter_http_example; flutter pub upgrade + run: flutter pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + - name: "pkgs/flutter_http_example; flutter test --platform chrome" + run: flutter test --platform chrome + if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_019: + name: "unit_test; linux; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example;commands:command_0" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example + os:ubuntu-latest;pub-cache-hosted;sdk:stable + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Flutter SDK + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + channel: stable + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_flutter_http_example_pub_upgrade + name: pkgs/flutter_http_example; flutter pub upgrade + run: flutter pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + - name: pkgs/flutter_http_example; flutter test + run: flutter test + if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_020: + name: "unit_test; macos; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test`" + runs-on: macos-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: "~/.pub-cache/hosted" + key: "os:macos-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example;commands:command_0" + restore-keys: | + os:macos-latest;pub-cache-hosted;sdk:stable;packages:pkgs/flutter_http_example + os:macos-latest;pub-cache-hosted;sdk:stable + os:macos-latest;pub-cache-hosted + os:macos-latest + - name: Setup Flutter SDK + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + channel: stable + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_flutter_http_example_pub_upgrade + name: pkgs/flutter_http_example; flutter pub upgrade + run: flutter pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + - name: pkgs/flutter_http_example; flutter test + run: flutter test + if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 + job_021: + name: "unit_test; windows; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test`" + runs-on: windows-latest + steps: + - name: Setup Flutter SDK + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + channel: stable + - id: checkout + name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - id: pkgs_flutter_http_example_pub_upgrade + name: pkgs/flutter_http_example; flutter pub upgrade + run: flutter pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + - name: pkgs/flutter_http_example; flutter test + run: flutter test + if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/flutter_http_example + needs: + - job_001 + - job_002 + - job_003 + - job_004 + - job_005 + - job_006 diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml new file mode 100644 index 0000000000..1c904405a2 --- /dev/null +++ b/.github/workflows/health.yaml @@ -0,0 +1,14 @@ +name: Health +on: + pull_request: + branches: [ master ] + types: [opened, synchronize, reopened, labeled, unlabeled] + +jobs: + health: + uses: dart-lang/ecosystem/.github/workflows/health.yaml@main + with: + ignore_license: "**.g.dart" + sdk: dev + permissions: + pull-requests: write diff --git a/.github/workflows/http2.yaml b/.github/workflows/http2.yaml new file mode 100644 index 0000000000..9ab5ad9214 --- /dev/null +++ b/.github/workflows/http2.yaml @@ -0,0 +1,70 @@ +name: package:http2 + +on: + push: + branches: + - master + paths: + - '.github/workflows/http2.yaml' + - 'pkgs/http2/**' + pull_request: + paths: + - '.github/workflows/http2.yaml' + - 'pkgs/http2/**' + schedule: + - cron: "0 0 * * 0" + +defaults: + run: + working-directory: pkgs/http2/ + +env: + PUB_ENVIRONMENT: bot.github + +jobs: + # Check code formatting and static analysis on a single OS (linux) + # against Dart dev. + analyze: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sdk: [dev] + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: ${{ matrix.sdk }} + - id: install + name: Install dependencies + run: dart pub get + - name: Check formatting + run: dart format --output=none --set-exit-if-changed . + if: always() && steps.install.outcome == 'success' + - name: Analyze code + run: dart analyze --fatal-infos + if: always() && steps.install.outcome == 'success' + + # Run tests on a matrix consisting of two dimensions: + # 1. OS: ubuntu-latest, (macos-latest, windows-latest) + # 2. release channel: dev + test: + needs: analyze + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # Add macos-latest and/or windows-latest if relevant for this package. + os: [ubuntu-latest] + sdk: [3.2, dev] + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + with: + sdk: ${{ matrix.sdk }} + - id: install + name: Install dependencies + run: dart pub get + - name: Run VM tests + run: dart test --platform vm + if: always() && steps.install.outcome == 'success' diff --git a/pkgs/http_parser/.github/workflows/test-package.yml b/.github/workflows/http_parser.yaml similarity index 78% rename from pkgs/http_parser/.github/workflows/test-package.yml rename to .github/workflows/http_parser.yaml index 5014c53186..d8b2ae33a8 100644 --- a/pkgs/http_parser/.github/workflows/test-package.yml +++ b/.github/workflows/http_parser.yaml @@ -1,16 +1,26 @@ -name: Dart CI +name: package:http_parser on: - # Run on PRs and pushes to the default branch. push: - branches: [ master ] + branches: + - master + paths: + - '.github/workflows/http_parser.yaml' + - 'pkgs/http_parser/**' pull_request: - branches: [ master ] + paths: + - '.github/workflows/http_parser.yaml' + - 'pkgs/http_parser/**' schedule: - cron: "0 0 * * 0" env: PUB_ENVIRONMENT: bot.github + +defaults: + run: + working-directory: pkgs/http_parser/ + permissions: read-all jobs: @@ -23,7 +33,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} @@ -46,7 +56,7 @@ jobs: os: [ubuntu-latest] sdk: [3.4, dev] steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} diff --git a/pkgs/http_parser/.github/workflows/no-response.yml b/.github/workflows/no-response.yml similarity index 100% rename from pkgs/http_parser/.github/workflows/no-response.yml rename to .github/workflows/no-response.yml diff --git a/.github/workflows/okhttp.yaml b/.github/workflows/okhttp.yaml new file mode 100644 index 0000000000..cfdb28b11d --- /dev/null +++ b/.github/workflows/okhttp.yaml @@ -0,0 +1,58 @@ +name: package:ok_http CI + +on: + push: + branches: + - main + - master + paths: + - '.github/workflows/okhttp.yml' + - 'pkgs/ok_http/**' + - 'pkgs/http_client_conformance_tests/**' + pull_request: + paths: + - '.github/workflows/okhttp.yml' + - 'pkgs/ok_http/**' + - 'pkgs/http_client_conformance_tests/**' + schedule: + - cron: "0 0 * * 0" + +env: + PUB_ENVIRONMENT: bot.github + +jobs: + verify: + name: Format & Analyze & Test + runs-on: ubuntu-latest + defaults: + run: + working-directory: pkgs/ok_http + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b + with: + distribution: 'zulu' + java-version: '17' + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 + with: + channel: 'stable' + - id: install + name: Install dependencies + run: flutter pub get + - name: Check formatting + if: always() && steps.install.outcome == 'success' + run: dart format --output=none --set-exit-if-changed . + - name: Analyze code + if: always() && steps.install.outcome == 'success' + run: flutter analyze --fatal-infos + - name: Run tests + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d + if: always() && steps.install.outcome == 'success' + with: + # api-level/minSdkVersion should be help in sync in: + # - .github/workflows/ok.yml + # - pkgs/ok_http/android/build.gradle + # - pkgs/ok_http/example/android/app/build.gradle + api-level: 21 + arch: x86_64 + script: cd pkgs/ok_http/example && flutter test --timeout=1200s integration_test/ diff --git a/.github/workflows/post_summaries.yaml b/.github/workflows/post_summaries.yaml new file mode 100644 index 0000000000..e082efe95a --- /dev/null +++ b/.github/workflows/post_summaries.yaml @@ -0,0 +1,17 @@ +name: Comment on the pull request + +on: + # Trigger this workflow after the Health workflow completes. This workflow will have permissions to + # do things like create comments on the PR, even if the original workflow couldn't. + workflow_run: + workflows: + - Health + - Publish + types: + - completed + +jobs: + upload: + uses: dart-lang/ecosystem/.github/workflows/post_summaries.yaml@main + permissions: + pull-requests: write diff --git a/pkgs/http_parser/.github/workflows/publish.yaml b/.github/workflows/publish.yaml similarity index 83% rename from pkgs/http_parser/.github/workflows/publish.yaml rename to .github/workflows/publish.yaml index 27157a046a..151e5e4d16 100644 --- a/pkgs/http_parser/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -6,12 +6,14 @@ on: pull_request: branches: [ master ] push: - tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] + tags: [ '[A-z]+-v[0-9]+.[0-9]+.[0-9]+' ] jobs: publish: if: ${{ github.repository_owner == 'dart-lang' }} uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main + with: + write-comments: false permissions: id-token: write # Required for authentication using OIDC pull-requests: write # Required for writing the pull request note diff --git a/.github/workflows/pull_request_label.yml b/.github/workflows/pull_request_label.yml new file mode 100644 index 0000000000..54e3df537c --- /dev/null +++ b/.github/workflows/pull_request_label.yml @@ -0,0 +1,22 @@ +# This workflow applies labels to pull requests based on the paths that are +# modified in the pull request. +# +# Edit `.github/labeler.yml` to configure labels. For more information, see +# https://github.com/actions/labeler. + +name: Pull Request Labeler +permissions: read-all + +on: + pull_request_target + +jobs: + label: + permissions: + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..828cb6ca3a --- /dev/null +++ b/.gitignore @@ -0,0 +1,119 @@ +# Adapted from https://github.com/flutter/flutter/blob/master/.gitignore + +# Miscellaneous +*.class +*.lock +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# Visual Studio Code related +.vscode/ +.classpath +.project +.settings/ +.vscode/* + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +**/generated_plugin_registrant.dart +.packages +.pub-preload-cache/ +.pub-cache/ +.pub/ +build/ +flutter_*.png +linked_*.ds +unlinked.ds +unlinked_spec.ds +pubspec.lock +pubspec_overrides.yaml + +# Android related +**/android/**/gradle-wrapper.jar +.gradle/ +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java +**/android/key.properties +*.jks + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/.last_build_id +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/ephemeral +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# macOS +**/Flutter/ephemeral/ +**/Pods/ +**/macos/Flutter/GeneratedPluginRegistrant.swift +**/macos/Flutter/ephemeral +**/xcuserdata/ + +# Windows +**/windows/flutter/ephemeral/ +**/windows/flutter/generated_plugin_registrant.cc +**/windows/flutter/generated_plugin_registrant.h +**/windows/flutter/generated_plugins.cmake + +# Linux +**/linux/flutter/ephemeral/ +**/linux/flutter/generated_plugin_registrant.cc +**/linux/flutter/generated_plugin_registrant.h +**/linux/flutter/generated_plugins.cmake + +# Coverage +coverage/ + +# Symbols +app.*.symbols + +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +!/dev/ci/**/Gemfile.lock +!.vscode/settings.json \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..32c6edd91f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# Contributing :heart: + +Want to contribute? Great! First, read this page (including the small print at +the end). + +### Before you contribute + +Before we can use your code, you must sign the +[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual) +(CLA), which you can do online. The CLA is necessary mainly because you own the +copyright to your changes, even after your contribution becomes part of our +codebase, so we need your permission to use and distribute your code. We also +need to be sure of various other things—for instance that you'll tell us if you +know that your code infringes on other people's patents. You don't have to sign +the CLA until after you've submitted your code for review and a member has +approved it, but you must do it before we can put your code into our codebase. + +Before you start working on a larger contribution, you should get in touch with +us first through the issue tracker with your idea so that we can help out and +possibly guide you. Coordinating up front makes it much easier to avoid +frustration later on. + +### Code reviews + +All submissions, including submissions by project members, require review. + +### File headers + +All files in the project must start with the following header. + +```dart +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +``` + +### The small print + +Contributions made by corporations are covered by a different agreement than the +one above, the +[Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate). + +## A word about conduct + +We pledge to maintain an open and welcoming environment :hugs:. +For details, see our +[code of conduct](https://dart.dev/community/code-of-conduct). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..000cd7beca --- /dev/null +++ b/LICENSE @@ -0,0 +1,27 @@ +Copyright 2014, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000000..31fc6500b1 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +[![Build Status](https://github.com/dart-lang/http/workflows/Dart%20CI/badge.svg)](https://github.com/dart-lang/http/actions?query=workflow%3A"Dart+CI"+branch%3Amaster) + +A composable, Future-based library for making HTTP requests. + +`package:http` contains a set of high-level functions and classes that make it +easy to consume HTTP resources. It's multi-platform, and supports mobile, desktop, +and the browser. + +## Packages + +| Package | Description | Version | +|---|---|---| +| [cronet_http](pkgs/cronet_http/) | An Android Flutter plugin that provides access to the [Cronet](https://developer.android.com/guide/topics/connectivity/cronet/reference/org/chromium/net/package-summary) HTTP client. | [![pub package](https://img.shields.io/pub/v/cronet_http.svg)](https://pub.dev/packages/cronet_http) | +| [cupertino_http](pkgs/cupertino_http/) | A macOS/iOS Flutter plugin that provides access to the [Foundation URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system). | [![pub package](https://img.shields.io/pub/v/cupertino_http.svg)](https://pub.dev/packages/cupertino_http) | +| [flutter_http_example](pkgs/flutter_http_example/) | An Flutter app that demonstrates how to configure and use `package:http`. | — | +| [http](pkgs/http/) | A composable, multi-platform, Future-based API for HTTP requests. | [![pub package](https://img.shields.io/pub/v/http.svg)](https://pub.dev/packages/http) | +| [http2](pkgs/http2/) | A HTTP/2 implementation in Dart. | [![pub package](https://img.shields.io/pub/v/http2.svg)](https://pub.dev/packages/http2) | +| [http_client_conformance_tests](pkgs/http_client_conformance_tests/) | A library that tests whether implementations of package:http's `Client` class behave as expected. | | +| [http_parser](pkgs/http_parser/) | A platform-independent package for parsing and serializing HTTP formats. | [![pub package](https://img.shields.io/pub/v/http_parser.svg)](https://pub.dev/packages/http_parser) | +| [http_profile](pkgs/http_profile/) | A library used by HTTP client authors to integrate with the DevTools Network View. | [![pub package](https://img.shields.io/pub/v/http_profile.svg)](https://pub.dev/packages/http_profile) | +| [ok_http](pkgs/ok_http/) | An Android Flutter plugin that provides access to the [OkHttp](https://square.github.io/okhttp/) HTTP client and the OkHttp [WebSocket](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html) API. | [![pub package](https://img.shields.io/pub/v/ok_http.svg)](https://pub.dev/packages/ok_http) | +| [web_socket](pkgs/web_socket/) | Any easy-to-use library for communicating with WebSockets that has multiple implementations. | [![pub package](https://img.shields.io/pub/v/web_socket.svg)](https://pub.dev/packages/web_socket) | +| [web_socket_conformance_tests](pkgs/web_socket_conformance_tests/) | A library that tests whether implementations of `package:web_socket`'s `WebSocket` class behave as expected. | | + +## Contributing + +If you'd like to contribute to any of these packages, see the +[Contributing Guide](CONTRIBUTING.md). diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000000..e536739953 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,23 @@ +include: package:dart_flutter_team_lints/analysis_options.yaml + +analyzer: + language: + strict-casts: true + strict-raw-types: true + strict-inference: true + +linter: + rules: + - avoid_bool_literals_in_conditional_expressions + - avoid_classes_with_only_static_members + - avoid_private_typedef_functions + - avoid_returning_this + - avoid_unused_constructor_parameters + - cascade_invocations + - join_return_with_assignment + - missing_whitespace_between_adjacent_strings + - no_adjacent_strings_in_list + - no_runtimeType_toString + - prefer_const_declarations + - prefer_expression_function_bodies + - use_string_buffers diff --git a/mono_repo.yaml b/mono_repo.yaml new file mode 100644 index 0000000000..fea61aac43 --- /dev/null +++ b/mono_repo.yaml @@ -0,0 +1,9 @@ +# See https://github.com/google/mono_repo.dart for details on this file +self_validate: analyze_and_format + +github: + cron: "0 0 * * 0" + +merge_stages: + - analyze_and_format + - unit_test diff --git a/pkgs/cronet_http/.gitattributes b/pkgs/cronet_http/.gitattributes new file mode 100644 index 0000000000..94741c6e03 --- /dev/null +++ b/pkgs/cronet_http/.gitattributes @@ -0,0 +1,2 @@ +# jnigen generated code +lib/src/jni/jni_bindings.dart linguist-generated diff --git a/pkgs/cronet_http/.gitignore b/pkgs/cronet_http/.gitignore new file mode 100644 index 0000000000..9f2a078806 --- /dev/null +++ b/pkgs/cronet_http/.gitignore @@ -0,0 +1,2 @@ +build/ +.gradle/ diff --git a/pkgs/cronet_http/.metadata b/pkgs/cronet_http/.metadata new file mode 100644 index 0000000000..93fddf202a --- /dev/null +++ b/pkgs/cronet_http/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: 85684f9300908116a78138ea4c6036c35c9a1236 + channel: stable + +project_type: plugin + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 + base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 + - platform: android + create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 + base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/pkgs/cronet_http/CHANGELOG.md b/pkgs/cronet_http/CHANGELOG.md new file mode 100644 index 0000000000..2b565f3105 --- /dev/null +++ b/pkgs/cronet_http/CHANGELOG.md @@ -0,0 +1,124 @@ +## 1.3.3-wip + +* Throw `ClientException` if `CronetClient.send` runs out of Java heap while + allocating memory for the request body. +* Upgrade `package:jni` and `package:jnigen` to 0.12.0. + +## 1.3.2 + +* Upgrade `package:jni` to 0.10.1 and `package:jnigen` to 0.10.0 to fix method + calling bugs and a + [debug mode issue](https://github.com/dart-lang/http/issues/1260). + +## 1.3.1 + +* Add relevant rules with the ProGuard to avoid runtime exceptions. +* Upgrade `package:jnigen` to 0.9.2 to fix a bug for 32-bit architectures. + +## 1.3.0 + +* Add integration to the + [DevTools Network View](https://docs.flutter.dev/tools/devtools/network). + +## 1.2.1 + +* Upgrade `package:jni` to 0.9.2 to fix the build error in the latest versions + of Flutter. +* Upgrade `package:jnigen` to 0.9.1 and regenerate the bindings to improve the + efficiency of function calls. + +## 1.2.0 + +* Support the Cronet embedding dependency with `--dart-define=cronetHttpNoPlay=true`. +* Fix a bug in the documentation where `isOwned` is used rather than + `closeEngine`. +* Upgrade `package:jni` to 0.7.3 to fix a SIGSEGV caused by a null + pointer dereference. + +## 1.1.1 + +* Make it possible to construct `CronetClient` with custom a `CronetEngine` + while still allowing `CronetClient` to close the `CronetEngine`. + +## 1.1.0 + +* Use `package:http_image_provider` in the example application. +* Support Android API 21+. +* Support `BaseResponseWithUrl`. + +## 1.0.0 + +* No functional changes. + +## 0.4.2 + +* Require `package:jni >= 0.7.2` to remove a potential buffer overflow. +* Fix a bug where incorrect HTTP request methods were sent. + +## 0.4.1 + +* Require `package:jni >= 0.7.1` so that depending on `package:cronet_http` + does not break macOS builds. + +* Fix obsolete `CronetClient()` constructor usage. + +## 0.4.0 + +* Use more efficient operations when copying bytes between Java and Dart. + +## 0.3.0-jni + +* Switch to using `package:jnigen` for bindings to Cronet +* Support for running in background isolates. +* **Breaking Change:** `CronetEngine.build()` returns a `CronetEngine` rather + than a `Future` and `CronetClient.fromCronetEngineFuture()` + has been removed because it is no longer necessary. + +## 0.2.2 + +* Require Dart 3.0 +* Throw `ClientException` when the `'Content-Length'` header is invalid. + +## 0.2.1 + +* Require Dart 2.19 +* Support `package:http` 1.0.0 + +## 0.2.0 + +* Restructure `package:cronet_http` to offer a + `package:cronet_http/cronet_http.dart` import. + +## 0.1.2 + +* Fix a NPE that occurs when an error occurs before a response is received. + +## 0.1.1 + +* `CronetClient` throws an exception if `send` is called after `close`. + +## 0.1.0 + +* Add a CronetClient that accepts a `Future`. +* Modify the example application to create a `CronetClient` using a + `Future`. + +## 0.0.4 + +* Fix a bug where the example would not use the configured `package:http` + `Client` for Books API calls in some circumstances. +* Fix a bug where the images in the example would be loaded using `dart:io` + `HttpClient`. + +## 0.0.3 + +* Fix + [contentLength property is not sent for streamed responses](https://github.com/dart-lang/http/issues/801) + +## 0.0.2 + +* Set `StreamedResponse.reasonPhrase` and `StreamedResponse.request`. + +## 0.0.1 + +* Initial development release. diff --git a/pkgs/cronet_http/LICENSE b/pkgs/cronet_http/LICENSE new file mode 100644 index 0000000000..59f5c75b6d --- /dev/null +++ b/pkgs/cronet_http/LICENSE @@ -0,0 +1,27 @@ +Copyright 2022, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. \ No newline at end of file diff --git a/pkgs/cronet_http/README.md b/pkgs/cronet_http/README.md new file mode 100644 index 0000000000..eca84103b0 --- /dev/null +++ b/pkgs/cronet_http/README.md @@ -0,0 +1,82 @@ +[![pub package](https://img.shields.io/pub/v/cronet_http.svg)](https://pub.dev/packages/cronet_http) +[![package publisher](https://img.shields.io/pub/publisher/cronet_http.svg)](https://pub.dev/packages/cronet_http/publisher) + +An Android Flutter plugin that provides access to the +[Cronet][] HTTP client. + +Cronet is available as part of [Google Play Services][] +and as [a standalone embedded library][]. + +This package depends on [Google Play Services][] +for its [Cronet][] implementation. +To use the embedded version of [Cronet][] without [Google Play Services][], +see [Use embedded Cronet](#use-embedded-cronet). + +## Motivation + +Using [Cronet][], rather than the socket-based +[dart:io HttpClient][] implementation, has several advantages: + +1. It automatically supports Android platform features such as HTTP proxies. +2. It supports configurable caching. +3. It supports more HTTP features such as HTTP/3. + +## Using + +The easiest way to use this library is via the high-level interface +defined by [package:http Client][]. + +This approach allows the same HTTP code to be used on all platforms, while +still allowing platform-specific setup. + +```dart +import 'package:cronet_http/cronet_http.dart'; +import 'package:http/http.dart'; +import 'package:http/io_client.dart'; + +void main() async { + final Client httpClient; + if (Platform.isAndroid) { + final engine = CronetEngine.build( + cacheMode: CacheMode.memory, + cacheMaxSize: 2 * 1024 * 1024, + userAgent: 'Book Agent'); + httpClient = CronetClient.fromCronetEngine(engine, closeEngine: true); + } else { + httpClient = IOClient(HttpClient()..userAgent = 'Book Agent'); + } + + final response = await client.get( + Uri.https( + 'www.googleapis.com', + '/books/v1/volumes', + {'q': 'HTTP', 'maxResults': '40', 'printType': 'books'}, + ), + ); + httpClient.close(); +} +``` + +### Use embedded Cronet + +If you want your application to work without [Google Play Services][], +you can instead depend on the `org.chromium.net:cronet-embedded` package +by using `dart-define` to set `cronetHttpNoPlay` is set to `true`. + +For example: + +``` +flutter run --dart-define=cronetHttpNoPlay=true +``` + +To use the embedded version in `flutter test`: + +``` +flutter test --dart-define=cronetHttpNoPlay=true +``` + +[Cronet]: https://developer.android.com/guide/topics/connectivity/cronet/reference/org/chromium/net/package-summary +[Google Play Services]: https://developers.google.com/android/guides/overview +[a standalone embedded library]: https://mvnrepository.com/artifact/org.chromium.net/cronet-embedded +[dart:io HttpClient]: https://api.dart.dev/stable/dart-io/HttpClient-class.html +[package:http Client]: https://pub.dev/documentation/http/latest/http/Client-class.html diff --git a/pkgs/cronet_http/analysis_options.yaml b/pkgs/cronet_http/analysis_options.yaml new file mode 100644 index 0000000000..0c386de022 --- /dev/null +++ b/pkgs/cronet_http/analysis_options.yaml @@ -0,0 +1,7 @@ +include: ../../analysis_options.yaml + +analyzer: + exclude: + - lib/src/jni/jni_bindings.dart + - lib/src/messages.dart + - pigeons/messages.dart diff --git a/pkgs/cronet_http/android/.gitignore b/pkgs/cronet_http/android/.gitignore new file mode 100644 index 0000000000..161bdcdaf8 --- /dev/null +++ b/pkgs/cronet_http/android/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.cxx diff --git a/pkgs/cronet_http/android/build.gradle b/pkgs/cronet_http/android/build.gradle new file mode 100644 index 0000000000..9f3250978f --- /dev/null +++ b/pkgs/cronet_http/android/build.gradle @@ -0,0 +1,84 @@ +group 'io.flutter.plugins.cronet_http' +version '1.0-SNAPSHOT' + +buildscript { + ext.kotlin_version = '1.7.21' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:8.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +rootProject.allprojects { + repositories { + google() + mavenCentral() + } +} + +def dartDefines = [ + cronetHttpNoPlay: 'false' +] +if (project.hasProperty('dart-defines')) { + def defines = project.property('dart-defines').split(',').collectEntries { entry -> + def pair = new String(entry.decodeBase64(), 'UTF-8').split('=') + [(pair.first()): pair.last()] + } + dartDefines = dartDefines + defines +} + +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' + +android { + // Conditional for compatibility with AGP <4.2. + if (project.android.hasProperty("namespace")) { + namespace 'io.flutter.plugins.cronet_http' + } + + compileSdkVersion 31 + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // api-level/minSdkVersion should be help in sync in: + // - .github/workflows/cronet.yml + // - pkgs/cronet_http/android/build.gradle + // - pkgs/cronet_http/example/android/app/build.gradle + minSdkVersion 21 + } + + defaultConfig { + consumerProguardFiles 'consumer-rules.pro' + } + + buildTypes { + release { + minifyEnabled false + } + } +} + +dependencies { + if (dartDefines.cronetHttpNoPlay == 'true') { + implementation 'org.chromium.net:cronet-embedded:113.5672.61' + } else { + implementation "com.google.android.gms:play-services-cronet:18.0.1" + } +} diff --git a/pkgs/cronet_http/android/consumer-rules.pro b/pkgs/cronet_http/android/consumer-rules.pro new file mode 100644 index 0000000000..00a7e574f6 --- /dev/null +++ b/pkgs/cronet_http/android/consumer-rules.pro @@ -0,0 +1,4 @@ +-keep class io.flutter.plugins.cronet_http.** { *; } +-keep class java.net.URL { *; } +-keep class java.util.concurrent.Executors { *; } +-keep class org.chromium.net.** { *; } diff --git a/pkgs/cronet_http/android/settings.gradle b/pkgs/cronet_http/android/settings.gradle new file mode 100644 index 0000000000..3a57f65f76 --- /dev/null +++ b/pkgs/cronet_http/android/settings.gradle @@ -0,0 +1,6 @@ +rootProject.name = 'cronet_http' +dependencyResolutionManagement { + repositories { + google() + } +} \ No newline at end of file diff --git a/pkgs/cronet_http/android/src/main/AndroidManifest.xml b/pkgs/cronet_http/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..3df617b3ac --- /dev/null +++ b/pkgs/cronet_http/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/pkgs/cronet_http/android/src/main/kotlin/io/flutter/plugins/cronet_http/UrlRequestCallbackProxy.kt b/pkgs/cronet_http/android/src/main/kotlin/io/flutter/plugins/cronet_http/UrlRequestCallbackProxy.kt new file mode 100644 index 0000000000..c16fb681e9 --- /dev/null +++ b/pkgs/cronet_http/android/src/main/kotlin/io/flutter/plugins/cronet_http/UrlRequestCallbackProxy.kt @@ -0,0 +1,77 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Cronet allows developers to manage HTTP requests by subclassing the +// the abstract class `UrlRequest.Callback`. +// +// `package:jnigen` does not support the ability to subclass abstract Java +// classes in Dart (see https://github.com/dart-lang/jnigen/issues/348). +// +// This file provides an interface `UrlRequestCallbackInterface`, which can +// be implemented in Dart and a wrapper class `UrlRequestCallbackProxy`, which +// can be passed to the Cronet API. + +package io.flutter.plugins.cronet_http + +import org.chromium.net.CronetException +import org.chromium.net.UrlRequest +import org.chromium.net.UrlResponseInfo +import java.nio.ByteBuffer + + +class UrlRequestCallbackProxy(val callback: UrlRequestCallbackInterface) : UrlRequest.Callback() { + public interface UrlRequestCallbackInterface { + fun onRedirectReceived( + request: UrlRequest, + info: UrlResponseInfo, + newLocationUrl: String + ) + + fun onResponseStarted(request: UrlRequest?, info: UrlResponseInfo) + fun onReadCompleted( + request: UrlRequest, + info: UrlResponseInfo, + byteBuffer: ByteBuffer + ) + + fun onSucceeded(request: UrlRequest, info: UrlResponseInfo?) + fun onFailed( + request: UrlRequest, + info: UrlResponseInfo?, + error: CronetException + ) + } + + override fun onRedirectReceived( + request: UrlRequest, + info: UrlResponseInfo, + newLocationUrl: String + ) { + callback.onRedirectReceived(request, info, newLocationUrl); + } + + override fun onResponseStarted(request: UrlRequest?, info: UrlResponseInfo) { + callback.onResponseStarted(request, info); + } + + override fun onReadCompleted( + request: UrlRequest, + info: UrlResponseInfo, + byteBuffer: ByteBuffer + ) { + callback.onReadCompleted(request, info, byteBuffer); + } + + override fun onSucceeded(request: UrlRequest, info: UrlResponseInfo?) { + callback.onSucceeded(request, info); + } + + override fun onFailed( + request: UrlRequest, + info: UrlResponseInfo?, + error: CronetException + ) { + callback.onFailed(request, info, error); + } +} diff --git a/pkgs/cronet_http/cronet_http.iml b/pkgs/cronet_http/cronet_http.iml new file mode 100644 index 0000000000..bbb426a757 --- /dev/null +++ b/pkgs/cronet_http/cronet_http.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pkgs/cronet_http/example/.gitignore b/pkgs/cronet_http/example/.gitignore new file mode 100644 index 0000000000..a8e938c083 --- /dev/null +++ b/pkgs/cronet_http/example/.gitignore @@ -0,0 +1,47 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/pkgs/cronet_http/example/README.md b/pkgs/cronet_http/example/README.md new file mode 100644 index 0000000000..02f1853c17 --- /dev/null +++ b/pkgs/cronet_http/example/README.md @@ -0,0 +1,3 @@ +# cronet_http_example + +Demonstrates how to use the cronet_http plugin. diff --git a/pkgs/cronet_http/example/android/.gitignore b/pkgs/cronet_http/example/android/.gitignore new file mode 100644 index 0000000000..55afd919c6 --- /dev/null +++ b/pkgs/cronet_http/example/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/pkgs/cronet_http/example/android/app/build.gradle b/pkgs/cronet_http/example/android/app/build.gradle new file mode 100644 index 0000000000..feddb9ca9f --- /dev/null +++ b/pkgs/cronet_http/example/android/app/build.gradle @@ -0,0 +1,79 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + namespace 'io.flutter.cronet_http_example' + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + applicationId "io.flutter.cronet_http_example" + // api-level/minSdkVersion should be help in sync in: + // - .github/workflows/cronet.yml + // - pkgs/cronet_http/android/build.gradle + // - pkgs/cronet_http/example/android/app/build.gradle + minSdkVersion 21 + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + // TODO(#1112): org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions. + // This should be removed when https://github.com/flutter/flutter/issues/125062 is fixed. + implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) + // ""com.google.android.gms:play-services-cronet" is only present so that + // `jnigen` will work. Applications should not include this line. + // The version should be synced with `pkgs/cronet_http/android/build.gradle`. + implementation "com.google.android.gms:play-services-cronet:18.0.1" +} diff --git a/pkgs/cronet_http/example/android/app/src/debug/AndroidManifest.xml b/pkgs/cronet_http/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000000..bbd7ee7776 --- /dev/null +++ b/pkgs/cronet_http/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/pkgs/cronet_http/example/android/app/src/main/AndroidManifest.xml b/pkgs/cronet_http/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..47fa040c26 --- /dev/null +++ b/pkgs/cronet_http/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/pkgs/cronet_http/example/android/app/src/main/kotlin/io/flutter/cronet_http_example/MainActivity.kt b/pkgs/cronet_http/example/android/app/src/main/kotlin/io/flutter/cronet_http_example/MainActivity.kt new file mode 100644 index 0000000000..97b07c80f0 --- /dev/null +++ b/pkgs/cronet_http/example/android/app/src/main/kotlin/io/flutter/cronet_http_example/MainActivity.kt @@ -0,0 +1,6 @@ +package io.flutter.cronet_http_example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/pkgs/cronet_http/example/android/app/src/main/res/drawable-v21/launch_background.xml b/pkgs/cronet_http/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000000..f74085f3f6 --- /dev/null +++ b/pkgs/cronet_http/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/pkgs/cronet_http/example/android/app/src/main/res/drawable/launch_background.xml b/pkgs/cronet_http/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000000..304732f884 --- /dev/null +++ b/pkgs/cronet_http/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/pkgs/cronet_http/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..db77bb4b7b Binary files /dev/null and b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/pkgs/cronet_http/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..17987b79bb Binary files /dev/null and b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/pkgs/cronet_http/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..09d4391482 Binary files /dev/null and b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/pkgs/cronet_http/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..d5f1c8d34e Binary files /dev/null and b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/pkgs/cronet_http/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..4d6372eebd Binary files /dev/null and b/pkgs/cronet_http/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/pkgs/cronet_http/example/android/app/src/main/res/values-night/styles.xml b/pkgs/cronet_http/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000000..06952be745 --- /dev/null +++ b/pkgs/cronet_http/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/pkgs/cronet_http/example/android/app/src/main/res/values/styles.xml b/pkgs/cronet_http/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000..cb1ef88056 --- /dev/null +++ b/pkgs/cronet_http/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/pkgs/cronet_http/example/android/app/src/profile/AndroidManifest.xml b/pkgs/cronet_http/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000000..bbd7ee7776 --- /dev/null +++ b/pkgs/cronet_http/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/pkgs/cronet_http/example/android/build.gradle b/pkgs/cronet_http/example/android/build.gradle new file mode 100644 index 0000000000..6dd9012781 --- /dev/null +++ b/pkgs/cronet_http/example/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.7.21' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:8.6.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/pkgs/cronet_http/example/android/gradle.properties b/pkgs/cronet_http/example/android/gradle.properties new file mode 100644 index 0000000000..dda9ad986c --- /dev/null +++ b/pkgs/cronet_http/example/android/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx1536M +org.gradle.caching=true +android.useAndroidX=true +android.enableJetifier=true diff --git a/pkgs/cronet_http/example/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/cronet_http/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..7aeeb11c6e --- /dev/null +++ b/pkgs/cronet_http/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/pkgs/cronet_http/example/android/settings.gradle b/pkgs/cronet_http/example/android/settings.gradle new file mode 100644 index 0000000000..44e62bcf06 --- /dev/null +++ b/pkgs/cronet_http/example/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/pkgs/cronet_http/example/integration_test/client_profile_test.dart b/pkgs/cronet_http/example/integration_test/client_profile_test.dart new file mode 100644 index 0000000000..3e17327ce8 --- /dev/null +++ b/pkgs/cronet_http/example/integration_test/client_profile_test.dart @@ -0,0 +1,288 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:cronet_http/src/cronet_client.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart'; +import 'package:http_profile/http_profile.dart'; +import 'package:integration_test/integration_test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('profile', () { + final profilingEnabled = HttpClientRequestProfile.profilingEnabled; + + setUpAll(() { + HttpClientRequestProfile.profilingEnabled = true; + }); + + tearDownAll(() { + HttpClientRequestProfile.profilingEnabled = profilingEnabled; + }); + + group('POST', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.headers.set('Content-Length', '11'); + request.response.write('Hello World'); + await request.response.close(); + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + final client = CronetClientWithProfile.defaultCronetEngine(); + await client.post(successServerUri, + headers: {'Content-Type': 'text/plain'}, body: 'Hi'); + profile = client.profile!; + }); + tearDownAll(() { + successServer.close(); + }); + + test('profile attributes', () { + expect(profile.events, isEmpty); + expect(profile.requestMethod, 'POST'); + expect(profile.requestUri, successServerUri.toString()); + expect(profile.connectionInfo, + containsPair('package', 'package:cronet_http')); + }); + + test('request attributes', () { + expect(profile.requestData.bodyBytes, 'Hi'.codeUnits); + expect(profile.requestData.contentLength, 2); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.error, isNull); + expect( + profile.requestData.headers, containsPair('Content-Length', ['2'])); + expect(profile.requestData.headers, + containsPair('Content-Type', ['text/plain; charset=utf-8'])); + expect(profile.requestData.persistentConnection, isNull); + expect(profile.requestData.proxyDetails, isNull); + expect(profile.requestData.startTime, isNotNull); + }); + + test('response attributes', () { + expect(profile.responseData.bodyBytes, 'Hello World'.codeUnits); + expect(profile.responseData.compressionState, isNull); + expect(profile.responseData.contentLength, 11); + expect(profile.responseData.endTime, isNotNull); + expect(profile.responseData.error, isNull); + expect(profile.responseData.headers, + containsPair('content-type', ['text/plain'])); + expect(profile.responseData.headers, + containsPair('content-length', ['11'])); + expect(profile.responseData.isRedirect, false); + expect(profile.responseData.persistentConnection, isNull); + expect(profile.responseData.reasonPhrase, 'OK'); + expect(profile.responseData.redirects, isEmpty); + expect(profile.responseData.startTime, isNotNull); + expect(profile.responseData.statusCode, 200); + }); + }); + + group('failed POST request', () { + late HttpClientRequestProfile profile; + + setUpAll(() async { + final client = CronetClientWithProfile.defaultCronetEngine(); + try { + await client.post(Uri.http('thisisnotahost'), + headers: {'Content-Type': 'text/plain'}, body: 'Hi'); + fail('expected exception'); + } on ClientException { + // Expected exception. + } + profile = client.profile!; + }); + + test('profile attributes', () { + expect(profile.events, isEmpty); + expect(profile.requestMethod, 'POST'); + expect(profile.requestUri, 'http://thisisnotahost'); + expect(profile.connectionInfo, + containsPair('package', 'package:cronet_http')); + }); + + test('request attributes', () { + expect(profile.requestData.bodyBytes, 'Hi'.codeUnits); + expect(profile.requestData.contentLength, 2); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.error, startsWith('ClientException:')); + expect( + profile.requestData.headers, containsPair('Content-Length', ['2'])); + expect(profile.requestData.headers, + containsPair('Content-Type', ['text/plain; charset=utf-8'])); + expect(profile.requestData.persistentConnection, isNull); + expect(profile.requestData.proxyDetails, isNull); + expect(profile.requestData.startTime, isNotNull); + }); + + test('response attributes', () { + expect(profile.responseData.bodyBytes, isEmpty); + expect(profile.responseData.compressionState, isNull); + expect(profile.responseData.contentLength, isNull); + expect(profile.responseData.endTime, isNull); + expect(profile.responseData.error, isNull); + expect(profile.responseData.headers, isNull); + expect(profile.responseData.isRedirect, isNull); + expect(profile.responseData.persistentConnection, isNull); + expect(profile.responseData.reasonPhrase, isNull); + expect(profile.responseData.redirects, isEmpty); + expect(profile.responseData.startTime, isNull); + expect(profile.responseData.statusCode, isNull); + }); + }); + + group('failed POST response', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.headers.set('Content-Length', '11'); + final socket = await request.response.detachSocket(); + await socket.close(); + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + final client = CronetClientWithProfile.defaultCronetEngine(); + + try { + await client.post(successServerUri, + headers: {'Content-Type': 'text/plain'}, body: 'Hi'); + fail('expected exception'); + } on ClientException { + // Expected exception. + } + profile = client.profile!; + }); + tearDownAll(() { + successServer.close(); + }); + + test('profile attributes', () { + expect(profile.events, isEmpty); + expect(profile.requestMethod, 'POST'); + expect(profile.requestUri, successServerUri.toString()); + expect(profile.connectionInfo, + containsPair('package', 'package:cronet_http')); + }); + + test('request attributes', () { + expect(profile.requestData.bodyBytes, 'Hi'.codeUnits); + expect(profile.requestData.contentLength, 2); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.error, isNull); + expect( + profile.requestData.headers, containsPair('Content-Length', ['2'])); + expect(profile.requestData.headers, + containsPair('Content-Type', ['text/plain; charset=utf-8'])); + expect(profile.requestData.persistentConnection, isNull); + expect(profile.requestData.proxyDetails, isNull); + expect(profile.requestData.startTime, isNotNull); + }); + + test('response attributes', () { + expect(profile.responseData.bodyBytes, isEmpty); + expect(profile.responseData.compressionState, isNull); + expect(profile.responseData.contentLength, 11); + expect(profile.responseData.endTime, isNotNull); + expect(profile.responseData.error, startsWith('ClientException:')); + expect(profile.responseData.headers, + containsPair('content-type', ['text/plain'])); + expect(profile.responseData.headers, + containsPair('content-length', ['11'])); + expect(profile.responseData.isRedirect, false); + expect(profile.responseData.persistentConnection, isNull); + expect(profile.responseData.reasonPhrase, 'OK'); + expect(profile.responseData.redirects, isEmpty); + expect(profile.responseData.startTime, isNotNull); + expect(profile.responseData.statusCode, 200); + }); + }); + + group('redirects', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + if (request.requestedUri.pathSegments.isEmpty) { + unawaited(request.response.close()); + } else { + final n = int.parse(request.requestedUri.pathSegments.last); + final nextPath = n - 1 == 0 ? '' : '${n - 1}'; + unawaited(request.response + .redirect(successServerUri.replace(path: '/$nextPath'))); + } + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + }); + tearDownAll(() { + successServer.close(); + }); + + test('no redirects', () async { + final client = CronetClientWithProfile.defaultCronetEngine(); + await client.get(successServerUri); + profile = client.profile!; + + expect(profile.responseData.redirects, isEmpty); + }); + + test('follow redirects', () async { + final client = CronetClientWithProfile.defaultCronetEngine(); + await client.send(Request('GET', successServerUri.replace(path: '/3')) + ..followRedirects = true + ..maxRedirects = 4); + profile = client.profile!; + + expect(profile.requestData.followRedirects, true); + expect(profile.requestData.maxRedirects, 4); + expect(profile.responseData.isRedirect, false); + + expect(profile.responseData.redirects, [ + HttpProfileRedirectData( + statusCode: 302, + method: 'GET', + location: successServerUri.replace(path: '/2').toString()), + HttpProfileRedirectData( + statusCode: 302, + method: 'GET', + location: successServerUri.replace(path: '/1').toString()), + HttpProfileRedirectData( + statusCode: 302, + method: 'GET', + location: successServerUri.replace(path: '/').toString(), + ) + ]); + }); + + test('no follow redirects', () async { + final client = CronetClientWithProfile.defaultCronetEngine(); + await client.send(Request('GET', successServerUri.replace(path: '/3')) + ..followRedirects = false); + profile = client.profile!; + + expect(profile.requestData.followRedirects, false); + expect(profile.responseData.isRedirect, true); + expect(profile.responseData.redirects, isEmpty); + }); + }); + }); +} diff --git a/pkgs/cronet_http/example/integration_test/client_test.dart b/pkgs/cronet_http/example/integration_test/client_test.dart new file mode 100644 index 0000000000..e2ea74912a --- /dev/null +++ b/pkgs/cronet_http/example/integration_test/client_test.dart @@ -0,0 +1,59 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:cronet_http/cronet_http.dart'; +import 'package:http_client_conformance_tests/http_client_conformance_tests.dart'; +import 'package:http_profile/http_profile.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:test/test.dart'; + +Future testConformance() async { + group('default cronet engine', () { + group('profile enabled', () { + final profile = HttpClientRequestProfile.profilingEnabled; + HttpClientRequestProfile.profilingEnabled = true; + try { + testAll( + CronetClient.defaultCronetEngine, + canStreamRequestBody: false, + canReceiveSetCookieHeaders: true, + canSendCookieHeaders: true, + ); + } finally { + HttpClientRequestProfile.profilingEnabled = profile; + } + }); + group('profile disabled', () { + final profile = HttpClientRequestProfile.profilingEnabled; + HttpClientRequestProfile.profilingEnabled = false; + try { + testAll( + CronetClient.defaultCronetEngine, + canStreamRequestBody: false, + canReceiveSetCookieHeaders: true, + canSendCookieHeaders: true, + ); + } finally { + HttpClientRequestProfile.profilingEnabled = profile; + } + }); + }); + + group('from cronet engine', () { + testAll( + () { + final engine = CronetEngine.build( + cacheMode: CacheMode.disabled, userAgent: 'Test Agent (Future)'); + return CronetClient.fromCronetEngine(engine); + }, + canStreamRequestBody: false, + ); + }); +} + +void main() async { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + await testConformance(); +} diff --git a/pkgs/cronet_http/example/integration_test/cronet_configuration_test.dart b/pkgs/cronet_http/example/integration_test/cronet_configuration_test.dart new file mode 100644 index 0000000000..63ce8eba0f --- /dev/null +++ b/pkgs/cronet_http/example/integration_test/cronet_configuration_test.dart @@ -0,0 +1,159 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:cronet_http/cronet_http.dart'; +import 'package:http/http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:test/test.dart'; + +void testCache() { + group('cache', () { + late HttpServer server; + var numRequests = 0; + + setUp(() async { + numRequests = 0; + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + ++numRequests; + request.response.headers.set('Content-Type', 'text/plain'); + request.response.headers + .set('Cache-Control', 'public, max-age=30, immutable'); + request.response.headers.set('etag', '12345'); + await request.response.close(); + }); + }); + tearDown(() { + server.close(); + }); + + test('disabled', () async { + final engine = CronetEngine.build(cacheMode: CacheMode.disabled); + final client = CronetClient.fromCronetEngine(engine); + await client.get(Uri.parse('http://localhost:${server.port}')); + await client.get(Uri.parse('http://localhost:${server.port}')); + expect(numRequests, 2); + }); + + test('memory', () async { + final engine = CronetEngine.build( + cacheMode: CacheMode.memory, cacheMaxSize: 1024 * 1024); + final client = CronetClient.fromCronetEngine(engine); + await client.get(Uri.parse('http://localhost:${server.port}')); + await client.get(Uri.parse('http://localhost:${server.port}')); + expect(numRequests, 1); + }); + + test('disk', () async { + final engine = CronetEngine.build( + cacheMode: CacheMode.disk, + cacheMaxSize: 1024 * 1024, + storagePath: (await Directory.systemTemp.createTemp()).absolute.path); + final client = CronetClient.fromCronetEngine(engine); + await client.get(Uri.parse('http://localhost:${server.port}')); + await client.get(Uri.parse('http://localhost:${server.port}')); + expect(numRequests, 1); + }); + + test('diskNoHttp', () async { + final engine = CronetEngine.build( + cacheMode: CacheMode.diskNoHttp, + cacheMaxSize: 1024 * 1024, + storagePath: (await Directory.systemTemp.createTemp()).absolute.path); + + final client = CronetClient.fromCronetEngine(engine); + await client.get(Uri.parse('http://localhost:${server.port}')); + await client.get(Uri.parse('http://localhost:${server.port}')); + expect(numRequests, 2); + }); + }); +} + +void testInvalidConfigurations() { + group('invalidConfigurations', () { + test('no storagePath', () async { + expect( + () async => CronetEngine.build( + cacheMode: CacheMode.disk, cacheMaxSize: 1024 * 1024), + throwsArgumentError); + }); + + test('non-existing storagePath', () async { + expect( + () async => CronetEngine.build( + cacheMode: CacheMode.disk, + cacheMaxSize: 1024 * 1024, + storagePath: '/a/b/c/d'), + throwsArgumentError); + }); + }); +} + +void testUserAgent() { + group('userAgent', () { + late HttpServer server; + late HttpHeaders requestHeaders; + + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + requestHeaders = request.headers; + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + }); + tearDown(() { + server.close(); + }); + + test('userAgent', () async { + final engine = CronetEngine.build(userAgent: 'fake-agent'); + await CronetClient.fromCronetEngine(engine) + .get(Uri.parse('http://localhost:${server.port}')); + expect(requestHeaders['user-agent'], ['fake-agent']); + }); + }); +} + +void testEngineClose() { + group('engine close', () { + test('multiple close', () { + CronetEngine.build() + ..close() + ..close(); + }); + + test('request after close', () async { + final closedEngine = CronetEngine.build()..close(); + final client = CronetClient.fromCronetEngine(closedEngine); + await expectLater(() => client.get(Uri.https('example.com', '/')), + throwsA(isA())); + }); + + test('engine owned close', () { + final engine = CronetEngine.build(); + CronetClient.fromCronetEngine(engine, closeEngine: true).close(); + }); + + test('engine not owned close', () { + final engine = CronetEngine.build(); + CronetClient.fromCronetEngine(engine, closeEngine: false).close(); + engine.close(); + }); + }); +} + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + testCache(); + testInvalidConfigurations(); + testUserAgent(); + testEngineClose(); +} diff --git a/pkgs/cronet_http/example/lib/book.dart b/pkgs/cronet_http/example/lib/book.dart new file mode 100644 index 0000000000..584ae9a361 --- /dev/null +++ b/pkgs/cronet_http/example/lib/book.dart @@ -0,0 +1,32 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Book { + String title; + String description; + Uri imageUrl; + + Book(this.title, this.description, this.imageUrl); + + static List listFromJson(Map json) { + final books = []; + + if (json['items'] case final List items) { + for (final item in items) { + if (item case {'volumeInfo': final Map volumeInfo}) { + if (volumeInfo + case { + 'title': final String title, + 'description': final String description, + 'imageLinks': {'smallThumbnail': final String thumbnail} + }) { + books.add(Book(title, description, Uri.parse(thumbnail))); + } + } + } + } + + return books; + } +} diff --git a/pkgs/cronet_http/example/lib/main.dart b/pkgs/cronet_http/example/lib/main.dart new file mode 100644 index 0000000000..37136a2afb --- /dev/null +++ b/pkgs/cronet_http/example/lib/main.dart @@ -0,0 +1,154 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:io'; + +import 'package:cronet_http/cronet_http.dart'; +import 'package:flutter/material.dart'; +import 'package:http/http.dart'; +import 'package:http/io_client.dart'; +import 'package:http_image_provider/http_image_provider.dart'; +import 'package:provider/provider.dart'; + +import 'book.dart'; + +void main() { + final Client httpClient; + if (Platform.isAndroid) { + WidgetsFlutterBinding.ensureInitialized(); + final engine = CronetEngine.build( + cacheMode: CacheMode.memory, + cacheMaxSize: 2 * 1024 * 1024, + userAgent: 'Book Agent'); + httpClient = CronetClient.fromCronetEngine(engine, closeEngine: true); + } else { + httpClient = IOClient(HttpClient()..userAgent = 'Book Agent'); + } + + runApp(Provider( + create: (_) => httpClient, + child: const BookSearchApp(), + dispose: (_, client) => client.close())); +} + +class BookSearchApp extends StatelessWidget { + const BookSearchApp({super.key}); + + @override + Widget build(BuildContext context) => const MaterialApp( + // Remove the debug banner. + debugShowCheckedModeBanner: false, + title: 'Book Search', + home: HomePage(), + ); +} + +class HomePage extends StatefulWidget { + const HomePage({super.key}); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + List? _books; + String? _lastQuery; + late Client _client; + + @override + void initState() { + super.initState(); + _client = context.read(); + } + + // Get the list of books matching `query`. + // The `get` call will automatically use the `client` configured in `main`. + Future> _findMatchingBooks(String query) async { + final response = await _client.get( + Uri.https( + 'www.googleapis.com', + '/books/v1/volumes', + {'q': query, 'maxResults': '20', 'printType': 'books'}, + ), + ); + + final json = jsonDecode(utf8.decode(response.bodyBytes)) as Map; + return Book.listFromJson(json); + } + + void _runSearch(String query) async { + _lastQuery = query; + if (query.isEmpty) { + setState(() { + _books = null; + }); + return; + } + + final books = await _findMatchingBooks(query); + // Avoid the situation where a slow-running query finishes late and + // replaces newer search results. + if (query != _lastQuery) return; + setState(() { + _books = books; + }); + } + + @override + Widget build(BuildContext context) { + final searchResult = _books == null + ? const Text('Please enter a query', style: TextStyle(fontSize: 24)) + : _books!.isNotEmpty + ? BookList(_books!) + : const Text('No results found', style: TextStyle(fontSize: 24)); + + return Scaffold( + appBar: AppBar(title: const Text('Book Search')), + body: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + const SizedBox(height: 20), + TextField( + onChanged: _runSearch, + decoration: const InputDecoration( + labelText: 'Search', + suffixIcon: Icon(Icons.search), + ), + ), + const SizedBox(height: 20), + Expanded(child: searchResult), + ], + ), + ), + ); + } +} + +class BookList extends StatefulWidget { + final List books; + const BookList(this.books, {super.key}); + + @override + State createState() => _BookListState(); +} + +class _BookListState extends State { + @override + Widget build(BuildContext context) => ListView.builder( + itemCount: widget.books.length, + itemBuilder: (context, index) => Card( + key: ValueKey(widget.books[index].title), + child: ListTile( + leading: Image( + image: HttpImageProvider( + widget.books[index].imageUrl.replace(scheme: 'https'), + client: context.read())), + title: Text(widget.books[index].title), + subtitle: Text(widget.books[index].description), + ), + ), + ); +} diff --git a/pkgs/cronet_http/example/pubspec.yaml b/pkgs/cronet_http/example/pubspec.yaml new file mode 100644 index 0000000000..dfaa39a8e7 --- /dev/null +++ b/pkgs/cronet_http/example/pubspec.yaml @@ -0,0 +1,31 @@ +name: cronet_http_example +description: Demonstrates how to use the cronet_http plugin. + +publish_to: 'none' + +environment: + sdk: ^3.4.0 + +dependencies: + cronet_http: + path: ../ + cupertino_icons: ^1.0.2 + flutter: + sdk: flutter + http: ^1.0.0 + http_image_provider: ^1.0.0 + provider: ^6.1.1 + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + flutter_test: + sdk: flutter + http_client_conformance_tests: + path: ../../http_client_conformance_tests/ + http_profile: ^0.1.0 + integration_test: + sdk: flutter + test: ^1.23.1 + +flutter: + uses-material-design: true diff --git a/pkgs/cronet_http/jnigen.yaml b/pkgs/cronet_http/jnigen.yaml new file mode 100644 index 0000000000..2413c9f2b4 --- /dev/null +++ b/pkgs/cronet_http/jnigen.yaml @@ -0,0 +1,20 @@ +# Regenerate bindings with `dart run jnigen --config jnigen.yaml`. + +android_sdk_config: + add_gradle_deps: true + android_example: 'example/' + +output: + dart: + path: 'lib/src/jni/jni_bindings.dart' + structure: single_file + +classes: + - 'io.flutter.plugins.cronet_http.UrlRequestCallbackProxy' + - 'java.net.URL' + - 'java.util.concurrent.Executors' + - 'org.chromium.net.CronetEngine' + - 'org.chromium.net.CronetException' + - 'org.chromium.net.UploadDataProviders' + - 'org.chromium.net.UrlRequest' + - 'org.chromium.net.UrlResponseInfo' diff --git a/pkgs/cronet_http/lib/cronet_http.dart b/pkgs/cronet_http/lib/cronet_http.dart new file mode 100644 index 0000000000..53c9aca019 --- /dev/null +++ b/pkgs/cronet_http/lib/cronet_http.dart @@ -0,0 +1,50 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// An Android Flutter plugin that provides access to the +/// [Cronet](https://developer.android.com/guide/topics/connectivity/cronet/reference/org/chromium/net/package-summary) +/// HTTP client. +/// +/// The platform interface must be initialized before using this plugin e.g. by +/// calling +/// [`WidgetsFlutterBinding.ensureInitialized`](https://api.flutter.dev/flutter/widgets/WidgetsFlutterBinding/ensureInitialized.html) +/// or +/// [`runApp`](https://api.flutter.dev/flutter/widgets/runApp.html). +/// +/// [CronetClient] is an implementation of the `package:http` [Client], +/// which means that it can easily used conditionally based on the current +/// platform. +/// +/// ``` +/// import 'package:provider/provider.dart'; +/// +/// void main() { +/// final Client httpClient; +/// if (Platform.isAndroid) { +/// // `package:cronet_http` cannot be used until +/// // `WidgetsFlutterBinding.ensureInitialized()` or `runApp` is called. +/// WidgetsFlutterBinding.ensureInitialized(); +/// final engine = CronetEngine.build( +/// cacheMode: CacheMode.memory, +/// cacheMaxSize: 2 * 1024 * 1024, +/// userAgent: 'Book Agent'); +/// httpClient = CronetClient.fromCronetEngine(engine, closeEngine: true); +/// } else { +/// httpClient = IOClient(HttpClient()..userAgent = 'Book Agent'); +/// } +/// +/// runApp(Provider( +/// create: (_) => httpClient, +/// child: const BookSearchApp(), +/// dispose: (_, client) => client.close())); +/// } +/// } +/// ``` +library; + +import 'package:http/http.dart'; + +import 'src/cronet_client.dart'; + +export 'src/cronet_client.dart'; diff --git a/pkgs/cronet_http/lib/src/cronet_client.dart b/pkgs/cronet_http/lib/src/cronet_client.dart new file mode 100644 index 0000000000..8341e1caa5 --- /dev/null +++ b/pkgs/cronet_http/lib/src/cronet_client.dart @@ -0,0 +1,429 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http/http.dart'; +import 'package:http_profile/http_profile.dart'; +import 'package:jni/jni.dart'; + +import 'jni/jni_bindings.dart' as jb; + +final _digitRegex = RegExp(r'^\d+$'); +const _bufferSize = 10 * 1024; // The size of the Cronet read buffer. + +/// This class can be removed when `package:http` v2 is released. +class _StreamedResponseWithUrl extends StreamedResponse + implements BaseResponseWithUrl { + @override + final Uri url; + + _StreamedResponseWithUrl(super.stream, super.statusCode, + {required this.url, + super.contentLength, + super.request, + super.headers, + super.isRedirect, + super.reasonPhrase}); +} + +/// The type of caching to use when making HTTP requests. +enum CacheMode { + disabled, + memory, + diskNoHttp, + disk, +} + +/// An environment that can be used to make HTTP requests. +class CronetEngine { + late final jb.CronetEngine _engine; + bool _isClosed = false; + + CronetEngine._(this._engine); + + /// Construct a new [CronetEngine] with the given configuration. + /// + /// [cacheMode] controls the type of caching that should be used by the + /// engine. If [cacheMode] is not [CacheMode.disabled] then [cacheMaxSize] + /// must be set. If [cacheMode] is [CacheMode.disk] or [CacheMode.diskNoHttp] + /// then [storagePath] must be set. + /// + /// [cacheMaxSize] is the maximum amount of data that should be cached, in + /// bytes. + /// + /// [enableBrotli] controls whether + /// [Brotli compression](https://www.rfc-editor.org/rfc/rfc7932) can be used. + /// + /// [enableHttp2] controls whether the HTTP/2 protocol can be used. + /// + /// [enablePublicKeyPinningBypassForLocalTrustAnchors] enables or disables + /// public key pinning bypass for local trust anchors. Disabling the bypass + /// for local trust anchors is highly discouraged since it may prohibit the + /// app from communicating with the pinned hosts. E.g., a user may want to + /// send all traffic through an SSL enabled proxy by changing the device + /// proxy settings and adding the proxy certificate to the list of local + /// trust anchor. + /// + /// [enableQuic] controls whether the [QUIC](https://www.chromium.org/quic/) + /// protocol can be used. + /// + /// [storagePath] sets the path of an existing directory where HTTP data can + /// be cached and where cookies can be stored. NOTE: a unique [storagePath] + /// should be used per [CronetEngine]. + /// + /// [userAgent] controls the `User-Agent` header. + static CronetEngine build( + {CacheMode? cacheMode, + int? cacheMaxSize, + bool? enableBrotli, + bool? enableHttp2, + bool? enablePublicKeyPinningBypassForLocalTrustAnchors, + bool? enableQuic, + String? storagePath, + String? userAgent}) { + final builder = jb.CronetEngine_Builder( + JObject.fromReference(Jni.getCachedApplicationContext())); + + try { + if (storagePath != null) { + builder.setStoragePath(storagePath.toJString()); + } + + if (cacheMode == CacheMode.disabled) { + builder.enableHttpCache(0, 0); // HTTP_CACHE_DISABLED, 0 bytes + } else if (cacheMode != null && cacheMaxSize != null) { + builder.enableHttpCache(cacheMode.index, cacheMaxSize); + } + + if (enableBrotli != null) { + builder.enableBrotli(enableBrotli); + } + + if (enableHttp2 != null) { + builder.enableHttp2(enableHttp2); + } + + if (enablePublicKeyPinningBypassForLocalTrustAnchors != null) { + builder.enablePublicKeyPinningBypassForLocalTrustAnchors( + enablePublicKeyPinningBypassForLocalTrustAnchors); + } + + if (enableQuic != null) { + builder.enableQuic(enableQuic); + } + + if (userAgent != null) { + builder.setUserAgent(userAgent.toJString()); + } + + return CronetEngine._(builder.build()); + } on JniException catch (e) { + // TODO: Decode this exception in a better way when + // https://github.com/dart-lang/jnigen/issues/239 is fixed. + if (e.message.contains('java.lang.IllegalArgumentException:')) { + throw ArgumentError( + e.message.split('java.lang.IllegalArgumentException:').last); + } + rethrow; + } + } + + void close() { + if (!_isClosed) { + _engine + ..shutdown() + ..release(); + } + _isClosed = true; + } +} + +Map _cronetToClientHeaders( + JMap> cronetHeaders) => + cronetHeaders.map((key, value) => MapEntry( + key.toDartString(releaseOriginal: true).toLowerCase(), + value.join(','))); + +jb.UrlRequestCallbackProxy_UrlRequestCallbackInterface _urlRequestCallbacks( + BaseRequest request, + Completer responseCompleter, + HttpClientRequestProfile? profile) { + StreamController>? responseStream; + JByteBuffer? jByteBuffer; + var numRedirects = 0; + + // The order of callbacks generated by Cronet is documented here: + // https://developer.android.com/guide/topics/connectivity/cronet/lifecycle + return jb.UrlRequestCallbackProxy_UrlRequestCallbackInterface.implement( + jb.$UrlRequestCallbackProxy_UrlRequestCallbackInterface( + onResponseStarted: (urlRequest, responseInfo) { + responseStream = StreamController(); + final responseHeaders = + _cronetToClientHeaders(responseInfo.getAllHeaders()); + int? contentLength; + + switch (responseHeaders['content-length']) { + case final contentLengthHeader? + when !_digitRegex.hasMatch(contentLengthHeader): + responseCompleter.completeError(ClientException( + 'Invalid content-length header [$contentLengthHeader].', + request.url, + )); + urlRequest.cancel(); + return; + case final contentLengthHeader?: + contentLength = int.parse(contentLengthHeader); + } + responseCompleter.complete(_StreamedResponseWithUrl( + responseStream!.stream, + responseInfo.getHttpStatusCode(), + url: Uri.parse( + responseInfo.getUrl().toDartString(releaseOriginal: true)), + contentLength: contentLength, + reasonPhrase: responseInfo + .getHttpStatusText() + .toDartString(releaseOriginal: true), + request: request, + isRedirect: false, + headers: responseHeaders, + )); + + profile?.requestData.close(); + profile?.responseData + ?..contentLength = contentLength + ..headersCommaValues = responseHeaders + ..isRedirect = false + ..reasonPhrase = + responseInfo.getHttpStatusText().toDartString(releaseOriginal: true) + ..startTime = DateTime.now() + ..statusCode = responseInfo.getHttpStatusCode(); + jByteBuffer = JByteBuffer.allocateDirect(_bufferSize); + urlRequest.read(jByteBuffer!); + }, + onRedirectReceived: (urlRequest, responseInfo, newLocationUrl) { + final responseHeaders = + _cronetToClientHeaders(responseInfo.getAllHeaders()); + + if (!request.followRedirects) { + urlRequest.cancel(); + responseCompleter.complete(StreamedResponse( + const Stream.empty(), // Cronet provides no body for redirects. + responseInfo.getHttpStatusCode(), + contentLength: 0, + reasonPhrase: responseInfo + .getHttpStatusText() + .toDartString(releaseOriginal: true), + request: request, + isRedirect: true, + headers: _cronetToClientHeaders(responseInfo.getAllHeaders()))); + + profile?.responseData + ?..headersCommaValues = responseHeaders + ..isRedirect = true + ..reasonPhrase = responseInfo + .getHttpStatusText() + .toDartString(releaseOriginal: true) + ..startTime = DateTime.now() + ..statusCode = responseInfo.getHttpStatusCode(); + + return; + } + ++numRedirects; + if (numRedirects <= request.maxRedirects) { + profile?.responseData.addRedirect(HttpProfileRedirectData( + statusCode: responseInfo.getHttpStatusCode(), + // This method is not correct for status codes 303 to 307. Cronet + // does not seem to have a way to get the method so we'd have to + // calculate it according to the rules in RFC-7231. + method: 'GET', + location: newLocationUrl.toDartString(releaseOriginal: true))); + urlRequest.followRedirect(); + } else { + urlRequest.cancel(); + responseCompleter.completeError( + ClientException('Redirect limit exceeded', request.url)); + } + }, + onReadCompleted: (urlRequest, responseInfo, byteBuffer) { + byteBuffer.flip(); + final data = jByteBuffer!.asUint8List().sublist(0, byteBuffer.remaining); + responseStream!.add(data); + profile?.responseData.bodySink.add(data); + + byteBuffer.clear(); + urlRequest.read(byteBuffer); + }, + onSucceeded: (urlRequest, responseInfo) { + responseStream!.sink.close(); + jByteBuffer?.release(); + profile?.responseData.close(); + }, + onFailed: (urlRequest, responseInfo, cronetException) { + final error = ClientException( + 'Cronet exception: ${cronetException.toString()}', request.url); + if (responseStream == null) { + responseCompleter.completeError(error); + } else { + responseStream!.addError(error); + responseStream!.close(); + } + + if (profile != null) { + if (profile.requestData.endTime == null) { + profile.requestData.closeWithError(error.toString()); + } else { + profile.responseData.closeWithError(error.toString()); + } + } + jByteBuffer?.release(); + }, + )); +} + +/// A HTTP [Client] based on the +/// [Cronet](https://developer.android.com/guide/topics/connectivity/cronet) +/// network stack. +class CronetClient extends BaseClient { + static final _executor = jb.Executors.newCachedThreadPool(); + CronetEngine? _engine; + bool _isClosed = false; + + /// Indicates that [CronetClient] is responsible for closing [_engine]. + final bool _closeEngine; + + CronetClient._(this._engine, this._closeEngine); + + /// A [CronetClient] that will be initialized with a new [CronetEngine]. + factory CronetClient.defaultCronetEngine() => CronetClient._(null, true); + + /// A [CronetClient] configured with a [CronetEngine]. + /// + /// If [closeEngine] is `true`, then [engine] will be closed when [close] is + /// called on this [CronetClient]. This can simplify lifetime management if + /// [engine] is only used in one [CronetClient]. + factory CronetClient.fromCronetEngine(CronetEngine engine, + {bool closeEngine = false}) => + CronetClient._(engine, closeEngine); + + /// A [CronetClient] configured with a [Future] containing a [CronetEngine]. + /// + /// This can be useful in circumstances where a non-Future [CronetClient] is + /// required but you want to configure the [CronetClient] with a custom + /// [CronetEngine]. For example: + /// ``` + /// void main() { + /// Client clientFactory() { + /// final engine = CronetEngine.build( + /// cacheMode: CacheMode.memory, userAgent: 'Book Agent'); + /// return CronetClient.fromCronetEngineFuture(engine); + /// } + /// + /// runWithClient(() => runApp(const BookSearchApp()), clientFactory); + /// } + /// ``` + @override + void close() { + if (!_isClosed && _closeEngine) { + _engine?.close(); + } + _isClosed = true; + } + + HttpClientRequestProfile? _createProfile(BaseRequest request) => + HttpClientRequestProfile.profile( + requestStartTime: DateTime.now(), + requestMethod: request.method, + requestUri: request.url.toString()); + + @override + Future send(BaseRequest request) async { + if (_isClosed) { + throw ClientException( + 'HTTP request failed. Client is already closed.', request.url); + } + + final engine = _engine ?? CronetEngine.build(); + _engine = engine; + + if (engine._isClosed) { + throw ClientException( + 'HTTP request failed. CronetEngine is already closed.', request.url); + } + + final profile = _createProfile(request); + profile?.connectionInfo = { + 'package': 'package:cronet_http', + 'client': 'CronetHttp', + }; + profile?.requestData + ?..contentLength = request.contentLength + ..followRedirects = request.followRedirects + ..headersCommaValues = request.headers + ..maxRedirects = request.maxRedirects; + if (profile != null && request.contentLength != null) { + profile.requestData.headersListValues = { + 'Content-Length': ['${request.contentLength}'], + ...profile.requestData.headers! + }; + } + + final stream = request.finalize(); + final body = await stream.toBytes(); + profile?.requestData.bodySink.add(body); + + final responseCompleter = Completer(); + + final builder = engine._engine.newUrlRequestBuilder( + request.url.toString().toJString(), + jb.UrlRequestCallbackProxy( + _urlRequestCallbacks(request, responseCompleter, profile)), + _executor, + )..setHttpMethod(request.method.toJString()); + + var headers = request.headers; + if (body.isNotEmpty && + !headers.keys.any((h) => h.toLowerCase() == 'content-type')) { + // Cronet requires that requests containing upload data set a + // 'Content-Type' header. + headers = {...headers, 'content-type': 'application/octet-stream'}; + } + headers.forEach((k, v) => builder.addHeader(k.toJString(), v.toJString())); + + if (body.isNotEmpty) { + final JByteBuffer data; + try { + data = body.toJByteBuffer(); + } on JniException catch (e) { + // There are no unit tests for this code. You can verify this behavior + // manually by incrementally increasing the amount of body data in + // `CronetClient.post` until you get this exception. + if (e.message.contains('java.lang.OutOfMemoryError:')) { + throw ClientException( + 'Not enough memory for request body: ${e.message}', request.url); + } + rethrow; + } + + builder.setUploadDataProvider( + jb.UploadDataProviders.create$2(data), _executor); + } + builder.build().start(); + return responseCompleter.future; + } +} + +/// A test-only class that makes the [HttpClientRequestProfile] data available. +class CronetClientWithProfile extends CronetClient { + HttpClientRequestProfile? profile; + + @override + HttpClientRequestProfile? _createProfile(BaseRequest request) => + profile = super._createProfile(request); + + CronetClientWithProfile._(super._engine, super._closeEngine) : super._(); + + factory CronetClientWithProfile.defaultCronetEngine() => + CronetClientWithProfile._(null, true); +} diff --git a/pkgs/cronet_http/lib/src/jni/jni_bindings.dart b/pkgs/cronet_http/lib/src/jni/jni_bindings.dart new file mode 100644 index 0000000000..9f04460e60 --- /dev/null +++ b/pkgs/cronet_http/lib/src/jni/jni_bindings.dart @@ -0,0 +1,4612 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: argument_type_not_assignable +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: inference_failure_on_untyped_parameter +// ignore_for_file: invalid_internal_annotation +// ignore_for_file: invalid_use_of_internal_member +// ignore_for_file: library_prefixes +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_library_prefixes +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: only_throw_errors +// ignore_for_file: overridden_fields +// ignore_for_file: prefer_double_quotes +// ignore_for_file: unintended_html_in_doc_comment +// ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import 'dart:core' show Object, String, bool, double, int; +import 'dart:core' as _$core; + +import 'package:jni/_internal.dart' as _$jni; +import 'package:jni/jni.dart' as _$jni; + +/// from: `io.flutter.plugins.cronet_http.UrlRequestCallbackProxy$UrlRequestCallbackInterface` +class UrlRequestCallbackProxy_UrlRequestCallbackInterface + extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType + $type; + + @_$jni.internal + UrlRequestCallbackProxy_UrlRequestCallbackInterface.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName( + r'io/flutter/plugins/cronet_http/UrlRequestCallbackProxy$UrlRequestCallbackInterface'); + + /// The type which includes information such as the signature of this class. + static const type = + $UrlRequestCallbackProxy_UrlRequestCallbackInterface$Type(); + static final _id_onRedirectReceived = _class.instanceMethodId( + r'onRedirectReceived', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/lang/String;)V', + ); + + static final _onRedirectReceived = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onRedirectReceived(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo, java.lang.String string)` + void onRedirectReceived( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + _$jni.JString string, + ) { + _onRedirectReceived( + reference.pointer, + _id_onRedirectReceived as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer, + string.reference.pointer) + .check(); + } + + static final _id_onResponseStarted = _class.instanceMethodId( + r'onResponseStarted', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V', + ); + + static final _onResponseStarted = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onResponseStarted(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo)` + void onResponseStarted( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + ) { + _onResponseStarted( + reference.pointer, + _id_onResponseStarted as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer) + .check(); + } + + static final _id_onReadCompleted = _class.instanceMethodId( + r'onReadCompleted', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/nio/ByteBuffer;)V', + ); + + static final _onReadCompleted = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onReadCompleted(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo, java.nio.ByteBuffer byteBuffer)` + void onReadCompleted( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + _$jni.JByteBuffer byteBuffer, + ) { + _onReadCompleted( + reference.pointer, + _id_onReadCompleted as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer, + byteBuffer.reference.pointer) + .check(); + } + + static final _id_onSucceeded = _class.instanceMethodId( + r'onSucceeded', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V', + ); + + static final _onSucceeded = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onSucceeded(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo)` + void onSucceeded( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + ) { + _onSucceeded(reference.pointer, _id_onSucceeded as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, urlResponseInfo.reference.pointer) + .check(); + } + + static final _id_onFailed = _class.instanceMethodId( + r'onFailed', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Lorg/chromium/net/CronetException;)V', + ); + + static final _onFailed = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onFailed(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo, org.chromium.net.CronetException cronetException)` + void onFailed( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + CronetException cronetException, + ) { + _onFailed( + reference.pointer, + _id_onFailed as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer, + cronetException.reference.pointer) + .check(); + } + + /// Maps a specific port to the implemented interface. + static final _$core + .Map + _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == + r'onRedirectReceived(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/lang/String;)V') { + _$impls[$p]!.onRedirectReceived( + $a[0].as(const $UrlRequest$Type(), releaseOriginal: true), + $a[1].as(const $UrlResponseInfo$Type(), releaseOriginal: true), + $a[2].as(const _$jni.JStringType(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == + r'onResponseStarted(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V') { + _$impls[$p]!.onResponseStarted( + $a[0].as(const $UrlRequest$Type(), releaseOriginal: true), + $a[1].as(const $UrlResponseInfo$Type(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == + r'onReadCompleted(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/nio/ByteBuffer;)V') { + _$impls[$p]!.onReadCompleted( + $a[0].as(const $UrlRequest$Type(), releaseOriginal: true), + $a[1].as(const $UrlResponseInfo$Type(), releaseOriginal: true), + $a[2].as(const _$jni.JByteBufferType(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == + r'onSucceeded(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V') { + _$impls[$p]!.onSucceeded( + $a[0].as(const $UrlRequest$Type(), releaseOriginal: true), + $a[1].as(const $UrlResponseInfo$Type(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == + r'onFailed(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Lorg/chromium/net/CronetException;)V') { + _$impls[$p]!.onFailed( + $a[0].as(const $UrlRequest$Type(), releaseOriginal: true), + $a[1].as(const $UrlResponseInfo$Type(), releaseOriginal: true), + $a[2].as(const $CronetException$Type(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $UrlRequestCallbackProxy_UrlRequestCallbackInterface $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'io.flutter.plugins.cronet_http.UrlRequestCallbackProxy$UrlRequestCallbackInterface', + $p, + _$invokePointer, + [ + if ($impl.onRedirectReceived$async) + r'onRedirectReceived(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/lang/String;)V', + if ($impl.onResponseStarted$async) + r'onResponseStarted(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V', + if ($impl.onReadCompleted$async) + r'onReadCompleted(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/nio/ByteBuffer;)V', + if ($impl.onSucceeded$async) + r'onSucceeded(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V', + if ($impl.onFailed$async) + r'onFailed(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Lorg/chromium/net/CronetException;)V', + ], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory UrlRequestCallbackProxy_UrlRequestCallbackInterface.implement( + $UrlRequestCallbackProxy_UrlRequestCallbackInterface $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return UrlRequestCallbackProxy_UrlRequestCallbackInterface.fromReference( + $i.implementReference(), + ); + } +} + +abstract mixin class $UrlRequestCallbackProxy_UrlRequestCallbackInterface { + factory $UrlRequestCallbackProxy_UrlRequestCallbackInterface({ + required void Function(UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, _$jni.JString string) + onRedirectReceived, + bool onRedirectReceived$async, + required void Function( + UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) + onResponseStarted, + bool onResponseStarted$async, + required void Function(UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, _$jni.JByteBuffer byteBuffer) + onReadCompleted, + bool onReadCompleted$async, + required void Function( + UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) + onSucceeded, + bool onSucceeded$async, + required void Function(UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, CronetException cronetException) + onFailed, + bool onFailed$async, + }) = _$UrlRequestCallbackProxy_UrlRequestCallbackInterface; + + void onRedirectReceived(UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, _$jni.JString string); + bool get onRedirectReceived$async => false; + void onResponseStarted( + UrlRequest urlRequest, UrlResponseInfo urlResponseInfo); + bool get onResponseStarted$async => false; + void onReadCompleted(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, + _$jni.JByteBuffer byteBuffer); + bool get onReadCompleted$async => false; + void onSucceeded(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo); + bool get onSucceeded$async => false; + void onFailed(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, + CronetException cronetException); + bool get onFailed$async => false; +} + +class _$UrlRequestCallbackProxy_UrlRequestCallbackInterface + implements $UrlRequestCallbackProxy_UrlRequestCallbackInterface { + _$UrlRequestCallbackProxy_UrlRequestCallbackInterface({ + required void Function(UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, _$jni.JString string) + onRedirectReceived, + this.onRedirectReceived$async = false, + required void Function( + UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) + onResponseStarted, + this.onResponseStarted$async = false, + required void Function(UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, _$jni.JByteBuffer byteBuffer) + onReadCompleted, + this.onReadCompleted$async = false, + required void Function( + UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) + onSucceeded, + this.onSucceeded$async = false, + required void Function(UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, CronetException cronetException) + onFailed, + this.onFailed$async = false, + }) : _onRedirectReceived = onRedirectReceived, + _onResponseStarted = onResponseStarted, + _onReadCompleted = onReadCompleted, + _onSucceeded = onSucceeded, + _onFailed = onFailed; + + final void Function(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, + _$jni.JString string) _onRedirectReceived; + final bool onRedirectReceived$async; + final void Function(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) + _onResponseStarted; + final bool onResponseStarted$async; + final void Function(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, + _$jni.JByteBuffer byteBuffer) _onReadCompleted; + final bool onReadCompleted$async; + final void Function(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) + _onSucceeded; + final bool onSucceeded$async; + final void Function(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, + CronetException cronetException) _onFailed; + final bool onFailed$async; + + void onRedirectReceived(UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, _$jni.JString string) { + return _onRedirectReceived(urlRequest, urlResponseInfo, string); + } + + void onResponseStarted( + UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) { + return _onResponseStarted(urlRequest, urlResponseInfo); + } + + void onReadCompleted(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, + _$jni.JByteBuffer byteBuffer) { + return _onReadCompleted(urlRequest, urlResponseInfo, byteBuffer); + } + + void onSucceeded(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) { + return _onSucceeded(urlRequest, urlResponseInfo); + } + + void onFailed(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, + CronetException cronetException) { + return _onFailed(urlRequest, urlResponseInfo, cronetException); + } +} + +final class $UrlRequestCallbackProxy_UrlRequestCallbackInterface$Type + extends _$jni + .JObjType { + @_$jni.internal + const $UrlRequestCallbackProxy_UrlRequestCallbackInterface$Type(); + + @_$jni.internal + @_$core.override + String get signature => + r'Lio/flutter/plugins/cronet_http/UrlRequestCallbackProxy$UrlRequestCallbackInterface;'; + + @_$jni.internal + @_$core.override + UrlRequestCallbackProxy_UrlRequestCallbackInterface fromReference( + _$jni.JReference reference) => + UrlRequestCallbackProxy_UrlRequestCallbackInterface.fromReference( + reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => + ($UrlRequestCallbackProxy_UrlRequestCallbackInterface$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == + ($UrlRequestCallbackProxy_UrlRequestCallbackInterface$Type) && + other is $UrlRequestCallbackProxy_UrlRequestCallbackInterface$Type; + } +} + +/// from: `io.flutter.plugins.cronet_http.UrlRequestCallbackProxy` +class UrlRequestCallbackProxy extends UrlRequest_Callback { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + UrlRequestCallbackProxy.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName( + r'io/flutter/plugins/cronet_http/UrlRequestCallbackProxy'); + + /// The type which includes information such as the signature of this class. + static const type = $UrlRequestCallbackProxy$Type(); + static final _id_new$ = _class.constructorId( + r'(Lio/flutter/plugins/cronet_http/UrlRequestCallbackProxy$UrlRequestCallbackInterface;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (io.flutter.plugins.cronet_http.UrlRequestCallbackProxy$UrlRequestCallbackInterface urlRequestCallbackInterface)` + /// The returned object must be released after use, by calling the [release] method. + factory UrlRequestCallbackProxy( + UrlRequestCallbackProxy_UrlRequestCallbackInterface + urlRequestCallbackInterface, + ) { + return UrlRequestCallbackProxy.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + urlRequestCallbackInterface.reference.pointer) + .reference); + } + + static final _id_getCallback = _class.instanceMethodId( + r'getCallback', + r'()Lio/flutter/plugins/cronet_http/UrlRequestCallbackProxy$UrlRequestCallbackInterface;', + ); + + static final _getCallback = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final io.flutter.plugins.cronet_http.UrlRequestCallbackProxy$UrlRequestCallbackInterface getCallback()` + /// The returned object must be released after use, by calling the [release] method. + UrlRequestCallbackProxy_UrlRequestCallbackInterface getCallback() { + return _getCallback( + reference.pointer, _id_getCallback as _$jni.JMethodIDPtr) + .object( + const $UrlRequestCallbackProxy_UrlRequestCallbackInterface$Type()); + } + + static final _id_onRedirectReceived = _class.instanceMethodId( + r'onRedirectReceived', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/lang/String;)V', + ); + + static final _onRedirectReceived = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onRedirectReceived(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo, java.lang.String string)` + void onRedirectReceived( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + _$jni.JString string, + ) { + _onRedirectReceived( + reference.pointer, + _id_onRedirectReceived as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer, + string.reference.pointer) + .check(); + } + + static final _id_onResponseStarted = _class.instanceMethodId( + r'onResponseStarted', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V', + ); + + static final _onResponseStarted = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onResponseStarted(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo)` + void onResponseStarted( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + ) { + _onResponseStarted( + reference.pointer, + _id_onResponseStarted as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer) + .check(); + } + + static final _id_onReadCompleted = _class.instanceMethodId( + r'onReadCompleted', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/nio/ByteBuffer;)V', + ); + + static final _onReadCompleted = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onReadCompleted(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo, java.nio.ByteBuffer byteBuffer)` + void onReadCompleted( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + _$jni.JByteBuffer byteBuffer, + ) { + _onReadCompleted( + reference.pointer, + _id_onReadCompleted as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer, + byteBuffer.reference.pointer) + .check(); + } + + static final _id_onSucceeded = _class.instanceMethodId( + r'onSucceeded', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V', + ); + + static final _onSucceeded = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onSucceeded(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo)` + void onSucceeded( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + ) { + _onSucceeded(reference.pointer, _id_onSucceeded as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, urlResponseInfo.reference.pointer) + .check(); + } + + static final _id_onFailed = _class.instanceMethodId( + r'onFailed', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Lorg/chromium/net/CronetException;)V', + ); + + static final _onFailed = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onFailed(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo, org.chromium.net.CronetException cronetException)` + void onFailed( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + CronetException cronetException, + ) { + _onFailed( + reference.pointer, + _id_onFailed as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer, + cronetException.reference.pointer) + .check(); + } +} + +final class $UrlRequestCallbackProxy$Type + extends _$jni.JObjType { + @_$jni.internal + const $UrlRequestCallbackProxy$Type(); + + @_$jni.internal + @_$core.override + String get signature => + r'Lio/flutter/plugins/cronet_http/UrlRequestCallbackProxy;'; + + @_$jni.internal + @_$core.override + UrlRequestCallbackProxy fromReference(_$jni.JReference reference) => + UrlRequestCallbackProxy.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const $UrlRequest_Callback$Type(); + + @_$jni.internal + @_$core.override + final superCount = 2; + + @_$core.override + int get hashCode => ($UrlRequestCallbackProxy$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($UrlRequestCallbackProxy$Type) && + other is $UrlRequestCallbackProxy$Type; + } +} + +/// from: `java.net.URL` +class URL extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + URL.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'java/net/URL'); + + /// The type which includes information such as the signature of this class. + static const type = $URL$Type(); + static final _id_new$ = _class.constructorId( + r'(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (java.lang.String string, java.lang.String string1, int i, java.lang.String string2)` + /// The returned object must be released after use, by calling the [release] method. + factory URL( + _$jni.JString string, + _$jni.JString string1, + int i, + _$jni.JString string2, + ) { + return URL.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + string.reference.pointer, + string1.reference.pointer, + i, + string2.reference.pointer) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (java.lang.String string, java.lang.String string1, java.lang.String string2)` + /// The returned object must be released after use, by calling the [release] method. + factory URL.new$1( + _$jni.JString string, + _$jni.JString string1, + _$jni.JString string2, + ) { + return URL.fromReference(_new$1( + _class.reference.pointer, + _id_new$1 as _$jni.JMethodIDPtr, + string.reference.pointer, + string1.reference.pointer, + string2.reference.pointer) + .reference); + } + + static final _id_new$2 = _class.constructorId( + r'(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/net/URLStreamHandler;)V', + ); + + static final _new$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (java.lang.String string, java.lang.String string1, int i, java.lang.String string2, java.net.URLStreamHandler uRLStreamHandler)` + /// The returned object must be released after use, by calling the [release] method. + factory URL.new$2( + _$jni.JString string, + _$jni.JString string1, + int i, + _$jni.JString string2, + _$jni.JObject uRLStreamHandler, + ) { + return URL.fromReference(_new$2( + _class.reference.pointer, + _id_new$2 as _$jni.JMethodIDPtr, + string.reference.pointer, + string1.reference.pointer, + i, + string2.reference.pointer, + uRLStreamHandler.reference.pointer) + .reference); + } + + static final _id_new$3 = _class.constructorId( + r'(Ljava/lang/String;)V', + ); + + static final _new$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + factory URL.new$3( + _$jni.JString string, + ) { + return URL.fromReference(_new$3(_class.reference.pointer, + _id_new$3 as _$jni.JMethodIDPtr, string.reference.pointer) + .reference); + } + + static final _id_new$4 = _class.constructorId( + r'(Ljava/net/URL;Ljava/lang/String;)V', + ); + + static final _new$4 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (java.net.URL uRL, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + factory URL.new$4( + URL uRL, + _$jni.JString string, + ) { + return URL.fromReference(_new$4( + _class.reference.pointer, + _id_new$4 as _$jni.JMethodIDPtr, + uRL.reference.pointer, + string.reference.pointer) + .reference); + } + + static final _id_new$5 = _class.constructorId( + r'(Ljava/net/URL;Ljava/lang/String;Ljava/net/URLStreamHandler;)V', + ); + + static final _new$5 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (java.net.URL uRL, java.lang.String string, java.net.URLStreamHandler uRLStreamHandler)` + /// The returned object must be released after use, by calling the [release] method. + factory URL.new$5( + URL uRL, + _$jni.JString string, + _$jni.JObject uRLStreamHandler, + ) { + return URL.fromReference(_new$5( + _class.reference.pointer, + _id_new$5 as _$jni.JMethodIDPtr, + uRL.reference.pointer, + string.reference.pointer, + uRLStreamHandler.reference.pointer) + .reference); + } + + static final _id_getQuery = _class.instanceMethodId( + r'getQuery', + r'()Ljava/lang/String;', + ); + + static final _getQuery = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getQuery()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getQuery() { + return _getQuery(reference.pointer, _id_getQuery as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getPath = _class.instanceMethodId( + r'getPath', + r'()Ljava/lang/String;', + ); + + static final _getPath = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getPath()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getPath() { + return _getPath(reference.pointer, _id_getPath as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getUserInfo = _class.instanceMethodId( + r'getUserInfo', + r'()Ljava/lang/String;', + ); + + static final _getUserInfo = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getUserInfo()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getUserInfo() { + return _getUserInfo( + reference.pointer, _id_getUserInfo as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getAuthority = _class.instanceMethodId( + r'getAuthority', + r'()Ljava/lang/String;', + ); + + static final _getAuthority = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getAuthority()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getAuthority() { + return _getAuthority( + reference.pointer, _id_getAuthority as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getPort = _class.instanceMethodId( + r'getPort', + r'()I', + ); + + static final _getPort = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public int getPort()` + int getPort() { + return _getPort(reference.pointer, _id_getPort as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_getDefaultPort = _class.instanceMethodId( + r'getDefaultPort', + r'()I', + ); + + static final _getDefaultPort = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public int getDefaultPort()` + int getDefaultPort() { + return _getDefaultPort( + reference.pointer, _id_getDefaultPort as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_getProtocol = _class.instanceMethodId( + r'getProtocol', + r'()Ljava/lang/String;', + ); + + static final _getProtocol = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getProtocol()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getProtocol() { + return _getProtocol( + reference.pointer, _id_getProtocol as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getHost = _class.instanceMethodId( + r'getHost', + r'()Ljava/lang/String;', + ); + + static final _getHost = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getHost()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getHost() { + return _getHost(reference.pointer, _id_getHost as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getFile = _class.instanceMethodId( + r'getFile', + r'()Ljava/lang/String;', + ); + + static final _getFile = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getFile()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getFile() { + return _getFile(reference.pointer, _id_getFile as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getRef = _class.instanceMethodId( + r'getRef', + r'()Ljava/lang/String;', + ); + + static final _getRef = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getRef()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getRef() { + return _getRef(reference.pointer, _id_getRef as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_equals = _class.instanceMethodId( + r'equals', + r'(Ljava/lang/Object;)Z', + ); + + static final _equals = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public boolean equals(java.lang.Object object)` + bool equals( + _$jni.JObject object, + ) { + return _equals(reference.pointer, _id_equals as _$jni.JMethodIDPtr, + object.reference.pointer) + .boolean; + } + + static final _id_hashCode$1 = _class.instanceMethodId( + r'hashCode', + r'()I', + ); + + static final _hashCode$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public int hashCode()` + int hashCode$1() { + return _hashCode$1(reference.pointer, _id_hashCode$1 as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_sameFile = _class.instanceMethodId( + r'sameFile', + r'(Ljava/net/URL;)Z', + ); + + static final _sameFile = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public boolean sameFile(java.net.URL uRL)` + bool sameFile( + URL uRL, + ) { + return _sameFile(reference.pointer, _id_sameFile as _$jni.JMethodIDPtr, + uRL.reference.pointer) + .boolean; + } + + static final _id_toString$1 = _class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_toExternalForm = _class.instanceMethodId( + r'toExternalForm', + r'()Ljava/lang/String;', + ); + + static final _toExternalForm = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toExternalForm()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString toExternalForm() { + return _toExternalForm( + reference.pointer, _id_toExternalForm as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_toURI = _class.instanceMethodId( + r'toURI', + r'()Ljava/net/URI;', + ); + + static final _toURI = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.net.URI toURI()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject toURI() { + return _toURI(reference.pointer, _id_toURI as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_openConnection = _class.instanceMethodId( + r'openConnection', + r'()Ljava/net/URLConnection;', + ); + + static final _openConnection = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.net.URLConnection openConnection()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject openConnection() { + return _openConnection( + reference.pointer, _id_openConnection as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_openConnection$1 = _class.instanceMethodId( + r'openConnection', + r'(Ljava/net/Proxy;)Ljava/net/URLConnection;', + ); + + static final _openConnection$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public java.net.URLConnection openConnection(java.net.Proxy proxy)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject openConnection$1( + _$jni.JObject proxy, + ) { + return _openConnection$1(reference.pointer, + _id_openConnection$1 as _$jni.JMethodIDPtr, proxy.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_openStream = _class.instanceMethodId( + r'openStream', + r'()Ljava/io/InputStream;', + ); + + static final _openStream = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.io.InputStream openStream()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject openStream() { + return _openStream(reference.pointer, _id_openStream as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_getContent = _class.instanceMethodId( + r'getContent', + r'()Ljava/lang/Object;', + ); + + static final _getContent = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.Object getContent()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject getContent() { + return _getContent(reference.pointer, _id_getContent as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_getContent$1 = _class.instanceMethodId( + r'getContent', + r'([Ljava/lang/Class;)Ljava/lang/Object;', + ); + + static final _getContent$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public java.lang.Object getContent(java.lang.Class[] classs)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject getContent$1( + _$jni.JArray<_$jni.JObject> classs, + ) { + return _getContent$1(reference.pointer, + _id_getContent$1 as _$jni.JMethodIDPtr, classs.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_setURLStreamHandlerFactory = _class.staticMethodId( + r'setURLStreamHandlerFactory', + r'(Ljava/net/URLStreamHandlerFactory;)V', + ); + + static final _setURLStreamHandlerFactory = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public void setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory uRLStreamHandlerFactory)` + static void setURLStreamHandlerFactory( + _$jni.JObject uRLStreamHandlerFactory, + ) { + _setURLStreamHandlerFactory( + _class.reference.pointer, + _id_setURLStreamHandlerFactory as _$jni.JMethodIDPtr, + uRLStreamHandlerFactory.reference.pointer) + .check(); + } +} + +final class $URL$Type extends _$jni.JObjType { + @_$jni.internal + const $URL$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Ljava/net/URL;'; + + @_$jni.internal + @_$core.override + URL fromReference(_$jni.JReference reference) => URL.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($URL$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($URL$Type) && other is $URL$Type; + } +} + +/// from: `java.util.concurrent.Executors` +class Executors extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Executors.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'java/util/concurrent/Executors'); + + /// The type which includes information such as the signature of this class. + static const type = $Executors$Type(); + static final _id_newFixedThreadPool = _class.staticMethodId( + r'newFixedThreadPool', + r'(I)Ljava/util/concurrent/ExecutorService;', + ); + + static final _newFixedThreadPool = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `static public java.util.concurrent.ExecutorService newFixedThreadPool(int i)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newFixedThreadPool( + int i, + ) { + return _newFixedThreadPool(_class.reference.pointer, + _id_newFixedThreadPool as _$jni.JMethodIDPtr, i) + .object(const _$jni.JObjectType()); + } + + static final _id_newWorkStealingPool = _class.staticMethodId( + r'newWorkStealingPool', + r'(I)Ljava/util/concurrent/ExecutorService;', + ); + + static final _newWorkStealingPool = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `static public java.util.concurrent.ExecutorService newWorkStealingPool(int i)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newWorkStealingPool( + int i, + ) { + return _newWorkStealingPool(_class.reference.pointer, + _id_newWorkStealingPool as _$jni.JMethodIDPtr, i) + .object(const _$jni.JObjectType()); + } + + static final _id_newWorkStealingPool$1 = _class.staticMethodId( + r'newWorkStealingPool', + r'()Ljava/util/concurrent/ExecutorService;', + ); + + static final _newWorkStealingPool$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `static public java.util.concurrent.ExecutorService newWorkStealingPool()` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newWorkStealingPool$1() { + return _newWorkStealingPool$1(_class.reference.pointer, + _id_newWorkStealingPool$1 as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_newFixedThreadPool$1 = _class.staticMethodId( + r'newFixedThreadPool', + r'(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;', + ); + + static final _newFixedThreadPool$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int32, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.ExecutorService newFixedThreadPool(int i, java.util.concurrent.ThreadFactory threadFactory)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newFixedThreadPool$1( + int i, + _$jni.JObject threadFactory, + ) { + return _newFixedThreadPool$1( + _class.reference.pointer, + _id_newFixedThreadPool$1 as _$jni.JMethodIDPtr, + i, + threadFactory.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_newSingleThreadExecutor = _class.staticMethodId( + r'newSingleThreadExecutor', + r'()Ljava/util/concurrent/ExecutorService;', + ); + + static final _newSingleThreadExecutor = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `static public java.util.concurrent.ExecutorService newSingleThreadExecutor()` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newSingleThreadExecutor() { + return _newSingleThreadExecutor(_class.reference.pointer, + _id_newSingleThreadExecutor as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_newSingleThreadExecutor$1 = _class.staticMethodId( + r'newSingleThreadExecutor', + r'(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;', + ); + + static final _newSingleThreadExecutor$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.ExecutorService newSingleThreadExecutor(java.util.concurrent.ThreadFactory threadFactory)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newSingleThreadExecutor$1( + _$jni.JObject threadFactory, + ) { + return _newSingleThreadExecutor$1( + _class.reference.pointer, + _id_newSingleThreadExecutor$1 as _$jni.JMethodIDPtr, + threadFactory.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_newCachedThreadPool = _class.staticMethodId( + r'newCachedThreadPool', + r'()Ljava/util/concurrent/ExecutorService;', + ); + + static final _newCachedThreadPool = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `static public java.util.concurrent.ExecutorService newCachedThreadPool()` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newCachedThreadPool() { + return _newCachedThreadPool(_class.reference.pointer, + _id_newCachedThreadPool as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_newCachedThreadPool$1 = _class.staticMethodId( + r'newCachedThreadPool', + r'(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;', + ); + + static final _newCachedThreadPool$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.ExecutorService newCachedThreadPool(java.util.concurrent.ThreadFactory threadFactory)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newCachedThreadPool$1( + _$jni.JObject threadFactory, + ) { + return _newCachedThreadPool$1( + _class.reference.pointer, + _id_newCachedThreadPool$1 as _$jni.JMethodIDPtr, + threadFactory.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_newSingleThreadScheduledExecutor = _class.staticMethodId( + r'newSingleThreadScheduledExecutor', + r'()Ljava/util/concurrent/ScheduledExecutorService;', + ); + + static final _newSingleThreadScheduledExecutor = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `static public java.util.concurrent.ScheduledExecutorService newSingleThreadScheduledExecutor()` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newSingleThreadScheduledExecutor() { + return _newSingleThreadScheduledExecutor(_class.reference.pointer, + _id_newSingleThreadScheduledExecutor as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_newSingleThreadScheduledExecutor$1 = _class.staticMethodId( + r'newSingleThreadScheduledExecutor', + r'(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ScheduledExecutorService;', + ); + + static final _newSingleThreadScheduledExecutor$1 = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.ScheduledExecutorService newSingleThreadScheduledExecutor(java.util.concurrent.ThreadFactory threadFactory)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newSingleThreadScheduledExecutor$1( + _$jni.JObject threadFactory, + ) { + return _newSingleThreadScheduledExecutor$1( + _class.reference.pointer, + _id_newSingleThreadScheduledExecutor$1 as _$jni.JMethodIDPtr, + threadFactory.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_newScheduledThreadPool = _class.staticMethodId( + r'newScheduledThreadPool', + r'(I)Ljava/util/concurrent/ScheduledExecutorService;', + ); + + static final _newScheduledThreadPool = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `static public java.util.concurrent.ScheduledExecutorService newScheduledThreadPool(int i)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newScheduledThreadPool( + int i, + ) { + return _newScheduledThreadPool(_class.reference.pointer, + _id_newScheduledThreadPool as _$jni.JMethodIDPtr, i) + .object(const _$jni.JObjectType()); + } + + static final _id_newScheduledThreadPool$1 = _class.staticMethodId( + r'newScheduledThreadPool', + r'(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ScheduledExecutorService;', + ); + + static final _newScheduledThreadPool$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int32, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.ScheduledExecutorService newScheduledThreadPool(int i, java.util.concurrent.ThreadFactory threadFactory)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject newScheduledThreadPool$1( + int i, + _$jni.JObject threadFactory, + ) { + return _newScheduledThreadPool$1( + _class.reference.pointer, + _id_newScheduledThreadPool$1 as _$jni.JMethodIDPtr, + i, + threadFactory.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_unconfigurableExecutorService = _class.staticMethodId( + r'unconfigurableExecutorService', + r'(Ljava/util/concurrent/ExecutorService;)Ljava/util/concurrent/ExecutorService;', + ); + + static final _unconfigurableExecutorService = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.ExecutorService unconfigurableExecutorService(java.util.concurrent.ExecutorService executorService)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject unconfigurableExecutorService( + _$jni.JObject executorService, + ) { + return _unconfigurableExecutorService( + _class.reference.pointer, + _id_unconfigurableExecutorService as _$jni.JMethodIDPtr, + executorService.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_unconfigurableScheduledExecutorService = + _class.staticMethodId( + r'unconfigurableScheduledExecutorService', + r'(Ljava/util/concurrent/ScheduledExecutorService;)Ljava/util/concurrent/ScheduledExecutorService;', + ); + + static final _unconfigurableScheduledExecutorService = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.ScheduledExecutorService unconfigurableScheduledExecutorService(java.util.concurrent.ScheduledExecutorService scheduledExecutorService)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject unconfigurableScheduledExecutorService( + _$jni.JObject scheduledExecutorService, + ) { + return _unconfigurableScheduledExecutorService( + _class.reference.pointer, + _id_unconfigurableScheduledExecutorService as _$jni.JMethodIDPtr, + scheduledExecutorService.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_defaultThreadFactory = _class.staticMethodId( + r'defaultThreadFactory', + r'()Ljava/util/concurrent/ThreadFactory;', + ); + + static final _defaultThreadFactory = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `static public java.util.concurrent.ThreadFactory defaultThreadFactory()` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject defaultThreadFactory() { + return _defaultThreadFactory(_class.reference.pointer, + _id_defaultThreadFactory as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_privilegedThreadFactory = _class.staticMethodId( + r'privilegedThreadFactory', + r'()Ljava/util/concurrent/ThreadFactory;', + ); + + static final _privilegedThreadFactory = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `static public java.util.concurrent.ThreadFactory privilegedThreadFactory()` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject privilegedThreadFactory() { + return _privilegedThreadFactory(_class.reference.pointer, + _id_privilegedThreadFactory as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_callable = _class.staticMethodId( + r'callable', + r'(Ljava/lang/Runnable;Ljava/lang/Object;)Ljava/util/concurrent/Callable;', + ); + + static final _callable = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.Callable callable(java.lang.Runnable runnable, T object)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject callable<$T extends _$jni.JObject>( + _$jni.JObject runnable, + $T object, { + _$jni.JObjType<$T>? T, + }) { + T ??= _$jni.lowestCommonSuperType([ + object.$type, + ]) as _$jni.JObjType<$T>; + return _callable( + _class.reference.pointer, + _id_callable as _$jni.JMethodIDPtr, + runnable.reference.pointer, + object.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_callable$1 = _class.staticMethodId( + r'callable', + r'(Ljava/lang/Runnable;)Ljava/util/concurrent/Callable;', + ); + + static final _callable$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.Callable callable(java.lang.Runnable runnable)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject callable$1( + _$jni.JObject runnable, + ) { + return _callable$1(_class.reference.pointer, + _id_callable$1 as _$jni.JMethodIDPtr, runnable.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_callable$2 = _class.staticMethodId( + r'callable', + r'(Ljava/security/PrivilegedAction;)Ljava/util/concurrent/Callable;', + ); + + static final _callable$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.Callable callable(java.security.PrivilegedAction privilegedAction)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject callable$2( + _$jni.JObject privilegedAction, + ) { + return _callable$2( + _class.reference.pointer, + _id_callable$2 as _$jni.JMethodIDPtr, + privilegedAction.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_callable$3 = _class.staticMethodId( + r'callable', + r'(Ljava/security/PrivilegedExceptionAction;)Ljava/util/concurrent/Callable;', + ); + + static final _callable$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.Callable callable(java.security.PrivilegedExceptionAction privilegedExceptionAction)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject callable$3( + _$jni.JObject privilegedExceptionAction, + ) { + return _callable$3( + _class.reference.pointer, + _id_callable$3 as _$jni.JMethodIDPtr, + privilegedExceptionAction.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_privilegedCallable = _class.staticMethodId( + r'privilegedCallable', + r'(Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Callable;', + ); + + static final _privilegedCallable = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.Callable privilegedCallable(java.util.concurrent.Callable callable)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject privilegedCallable<$T extends _$jni.JObject>( + _$jni.JObject callable, { + required _$jni.JObjType<$T> T, + }) { + return _privilegedCallable( + _class.reference.pointer, + _id_privilegedCallable as _$jni.JMethodIDPtr, + callable.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_privilegedCallableUsingCurrentClassLoader = + _class.staticMethodId( + r'privilegedCallableUsingCurrentClassLoader', + r'(Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Callable;', + ); + + static final _privilegedCallableUsingCurrentClassLoader = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.Callable privilegedCallableUsingCurrentClassLoader(java.util.concurrent.Callable callable)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject + privilegedCallableUsingCurrentClassLoader<$T extends _$jni.JObject>( + _$jni.JObject callable, { + required _$jni.JObjType<$T> T, + }) { + return _privilegedCallableUsingCurrentClassLoader( + _class.reference.pointer, + _id_privilegedCallableUsingCurrentClassLoader as _$jni.JMethodIDPtr, + callable.reference.pointer) + .object(const _$jni.JObjectType()); + } +} + +final class $Executors$Type extends _$jni.JObjType { + @_$jni.internal + const $Executors$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Ljava/util/concurrent/Executors;'; + + @_$jni.internal + @_$core.override + Executors fromReference(_$jni.JReference reference) => + Executors.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Executors$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Executors$Type) && other is $Executors$Type; + } +} + +/// from: `org.chromium.net.CronetEngine$Builder$LibraryLoader` +class CronetEngine_Builder_LibraryLoader extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + CronetEngine_Builder_LibraryLoader.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName( + r'org/chromium/net/CronetEngine$Builder$LibraryLoader'); + + /// The type which includes information such as the signature of this class. + static const type = $CronetEngine_Builder_LibraryLoader$Type(); + static final _id_loadLibrary = _class.instanceMethodId( + r'loadLibrary', + r'(Ljava/lang/String;)V', + ); + + static final _loadLibrary = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void loadLibrary(java.lang.String string)` + void loadLibrary( + _$jni.JString string, + ) { + _loadLibrary(reference.pointer, _id_loadLibrary as _$jni.JMethodIDPtr, + string.reference.pointer) + .check(); + } +} + +final class $CronetEngine_Builder_LibraryLoader$Type + extends _$jni.JObjType { + @_$jni.internal + const $CronetEngine_Builder_LibraryLoader$Type(); + + @_$jni.internal + @_$core.override + String get signature => + r'Lorg/chromium/net/CronetEngine$Builder$LibraryLoader;'; + + @_$jni.internal + @_$core.override + CronetEngine_Builder_LibraryLoader fromReference( + _$jni.JReference reference) => + CronetEngine_Builder_LibraryLoader.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($CronetEngine_Builder_LibraryLoader$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($CronetEngine_Builder_LibraryLoader$Type) && + other is $CronetEngine_Builder_LibraryLoader$Type; + } +} + +/// from: `org.chromium.net.CronetEngine$Builder` +class CronetEngine_Builder extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + CronetEngine_Builder.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'org/chromium/net/CronetEngine$Builder'); + + /// The type which includes information such as the signature of this class. + static const type = $CronetEngine_Builder$Type(); + + /// from: `static public final int HTTP_CACHE_DISABLED` + static const HTTP_CACHE_DISABLED = 0; + + /// from: `static public final int HTTP_CACHE_IN_MEMORY` + static const HTTP_CACHE_IN_MEMORY = 1; + + /// from: `static public final int HTTP_CACHE_DISK_NO_HTTP` + static const HTTP_CACHE_DISK_NO_HTTP = 2; + + /// from: `static public final int HTTP_CACHE_DISK` + static const HTTP_CACHE_DISK = 3; + static final _id_new$ = _class.constructorId( + r'(Landroid/content/Context;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (android.content.Context context)` + /// The returned object must be released after use, by calling the [release] method. + factory CronetEngine_Builder( + _$jni.JObject context, + ) { + return CronetEngine_Builder.fromReference(_new$(_class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, context.reference.pointer) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(Lorg/chromium/net/ICronetEngineBuilder;)V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (org.chromium.net.ICronetEngineBuilder iCronetEngineBuilder)` + /// The returned object must be released after use, by calling the [release] method. + factory CronetEngine_Builder.new$1( + _$jni.JObject iCronetEngineBuilder, + ) { + return CronetEngine_Builder.fromReference(_new$1( + _class.reference.pointer, + _id_new$1 as _$jni.JMethodIDPtr, + iCronetEngineBuilder.reference.pointer) + .reference); + } + + static final _id_getDefaultUserAgent = _class.instanceMethodId( + r'getDefaultUserAgent', + r'()Ljava/lang/String;', + ); + + static final _getDefaultUserAgent = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getDefaultUserAgent()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getDefaultUserAgent() { + return _getDefaultUserAgent( + reference.pointer, _id_getDefaultUserAgent as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_setUserAgent = _class.instanceMethodId( + r'setUserAgent', + r'(Ljava/lang/String;)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _setUserAgent = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder setUserAgent(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder setUserAgent( + _$jni.JString string, + ) { + return _setUserAgent(reference.pointer, + _id_setUserAgent as _$jni.JMethodIDPtr, string.reference.pointer) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_setStoragePath = _class.instanceMethodId( + r'setStoragePath', + r'(Ljava/lang/String;)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _setStoragePath = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder setStoragePath(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder setStoragePath( + _$jni.JString string, + ) { + return _setStoragePath(reference.pointer, + _id_setStoragePath as _$jni.JMethodIDPtr, string.reference.pointer) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_setLibraryLoader = _class.instanceMethodId( + r'setLibraryLoader', + r'(Lorg/chromium/net/CronetEngine$Builder$LibraryLoader;)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _setLibraryLoader = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder setLibraryLoader(org.chromium.net.CronetEngine$Builder$LibraryLoader libraryLoader)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder setLibraryLoader( + CronetEngine_Builder_LibraryLoader libraryLoader, + ) { + return _setLibraryLoader( + reference.pointer, + _id_setLibraryLoader as _$jni.JMethodIDPtr, + libraryLoader.reference.pointer) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_enableQuic = _class.instanceMethodId( + r'enableQuic', + r'(Z)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _enableQuic = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder enableQuic(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder enableQuic( + bool z, + ) { + return _enableQuic( + reference.pointer, _id_enableQuic as _$jni.JMethodIDPtr, z ? 1 : 0) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_enableHttp2 = _class.instanceMethodId( + r'enableHttp2', + r'(Z)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _enableHttp2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder enableHttp2(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder enableHttp2( + bool z, + ) { + return _enableHttp2( + reference.pointer, _id_enableHttp2 as _$jni.JMethodIDPtr, z ? 1 : 0) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_enableSdch = _class.instanceMethodId( + r'enableSdch', + r'(Z)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _enableSdch = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder enableSdch(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder enableSdch( + bool z, + ) { + return _enableSdch( + reference.pointer, _id_enableSdch as _$jni.JMethodIDPtr, z ? 1 : 0) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_enableBrotli = _class.instanceMethodId( + r'enableBrotli', + r'(Z)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _enableBrotli = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder enableBrotli(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder enableBrotli( + bool z, + ) { + return _enableBrotli(reference.pointer, + _id_enableBrotli as _$jni.JMethodIDPtr, z ? 1 : 0) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_enableHttpCache = _class.instanceMethodId( + r'enableHttpCache', + r'(IJ)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _enableHttpCache = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32, _$jni.Int64)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int, int)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder enableHttpCache(int i, long j)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder enableHttpCache( + int i, + int j, + ) { + return _enableHttpCache( + reference.pointer, _id_enableHttpCache as _$jni.JMethodIDPtr, i, j) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_addQuicHint = _class.instanceMethodId( + r'addQuicHint', + r'(Ljava/lang/String;II)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _addQuicHint = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder addQuicHint(java.lang.String string, int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder addQuicHint( + _$jni.JString string, + int i, + int i1, + ) { + return _addQuicHint( + reference.pointer, + _id_addQuicHint as _$jni.JMethodIDPtr, + string.reference.pointer, + i, + i1) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_addPublicKeyPins = _class.instanceMethodId( + r'addPublicKeyPins', + r'(Ljava/lang/String;Ljava/util/Set;ZLjava/util/Date;)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _addPublicKeyPins = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder addPublicKeyPins(java.lang.String string, java.util.Set set, boolean z, java.util.Date date)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder addPublicKeyPins( + _$jni.JString string, + _$jni.JSet<_$jni.JArray<_$jni.jbyte>> set, + bool z, + _$jni.JObject date, + ) { + return _addPublicKeyPins( + reference.pointer, + _id_addPublicKeyPins as _$jni.JMethodIDPtr, + string.reference.pointer, + set.reference.pointer, + z ? 1 : 0, + date.reference.pointer) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_enablePublicKeyPinningBypassForLocalTrustAnchors = + _class.instanceMethodId( + r'enablePublicKeyPinningBypassForLocalTrustAnchors', + r'(Z)Lorg/chromium/net/CronetEngine$Builder;', + ); + + static final _enablePublicKeyPinningBypassForLocalTrustAnchors = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public org.chromium.net.CronetEngine$Builder enablePublicKeyPinningBypassForLocalTrustAnchors(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine_Builder enablePublicKeyPinningBypassForLocalTrustAnchors( + bool z, + ) { + return _enablePublicKeyPinningBypassForLocalTrustAnchors( + reference.pointer, + _id_enablePublicKeyPinningBypassForLocalTrustAnchors + as _$jni.JMethodIDPtr, + z ? 1 : 0) + .object(const $CronetEngine_Builder$Type()); + } + + static final _id_build = _class.instanceMethodId( + r'build', + r'()Lorg/chromium/net/CronetEngine;', + ); + + static final _build = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public org.chromium.net.CronetEngine build()` + /// The returned object must be released after use, by calling the [release] method. + CronetEngine build() { + return _build(reference.pointer, _id_build as _$jni.JMethodIDPtr) + .object(const $CronetEngine$Type()); + } +} + +final class $CronetEngine_Builder$Type + extends _$jni.JObjType { + @_$jni.internal + const $CronetEngine_Builder$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/CronetEngine$Builder;'; + + @_$jni.internal + @_$core.override + CronetEngine_Builder fromReference(_$jni.JReference reference) => + CronetEngine_Builder.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($CronetEngine_Builder$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($CronetEngine_Builder$Type) && + other is $CronetEngine_Builder$Type; + } +} + +/// from: `org.chromium.net.CronetEngine` +class CronetEngine extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + CronetEngine.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'org/chromium/net/CronetEngine'); + + /// The type which includes information such as the signature of this class. + static const type = $CronetEngine$Type(); + static final _id_getVersionString = _class.instanceMethodId( + r'getVersionString', + r'()Ljava/lang/String;', + ); + + static final _getVersionString = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.lang.String getVersionString()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getVersionString() { + return _getVersionString( + reference.pointer, _id_getVersionString as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_shutdown = _class.instanceMethodId( + r'shutdown', + r'()V', + ); + + static final _shutdown = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract void shutdown()` + void shutdown() { + _shutdown(reference.pointer, _id_shutdown as _$jni.JMethodIDPtr).check(); + } + + static final _id_startNetLogToFile = _class.instanceMethodId( + r'startNetLogToFile', + r'(Ljava/lang/String;Z)V', + ); + + static final _startNetLogToFile = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public abstract void startNetLogToFile(java.lang.String string, boolean z)` + void startNetLogToFile( + _$jni.JString string, + bool z, + ) { + _startNetLogToFile( + reference.pointer, + _id_startNetLogToFile as _$jni.JMethodIDPtr, + string.reference.pointer, + z ? 1 : 0) + .check(); + } + + static final _id_stopNetLog = _class.instanceMethodId( + r'stopNetLog', + r'()V', + ); + + static final _stopNetLog = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract void stopNetLog()` + void stopNetLog() { + _stopNetLog(reference.pointer, _id_stopNetLog as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getGlobalMetricsDeltas = _class.instanceMethodId( + r'getGlobalMetricsDeltas', + r'()[B', + ); + + static final _getGlobalMetricsDeltas = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract byte[] getGlobalMetricsDeltas()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JArray<_$jni.jbyte> getGlobalMetricsDeltas() { + return _getGlobalMetricsDeltas( + reference.pointer, _id_getGlobalMetricsDeltas as _$jni.JMethodIDPtr) + .object(const _$jni.JArrayType(_$jni.jbyteType())); + } + + static final _id_openConnection = _class.instanceMethodId( + r'openConnection', + r'(Ljava/net/URL;)Ljava/net/URLConnection;', + ); + + static final _openConnection = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract java.net.URLConnection openConnection(java.net.URL uRL)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject openConnection( + URL uRL, + ) { + return _openConnection(reference.pointer, + _id_openConnection as _$jni.JMethodIDPtr, uRL.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_createURLStreamHandlerFactory = _class.instanceMethodId( + r'createURLStreamHandlerFactory', + r'()Ljava/net/URLStreamHandlerFactory;', + ); + + static final _createURLStreamHandlerFactory = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.net.URLStreamHandlerFactory createURLStreamHandlerFactory()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject createURLStreamHandlerFactory() { + return _createURLStreamHandlerFactory(reference.pointer, + _id_createURLStreamHandlerFactory as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_newUrlRequestBuilder = _class.instanceMethodId( + r'newUrlRequestBuilder', + r'(Ljava/lang/String;Lorg/chromium/net/UrlRequest$Callback;Ljava/util/concurrent/Executor;)Lorg/chromium/net/UrlRequest$Builder;', + ); + + static final _newUrlRequestBuilder = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract org.chromium.net.UrlRequest$Builder newUrlRequestBuilder(java.lang.String string, org.chromium.net.UrlRequest$Callback callback, java.util.concurrent.Executor executor)` + /// The returned object must be released after use, by calling the [release] method. + UrlRequest_Builder newUrlRequestBuilder( + _$jni.JString string, + UrlRequest_Callback callback, + _$jni.JObject executor, + ) { + return _newUrlRequestBuilder( + reference.pointer, + _id_newUrlRequestBuilder as _$jni.JMethodIDPtr, + string.reference.pointer, + callback.reference.pointer, + executor.reference.pointer) + .object(const $UrlRequest_Builder$Type()); + } +} + +final class $CronetEngine$Type extends _$jni.JObjType { + @_$jni.internal + const $CronetEngine$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/CronetEngine;'; + + @_$jni.internal + @_$core.override + CronetEngine fromReference(_$jni.JReference reference) => + CronetEngine.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($CronetEngine$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($CronetEngine$Type) && + other is $CronetEngine$Type; + } +} + +/// from: `org.chromium.net.CronetException` +class CronetException extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + CronetException.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'org/chromium/net/CronetException'); + + /// The type which includes information such as the signature of this class. + static const type = $CronetException$Type(); +} + +final class $CronetException$Type extends _$jni.JObjType { + @_$jni.internal + const $CronetException$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/CronetException;'; + + @_$jni.internal + @_$core.override + CronetException fromReference(_$jni.JReference reference) => + CronetException.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($CronetException$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($CronetException$Type) && + other is $CronetException$Type; + } +} + +/// from: `org.chromium.net.UploadDataProviders` +class UploadDataProviders extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + UploadDataProviders.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'org/chromium/net/UploadDataProviders'); + + /// The type which includes information such as the signature of this class. + static const type = $UploadDataProviders$Type(); + static final _id_create = _class.staticMethodId( + r'create', + r'(Ljava/io/File;)Lorg/chromium/net/UploadDataProvider;', + ); + + static final _create = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public org.chromium.net.UploadDataProvider create(java.io.File file)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject create( + _$jni.JObject file, + ) { + return _create(_class.reference.pointer, _id_create as _$jni.JMethodIDPtr, + file.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_create$1 = _class.staticMethodId( + r'create', + r'(Landroid/os/ParcelFileDescriptor;)Lorg/chromium/net/UploadDataProvider;', + ); + + static final _create$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public org.chromium.net.UploadDataProvider create(android.os.ParcelFileDescriptor parcelFileDescriptor)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject create$1( + _$jni.JObject parcelFileDescriptor, + ) { + return _create$1( + _class.reference.pointer, + _id_create$1 as _$jni.JMethodIDPtr, + parcelFileDescriptor.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_create$2 = _class.staticMethodId( + r'create', + r'(Ljava/nio/ByteBuffer;)Lorg/chromium/net/UploadDataProvider;', + ); + + static final _create$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public org.chromium.net.UploadDataProvider create(java.nio.ByteBuffer byteBuffer)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject create$2( + _$jni.JByteBuffer byteBuffer, + ) { + return _create$2(_class.reference.pointer, + _id_create$2 as _$jni.JMethodIDPtr, byteBuffer.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_create$3 = _class.staticMethodId( + r'create', + r'([BII)Lorg/chromium/net/UploadDataProvider;', + ); + + static final _create$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); + + /// from: `static public org.chromium.net.UploadDataProvider create(byte[] bs, int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject create$3( + _$jni.JArray<_$jni.jbyte> bs, + int i, + int i1, + ) { + return _create$3(_class.reference.pointer, + _id_create$3 as _$jni.JMethodIDPtr, bs.reference.pointer, i, i1) + .object(const _$jni.JObjectType()); + } + + static final _id_create$4 = _class.staticMethodId( + r'create', + r'([B)Lorg/chromium/net/UploadDataProvider;', + ); + + static final _create$4 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public org.chromium.net.UploadDataProvider create(byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject create$4( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _create$4(_class.reference.pointer, + _id_create$4 as _$jni.JMethodIDPtr, bs.reference.pointer) + .object(const _$jni.JObjectType()); + } +} + +final class $UploadDataProviders$Type + extends _$jni.JObjType { + @_$jni.internal + const $UploadDataProviders$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/UploadDataProviders;'; + + @_$jni.internal + @_$core.override + UploadDataProviders fromReference(_$jni.JReference reference) => + UploadDataProviders.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($UploadDataProviders$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($UploadDataProviders$Type) && + other is $UploadDataProviders$Type; + } +} + +/// from: `org.chromium.net.UrlRequest$Builder` +class UrlRequest_Builder extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + UrlRequest_Builder.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'org/chromium/net/UrlRequest$Builder'); + + /// The type which includes information such as the signature of this class. + static const type = $UrlRequest_Builder$Type(); + + /// from: `static public final int REQUEST_PRIORITY_IDLE` + static const REQUEST_PRIORITY_IDLE = 0; + + /// from: `static public final int REQUEST_PRIORITY_LOWEST` + static const REQUEST_PRIORITY_LOWEST = 1; + + /// from: `static public final int REQUEST_PRIORITY_LOW` + static const REQUEST_PRIORITY_LOW = 2; + + /// from: `static public final int REQUEST_PRIORITY_MEDIUM` + static const REQUEST_PRIORITY_MEDIUM = 3; + + /// from: `static public final int REQUEST_PRIORITY_HIGHEST` + static const REQUEST_PRIORITY_HIGHEST = 4; + static final _id_setHttpMethod = _class.instanceMethodId( + r'setHttpMethod', + r'(Ljava/lang/String;)Lorg/chromium/net/UrlRequest$Builder;', + ); + + static final _setHttpMethod = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract org.chromium.net.UrlRequest$Builder setHttpMethod(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + UrlRequest_Builder setHttpMethod( + _$jni.JString string, + ) { + return _setHttpMethod(reference.pointer, + _id_setHttpMethod as _$jni.JMethodIDPtr, string.reference.pointer) + .object(const $UrlRequest_Builder$Type()); + } + + static final _id_addHeader = _class.instanceMethodId( + r'addHeader', + r'(Ljava/lang/String;Ljava/lang/String;)Lorg/chromium/net/UrlRequest$Builder;', + ); + + static final _addHeader = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract org.chromium.net.UrlRequest$Builder addHeader(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + UrlRequest_Builder addHeader( + _$jni.JString string, + _$jni.JString string1, + ) { + return _addHeader(reference.pointer, _id_addHeader as _$jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $UrlRequest_Builder$Type()); + } + + static final _id_disableCache = _class.instanceMethodId( + r'disableCache', + r'()Lorg/chromium/net/UrlRequest$Builder;', + ); + + static final _disableCache = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract org.chromium.net.UrlRequest$Builder disableCache()` + /// The returned object must be released after use, by calling the [release] method. + UrlRequest_Builder disableCache() { + return _disableCache( + reference.pointer, _id_disableCache as _$jni.JMethodIDPtr) + .object(const $UrlRequest_Builder$Type()); + } + + static final _id_setPriority = _class.instanceMethodId( + r'setPriority', + r'(I)Lorg/chromium/net/UrlRequest$Builder;', + ); + + static final _setPriority = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public abstract org.chromium.net.UrlRequest$Builder setPriority(int i)` + /// The returned object must be released after use, by calling the [release] method. + UrlRequest_Builder setPriority( + int i, + ) { + return _setPriority( + reference.pointer, _id_setPriority as _$jni.JMethodIDPtr, i) + .object(const $UrlRequest_Builder$Type()); + } + + static final _id_setUploadDataProvider = _class.instanceMethodId( + r'setUploadDataProvider', + r'(Lorg/chromium/net/UploadDataProvider;Ljava/util/concurrent/Executor;)Lorg/chromium/net/UrlRequest$Builder;', + ); + + static final _setUploadDataProvider = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract org.chromium.net.UrlRequest$Builder setUploadDataProvider(org.chromium.net.UploadDataProvider uploadDataProvider, java.util.concurrent.Executor executor)` + /// The returned object must be released after use, by calling the [release] method. + UrlRequest_Builder setUploadDataProvider( + _$jni.JObject uploadDataProvider, + _$jni.JObject executor, + ) { + return _setUploadDataProvider( + reference.pointer, + _id_setUploadDataProvider as _$jni.JMethodIDPtr, + uploadDataProvider.reference.pointer, + executor.reference.pointer) + .object(const $UrlRequest_Builder$Type()); + } + + static final _id_allowDirectExecutor = _class.instanceMethodId( + r'allowDirectExecutor', + r'()Lorg/chromium/net/UrlRequest$Builder;', + ); + + static final _allowDirectExecutor = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract org.chromium.net.UrlRequest$Builder allowDirectExecutor()` + /// The returned object must be released after use, by calling the [release] method. + UrlRequest_Builder allowDirectExecutor() { + return _allowDirectExecutor( + reference.pointer, _id_allowDirectExecutor as _$jni.JMethodIDPtr) + .object(const $UrlRequest_Builder$Type()); + } + + static final _id_build = _class.instanceMethodId( + r'build', + r'()Lorg/chromium/net/UrlRequest;', + ); + + static final _build = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract org.chromium.net.UrlRequest build()` + /// The returned object must be released after use, by calling the [release] method. + UrlRequest build() { + return _build(reference.pointer, _id_build as _$jni.JMethodIDPtr) + .object(const $UrlRequest$Type()); + } +} + +final class $UrlRequest_Builder$Type + extends _$jni.JObjType { + @_$jni.internal + const $UrlRequest_Builder$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/UrlRequest$Builder;'; + + @_$jni.internal + @_$core.override + UrlRequest_Builder fromReference(_$jni.JReference reference) => + UrlRequest_Builder.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($UrlRequest_Builder$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($UrlRequest_Builder$Type) && + other is $UrlRequest_Builder$Type; + } +} + +/// from: `org.chromium.net.UrlRequest$Callback` +class UrlRequest_Callback extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + UrlRequest_Callback.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'org/chromium/net/UrlRequest$Callback'); + + /// The type which includes information such as the signature of this class. + static const type = $UrlRequest_Callback$Type(); + static final _id_onRedirectReceived = _class.instanceMethodId( + r'onRedirectReceived', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/lang/String;)V', + ); + + static final _onRedirectReceived = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onRedirectReceived(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo, java.lang.String string)` + void onRedirectReceived( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + _$jni.JString string, + ) { + _onRedirectReceived( + reference.pointer, + _id_onRedirectReceived as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer, + string.reference.pointer) + .check(); + } + + static final _id_onResponseStarted = _class.instanceMethodId( + r'onResponseStarted', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V', + ); + + static final _onResponseStarted = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onResponseStarted(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo)` + void onResponseStarted( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + ) { + _onResponseStarted( + reference.pointer, + _id_onResponseStarted as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer) + .check(); + } + + static final _id_onReadCompleted = _class.instanceMethodId( + r'onReadCompleted', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/nio/ByteBuffer;)V', + ); + + static final _onReadCompleted = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onReadCompleted(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo, java.nio.ByteBuffer byteBuffer)` + void onReadCompleted( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + _$jni.JByteBuffer byteBuffer, + ) { + _onReadCompleted( + reference.pointer, + _id_onReadCompleted as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer, + byteBuffer.reference.pointer) + .check(); + } + + static final _id_onSucceeded = _class.instanceMethodId( + r'onSucceeded', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V', + ); + + static final _onSucceeded = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onSucceeded(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo)` + void onSucceeded( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + ) { + _onSucceeded(reference.pointer, _id_onSucceeded as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, urlResponseInfo.reference.pointer) + .check(); + } + + static final _id_onFailed = _class.instanceMethodId( + r'onFailed', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Lorg/chromium/net/CronetException;)V', + ); + + static final _onFailed = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onFailed(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo, org.chromium.net.CronetException cronetException)` + void onFailed( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + CronetException cronetException, + ) { + _onFailed( + reference.pointer, + _id_onFailed as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, + urlResponseInfo.reference.pointer, + cronetException.reference.pointer) + .check(); + } + + static final _id_onCanceled = _class.instanceMethodId( + r'onCanceled', + r'(Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V', + ); + + static final _onCanceled = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onCanceled(org.chromium.net.UrlRequest urlRequest, org.chromium.net.UrlResponseInfo urlResponseInfo)` + void onCanceled( + UrlRequest urlRequest, + UrlResponseInfo urlResponseInfo, + ) { + _onCanceled(reference.pointer, _id_onCanceled as _$jni.JMethodIDPtr, + urlRequest.reference.pointer, urlResponseInfo.reference.pointer) + .check(); + } +} + +final class $UrlRequest_Callback$Type + extends _$jni.JObjType { + @_$jni.internal + const $UrlRequest_Callback$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/UrlRequest$Callback;'; + + @_$jni.internal + @_$core.override + UrlRequest_Callback fromReference(_$jni.JReference reference) => + UrlRequest_Callback.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($UrlRequest_Callback$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($UrlRequest_Callback$Type) && + other is $UrlRequest_Callback$Type; + } +} + +/// from: `org.chromium.net.UrlRequest$Status` +class UrlRequest_Status extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + UrlRequest_Status.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'org/chromium/net/UrlRequest$Status'); + + /// The type which includes information such as the signature of this class. + static const type = $UrlRequest_Status$Type(); + + /// from: `static public final int INVALID` + static const INVALID = -1; + + /// from: `static public final int IDLE` + static const IDLE = 0; + + /// from: `static public final int WAITING_FOR_STALLED_SOCKET_POOL` + static const WAITING_FOR_STALLED_SOCKET_POOL = 1; + + /// from: `static public final int WAITING_FOR_AVAILABLE_SOCKET` + static const WAITING_FOR_AVAILABLE_SOCKET = 2; + + /// from: `static public final int WAITING_FOR_DELEGATE` + static const WAITING_FOR_DELEGATE = 3; + + /// from: `static public final int WAITING_FOR_CACHE` + static const WAITING_FOR_CACHE = 4; + + /// from: `static public final int DOWNLOADING_PAC_FILE` + static const DOWNLOADING_PAC_FILE = 5; + + /// from: `static public final int RESOLVING_PROXY_FOR_URL` + static const RESOLVING_PROXY_FOR_URL = 6; + + /// from: `static public final int RESOLVING_HOST_IN_PAC_FILE` + static const RESOLVING_HOST_IN_PAC_FILE = 7; + + /// from: `static public final int ESTABLISHING_PROXY_TUNNEL` + static const ESTABLISHING_PROXY_TUNNEL = 8; + + /// from: `static public final int RESOLVING_HOST` + static const RESOLVING_HOST = 9; + + /// from: `static public final int CONNECTING` + static const CONNECTING = 10; + + /// from: `static public final int SSL_HANDSHAKE` + static const SSL_HANDSHAKE = 11; + + /// from: `static public final int SENDING_REQUEST` + static const SENDING_REQUEST = 12; + + /// from: `static public final int WAITING_FOR_RESPONSE` + static const WAITING_FOR_RESPONSE = 13; + + /// from: `static public final int READING_RESPONSE` + static const READING_RESPONSE = 14; +} + +final class $UrlRequest_Status$Type extends _$jni.JObjType { + @_$jni.internal + const $UrlRequest_Status$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/UrlRequest$Status;'; + + @_$jni.internal + @_$core.override + UrlRequest_Status fromReference(_$jni.JReference reference) => + UrlRequest_Status.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($UrlRequest_Status$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($UrlRequest_Status$Type) && + other is $UrlRequest_Status$Type; + } +} + +/// from: `org.chromium.net.UrlRequest$StatusListener` +class UrlRequest_StatusListener extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + UrlRequest_StatusListener.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'org/chromium/net/UrlRequest$StatusListener'); + + /// The type which includes information such as the signature of this class. + static const type = $UrlRequest_StatusListener$Type(); + static final _id_onStatus = _class.instanceMethodId( + r'onStatus', + r'(I)V', + ); + + static final _onStatus = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public abstract void onStatus(int i)` + void onStatus( + int i, + ) { + _onStatus(reference.pointer, _id_onStatus as _$jni.JMethodIDPtr, i).check(); + } +} + +final class $UrlRequest_StatusListener$Type + extends _$jni.JObjType { + @_$jni.internal + const $UrlRequest_StatusListener$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/UrlRequest$StatusListener;'; + + @_$jni.internal + @_$core.override + UrlRequest_StatusListener fromReference(_$jni.JReference reference) => + UrlRequest_StatusListener.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($UrlRequest_StatusListener$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($UrlRequest_StatusListener$Type) && + other is $UrlRequest_StatusListener$Type; + } +} + +/// from: `org.chromium.net.UrlRequest` +class UrlRequest extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + UrlRequest.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'org/chromium/net/UrlRequest'); + + /// The type which includes information such as the signature of this class. + static const type = $UrlRequest$Type(); + static final _id_start = _class.instanceMethodId( + r'start', + r'()V', + ); + + static final _start = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract void start()` + void start() { + _start(reference.pointer, _id_start as _$jni.JMethodIDPtr).check(); + } + + static final _id_followRedirect = _class.instanceMethodId( + r'followRedirect', + r'()V', + ); + + static final _followRedirect = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract void followRedirect()` + void followRedirect() { + _followRedirect(reference.pointer, _id_followRedirect as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_read = _class.instanceMethodId( + r'read', + r'(Ljava/nio/ByteBuffer;)V', + ); + + static final _read = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void read(java.nio.ByteBuffer byteBuffer)` + void read( + _$jni.JByteBuffer byteBuffer, + ) { + _read(reference.pointer, _id_read as _$jni.JMethodIDPtr, + byteBuffer.reference.pointer) + .check(); + } + + static final _id_cancel = _class.instanceMethodId( + r'cancel', + r'()V', + ); + + static final _cancel = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract void cancel()` + void cancel() { + _cancel(reference.pointer, _id_cancel as _$jni.JMethodIDPtr).check(); + } + + static final _id_isDone = _class.instanceMethodId( + r'isDone', + r'()Z', + ); + + static final _isDone = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract boolean isDone()` + bool isDone() { + return _isDone(reference.pointer, _id_isDone as _$jni.JMethodIDPtr).boolean; + } + + static final _id_getStatus = _class.instanceMethodId( + r'getStatus', + r'(Lorg/chromium/net/UrlRequest$StatusListener;)V', + ); + + static final _getStatus = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void getStatus(org.chromium.net.UrlRequest$StatusListener statusListener)` + void getStatus( + UrlRequest_StatusListener statusListener, + ) { + _getStatus(reference.pointer, _id_getStatus as _$jni.JMethodIDPtr, + statusListener.reference.pointer) + .check(); + } +} + +final class $UrlRequest$Type extends _$jni.JObjType { + @_$jni.internal + const $UrlRequest$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/UrlRequest;'; + + @_$jni.internal + @_$core.override + UrlRequest fromReference(_$jni.JReference reference) => + UrlRequest.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($UrlRequest$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($UrlRequest$Type) && other is $UrlRequest$Type; + } +} + +/// from: `org.chromium.net.UrlResponseInfo$HeaderBlock` +class UrlResponseInfo_HeaderBlock extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + UrlResponseInfo_HeaderBlock.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'org/chromium/net/UrlResponseInfo$HeaderBlock'); + + /// The type which includes information such as the signature of this class. + static const type = $UrlResponseInfo_HeaderBlock$Type(); + static final _id_getAsList = _class.instanceMethodId( + r'getAsList', + r'()Ljava/util/List;', + ); + + static final _getAsList = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.util.List getAsList()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> getAsList() { + return _getAsList(reference.pointer, _id_getAsList as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_getAsMap = _class.instanceMethodId( + r'getAsMap', + r'()Ljava/util/Map;', + ); + + static final _getAsMap = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.util.Map getAsMap()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JMap<_$jni.JString, _$jni.JList<_$jni.JString>> getAsMap() { + return _getAsMap(reference.pointer, _id_getAsMap as _$jni.JMethodIDPtr) + .object(const _$jni.JMapType( + _$jni.JStringType(), _$jni.JListType(_$jni.JStringType()))); + } +} + +final class $UrlResponseInfo_HeaderBlock$Type + extends _$jni.JObjType { + @_$jni.internal + const $UrlResponseInfo_HeaderBlock$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/UrlResponseInfo$HeaderBlock;'; + + @_$jni.internal + @_$core.override + UrlResponseInfo_HeaderBlock fromReference(_$jni.JReference reference) => + UrlResponseInfo_HeaderBlock.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($UrlResponseInfo_HeaderBlock$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($UrlResponseInfo_HeaderBlock$Type) && + other is $UrlResponseInfo_HeaderBlock$Type; + } +} + +/// from: `org.chromium.net.UrlResponseInfo` +class UrlResponseInfo extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + UrlResponseInfo.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'org/chromium/net/UrlResponseInfo'); + + /// The type which includes information such as the signature of this class. + static const type = $UrlResponseInfo$Type(); + static final _id_getUrl = _class.instanceMethodId( + r'getUrl', + r'()Ljava/lang/String;', + ); + + static final _getUrl = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.lang.String getUrl()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getUrl() { + return _getUrl(reference.pointer, _id_getUrl as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getUrlChain = _class.instanceMethodId( + r'getUrlChain', + r'()Ljava/util/List;', + ); + + static final _getUrlChain = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.util.List getUrlChain()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JString> getUrlChain() { + return _getUrlChain( + reference.pointer, _id_getUrlChain as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JStringType())); + } + + static final _id_getHttpStatusCode = _class.instanceMethodId( + r'getHttpStatusCode', + r'()I', + ); + + static final _getHttpStatusCode = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract int getHttpStatusCode()` + int getHttpStatusCode() { + return _getHttpStatusCode( + reference.pointer, _id_getHttpStatusCode as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_getHttpStatusText = _class.instanceMethodId( + r'getHttpStatusText', + r'()Ljava/lang/String;', + ); + + static final _getHttpStatusText = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.lang.String getHttpStatusText()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getHttpStatusText() { + return _getHttpStatusText( + reference.pointer, _id_getHttpStatusText as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getAllHeadersAsList = _class.instanceMethodId( + r'getAllHeadersAsList', + r'()Ljava/util/List;', + ); + + static final _getAllHeadersAsList = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.util.List getAllHeadersAsList()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> getAllHeadersAsList() { + return _getAllHeadersAsList( + reference.pointer, _id_getAllHeadersAsList as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_getAllHeaders = _class.instanceMethodId( + r'getAllHeaders', + r'()Ljava/util/Map;', + ); + + static final _getAllHeaders = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.util.Map getAllHeaders()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JMap<_$jni.JString, _$jni.JList<_$jni.JString>> getAllHeaders() { + return _getAllHeaders( + reference.pointer, _id_getAllHeaders as _$jni.JMethodIDPtr) + .object(const _$jni.JMapType( + _$jni.JStringType(), _$jni.JListType(_$jni.JStringType()))); + } + + static final _id_wasCached = _class.instanceMethodId( + r'wasCached', + r'()Z', + ); + + static final _wasCached = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract boolean wasCached()` + bool wasCached() { + return _wasCached(reference.pointer, _id_wasCached as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_getNegotiatedProtocol = _class.instanceMethodId( + r'getNegotiatedProtocol', + r'()Ljava/lang/String;', + ); + + static final _getNegotiatedProtocol = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.lang.String getNegotiatedProtocol()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getNegotiatedProtocol() { + return _getNegotiatedProtocol( + reference.pointer, _id_getNegotiatedProtocol as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getProxyServer = _class.instanceMethodId( + r'getProxyServer', + r'()Ljava/lang/String;', + ); + + static final _getProxyServer = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.lang.String getProxyServer()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getProxyServer() { + return _getProxyServer( + reference.pointer, _id_getProxyServer as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_getReceivedByteCount = _class.instanceMethodId( + r'getReceivedByteCount', + r'()J', + ); + + static final _getReceivedByteCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract long getReceivedByteCount()` + int getReceivedByteCount() { + return _getReceivedByteCount( + reference.pointer, _id_getReceivedByteCount as _$jni.JMethodIDPtr) + .long; + } +} + +final class $UrlResponseInfo$Type extends _$jni.JObjType { + @_$jni.internal + const $UrlResponseInfo$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lorg/chromium/net/UrlResponseInfo;'; + + @_$jni.internal + @_$core.override + UrlResponseInfo fromReference(_$jni.JReference reference) => + UrlResponseInfo.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($UrlResponseInfo$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($UrlResponseInfo$Type) && + other is $UrlResponseInfo$Type; + } +} diff --git a/pkgs/cronet_http/pubspec.yaml b/pkgs/cronet_http/pubspec.yaml new file mode 100644 index 0000000000..10f5ac636c --- /dev/null +++ b/pkgs/cronet_http/pubspec.yaml @@ -0,0 +1,28 @@ +name: cronet_http +version: 1.3.3-wip +description: >- + An Android Flutter plugin that provides access to the Cronet HTTP client. +repository: https://github.com/dart-lang/http/tree/master/pkgs/cronet_http + +environment: + sdk: ^3.4.0 + flutter: '>=3.22.0' + +dependencies: + flutter: + sdk: flutter + http: ^1.2.0 + http_profile: ^0.1.0 + jni: ^0.12.0 + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + jnigen: ^0.12.0 + xml: ^6.1.0 + yaml_edit: ^2.0.3 + +flutter: + plugin: + platforms: + android: + ffiPlugin: true diff --git a/pkgs/cupertino_http/.gitattributes b/pkgs/cupertino_http/.gitattributes new file mode 100644 index 0000000000..472b1abfbd --- /dev/null +++ b/pkgs/cupertino_http/.gitattributes @@ -0,0 +1,3 @@ +# ffigen generated code +lib/src/native_cupertino_bindings.dart linguist-generated +darwin/cupertino_http/Sources/cupertino_http/native_cupertino_bindings.m linguist-generated diff --git a/pkgs/cupertino_http/.gitignore b/pkgs/cupertino_http/.gitignore new file mode 100644 index 0000000000..567609b123 --- /dev/null +++ b/pkgs/cupertino_http/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/pkgs/cupertino_http/.metadata b/pkgs/cupertino_http/.metadata new file mode 100644 index 0000000000..8e66409c58 --- /dev/null +++ b/pkgs/cupertino_http/.metadata @@ -0,0 +1,33 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + channel: stable + +project_type: plugin_ffi + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + - platform: ios + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + - platform: macos + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/pkgs/cupertino_http/CHANGELOG.md b/pkgs/cupertino_http/CHANGELOG.md new file mode 100644 index 0000000000..0878800a33 --- /dev/null +++ b/pkgs/cupertino_http/CHANGELOG.md @@ -0,0 +1,164 @@ +## 2.0.2-wip + +* Upgrade to `package:objective_c` 4.0. + +## 2.0.1 + +* Fix a [bug](https://github.com/dart-lang/http/issues/1398) where + `package:cupertino_http` only worked with iOS 17+. + +## 2.0.0 + +* The behavior of `CupertinoClient` and `CupertinoWebSocket` has not changed. +* **Breaking:** `MutableURLRequest.httpBodyStream` now takes a `NSInputStream` + instead of a `Stream>`. +* **Breaking:** The following enums/classes previous defined by + `package:cupertino_http` are now imported from `package:objective_c`: + * `NSData` + * `NSError` + * `NSHTTPCookieAcceptPolicy` + * `NSMutableData` + * `NSURLRequestCachePolicy` + * `NSURLRequestNetworkServiceType` + * `NSURLSessionMultipathServiceType` + * `NSURLSessionResponseDisposition` + * `NSURLSessionTaskState` + * `NSURLSessionWebSocketCloseCode` + * `NSURLSessionWebSocketMessageType` +* **Breaking:** `URLSession.dataTaskWithCompletionHandler` is no longer + supported for background sessions. + +## 1.5.1 + +* Allow `1000` as a `code` argument in `CupertinoWebSocket.close`. +* Fix a bug where the `Content-Length` header would not be set under certain + circumstances. + +## 1.5.0 + +* Add integration to the + [DevTools Network View](https://docs.flutter.dev/tools/devtools/network). +* Upgrade to `package:ffigen` 11.0.0. +* Bring `WebSocket` behavior in line with the documentation by throwing + `WebSocketConnectionClosed` rather than `StateError` when attempting to send + data to or close an already closed `CupertinoWebSocket`. +* Update minimum supported iOS/macOS versions to be in sync with the minimum + (best effort) supported for Flutter: iOS 12, macOS 10.14. +* Eagerly free resources on `CupertinoClient.close()`. + +## 1.4.0 + +* **Experimental** support for the `package:web_socket` `WebSocket` interface. + +## 1.3.0 + +* Use `package:http_image_provider` in the example application. +* Support `BaseResponseWithUrl`. + +## 1.2.0 + +* Add support for setting additional http headers in + `URLSessionConfiguration`. + +## 1.1.0 + +* Add websocket support to `cupertino_api`. +* Add streaming upload support, i.e., if `CupertinoClient.send()` is called + with a `StreamedRequest` then the data will be sent to the server + incrementally. +* Deprecate `Data.fromUint8List` in favor of `Data.fromList`, which accepts + any `List`. +* Disable additional analyses for generated Objective-C bindings to prevent + errors from `dart analyze`. +* Throw `ClientException` when the `'Content-Length'` header is invalid. +* Add support for configurable caching through + `URLSessionConfiguration.cache`. + +## 1.0.1 + +* Remove experimental status from "Readme" + +## 1.0.0 + +* Require Dart 3.0 +* Require Flutter 3.10.0 + +## 0.1.2 + +* Require Dart 2.19 +* Fix a [reference count race with forwarded delegates](https://github.com/dart-lang/http/issues/887). + +## 0.1.1 + +* Add a `URLSession.sessionDescription` field. + +## 0.1.0 + +* Restructure `package:cupertino_http` to offer a single `import`. + +## 0.0.11 + +* Fix a bug where the images in the example would be loaded using `dart:io` + `HttpClient`. +* `CupertinoClient` throws an exception if `send` is called after `close`. + +## 0.0.10 + +* Fix [Use of multiple CupertinoClients can result in cancelled requests](https://github.com/dart-lang/http/issues/826) + +## 0.0.9 + +* Add a more complete implementation for `URLSessionTask`: + * `priority` property - hint for host prioritization. + * `currentRequest` property - the current request for the task (will be + different than `originalRequest` in the face of redirects). + * `originalRequest` property - the original request for the task. + * `error` property - an `Error` object if the request failed. + * `taskDescription` property - a developer-set description of the task. + * `countOfBytesExpectedToSend` property - the size of the body bytes that + will be sent. + * `countOfBytesSent` property - the number of body bytes sent in the request. + * `prefersIncrementalDelivery` property - whether to deliver the response + body in one chunk (if possible) or many. +* Upgrade to ffigen ^7.2.0 and remove unnecessary casts. + +## 0.0.8 + +* Make timeout and caching policy configurable on a per-request basis. + +## 0.0.7 + +* Upgrade `ffi` dependency. + +## 0.0.6 + +* Make the number of simultaneous connections allowed to the same host + configurable. +* Fixes + [cupertino_http: Failure calling Dart_PostCObject_DL](https://github.com/dart-lang/http/issues/785). + +## 0.0.5 + +* Add the ability to set network service type. +* Add the ability to control multipath TCP connections. +* Set `StreamedResponse.reasonPhrase` and `StreamedResponse.request`. + Fixes + [cupertino_http: BaseResponse.request is null](https://github.com/dart-lang/http/issues/782). + +## 0.0.4 + +* Add the ability to control caching policy. + +## 0.0.3 + +* Follow the project style in the example app. +* Use `runWithClient` in the example app. +* Add another README example + +## 0.0.2 + +* A single comment adjustment. + +## 0.0.1 + +* Initial development release. diff --git a/pkgs/cupertino_http/DEVELOPMENT.md b/pkgs/cupertino_http/DEVELOPMENT.md new file mode 100644 index 0000000000..9c473ca60b --- /dev/null +++ b/pkgs/cupertino_http/DEVELOPMENT.md @@ -0,0 +1,23 @@ +# Development + +## Architecture + +![Architecture Diagram](./img/architecture.svg?raw=true) + +`package:cupertino_http` is organized into three components: +1. [bindings](lib/src/native_cupertino_bindings.dart) generated by + [ffigen](https://pub.dev/packages/ffigen) to relevant + [Foundation framework](https://developer.apple.com/documentation/foundation) + functionality. Configured using [`ffigen.yaml`](ffigen.yaml). +2. A [native helper library](src/) that fills gaps in the generated bindings. +3. Dart source that provides a high-level interface to the + [Foundation framework](https://developer.apple.com/documentation/foundation) + [URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system). + +## Running the tests + +```shell +cd example +flutter test integration_test +``` + diff --git a/pkgs/cupertino_http/LICENSE b/pkgs/cupertino_http/LICENSE new file mode 100644 index 0000000000..e1785dd36f --- /dev/null +++ b/pkgs/cupertino_http/LICENSE @@ -0,0 +1,27 @@ +Copyright 2022, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. diff --git a/pkgs/cupertino_http/README.md b/pkgs/cupertino_http/README.md new file mode 100644 index 0000000000..0e12a6ef08 --- /dev/null +++ b/pkgs/cupertino_http/README.md @@ -0,0 +1,96 @@ +[![pub package](https://img.shields.io/pub/v/cupertino_http.svg)](https://pub.dev/packages/cupertino_http) +[![package publisher](https://img.shields.io/pub/publisher/cupertino_http.svg)](https://pub.dev/packages/cupertino_http/publisher) + +A macOS/iOS Flutter plugin that provides access to the +[Foundation URL Loading System][]. + +## Motivation + +Using the [Foundation URL Loading System][], rather than the socket-based +[dart:io HttpClient][] implementation, has several advantages: + +1. It automatically supports iOS/macOS platform features such VPNs and HTTP + proxies. +2. It supports many more configuration options such as only allowing access + through WiFi and blocking cookies. +3. It supports more HTTP features such as HTTP/3 and custom redirect handling. + +## Using + +The easiest way to use this library is via the high-level interface +defined by [package:http Client][]. + +This approach allows the same HTTP code to be used on all platforms, while +still allowing platform-specific setup. + +```dart +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:http/http.dart'; +import 'package:http/io_client.dart'; + +void main() async { + final Client httpClient; + if (Platform.isIOS || Platform.isMacOS) { + final config = URLSessionConfiguration.ephemeralSessionConfiguration() + ..cache = URLCache.withCapacity(memoryCapacity: 2 * 1024 * 1024) + ..httpAdditionalHeaders = {'User-Agent': 'Book Agent'}; + httpClient = CupertinoClient.fromSessionConfiguration(config); + } else { + httpClient = IOClient(HttpClient()..userAgent = 'Book Agent'); + } + + final response = await client.get(Uri.https( + 'www.googleapis.com', + '/books/v1/volumes', + {'q': 'HTTP', 'maxResults': '40', 'printType': 'books'})); +} +``` + +[CupertinoWebSocket][] provides a [package:web_socket][] [WebSocket][] +implementation. + +```dart +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:web_socket/web_socket.dart'; + +void main() async { + final socket = await CupertinoWebSocket.connect( + Uri.parse('wss://ws.postman-echo.com/raw')); + + socket.events.listen((e) async { + switch (e) { + case TextDataReceived(text: final text): + print('Received Text: $text'); + await socket.close(); + case BinaryDataReceived(data: final data): + print('Received Binary: $data'); + case CloseReceived(code: final code, reason: final reason): + print('Connection to server closed: $code [$reason]'); + } + }); +} +``` + +You can also use the [Foundation URL Loading System] API directly. + +```dart +final url = Uri.https( + 'www.googleapis.com', + '/books/v1/volumes', + {'q': 'HTTP', 'maxResults': '40', 'printType': 'books'}); +final session = URLSession.sharedSession(); +final task = session.dataTaskWithCompletionHandler(URLRequest.fromUrl(url), + (data, response, error) { + if (error == null && response!.statusCode == 200) { + print(data!.bytes); + } +}); +task.resume(); +``` + +[CupertinoWebSocket]: https://pub.dev/documentation/cupertino_http/latest/cupertino_http/CupertinoWebSocket-class.html +[dart:io HttpClient]: https://api.dart.dev/stable/dart-io/HttpClient-class.html +[Foundation URL Loading System]: https://developer.apple.com/documentation/foundation/url_loading_system +[package:http Client]: https://pub.dev/documentation/http/latest/http/Client-class.html +[package:web_socket]: https://pub.dev/packages/web_socket +[WebSocket]: https://pub.dev/documentation/web_socket/latest/web_socket/WebSocket-class.html diff --git a/pkgs/cupertino_http/cupertino_http.iml b/pkgs/cupertino_http/cupertino_http.iml new file mode 100644 index 0000000000..bbb426a757 --- /dev/null +++ b/pkgs/cupertino_http/cupertino_http.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pkgs/cupertino_http/darwin/cupertino_http.podspec b/pkgs/cupertino_http/darwin/cupertino_http.podspec new file mode 100644 index 0000000000..0b44154cb6 --- /dev/null +++ b/pkgs/cupertino_http/darwin/cupertino_http.podspec @@ -0,0 +1,25 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# Run `pod lib lint cupertino_http.podspec` to validate before publishing. +# +Pod::Spec.new do |s| + s.name = 'cupertino_http' + s.version = '0.0.1' + s.summary = 'Flutter Foundation URL Loading System' + s.description = <<-DESC + A Flutter plugin for accessing the Foundation URL Loading System. + DESC + s.homepage = 'https://github.com/dart-lang/http/tree/master/pkgs/cupertino_http' + s.license = { :type => 'BSD', :file => '../LICENSE' } + s.author = { 'TODO' => 'use-valid-author' } + s.source = { :http => 'https://github.com/dart-lang/http/tree/master/pkgs/cupertino_http' } + + s.source_files = 'cupertino_http/Sources/cupertino_http/**/*' + s.ios.dependency 'Flutter' + s.osx.dependency 'FlutterMacOS' + s.ios.deployment_target = '13.0' # Required for NSURLSessionWebSocketDelegate. + s.osx.deployment_target = '10.15' # Required for NSURLSessionWebSocketDelegate. + + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + s.swift_version = '5.0' +end diff --git a/pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/native_cupertino_bindings.m b/pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/native_cupertino_bindings.m new file mode 100644 index 0000000000..3bc6c93307 --- /dev/null +++ b/pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/native_cupertino_bindings.m @@ -0,0 +1,330 @@ +#include +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import "utils.h" + +#if !__has_feature(objc_arc) +#error "This file must be compiled with ARC enabled" +#endif + +id objc_retain(id); +id objc_retainBlock(id); + +typedef void (^_ListenerTrampoline)(); +_ListenerTrampoline _NativeCupertinoHttp_wrapListenerBlock_1pl9qdv(_ListenerTrampoline block) NS_RETURNS_RETAINED { + return ^void() { + objc_retainBlock(block); + block(); + }; +} + +typedef void (^_ListenerTrampoline1)(id arg0); +_ListenerTrampoline1 _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(_ListenerTrampoline1 block) NS_RETURNS_RETAINED { + return ^void(id arg0) { + objc_retainBlock(block); + block(objc_retain(arg0)); + }; +} + +typedef void (^_ListenerTrampoline2)(void * arg0, id arg1); +_ListenerTrampoline2 _NativeCupertinoHttp_wrapListenerBlock_wjovn7(_ListenerTrampoline2 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1)); + }; +} + +typedef void (^_ListenerTrampoline3)(id arg0, id arg1, BOOL * arg2); +_ListenerTrampoline3 _NativeCupertinoHttp_wrapListenerBlock_1krhfwz(_ListenerTrampoline3 block) NS_RETURNS_RETAINED { + return ^void(id arg0, id arg1, BOOL * arg2) { + objc_retainBlock(block); + block(objc_retain(arg0), objc_retain(arg1), arg2); + }; +} + +typedef void (^_ListenerTrampoline4)(struct __CFRunLoopObserver * arg0, CFRunLoopActivity arg1); +_ListenerTrampoline4 _NativeCupertinoHttp_wrapListenerBlock_tg5tbv(_ListenerTrampoline4 block) NS_RETURNS_RETAINED { + return ^void(struct __CFRunLoopObserver * arg0, CFRunLoopActivity arg1) { + objc_retainBlock(block); + block(arg0, arg1); + }; +} + +typedef void (^_ListenerTrampoline5)(struct __CFRunLoopTimer * arg0); +_ListenerTrampoline5 _NativeCupertinoHttp_wrapListenerBlock_1dqvvol(_ListenerTrampoline5 block) NS_RETURNS_RETAINED { + return ^void(struct __CFRunLoopTimer * arg0) { + objc_retainBlock(block); + block(arg0); + }; +} + +typedef void (^_ListenerTrampoline6)(size_t arg0); +_ListenerTrampoline6 _NativeCupertinoHttp_wrapListenerBlock_6enxqz(_ListenerTrampoline6 block) NS_RETURNS_RETAINED { + return ^void(size_t arg0) { + objc_retainBlock(block); + block(arg0); + }; +} + +typedef void (^_ListenerTrampoline7)(id arg0, int arg1); +_ListenerTrampoline7 _NativeCupertinoHttp_wrapListenerBlock_qxvyq2(_ListenerTrampoline7 block) NS_RETURNS_RETAINED { + return ^void(id arg0, int arg1) { + objc_retainBlock(block); + block(objc_retain(arg0), arg1); + }; +} + +typedef void (^_ListenerTrampoline8)(int arg0); +_ListenerTrampoline8 _NativeCupertinoHttp_wrapListenerBlock_9o8504(_ListenerTrampoline8 block) NS_RETURNS_RETAINED { + return ^void(int arg0) { + objc_retainBlock(block); + block(arg0); + }; +} + +typedef void (^_ListenerTrampoline9)(BOOL arg0, id arg1, int arg2); +_ListenerTrampoline9 _NativeCupertinoHttp_wrapListenerBlock_12a4qua(_ListenerTrampoline9 block) NS_RETURNS_RETAINED { + return ^void(BOOL arg0, id arg1, int arg2) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), arg2); + }; +} + +typedef void (^_ListenerTrampoline10)(struct __SecTrust * arg0, SecTrustResultType arg1); +_ListenerTrampoline10 _NativeCupertinoHttp_wrapListenerBlock_gwxhxt(_ListenerTrampoline10 block) NS_RETURNS_RETAINED { + return ^void(struct __SecTrust * arg0, SecTrustResultType arg1) { + objc_retainBlock(block); + block(arg0, arg1); + }; +} + +typedef void (^_ListenerTrampoline11)(struct __SecTrust * arg0, BOOL arg1, struct __CFError * arg2); +_ListenerTrampoline11 _NativeCupertinoHttp_wrapListenerBlock_k73ff5(_ListenerTrampoline11 block) NS_RETURNS_RETAINED { + return ^void(struct __SecTrust * arg0, BOOL arg1, struct __CFError * arg2) { + objc_retainBlock(block); + block(arg0, arg1, arg2); + }; +} + +typedef void (^_ListenerTrampoline12)(uint16_t arg0); +_ListenerTrampoline12 _NativeCupertinoHttp_wrapListenerBlock_15f11yh(_ListenerTrampoline12 block) NS_RETURNS_RETAINED { + return ^void(uint16_t arg0) { + objc_retainBlock(block); + block(arg0); + }; +} + +typedef void (^_ListenerTrampoline13)(id arg0, id arg1); +_ListenerTrampoline13 _NativeCupertinoHttp_wrapListenerBlock_wjvic9(_ListenerTrampoline13 block) NS_RETURNS_RETAINED { + return ^void(id arg0, id arg1) { + objc_retainBlock(block); + block(objc_retain(arg0), objc_retain(arg1)); + }; +} + +typedef void (^_ListenerTrampoline14)(id arg0, id arg1, id arg2); +_ListenerTrampoline14 _NativeCupertinoHttp_wrapListenerBlock_91c9gi(_ListenerTrampoline14 block) NS_RETURNS_RETAINED { + return ^void(id arg0, id arg1, id arg2) { + objc_retainBlock(block); + block(objc_retain(arg0), objc_retain(arg1), objc_retainBlock(arg2)); + }; +} + +typedef void (^_ListenerTrampoline15)(id arg0, id arg1); +_ListenerTrampoline15 _NativeCupertinoHttp_wrapListenerBlock_14pxqbs(_ListenerTrampoline15 block) NS_RETURNS_RETAINED { + return ^void(id arg0, id arg1) { + objc_retainBlock(block); + block(objc_retain(arg0), objc_retainBlock(arg1)); + }; +} + +typedef void (^_ListenerTrampoline16)(BOOL arg0); +_ListenerTrampoline16 _NativeCupertinoHttp_wrapListenerBlock_1s56lr9(_ListenerTrampoline16 block) NS_RETURNS_RETAINED { + return ^void(BOOL arg0) { + objc_retainBlock(block); + block(arg0); + }; +} + +typedef void (^_ListenerTrampoline17)(id arg0, id arg1, id arg2); +_ListenerTrampoline17 _NativeCupertinoHttp_wrapListenerBlock_1hcfngn(_ListenerTrampoline17 block) NS_RETURNS_RETAINED { + return ^void(id arg0, id arg1, id arg2) { + objc_retainBlock(block); + block(objc_retain(arg0), objc_retain(arg1), objc_retain(arg2)); + }; +} + +typedef void (^_ListenerTrampoline18)(NSURLSessionResponseDisposition arg0); +_ListenerTrampoline18 _NativeCupertinoHttp_wrapListenerBlock_16sve1d(_ListenerTrampoline18 block) NS_RETURNS_RETAINED { + return ^void(NSURLSessionResponseDisposition arg0) { + objc_retainBlock(block); + block(arg0); + }; +} + +typedef void (^_ListenerTrampoline19)(void * arg0, id arg1, id arg2, id arg3, id arg4); +_ListenerTrampoline19 _NativeCupertinoHttp_wrapListenerBlock_1f43wec(_ListenerTrampoline19 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1, id arg2, id arg3, id arg4) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), objc_retain(arg2), objc_retain(arg3), objc_retainBlock(arg4)); + }; +} + +typedef void (^_ListenerTrampoline20)(void * arg0, id arg1, id arg2, id arg3); +_ListenerTrampoline20 _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f(_ListenerTrampoline20 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1, id arg2, id arg3) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), objc_retain(arg2), objc_retain(arg3)); + }; +} + +typedef void (^_ListenerTrampoline21)(void * arg0, id arg1, id arg2); +_ListenerTrampoline21 _NativeCupertinoHttp_wrapListenerBlock_ao4xm9(_ListenerTrampoline21 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1, id arg2) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), objc_retain(arg2)); + }; +} + +typedef void (^_ListenerTrampoline22)(NSURLSessionDelayedRequestDisposition arg0, id arg1); +_ListenerTrampoline22 _NativeCupertinoHttp_wrapListenerBlock_mn1xu3(_ListenerTrampoline22 block) NS_RETURNS_RETAINED { + return ^void(NSURLSessionDelayedRequestDisposition arg0, id arg1) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1)); + }; +} + +typedef void (^_ListenerTrampoline23)(void * arg0, id arg1, id arg2, id arg3, id arg4, id arg5); +_ListenerTrampoline23 _NativeCupertinoHttp_wrapListenerBlock_13vswqm(_ListenerTrampoline23 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1, id arg2, id arg3, id arg4, id arg5) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), objc_retain(arg2), objc_retain(arg3), objc_retain(arg4), objc_retainBlock(arg5)); + }; +} + +typedef void (^_ListenerTrampoline24)(NSURLSessionAuthChallengeDisposition arg0, id arg1); +_ListenerTrampoline24 _NativeCupertinoHttp_wrapListenerBlock_37btrl(_ListenerTrampoline24 block) NS_RETURNS_RETAINED { + return ^void(NSURLSessionAuthChallengeDisposition arg0, id arg1) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1)); + }; +} + +typedef void (^_ListenerTrampoline25)(void * arg0, id arg1, id arg2, id arg3); +_ListenerTrampoline25 _NativeCupertinoHttp_wrapListenerBlock_12nszru(_ListenerTrampoline25 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1, id arg2, id arg3) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), objc_retain(arg2), objc_retainBlock(arg3)); + }; +} + +typedef void (^_ListenerTrampoline26)(void * arg0, id arg1, id arg2, int64_t arg3, id arg4); +_ListenerTrampoline26 _NativeCupertinoHttp_wrapListenerBlock_qm01og(_ListenerTrampoline26 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1, id arg2, int64_t arg3, id arg4) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), objc_retain(arg2), arg3, objc_retainBlock(arg4)); + }; +} + +typedef void (^_ListenerTrampoline27)(void * arg0, id arg1, id arg2, int64_t arg3, int64_t arg4, int64_t arg5); +_ListenerTrampoline27 _NativeCupertinoHttp_wrapListenerBlock_1uuez7b(_ListenerTrampoline27 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1, id arg2, int64_t arg3, int64_t arg4, int64_t arg5) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), objc_retain(arg2), arg3, arg4, arg5); + }; +} + +Protocol* _NativeCupertinoHttp_NSURLSessionDataDelegate() { return @protocol(NSURLSessionDataDelegate); } + +typedef void (^_ListenerTrampoline28)(void * arg0, id arg1, id arg2, int64_t arg3, int64_t arg4); +_ListenerTrampoline28 _NativeCupertinoHttp_wrapListenerBlock_9qxjkl(_ListenerTrampoline28 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1, id arg2, int64_t arg3, int64_t arg4) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), objc_retain(arg2), arg3, arg4); + }; +} + +Protocol* _NativeCupertinoHttp_NSURLSessionDownloadDelegate() { return @protocol(NSURLSessionDownloadDelegate); } + +typedef void (^_ListenerTrampoline29)(void * arg0, id arg1, id arg2, NSURLSessionWebSocketCloseCode arg3, id arg4); +_ListenerTrampoline29 _NativeCupertinoHttp_wrapListenerBlock_3lo3bb(_ListenerTrampoline29 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, id arg1, id arg2, NSURLSessionWebSocketCloseCode arg3, id arg4) { + objc_retainBlock(block); + block(arg0, objc_retain(arg1), objc_retain(arg2), arg3, objc_retain(arg4)); + }; +} + +Protocol* _NativeCupertinoHttp_NSURLSessionWebSocketDelegate() { return @protocol(NSURLSessionWebSocketDelegate); } + +typedef void (^_ListenerTrampoline30)(id arg0, unsigned long arg1, BOOL * arg2); +_ListenerTrampoline30 _NativeCupertinoHttp_wrapListenerBlock_16ko9u(_ListenerTrampoline30 block) NS_RETURNS_RETAINED { + return ^void(id arg0, unsigned long arg1, BOOL * arg2) { + objc_retainBlock(block); + block(objc_retain(arg0), arg1, arg2); + }; +} + +typedef void (^_ListenerTrampoline31)(id arg0, id arg1, id arg2); +_ListenerTrampoline31 _NativeCupertinoHttp_wrapListenerBlock_1j2nt86(_ListenerTrampoline31 block) NS_RETURNS_RETAINED { + return ^void(id arg0, id arg1, id arg2) { + objc_retainBlock(block); + block(objc_retainBlock(arg0), objc_retain(arg1), objc_retain(arg2)); + }; +} + +typedef void (^_ListenerTrampoline32)(id arg0, struct _NSRange arg1, struct _NSRange arg2, BOOL * arg3); +_ListenerTrampoline32 _NativeCupertinoHttp_wrapListenerBlock_8wbg7l(_ListenerTrampoline32 block) NS_RETURNS_RETAINED { + return ^void(id arg0, struct _NSRange arg1, struct _NSRange arg2, BOOL * arg3) { + objc_retainBlock(block); + block(objc_retain(arg0), arg1, arg2, arg3); + }; +} + +typedef void (^_ListenerTrampoline33)(id arg0, BOOL * arg1); +_ListenerTrampoline33 _NativeCupertinoHttp_wrapListenerBlock_148br51(_ListenerTrampoline33 block) NS_RETURNS_RETAINED { + return ^void(id arg0, BOOL * arg1) { + objc_retainBlock(block); + block(objc_retain(arg0), arg1); + }; +} + +typedef void (^_ListenerTrampoline34)(unsigned short * arg0, unsigned long arg1); +_ListenerTrampoline34 _NativeCupertinoHttp_wrapListenerBlock_vhbh5h(_ListenerTrampoline34 block) NS_RETURNS_RETAINED { + return ^void(unsigned short * arg0, unsigned long arg1) { + objc_retainBlock(block); + block(arg0, arg1); + }; +} + +typedef void (^_ListenerTrampoline35)(void * arg0, unsigned long arg1); +_ListenerTrampoline35 _NativeCupertinoHttp_wrapListenerBlock_zuf90e(_ListenerTrampoline35 block) NS_RETURNS_RETAINED { + return ^void(void * arg0, unsigned long arg1) { + objc_retainBlock(block); + block(arg0, arg1); + }; +} + +typedef void (^_ListenerTrampoline36)(void * arg0); +_ListenerTrampoline36 _NativeCupertinoHttp_wrapListenerBlock_ovsamd(_ListenerTrampoline36 block) NS_RETURNS_RETAINED { + return ^void(void * arg0) { + objc_retainBlock(block); + block(arg0); + }; +} + +typedef void (^_ListenerTrampoline37)(id arg0, id arg1, id arg2, id arg3); +_ListenerTrampoline37 _NativeCupertinoHttp_wrapListenerBlock_4ya7yd(_ListenerTrampoline37 block) NS_RETURNS_RETAINED { + return ^void(id arg0, id arg1, id arg2, id arg3) { + objc_retainBlock(block); + block(objc_retain(arg0), objc_retain(arg1), objc_retain(arg2), objc_retain(arg3)); + }; +} diff --git a/pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/utils.h b/pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/utils.h new file mode 100644 index 0000000000..490b1d70b7 --- /dev/null +++ b/pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/utils.h @@ -0,0 +1,19 @@ +#import +#import +#import +#include + +#if !__has_feature(objc_arc) +#error "This file must be compiled with ARC enabled" +#endif + +typedef void (^_DidFinish)(void *closure, NSURLSession *session, + NSURLSessionDownloadTask *downloadTask, + NSURL *location); +typedef void (^_DidFinishWithLock)(NSCondition *lock, NSURLSession *session, + NSURLSessionDownloadTask *downloadTask, + NSURL *location); +/// Create a block useable as a +/// `URLSession:downloadTask:didFinishDownloadingToURL:` that can be used to +/// make an async Dart callback behave synchronously. +_DidFinish adaptFinishWithLock(_DidFinishWithLock block); diff --git a/pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/utils.m b/pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/utils.m new file mode 100644 index 0000000000..bad263c96c --- /dev/null +++ b/pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/utils.m @@ -0,0 +1,12 @@ +#import "utils.h" + +_DidFinish adaptFinishWithLock(_DidFinishWithLock block) { + return ^void(void *closure, NSURLSession *session, + NSURLSessionDownloadTask *downloadTask, NSURL *location) { + NSCondition *lock = [[NSCondition alloc] init]; + [lock lock]; + block(lock, session, downloadTask, location); + [lock lock]; + [lock unlock]; + }; +} diff --git a/pkgs/cupertino_http/example/.gitignore b/pkgs/cupertino_http/example/.gitignore new file mode 100644 index 0000000000..221b42254f --- /dev/null +++ b/pkgs/cupertino_http/example/.gitignore @@ -0,0 +1,49 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/pkgs/cupertino_http/example/.metadata b/pkgs/cupertino_http/example/.metadata new file mode 100644 index 0000000000..f720a23ccc --- /dev/null +++ b/pkgs/cupertino_http/example/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + channel: master + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + base_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + - platform: android + create_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + base_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + - platform: ios + create_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + base_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + - platform: linux + create_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + base_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + - platform: macos + create_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + base_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + - platform: web + create_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + base_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + - platform: windows + create_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + base_revision: c8569b6e98e3b83df410c6a1e78545f933d5e735 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/pkgs/cupertino_http/example/README.md b/pkgs/cupertino_http/example/README.md new file mode 100644 index 0000000000..f2838e8334 --- /dev/null +++ b/pkgs/cupertino_http/example/README.md @@ -0,0 +1,3 @@ +# cupertino_http_example + +Demonstrates how to use the cupertino_http plugin. diff --git a/pkgs/cupertino_http/example/integration_test/client_conformance_test.dart b/pkgs/cupertino_http/example/integration_test/client_conformance_test.dart new file mode 100644 index 0000000000..7c936da464 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/client_conformance_test.dart @@ -0,0 +1,51 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:http_client_conformance_tests/http_client_conformance_tests.dart'; +import 'package:http_profile/http_profile.dart'; +import 'package:integration_test/integration_test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('defaultSessionConfiguration', () { + group('profile enabled', () { + final profile = HttpClientRequestProfile.profilingEnabled; + HttpClientRequestProfile.profilingEnabled = true; + try { + testAll( + CupertinoClient.defaultSessionConfiguration, + canReceiveSetCookieHeaders: true, + canSendCookieHeaders: true, + ); + } finally { + HttpClientRequestProfile.profilingEnabled = profile; + } + }); + group('profile disabled', () { + final profile = HttpClientRequestProfile.profilingEnabled; + HttpClientRequestProfile.profilingEnabled = false; + try { + testAll( + CupertinoClient.defaultSessionConfiguration, + canReceiveSetCookieHeaders: true, + canSendCookieHeaders: true, + ); + } finally { + HttpClientRequestProfile.profilingEnabled = profile; + } + }); + }); + group('fromSessionConfiguration', () { + final config = URLSessionConfiguration.ephemeralSessionConfiguration(); + testAll( + () => CupertinoClient.fromSessionConfiguration(config), + canWorkInIsolates: false, + canReceiveSetCookieHeaders: true, + canSendCookieHeaders: true, + ); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/client_profile_test.dart b/pkgs/cupertino_http/example/integration_test/client_profile_test.dart new file mode 100644 index 0000000000..d823370618 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/client_profile_test.dart @@ -0,0 +1,335 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:cupertino_http/src/cupertino_client.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart'; +import 'package:http_profile/http_profile.dart'; +import 'package:integration_test/integration_test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('profile', () { + final profilingEnabled = HttpClientRequestProfile.profilingEnabled; + + setUpAll(() { + HttpClientRequestProfile.profilingEnabled = true; + }); + + tearDownAll(() { + HttpClientRequestProfile.profilingEnabled = profilingEnabled; + }); + + group('non-streamed POST', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.headers.set('Content-Length', '11'); + request.response.write('Hello World'); + await request.response.close(); + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + final client = CupertinoClientWithProfile.defaultSessionConfiguration(); + await client.post(successServerUri, + headers: {'Content-Type': 'text/plain'}, body: 'Hi'); + profile = client.profile!; + }); + tearDownAll(() { + successServer.close(); + }); + + test('profile attributes', () { + expect(profile.events, isEmpty); + expect(profile.requestMethod, 'POST'); + expect(profile.requestUri, successServerUri.toString()); + expect(profile.connectionInfo, + containsPair('package', 'package:cupertino_http')); + }); + + test('request attributes', () { + expect(profile.requestData.bodyBytes, 'Hi'.codeUnits); + expect(profile.requestData.contentLength, 2); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.error, isNull); + expect( + profile.requestData.headers, containsPair('Content-Length', ['2'])); + expect(profile.requestData.headers, + containsPair('Content-Type', ['text/plain; charset=utf-8'])); + expect(profile.requestData.persistentConnection, isNull); + expect(profile.requestData.proxyDetails, isNull); + expect(profile.requestData.startTime, isNotNull); + }); + + test('response attributes', () { + expect(profile.responseData.bodyBytes, 'Hello World'.codeUnits); + expect(profile.responseData.compressionState, isNull); + expect(profile.responseData.contentLength, 11); + expect(profile.responseData.endTime, isNotNull); + expect(profile.responseData.error, isNull); + expect(profile.responseData.headers, + containsPair('content-type', ['text/plain'])); + expect(profile.responseData.headers, + containsPair('content-length', ['11'])); + expect(profile.responseData.isRedirect, false); + expect(profile.responseData.persistentConnection, isNull); + expect(profile.responseData.reasonPhrase, 'OK'); + expect(profile.responseData.redirects, isEmpty); + expect(profile.responseData.startTime, isNotNull); + expect(profile.responseData.statusCode, 200); + }); + }); + + group('streaming POST request', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.headers.set('Content-Length', '11'); + request.response.write('Hello World'); + await request.response.close(); + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + final client = CupertinoClientWithProfile.defaultSessionConfiguration(); + final request = StreamedRequest('POST', successServerUri); + final stream = () async* { + for (var i = 0; i < 1000; ++i) { + await Future.delayed(const Duration()); + // The request has started but not finished. + expect(client.profile!.requestData.startTime, isNotNull); + expect(client.profile!.requestData.endTime, isNull); + expect(client.profile!.responseData.startTime, isNull); + expect(client.profile!.responseData.endTime, isNull); + yield 'Hello'.codeUnits; + } + }(); + unawaited( + request.sink.addStream(stream).then((_) => request.sink.close())); + + await client.send(request); + profile = client.profile!; + }); + tearDownAll(() { + successServer.close(); + }); + + test('request attributes', () async { + expect(profile.requestData.bodyBytes, ('Hello' * 1000).codeUnits); + expect(profile.requestData.contentLength, isNull); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.startTime, isNotNull); + expect(profile.requestData.headers, isNot(contains('Content-Length'))); + }); + }); + + group('failed POST request', () { + late HttpClientRequestProfile profile; + + setUpAll(() async { + final client = CupertinoClientWithProfile.defaultSessionConfiguration(); + try { + await client.post(Uri.http('thisisnotahost'), + headers: {'Content-Type': 'text/plain'}, body: 'Hi'); + fail('expected exception'); + } on ClientException { + // Expected exception. + } + profile = client.profile!; + }); + + test('profile attributes', () { + expect(profile.events, isEmpty); + expect(profile.requestMethod, 'POST'); + expect(profile.requestUri, 'http://thisisnotahost'); + expect(profile.connectionInfo, + containsPair('package', 'package:cupertino_http')); + }); + + test('request attributes', () { + expect(profile.requestData.bodyBytes, 'Hi'.codeUnits); + expect(profile.requestData.contentLength, 2); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.error, startsWith('ClientException:')); + expect( + profile.requestData.headers, containsPair('Content-Length', ['2'])); + expect(profile.requestData.headers, + containsPair('Content-Type', ['text/plain; charset=utf-8'])); + expect(profile.requestData.persistentConnection, isNull); + expect(profile.requestData.proxyDetails, isNull); + expect(profile.requestData.startTime, isNotNull); + }); + + test('response attributes', () { + expect(profile.responseData.bodyBytes, isEmpty); + expect(profile.responseData.compressionState, isNull); + expect(profile.responseData.contentLength, isNull); + expect(profile.responseData.endTime, isNull); + expect(profile.responseData.error, isNull); + expect(profile.responseData.headers, isNull); + expect(profile.responseData.isRedirect, isNull); + expect(profile.responseData.persistentConnection, isNull); + expect(profile.responseData.reasonPhrase, isNull); + expect(profile.responseData.redirects, isEmpty); + expect(profile.responseData.startTime, isNull); + expect(profile.responseData.statusCode, isNull); + }); + }); + + group('failed POST response', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.headers.set('Content-Length', '11'); + final socket = await request.response.detachSocket(); + await socket.close(); + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + final client = CupertinoClientWithProfile.defaultSessionConfiguration(); + + try { + await client.post(successServerUri, + headers: {'Content-Type': 'text/plain'}, body: 'Hi'); + fail('expected exception'); + } on ClientException { + // Expected exception. + } + profile = client.profile!; + }); + tearDownAll(() { + successServer.close(); + }); + + test('profile attributes', () { + expect(profile.events, isEmpty); + expect(profile.requestMethod, 'POST'); + expect(profile.requestUri, successServerUri.toString()); + expect(profile.connectionInfo, + containsPair('package', 'package:cupertino_http')); + }); + + test('request attributes', () { + expect(profile.requestData.bodyBytes, 'Hi'.codeUnits); + expect(profile.requestData.contentLength, 2); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.error, isNull); + expect( + profile.requestData.headers, containsPair('Content-Length', ['2'])); + expect(profile.requestData.headers, + containsPair('Content-Type', ['text/plain; charset=utf-8'])); + expect(profile.requestData.persistentConnection, isNull); + expect(profile.requestData.proxyDetails, isNull); + expect(profile.requestData.startTime, isNotNull); + }); + + test('response attributes', () { + expect(profile.responseData.bodyBytes, isEmpty); + expect(profile.responseData.compressionState, isNull); + expect(profile.responseData.contentLength, 11); + expect(profile.responseData.endTime, isNotNull); + expect(profile.responseData.error, startsWith('ClientException:')); + expect(profile.responseData.headers, + containsPair('content-type', ['text/plain'])); + expect(profile.responseData.headers, + containsPair('content-length', ['11'])); + expect(profile.responseData.isRedirect, false); + expect(profile.responseData.persistentConnection, isNull); + expect(profile.responseData.reasonPhrase, 'OK'); + expect(profile.responseData.redirects, isEmpty); + expect(profile.responseData.startTime, isNotNull); + expect(profile.responseData.statusCode, 200); + }); + }); + + group('redirects', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + if (request.requestedUri.pathSegments.isEmpty) { + unawaited(request.response.close()); + } else { + final n = int.parse(request.requestedUri.pathSegments.last); + final nextPath = n - 1 == 0 ? '' : '${n - 1}'; + unawaited(request.response + .redirect(successServerUri.replace(path: '/$nextPath'))); + } + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + }); + tearDownAll(() { + successServer.close(); + }); + + test('no redirects', () async { + final client = CupertinoClientWithProfile.defaultSessionConfiguration(); + await client.get(successServerUri); + profile = client.profile!; + + expect(profile.responseData.redirects, isEmpty); + }); + + test('follow redirects', () async { + final client = CupertinoClientWithProfile.defaultSessionConfiguration(); + await client.send(Request('GET', successServerUri.replace(path: '/3')) + ..followRedirects = true + ..maxRedirects = 4); + profile = client.profile!; + + expect(profile.requestData.followRedirects, true); + expect(profile.requestData.maxRedirects, 4); + expect(profile.responseData.isRedirect, false); + + expect(profile.responseData.redirects, [ + HttpProfileRedirectData( + statusCode: 302, + method: 'GET', + location: successServerUri.replace(path: '/2').toString()), + HttpProfileRedirectData( + statusCode: 302, + method: 'GET', + location: successServerUri.replace(path: '/1').toString()), + HttpProfileRedirectData( + statusCode: 302, + method: 'GET', + location: successServerUri.replace(path: '/').toString(), + ) + ]); + }); + + test('no follow redirects', () async { + final client = CupertinoClientWithProfile.defaultSessionConfiguration(); + await client.send(Request('GET', successServerUri.replace(path: '/3')) + ..followRedirects = false); + profile = client.profile!; + + expect(profile.requestData.followRedirects, false); + expect(profile.responseData.isRedirect, true); + expect(profile.responseData.redirects, isEmpty); + }); + }); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/client_test.dart b/pkgs/cupertino_http/example/integration_test/client_test.dart new file mode 100644 index 0000000000..1becd5c049 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/client_test.dart @@ -0,0 +1,66 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:convert/convert.dart'; +import 'package:crypto/crypto.dart'; +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart'; +import 'package:integration_test/integration_test.dart'; + +void testClient(Client client) { + group('client tests', () { + late HttpServer server; + late Uri uri; + late List serverHash; + + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + var hashSink = AccumulatorSink(); + final hashConverter = sha1.startChunkedConversion(hashSink); + await request.listen(hashConverter.add).asFuture(); + hashConverter.close(); + serverHash = hashSink.events.single.bytes; + await request.response.close(); + }); + uri = Uri.http('localhost:${server.port}'); + }); + tearDown(() { + server.close(); + }); + + test('large single item stream', () async { + // This tests that `CUPHTTPStreamToNSInputStreamAdapter` correctly + // handles calls to `read:maxLength:` where the maximum length + // is smaller than the amount of data in the buffer. + final size = (Platform.isIOS ? 10 : 100) * 1024 * 1024; + final data = Uint8List(size); + for (var i = 0; i < data.length; ++i) { + data[i] = i % 256; + } + final request = StreamedRequest('POST', uri); + request.sink.add(data); + unawaited(request.sink.close()); + await client.send(request); + expect(serverHash, sha1.convert(data).bytes); + }); + }); +} + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('defaultSessionConfiguration', () { + testClient(CupertinoClient.defaultSessionConfiguration()); + }); + group('fromSessionConfiguration', () { + final config = URLSessionConfiguration.ephemeralSessionConfiguration(); + testClient(CupertinoClient.fromSessionConfiguration(config)); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/http_url_response_test.dart b/pkgs/cupertino_http/example/integration_test/http_url_response_test.dart new file mode 100644 index 0000000000..5e29620a4b --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/http_url_response_test.dart @@ -0,0 +1,64 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:test/test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('response', () { + late HttpServer server; + late HTTPURLResponse response; + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.statusCode = 211; + request.response.headers.set('Content-Type', 'text/fancy'); + request.response.headers.set('custom-header', 'custom-header-value'); + request.response.write('Hello World'); + await request.response.close(); + }); + final session = URLSession.sharedSession(); + final task = session.dataTaskWithRequest( + URLRequest.fromUrl(Uri.parse('http://localhost:${server.port}'))) + ..resume(); + while ( + task.state != NSURLSessionTaskState.NSURLSessionTaskStateCompleted) { + // Let the event loop run. + await Future(() {}); + } + response = task.response as HTTPURLResponse; + }); + tearDown(() { + server.close(); + }); + + test('mimeType', () async { + expect(response.mimeType, 'text/fancy'); + }); + test('statusCode', () async { + expect(response.statusCode, 211); + }); + test('expectedContentLength - no content-length header', () async { + expect(response.expectedContentLength, -1); + }); + + test('custom set header', () async { + expect(response.allHeaderFields['custom-header'], 'custom-header-value'); + }); + + test('unset header', () async { + expect(response.allHeaderFields['unset-header'], null); + }); + + test('toString', () async { + response.toString(); // Just verify that there is no crash. + }); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/main.dart b/pkgs/cupertino_http/example/integration_test/main.dart new file mode 100644 index 0000000000..14a7ba9bcf --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/main.dart @@ -0,0 +1,44 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:integration_test/integration_test.dart'; + +import 'client_conformance_test.dart' as client_conformance_test; +import 'client_profile_test.dart' as profile_test; +import 'client_test.dart' as client_test; +import 'http_url_response_test.dart' as http_url_response_test; +import 'mutable_url_request_test.dart' as mutable_url_request_test; +import 'url_cache_test.dart' as url_cache_test; +import 'url_request_test.dart' as url_request_test; +import 'url_response_test.dart' as url_response_test; +import 'url_session_configuration_test.dart' as url_session_configuration_test; +import 'url_session_delegate_test.dart' as url_session_delegate_test; +import 'url_session_task_test.dart' as url_session_task_test; +import 'url_session_test.dart' as url_session_test; +import 'utils_test.dart' as utils_test; +import 'web_socket_conformance_test.dart' as web_socket_conformance_test; + +/// Execute all the tests in this directory. +/// +/// This is faster than running each test individually using +/// `flutter test integration_test/` because only one compilation step and +/// application launch is required. +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + client_conformance_test.main(); + profile_test.main(); + client_test.main(); + http_url_response_test.main(); + mutable_url_request_test.main(); + url_cache_test.main(); + url_request_test.main(); + url_response_test.main(); + url_session_configuration_test.main(); + url_session_delegate_test.main(); + url_session_task_test.main(); + url_session_test.main(); + utils_test.main(); + web_socket_conformance_test.main(); +} diff --git a/pkgs/cupertino_http/example/integration_test/mutable_url_request_test.dart b/pkgs/cupertino_http/example/integration_test/mutable_url_request_test.dart new file mode 100644 index 0000000000..446b1ee95f --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/mutable_url_request_test.dart @@ -0,0 +1,90 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:typed_data'; + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:objective_c/objective_c.dart'; +import 'package:test/test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('cachePolicy', () { + final uri = Uri.parse('http://www.example.com/foo?baz=3#bar'); + late MutableURLRequest request; + + setUp(() => request = MutableURLRequest.fromUrl(uri)); + + test('set', () { + request.cachePolicy = + NSURLRequestCachePolicy.NSURLRequestReturnCacheDataDontLoad; + expect(request.cachePolicy, + NSURLRequestCachePolicy.NSURLRequestReturnCacheDataDontLoad); + request.toString(); // Just verify that there is no crash. + }); + }); + + group('headers', () { + final uri = Uri.parse('http://www.example.com/foo?baz=3#bar'); + late MutableURLRequest request; + + setUp(() => request = MutableURLRequest.fromUrl(uri)); + + test('empty', () => expect(request.allHttpHeaderFields, null)); + test('add', () { + request.setValueForHttpHeaderField('header', 'value'); + expect(request.allHttpHeaderFields!['header'], 'value'); + request.toString(); // Just verify that there is no crash. + }); + }); + + group('body', () { + final uri = Uri.parse('http://www.example.com/foo?baz=3#bar'); + late MutableURLRequest request; + + setUp(() => request = MutableURLRequest.fromUrl(uri)); + + test('empty', () => expect(request.httpBody, null)); + test('set', () { + request.httpBody = [1, 2, 3].toNSData(); + expect(request.httpBody!.toList(), Uint8List.fromList([1, 2, 3])); + request.toString(); // Just verify that there is no crash. + }); + test('set to null', () { + request + ..httpBody = [1, 2, 3].toNSData() + ..httpBody = null; + expect(request.httpBody, null); + }); + }); + + group('http method', () { + final uri = Uri.parse('http://www.example.com/foo?baz=3#bar'); + late MutableURLRequest request; + + setUp(() => request = MutableURLRequest.fromUrl(uri)); + + test('empty', () => expect(request.httpMethod, 'GET')); + test('set', () { + request.httpMethod = 'POST'; + expect(request.httpMethod, 'POST'); + request.toString(); // Just verify that there is no crash. + }); + }); + + group('timeoutInterval', () { + final uri = Uri.parse('http://www.example.com/foo?baz=3#bar'); + late MutableURLRequest request; + + setUp(() => request = MutableURLRequest.fromUrl(uri)); + + test('set', () { + request.timeoutInterval = const Duration(seconds: 23); + expect(request.timeoutInterval, const Duration(seconds: 23)); + request.toString(); // Just verify that there is no crash. + }); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/url_cache_test.dart b/pkgs/cupertino_http/example/integration_test/url_cache_test.dart new file mode 100644 index 0000000000..133a5d9695 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/url_cache_test.dart @@ -0,0 +1,74 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:test/test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('dataTaskWithCompletionHandler', () { + late HttpServer server; + var uncachedRequestCount = 0; + + setUp(() async { + uncachedRequestCount = 0; + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + if (request.headers['if-none-match']?.first == '1234') { + request.response.statusCode = 304; + await request.response.close(); + return; + } + ++uncachedRequestCount; + request.response.headers.set('Content-Type', 'text/plain'); + request.response.headers.set('ETag', '1234'); + request.response.write('Hello World'); + await request.response.close(); + }); + }); + tearDown(() { + server.close(); + }); + + Future doRequest(URLSession session) { + final request = + URLRequest.fromUrl(Uri.parse('http://localhost:${server.port}')); + final c = Completer(); + session.dataTaskWithCompletionHandler(request, (d, r, e) { + c.complete(); + }).resume(); + return c.future; + } + + test('no cache', () async { + final config = URLSessionConfiguration.defaultSessionConfiguration() + ..cache = null; + final session = URLSession.sessionWithConfiguration(config); + + await doRequest(session); + await doRequest(session); + + expect(uncachedRequestCount, 2); + session.finishTasksAndInvalidate(); + }); + + test('with cache', () async { + final config = URLSessionConfiguration.defaultSessionConfiguration() + ..cache = URLCache.withCapacity(memoryCapacity: 100000); + final session = URLSession.sessionWithConfiguration(config); + + await doRequest(session); + await doRequest(session); + + expect(uncachedRequestCount, 1); + session.finishTasksAndInvalidate(); + }); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/url_request_test.dart b/pkgs/cupertino_http/example/integration_test/url_request_test.dart new file mode 100644 index 0000000000..266d578c41 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/url_request_test.dart @@ -0,0 +1,58 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:test/test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('fromUrl', () { + test('absolute URL', () { + final uri = Uri.parse('http://www.example.com/foo?baz=3#bar'); + final request = URLRequest.fromUrl(uri); + expect(request.url, uri); + expect(request.httpMethod, 'GET'); + expect(request.allHttpHeaderFields, null); + expect(request.httpBody, null); + + expect(request.timeoutInterval, const Duration(minutes: 1)); + expect(request.cachePolicy, + NSURLRequestCachePolicy.NSURLRequestUseProtocolCachePolicy); + + request.toString(); // Just verify that there is no crash. + }); + + test('relative URL', () { + final uri = Uri.parse('/foo?baz=3#bar'); + final request = URLRequest.fromUrl(uri); + expect(request.url, uri); + expect(request.httpMethod, 'GET'); + expect(request.allHttpHeaderFields, null); + expect(request.httpBody, null); + + expect(request.timeoutInterval, const Duration(minutes: 1)); + expect(request.cachePolicy, + NSURLRequestCachePolicy.NSURLRequestUseProtocolCachePolicy); + + request.toString(); // Just verify that there is no crash. + }); + + test('FTP URL', () { + final uri = Uri.parse('ftp://ftp.example.com/foo'); + final request = URLRequest.fromUrl(uri); + expect(request.url, uri); + expect(request.httpMethod, 'GET'); + expect(request.allHttpHeaderFields, null); + expect(request.httpBody, null); + + expect(request.timeoutInterval, const Duration(minutes: 1)); + expect(request.cachePolicy, + NSURLRequestCachePolicy.NSURLRequestUseProtocolCachePolicy); + + request.toString(); // Just verify that there is no crash. + }); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/url_response_test.dart b/pkgs/cupertino_http/example/integration_test/url_response_test.dart new file mode 100644 index 0000000000..908996d9e7 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/url_response_test.dart @@ -0,0 +1,40 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:test/test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('response', () { + late URLResponse response; + setUp(() async { + final session = URLSession.sharedSession(); + final task = session.dataTaskWithRequest(URLRequest.fromUrl( + Uri.parse('data:text/fancy;charset=utf-8,Hello%20World'))) + ..resume(); + while ( + task.state != NSURLSessionTaskState.NSURLSessionTaskStateCompleted) { + // Let the event loop run. + await Future.delayed(const Duration()); + } + + response = task.response!; + }); + + test('mimeType', () async { + expect(response.mimeType, 'text/fancy'); + }); + + test('expectedContentLength ', () { + expect(response.expectedContentLength, 11); + }); + + test('toString', () { + response.toString(); // Just verify that there is no crash. + }); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/url_session_configuration_test.dart b/pkgs/cupertino_http/example/integration_test/url_session_configuration_test.dart new file mode 100644 index 0000000000..e316e80bb3 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/url_session_configuration_test.dart @@ -0,0 +1,197 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:test/test.dart'; + +/// Make a HTTP request using the given configuration and return the headers +/// received by the server. +Future>> sentHeaders( + URLSessionConfiguration config) async { + final session = URLSession.sessionWithConfiguration(config); + final headers = >{}; + final server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + request.headers.forEach((k, v) => headers[k] = v); + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + + final task = session.dataTaskWithRequest(URLRequest.fromUrl( + Uri(scheme: 'http', host: 'localhost', port: server.port))) + ..resume(); + while (task.state != NSURLSessionTaskState.NSURLSessionTaskStateCompleted) { + await pumpEventQueue(); + } + + await server.close(); + return headers; +} + +void testProperties(URLSessionConfiguration config) { + group('properties', () { + test('allowsCellularAccess', () { + config.allowsCellularAccess = true; + expect(config.allowsCellularAccess, true); + config.allowsCellularAccess = false; + expect(config.allowsCellularAccess, false); + }); + test('allowsConstrainedNetworkAccess', () { + config.allowsConstrainedNetworkAccess = true; + expect(config.allowsConstrainedNetworkAccess, true); + config.allowsConstrainedNetworkAccess = false; + expect(config.allowsConstrainedNetworkAccess, false); + }); + test('allowsExpensiveNetworkAccess', () { + config.allowsExpensiveNetworkAccess = true; + expect(config.allowsExpensiveNetworkAccess, true); + config.allowsExpensiveNetworkAccess = false; + expect(config.allowsExpensiveNetworkAccess, false); + }); + test('discretionary', () { + config.discretionary = true; + expect(config.discretionary, true); + config.discretionary = false; + expect(config.discretionary, false); + }); + test('httpAdditionalHeaders', () async { + expect(config.httpAdditionalHeaders, isNull); + + config.httpAdditionalHeaders = { + 'User-Agent': 'My Client', + 'MyHeader': 'myvalue' + }; + expect(config.httpAdditionalHeaders, + {'User-Agent': 'My Client', 'MyHeader': 'myvalue'}); + final headers = await sentHeaders(config); + expect(headers, containsPair('user-agent', ['My Client'])); + expect(headers, containsPair('myheader', ['myvalue'])); + + config.httpAdditionalHeaders = null; + expect(config.httpAdditionalHeaders, isNull); + }); + test('httpCookieAcceptPolicy', () { + config.httpCookieAcceptPolicy = + NSHTTPCookieAcceptPolicy.NSHTTPCookieAcceptPolicyAlways; + expect(config.httpCookieAcceptPolicy, + NSHTTPCookieAcceptPolicy.NSHTTPCookieAcceptPolicyAlways); + config.httpCookieAcceptPolicy = + NSHTTPCookieAcceptPolicy.NSHTTPCookieAcceptPolicyNever; + expect(config.httpCookieAcceptPolicy, + NSHTTPCookieAcceptPolicy.NSHTTPCookieAcceptPolicyNever); + }); + test('httpMaximumConnectionsPerHost', () { + config.httpMaximumConnectionsPerHost = 6; + expect(config.httpMaximumConnectionsPerHost, 6); + config.httpMaximumConnectionsPerHost = 23; + expect(config.httpMaximumConnectionsPerHost, 23); + }); + test('httpShouldSetCookies', () { + config.httpShouldSetCookies = true; + expect(config.httpShouldSetCookies, true); + config.httpShouldSetCookies = false; + expect(config.httpShouldSetCookies, false); + }); + test('httpShouldUsePipelining', () { + config.httpShouldUsePipelining = true; + expect(config.httpShouldUsePipelining, true); + config.httpShouldUsePipelining = false; + expect(config.httpShouldUsePipelining, false); + }); + test('multipathServiceType', () { + expect( + config.multipathServiceType, + NSURLSessionMultipathServiceType + .NSURLSessionMultipathServiceTypeNone); + config.multipathServiceType = NSURLSessionMultipathServiceType + .NSURLSessionMultipathServiceTypeAggregate; + expect( + config.multipathServiceType, + NSURLSessionMultipathServiceType + .NSURLSessionMultipathServiceTypeAggregate); + config.multipathServiceType = + NSURLSessionMultipathServiceType.NSURLSessionMultipathServiceTypeNone; + expect( + config.multipathServiceType, + NSURLSessionMultipathServiceType + .NSURLSessionMultipathServiceTypeNone); + }); + test('networkServiceType', () { + expect(config.networkServiceType, + NSURLRequestNetworkServiceType.NSURLNetworkServiceTypeDefault); + config.networkServiceType = + NSURLRequestNetworkServiceType.NSURLNetworkServiceTypeResponsiveAV; + expect(config.networkServiceType, + NSURLRequestNetworkServiceType.NSURLNetworkServiceTypeResponsiveAV); + config.networkServiceType = + NSURLRequestNetworkServiceType.NSURLNetworkServiceTypeDefault; + expect(config.networkServiceType, + NSURLRequestNetworkServiceType.NSURLNetworkServiceTypeDefault); + }); + test('requestCachePolicy', () { + config.requestCachePolicy = + NSURLRequestCachePolicy.NSURLRequestReturnCacheDataDontLoad; + expect(config.requestCachePolicy, + NSURLRequestCachePolicy.NSURLRequestReturnCacheDataDontLoad); + config.requestCachePolicy = + NSURLRequestCachePolicy.NSURLRequestReloadIgnoringLocalCacheData; + expect(config.requestCachePolicy, + NSURLRequestCachePolicy.NSURLRequestReloadIgnoringLocalCacheData); + }); + test('sessionSendsLaunchEvents', () { + config.sessionSendsLaunchEvents = true; + expect(config.sessionSendsLaunchEvents, true); + config.sessionSendsLaunchEvents = false; + expect(config.sessionSendsLaunchEvents, false); + }); + test('shouldUseExtendedBackgroundIdleMode', () { + config.shouldUseExtendedBackgroundIdleMode = true; + expect(config.shouldUseExtendedBackgroundIdleMode, true); + config.shouldUseExtendedBackgroundIdleMode = false; + expect(config.shouldUseExtendedBackgroundIdleMode, false); + }); + test('timeoutIntervalForRequest', () { + config.timeoutIntervalForRequest = + const Duration(seconds: 15, microseconds: 23); + expect(config.timeoutIntervalForRequest, + const Duration(seconds: 15, microseconds: 23)); + }); + test('waitsForConnectivity', () { + config.waitsForConnectivity = true; + expect(config.waitsForConnectivity, true); + config.waitsForConnectivity = false; + expect(config.waitsForConnectivity, false); + }); + }); +} + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('backgroundSession', () { + final config = URLSessionConfiguration.backgroundSession('myid'); + + testProperties(config); + config.toString(); // Just verify that there is no crash. + }); + + group('defaultSessionConfiguration', () { + final config = URLSessionConfiguration.defaultSessionConfiguration(); + + testProperties(config); + config.toString(); // Just verify that there is no crash. + }); + + group('ephemeralSessionConfiguration', () { + final config = URLSessionConfiguration.ephemeralSessionConfiguration(); + + testProperties(config); + config.toString(); // Just verify that there is no crash. + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/url_session_delegate_test.dart b/pkgs/cupertino_http/example/integration_test/url_session_delegate_test.dart new file mode 100644 index 0000000000..6baa5e6ca9 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/url_session_delegate_test.dart @@ -0,0 +1,738 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:objective_c/objective_c.dart'; +import 'package:test/test.dart'; + +void testOnComplete(URLSessionConfiguration Function() config) { + group('onComplete', () { + late HttpServer server; + + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + }); + tearDown(() { + server.close(); + }); + + test('success', () async { + final c = Completer(); + NSError? actualError; + late URLSession actualSession; + late URLSessionTask actualTask; + + final session = + URLSession.sessionWithConfiguration(config(), onComplete: (s, t, e) { + actualSession = s; + actualTask = t; + actualError = e; + c.complete(); + }); + + final task = session.dataTaskWithRequest( + URLRequest.fromUrl(Uri.parse('http://localhost:${server.port}'))) + ..resume(); + await c.future; + + expect(actualSession, session); + expect(actualTask, task); + expect(actualError, null); + session.finishTasksAndInvalidate(); + }); + + test('bad host', () async { + final c = Completer(); + NSError? actualError; + late URLSession actualSession; + late URLSessionTask actualTask; + + final session = + URLSession.sessionWithConfiguration(config(), onComplete: (s, t, e) { + actualSession = s; + actualTask = t; + actualError = e; + c.complete(); + }); + + final task = session.dataTaskWithRequest( + URLRequest.fromUrl(Uri.https('does-not-exist', ''))) + ..resume(); + await c.future; + expect(actualSession, session); + expect(actualTask, task); + expect( + actualError!.code, + anyOf( + -1001, // kCFURLErrorTimedOut + -1003, // kCFURLErrorCannotFindHost + )); + session.finishTasksAndInvalidate(); + }); + }); +} + +void testOnResponse(URLSessionConfiguration Function() config) { + group('onResponse', () { + late HttpServer server; + + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + }); + tearDown(() { + server.close(); + }); + + test('success', () async { + final c = Completer(); + late HTTPURLResponse actualResponse; + late URLSession actualSession; + late URLSessionTask actualTask; + + final session = + URLSession.sessionWithConfiguration(config(), onResponse: (s, t, r) { + actualSession = s; + actualTask = t; + actualResponse = r as HTTPURLResponse; + c.complete(); + return NSURLSessionResponseDisposition.NSURLSessionResponseAllow; + }); + + final task = session.dataTaskWithRequest( + URLRequest.fromUrl(Uri.parse('http://localhost:${server.port}'))) + ..resume(); + await c.future; + expect(actualSession, session); + expect(actualTask, task); + expect(actualResponse.statusCode, 200); + session.finishTasksAndInvalidate(); + }); + + test('bad host', () async { + // `onResponse` should not be called because there was no valid response. + final c = Completer(); + var called = false; + + final session = URLSession.sessionWithConfiguration(config(), + onComplete: (session, task, error) => c.complete(), + onResponse: (s, t, r) { + called = true; + return NSURLSessionResponseDisposition.NSURLSessionResponseAllow; + }); + + session + .dataTaskWithRequest( + URLRequest.fromUrl(Uri.https('does-not-exist', ''))) + .resume(); + await c.future; + expect(called, false); + session.finishTasksAndInvalidate(); + }); + }); +} + +void testOnData(URLSessionConfiguration Function() config) { + group('onData', () { + late HttpServer server; + + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + }); + tearDown(() { + server.close(); + }); + + test('success', () async { + final c = Completer(); + final actualData = NSMutableData.data(); + late URLSession actualSession; + late URLSessionTask actualTask; + + final session = URLSession.sessionWithConfiguration(config(), + onComplete: (s, t, r) => c.complete(), + onData: (s, t, d) { + actualSession = s; + actualTask = t; + actualData.appendData_(d); + }); + + final task = session.dataTaskWithRequest( + URLRequest.fromUrl(Uri.parse('http://localhost:${server.port}'))) + ..resume(); + await c.future; + expect(actualSession, session); + expect(actualTask, task); + expect(actualData.toList(), 'Hello World'.codeUnits); + session.finishTasksAndInvalidate(); + }); + }); +} + +void testOnFinishedDownloading(URLSessionConfiguration Function() config) { + group('onFinishedDownloading', () { + late HttpServer server; + + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + }); + tearDown(() { + server.close(); + }); + + test('success', () async { + final c = Completer(); + late URLSession actualSession; + late URLSessionDownloadTask actualTask; + late String actualContent; + + final session = URLSession.sessionWithConfiguration(config(), + onComplete: (s, t, r) => c.complete(), + onFinishedDownloading: (s, t, uri) { + actualSession = s; + actualTask = t; + actualContent = File.fromUri(uri).readAsStringSync(); + }); + + final task = session.downloadTaskWithRequest( + URLRequest.fromUrl(Uri.parse('http://localhost:${server.port}'))) + ..resume(); + await c.future; + expect(actualSession, session); + expect(actualTask, task); + expect(actualContent, 'Hello World'); + session.finishTasksAndInvalidate(); + }); + }); +} + +void testOnRedirect(URLSessionConfiguration Function() config) { + group('onRedirect', () { + late HttpServer redirectServer; + + setUp(() async { + // URI | Redirects TO + // ===========|============== + // ".../10" | ".../9" + // ".../9" | ".../8" + // ... | ... + // ".../1" | "/" + // "/" | + redirectServer = await HttpServer.bind('localhost', 0) + ..listen((request) async { + if (request.requestedUri.pathSegments.isEmpty) { + unawaited(request.response.close()); + } else { + final n = int.parse(request.requestedUri.pathSegments.last); + final nextPath = n - 1 == 0 ? '' : '${n - 1}'; + unawaited(request.response.redirect(Uri.parse( + 'http://localhost:${redirectServer.port}/$nextPath'))); + } + }); + }); + tearDown(() { + redirectServer.close(); + }); + + test('disallow redirect', () async { + final session = URLSession.sessionWithConfiguration(config(), + onRedirect: + (redirectSession, redirectTask, redirectResponse, newRequest) => + null); + final c = Completer(); + URLResponse? response; + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl( + Uri.parse('http://localhost:${redirectServer.port}/100')), + (d, r, e) { + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect( + response, + isA() + .having((r) => r.statusCode, 'statusCode', 302) + .having( + (r) => r.allHeaderFields['Location'], + "allHeaderFields['Location']", + 'http://localhost:${redirectServer.port}/99')); + expect(error, null); + session.finishTasksAndInvalidate(); + }); + + test('use proposed redirect request', () async { + final session = URLSession.sessionWithConfiguration(config(), + onRedirect: + (redirectSession, redirectTask, redirectResponse, newRequest) => + newRequest); + final c = Completer(); + URLResponse? response; + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl( + Uri.parse('http://localhost:${redirectServer.port}/1')), + (d, r, e) { + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect( + response, + isA() + .having((r) => r.statusCode, 'statusCode', 200)); + expect(error, null); + session.finishTasksAndInvalidate(); + }); + + test('use custom redirect request', () async { + final session = URLSession.sessionWithConfiguration( + config(), + onRedirect: (redirectSession, redirectTask, redirectResponse, + newRequest) => + URLRequest.fromUrl( + Uri.parse('http://localhost:${redirectServer.port}/')), + ); + final c = Completer(); + URLResponse? response; + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl( + Uri.parse('http://localhost:${redirectServer.port}/100')), + (d, r, e) { + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect( + response, + isA() + .having((r) => r.statusCode, 'statusCode', 200)); + expect(error, null); + session.finishTasksAndInvalidate(); + }); + + test('exception in http redirection', () async { + final session = URLSession.sessionWithConfiguration( + config(), + onRedirect: + (redirectSession, redirectTask, redirectResponse, newRequest) { + throw UnimplementedError(); + }, + ); + final c = Completer(); + URLResponse? response; + // ignore: unused_local_variable + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl( + Uri.parse('http://localhost:${redirectServer.port}/100')), + (d, r, e) { + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect( + response, + isA() + .having((r) => r.statusCode, 'statusCode', 302)); + // TODO(https://github.com/dart-lang/ffigen/issues/386): Check that the + // error is set. + session.finishTasksAndInvalidate(); + }, skip: 'Error not set for redirect exceptions.'); + + test('3 redirects', () async { + var redirectCounter = 0; + final session = URLSession.sessionWithConfiguration( + config(), + onRedirect: + (redirectSession, redirectTask, redirectResponse, newRequest) { + ++redirectCounter; + return newRequest; + }, + ); + final c = Completer(); + URLResponse? response; + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl( + Uri.parse('http://localhost:${redirectServer.port}/3')), + (d, r, e) { + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect(redirectCounter, 3); + expect( + response, + isA() + .having((r) => r.statusCode, 'statusCode', 200)); + expect(error, null); + session.finishTasksAndInvalidate(); + }); + + test('allow too many redirects', () async { + // The Foundation URL Loading System limits the number of redirects + // even when a redirect delegate is present and allows the redirect. + final session = URLSession.sessionWithConfiguration( + config(), + onRedirect: + (redirectSession, redirectTask, redirectResponse, newRequest) => + newRequest, + ); + final c = Completer(); + URLResponse? response; + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl( + Uri.parse('http://localhost:${redirectServer.port}/100')), + (d, r, e) { + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect( + response, + anyOf( + isNull, + isA() + .having((r) => r.statusCode, 'statusCode', 302) + .having( + (r) => r.allHeaderFields['Location'], + "r.allHeaderFields['Location']", + matches('http://localhost:${redirectServer.port}/' + r'\d+')))); + expect(error!.code, -1007); // kCFURLErrorHTTPTooManyRedirects + session.finishTasksAndInvalidate(); + }); + }); +} + +void testOnWebSocketTaskOpened(URLSessionConfiguration Function() config) { + group('onWebSocketTaskOpened', () { + late HttpServer server; + + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + if (request.requestedUri.queryParameters.containsKey('error')) { + request.response.statusCode = 500; + unawaited(request.response.close()); + return; + } + final webSocket = await WebSocketTransformer.upgrade( + request, + protocolSelector: (l) => 'myprotocol', + ); + await webSocket.close(); + }); + }); + tearDown(() { + server.close(); + }); + + test('with protocol', () async { + final c = Completer(); + late String? actualProtocol; + late URLSession actualSession; + late URLSessionWebSocketTask actualTask; + + final session = URLSession.sessionWithConfiguration(config(), + onWebSocketTaskOpened: (s, t, p) { + actualSession = s; + actualTask = t; + actualProtocol = p; + c.complete(); + }); + + final request = MutableURLRequest.fromUrl( + Uri.parse('http://localhost:${server.port}')) + ..setValueForHttpHeaderField('Sec-WebSocket-Protocol', 'myprotocol'); + + final task = session.webSocketTaskWithRequest(request)..resume(); + await c.future; + expect(actualSession, session); + expect(actualTask, task); + expect(actualProtocol, 'myprotocol'); + session.finishTasksAndInvalidate(); + }); + + test('without protocol', () async { + final c = Completer(); + late String? actualProtocol; + late URLSession actualSession; + late URLSessionWebSocketTask actualTask; + + final session = URLSession.sessionWithConfiguration(config(), + onWebSocketTaskOpened: (s, t, p) { + actualSession = s; + actualTask = t; + actualProtocol = p; + c.complete(); + }); + + final request = MutableURLRequest.fromUrl( + Uri.parse('http://localhost:${server.port}')); + final task = session.webSocketTaskWithRequest(request)..resume(); + await c.future; + expect(actualSession, session); + expect(actualTask, task); + expect(actualProtocol, null); + session.finishTasksAndInvalidate(); + }); + + test('server failure', () async { + final c = Completer(); + var onWebSocketTaskOpenedCalled = false; + NSError? actualError; + + final session = URLSession.sessionWithConfiguration(config(), + onWebSocketTaskOpened: (s, t, p) { + onWebSocketTaskOpenedCalled = true; + }, onComplete: (s, t, e) { + actualError = e; + c.complete(); + }); + + final request = MutableURLRequest.fromUrl( + Uri.parse('http://localhost:${server.port}?error=1')); + session.webSocketTaskWithRequest(request).resume(); + await c.future; + expect(actualError, isNotNull); + expect(onWebSocketTaskOpenedCalled, false); + session.finishTasksAndInvalidate(); + }); + }); +} + +void testOnWebSocketTaskClosed(URLSessionConfiguration Function() config) { + group('testOnWebSocketTaskClosed', () { + late HttpServer server; + late int? serverCode; + late String? serverReason; + + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + if (request.requestedUri.queryParameters.containsKey('error')) { + request.response.statusCode = 500; + unawaited(request.response.close()); + return; + } + final webSocket = await WebSocketTransformer.upgrade( + request, + ); + await webSocket.close(serverCode, serverReason); + }); + }); + tearDown(() { + server.close(); + }); + + test('close no code', () async { + final c = Completer(); + late int actualCloseCode; + late String? actualReason; + late URLSession actualSession; + late URLSessionWebSocketTask actualTask; + + serverCode = null; + serverReason = null; + + final session = URLSession.sessionWithConfiguration(config(), + onWebSocketTaskOpened: (session, task, protocol) {}, + onWebSocketTaskClosed: (session, task, closeCode, reason) { + actualSession = session; + actualTask = task; + actualCloseCode = closeCode!; + actualReason = utf8.decode(reason!.toList()); + c.complete(); + }); + + final request = MutableURLRequest.fromUrl( + Uri.parse('http://localhost:${server.port}')); + + final task = session.webSocketTaskWithRequest(request)..resume(); + + expect( + task.receiveMessage(), + throwsA(isA() + .having((e) => e.code, 'code', 57 // Socket is not connected. + ))); + await c.future; + expect(actualSession, session); + expect(actualTask, task); + expect(actualCloseCode, 1005); + expect(actualReason, ''); + session.finishTasksAndInvalidate(); + }); + + test('close code', () async { + final c = Completer(); + late int actualCloseCode; + late String? actualReason; + late URLSession actualSession; + late URLSessionWebSocketTask actualTask; + + serverCode = 4000; + serverReason = null; + + final session = URLSession.sessionWithConfiguration(config(), + onWebSocketTaskOpened: (session, task, protocol) {}, + onWebSocketTaskClosed: (session, task, closeCode, reason) { + actualSession = session; + actualTask = task; + actualCloseCode = closeCode!; + actualReason = utf8.decode(reason!.toList()); + c.complete(); + }); + + final request = MutableURLRequest.fromUrl( + Uri.parse('http://localhost:${server.port}')); + + final task = session.webSocketTaskWithRequest(request)..resume(); + + expect( + task.receiveMessage(), + throwsA(isA() + .having((e) => e.code, 'code', 57 // Socket is not connected. + ))); + await c.future; + expect(actualSession, session); + expect(actualTask, task); + expect(actualCloseCode, serverCode); + expect(actualReason, ''); + session.finishTasksAndInvalidate(); + }); + + test('close code and reason', () async { + final c = Completer(); + late int actualCloseCode; + late String? actualReason; + late URLSession actualSession; + late URLSessionWebSocketTask actualTask; + + serverCode = 4000; + serverReason = 'no real reason'; + + final session = URLSession.sessionWithConfiguration(config(), + onWebSocketTaskOpened: (session, task, protocol) {}, + onWebSocketTaskClosed: (session, task, closeCode, reason) { + actualSession = session; + actualTask = task; + actualCloseCode = closeCode!; + actualReason = utf8.decode(reason!.toList()); + c.complete(); + }); + + final request = MutableURLRequest.fromUrl( + Uri.parse('http://localhost:${server.port}')); + + final task = session.webSocketTaskWithRequest(request)..resume(); + + expect( + task.receiveMessage(), + throwsA(isA() + .having((e) => e.code, 'code', 57 // Socket is not connected. + ))); + await c.future; + expect(actualSession, session); + expect(actualTask, task); + expect(actualCloseCode, serverCode); + expect(actualReason, serverReason); + session.finishTasksAndInvalidate(); + }); + }); +} + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('backgroundSession', () { + var count = 0; + URLSessionConfiguration config() { + ++count; + return URLSessionConfiguration.backgroundSession( + 'backgroundSession{$count}'); + } + + testOnComplete(config); + // onResponse is not called for background sessions. + testOnData(config); + // onRedirect is not called for background sessions. + testOnFinishedDownloading(config); + // WebSocket tasks are not supported in background sessions. + }); + + group('defaultSessionConfiguration', () { + URLSessionConfiguration config() => + URLSessionConfiguration.defaultSessionConfiguration(); + testOnComplete(config); + testOnResponse(config); + testOnData(config); + testOnRedirect(config); + testOnFinishedDownloading(config); + testOnWebSocketTaskOpened(config); + testOnWebSocketTaskClosed(config); + }); + + group('ephemeralSessionConfiguration', () { + URLSessionConfiguration config() => + URLSessionConfiguration.ephemeralSessionConfiguration(); + testOnComplete(config); + testOnResponse(config); + testOnData(config); + testOnRedirect(config); + testOnFinishedDownloading(config); + testOnWebSocketTaskOpened(config); + testOnWebSocketTaskClosed(config); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/url_session_task_test.dart b/pkgs/cupertino_http/example/integration_test/url_session_task_test.dart new file mode 100644 index 0000000000..a85b317a10 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/url_session_task_test.dart @@ -0,0 +1,405 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:objective_c/objective_c.dart'; +import 'package:test/test.dart'; + +void testWebSocketTask() { + group('websocket', () { + late HttpServer server; + int? lastCloseCode; + String? lastCloseReason; + + setUp(() async { + lastCloseCode = null; + lastCloseReason = null; + server = await HttpServer.bind('localhost', 0) + ..listen((request) { + if (request.uri.path.endsWith('error')) { + request.response.statusCode = 500; + request.response.close(); + } else { + WebSocketTransformer.upgrade(request) + .then((websocket) => websocket.listen((event) { + final code = request.uri.queryParameters['code']; + final reason = request.uri.queryParameters['reason']; + + websocket.add(event); + if (!request.uri.queryParameters.containsKey('noclose')) { + websocket.close( + code == null ? null : int.parse(code), reason); + } + }, onDone: () { + lastCloseCode = websocket.closeCode; + lastCloseReason = websocket.closeReason; + })); + } + }); + }); + + tearDown(() async { + await server.close(); + }); + + test('background session', () { + final session = URLSession.sessionWithConfiguration( + URLSessionConfiguration.backgroundSession('background')); + expect( + () => session.webSocketTaskWithRequest(URLRequest.fromUrl( + Uri.parse('ws://localhost:${server.port}/?noclose'))), + throwsUnsupportedError); + session.finishTasksAndInvalidate(); + }); + + test('client code and reason', () async { + final session = URLSession.sharedSession(); + final task = session.webSocketTaskWithRequest(URLRequest.fromUrl( + Uri.parse('ws://localhost:${server.port}/?noclose'))) + ..resume(); + await task + .sendMessage(URLSessionWebSocketMessage.fromString('Hello World!')); + await task.receiveMessage(); + task.cancelWithCloseCode(4998, 'Bye'.codeUnits.toNSData()); + + // Allow the server to run and save the close code. + while (lastCloseCode == null) { + await Future.delayed(const Duration(milliseconds: 10)); + } + expect(lastCloseCode, 4998); + expect(lastCloseReason, 'Bye'); + }); + + test('server code and reason', () async { + final session = URLSession.sharedSession(); + final task = session.webSocketTaskWithRequest(URLRequest.fromUrl( + Uri.parse('ws://localhost:${server.port}/?code=4999&reason=fun'))) + ..resume(); + await task + .sendMessage(URLSessionWebSocketMessage.fromString('Hello World!')); + await task.receiveMessage(); + await expectLater( + task.receiveMessage(), + throwsA( + isA().having((e) => e.code, 'code', 57 // NOT_CONNECTED + ))); + + expect(task.closeCode, 4999); + expect(task.closeReason!.toList(), 'fun'.codeUnits); + task.cancel(); + session.finishTasksAndInvalidate(); + }); + + test('data message', () async { + final session = URLSession.sharedSession(); + final task = session.webSocketTaskWithRequest( + URLRequest.fromUrl(Uri.parse('ws://localhost:${server.port}'))) + ..resume(); + await task.sendMessage( + URLSessionWebSocketMessage.fromData([1, 2, 3].toNSData())); + final receivedMessage = await task.receiveMessage(); + expect( + receivedMessage.type, + NSURLSessionWebSocketMessageType + .NSURLSessionWebSocketMessageTypeData); + expect(receivedMessage.data!.toList(), [1, 2, 3]); + expect(receivedMessage.string, null); + task.cancel(); + }); + + test('text message', () async { + final session = URLSession.sharedSession(); + final task = session.webSocketTaskWithRequest( + URLRequest.fromUrl(Uri.parse('ws://localhost:${server.port}'))) + ..resume(); + await task + .sendMessage(URLSessionWebSocketMessage.fromString('Hello World!')); + final receivedMessage = await task.receiveMessage(); + expect( + receivedMessage.type, + NSURLSessionWebSocketMessageType + .NSURLSessionWebSocketMessageTypeString); + expect(receivedMessage.data, null); + expect(receivedMessage.string, 'Hello World!'); + task.cancel(); + }); + + test('send failure', () async { + final session = URLSession.sharedSession(); + final task = session.webSocketTaskWithRequest( + URLRequest.fromUrl(Uri.parse('ws://localhost:${server.port}/error'))) + ..resume(); + await expectLater( + task.sendMessage( + URLSessionWebSocketMessage.fromString('Hello World!')), + throwsA(isA().having( + (e) => e.code, 'code', -1011 // NSURLErrorBadServerResponse + ))); + task.cancel(); + }); + + test('receive failure', () async { + final session = URLSession.sharedSession(); + final task = session.webSocketTaskWithRequest( + URLRequest.fromUrl(Uri.parse('ws://localhost:${server.port}'))) + ..resume(); + await task + .sendMessage(URLSessionWebSocketMessage.fromString('Hello World!')); + await task.receiveMessage(); + await expectLater( + task.receiveMessage(), + throwsA( + isA().having((e) => e.code, 'code', 57 // NOT_CONNECTED + ))); + task.cancel(); + }); + }); +} + +void testURLSessionTaskCommon( + URLSessionTask Function(URLSession session, Uri url) f, + {bool suspendedAfterCancel = false}) { + group('task states', () { + late HttpServer server; + late URLSessionTask task; + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + final session = URLSession.sharedSession(); + task = f(session, Uri.parse('http://localhost:${server.port}')); + }); + tearDown(() { + task.cancel(); + server.close(); + }); + test('starts suspended', () { + expect(task.state, NSURLSessionTaskState.NSURLSessionTaskStateSuspended); + expect(task.response, null); + task.toString(); // Just verify that there is no crash. + }); + + test('resume to running', () { + task.resume(); + expect(task.state, NSURLSessionTaskState.NSURLSessionTaskStateRunning); + expect(task.response, null); + task.toString(); // Just verify that there is no crash. + }); + + test('cancel', () { + task.cancel(); + if (suspendedAfterCancel) { + expect( + task.state, NSURLSessionTaskState.NSURLSessionTaskStateSuspended); + } else { + expect( + task.state, NSURLSessionTaskState.NSURLSessionTaskStateCanceling); + } + expect(task.response, null); + task.toString(); // Just verify that there is no crash. + }); + + test('completed', () async { + task.resume(); + while ( + task.state != NSURLSessionTaskState.NSURLSessionTaskStateCompleted) { + // Let the event loop run. + await Future(() {}); + } + }); + }); + + group('task completed', () { + late HttpServer server; + late URLSessionTask task; + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + final session = URLSession.sharedSession(); + task = session.dataTaskWithRequest( + MutableURLRequest.fromUrl( + Uri.parse('http://localhost:${server.port}/mypath')) + ..httpMethod = 'POST' + ..httpBody = [1, 2, 3].toNSData()) + ..prefersIncrementalDelivery = false + ..priority = 0.2 + ..taskDescription = 'my task description' + ..resume(); + + while ( + task.state != NSURLSessionTaskState.NSURLSessionTaskStateCompleted) { + // Let the event loop run. + await Future(() {}); + } + }); + tearDown(() { + task.cancel(); + server.close(); + }); + + test('priority', () async { + expect(task.priority, inInclusiveRange(0.19, 0.21)); + }); + + test('current request', () async { + expect(task.currentRequest!.url!.path, '/mypath'); + }); + + test('original request', () async { + expect(task.originalRequest!.url!.path, '/mypath'); + }); + + test('has response', () async { + expect(task.response, isA()); + }); + + test('no error', () async { + expect(task.error, null); + }); + + test('countOfBytesExpectedToReceive - no content length set', () async { + expect(task.countOfBytesExpectedToReceive, -1); + }); + + test('countOfBytesReceived', () async { + expect(task.countOfBytesReceived, 11); + }); + + test('countOfBytesExpectedToSend', () async { + expect(task.countOfBytesExpectedToSend, 3); + }); + + test('countOfBytesSent', () async { + expect(task.countOfBytesSent, 3); + }); + + test('taskDescription', () { + expect(task.taskDescription, 'my task description'); + }); + + test('taskIdentifier', () { + task.taskIdentifier; // Just verify that there is no crash. + }); + + test('prefersIncrementalDelivery', () { + expect(task.prefersIncrementalDelivery, false); + }); + + test('toString', () { + task.toString(); // Just verify that there is no crash. + }); + }); + + group('task failed', () { + late URLSessionTask task; + setUp(() async { + final session = URLSession.sharedSession(); + task = session.dataTaskWithRequest( + MutableURLRequest.fromUrl(Uri.parse('http://notarealserver'))) + ..resume(); + + while ( + task.state != NSURLSessionTaskState.NSURLSessionTaskStateCompleted) { + // Let the event loop run. + await Future(() {}); + } + }); + tearDown(() { + task.cancel(); + }); + + test('no response', () async { + expect(task.response, null); + }); + + test('no error', () async { + expect(task.error!.code, -1003); // CannotFindHost + }); + + test('toString', () { + task.toString(); // Just verify that there is no crash. + }); + }); + + group('task redirect', () { + late HttpServer server; + late URLSessionTask task; + setUp(() async { + // The task will request http://localhost:XXX/launch, which will be + // redirected to http://localhost:XXX/landed. + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + if (request.requestedUri.path != '/landed') { + await request.response.redirect(Uri(path: '/landed')); + return; + } + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + final session = URLSession.sharedSession(); + task = session.dataTaskWithRequest(MutableURLRequest.fromUrl( + Uri.parse('http://localhost:${server.port}/launch'))) + ..resume(); + + while ( + task.state != NSURLSessionTaskState.NSURLSessionTaskStateCompleted) { + // Let the event loop run. + await Future(() {}); + } + }); + tearDown(() { + task.cancel(); + server.close(); + }); + + test('current request', () async { + expect(task.currentRequest!.url!.path, '/landed'); + }); + + test('original request', () async { + expect(task.originalRequest!.url!.path, '/launch'); + }); + + test('toString', () { + task.toString(); // Just verify that there is no crash. + }); + }); +} + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('data task', () { + testURLSessionTaskCommon( + (session, uri) => session.dataTaskWithRequest(URLRequest.fromUrl(uri))); + }); + + group('download task', () { + testURLSessionTaskCommon((session, uri) => + session.downloadTaskWithRequest(URLRequest.fromUrl(uri))); + }); + + group('websocket task', () { + testURLSessionTaskCommon( + (session, uri) => + session.webSocketTaskWithRequest(URLRequest.fromUrl(uri)), + suspendedAfterCancel: true); + }); + + testWebSocketTask(); +} diff --git a/pkgs/cupertino_http/example/integration_test/url_session_test.dart b/pkgs/cupertino_http/example/integration_test/url_session_test.dart new file mode 100644 index 0000000000..96e09789f8 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/url_session_test.dart @@ -0,0 +1,283 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:objective_c/objective_c.dart'; +import 'package:test/test.dart'; + +void testDataTaskWithCompletionHandler(URLSession session) { + group('dataTaskWithCompletionHandler', () { + late HttpServer successServer; + late HttpServer failureServer; + late HttpServer redirectServer; + + setUp(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + failureServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.statusCode = 500; + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + // URI | Redirects TO + // ===========|============== + // ".../10" | ".../9" + // ".../9" | ".../8" + // ... | ... + // ".../1" | "/" + // "/" | + redirectServer = await HttpServer.bind('localhost', 0) + ..listen((request) async { + if (request.requestedUri.pathSegments.isEmpty) { + unawaited(request.response.close()); + } else { + final n = int.parse(request.requestedUri.pathSegments.last); + final nextPath = n - 1 == 0 ? '' : '${n - 1}'; + unawaited(request.response.redirect(Uri.parse( + 'http://localhost:${redirectServer.port}/$nextPath'))); + } + }); + }); + tearDown(() { + successServer.close(); + failureServer.close(); + redirectServer.close(); + }); + + test('success', () async { + final c = Completer(); + NSData? data; + URLResponse? response; + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl( + Uri.parse('http://localhost:${successServer.port}')), (d, r, e) { + data = d; + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect(data!.toList(), 'Hello World'.codeUnits); + expect( + response, + isA() + .having((r) => r.statusCode, 'statusCode', 200)); + expect(error, null); + }); + + test('success no data', () async { + final c = Completer(); + NSData? data; + URLResponse? response; + NSError? error; + + final request = MutableURLRequest.fromUrl( + Uri.parse('http://localhost:${successServer.port}')) + ..httpMethod = 'HEAD'; + + session.dataTaskWithCompletionHandler(request, (d, r, e) { + data = d; + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect(data!.length, 0); + expect( + response, + isA() + .having((r) => r.statusCode, 'statusCode', 200)); + expect(error, null); + }); + + test('500 response', () async { + final c = Completer(); + NSData? data; + URLResponse? response; + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl( + Uri.parse('http://localhost:${failureServer.port}')), (d, r, e) { + data = d; + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect(data!.toList(), 'Hello World'.codeUnits); + expect( + response, + isA() + .having((r) => r.statusCode, 'statusCode', 500)); + expect(error, null); + }); + + test('too many redirects', () async { + // Ensures that the delegate used to implement the completion handler + // does not interfere with the default redirect behavior. + final c = Completer(); + NSData? data; + URLResponse? response; + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl( + Uri.parse('http://localhost:${redirectServer.port}/100')), + (d, r, e) { + data = d; + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect(data, null); + expect( + response, + anyOf( + isNull, + isA() + .having((r) => r.statusCode, 'statusCode', 302) + .having( + (r) => r.allHeaderFields['Location'], + "r.allHeaderFields['Location']", + matches('http://localhost:${redirectServer.port}/' + r'\d+')))); + expect(error!.code, -1007); // kCFURLErrorHTTPTooManyRedirects + }); + + test('unable to connect', () async { + final c = Completer(); + NSData? data; + URLResponse? response; + NSError? error; + + session.dataTaskWithCompletionHandler( + URLRequest.fromUrl(Uri.parse('http://this is not a valid URL')), + (d, r, e) { + data = d; + response = r; + error = e; + c.complete(); + }).resume(); + await c.future; + + expect(data, null); + expect(response, null); + expect(error!.code, -1003); // kCFURLErrorCannotFindHost + expect(error!.localizedRecoverySuggestion, null); + }); + }); +} + +void testURLSession(URLSession session) { + group('URLSession', () { + late HttpServer server; + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.write('Hello World'); + await request.response.close(); + }); + }); + tearDown(() { + server.close(); + }); + + test('sessionDescription', () async { + session.sessionDescription = null; + expect(session.sessionDescription, null); + session.sessionDescription = 'Happy Days!'; + expect(session.sessionDescription, 'Happy Days!'); + }); + + test('dataTask', () async { + final task = session.dataTaskWithRequest( + URLRequest.fromUrl(Uri.parse('http://localhost:${server.port}'))) + ..resume(); + while ( + task.state != NSURLSessionTaskState.NSURLSessionTaskStateCompleted) { + // Let the event loop run. + await Future.delayed(const Duration()); + } + final response = task.response as HTTPURLResponse; + expect(response.statusCode, 200); + }); + + test('downloadTask', () async { + final task = session.downloadTaskWithRequest( + URLRequest.fromUrl(Uri.parse('http://localhost:${server.port}'))) + ..resume(); + while ( + task.state != NSURLSessionTaskState.NSURLSessionTaskStateCompleted) { + // Let the event loop run. + await Future.delayed(const Duration()); + } + final response = task.response as HTTPURLResponse; + expect(response.statusCode, 200); + }); + }); +} + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('sharedSession', () { + final session = URLSession.sharedSession(); + + test('configuration', () { + expect(session.configuration, isA()); + }); + + testURLSession(session); + testDataTaskWithCompletionHandler(session); + }); + + group('defaultSessionConfiguration', () { + final config = URLSessionConfiguration.defaultSessionConfiguration() + ..allowsCellularAccess = false; + final session = URLSession.sessionWithConfiguration(config); + + test('configuration', () { + expect(session.configuration.allowsCellularAccess, false); + }); + + testURLSession(session); + testDataTaskWithCompletionHandler(session); + }); + + group('backgroundSession', () { + final config = + URLSessionConfiguration.backgroundSession('backgroundSession') + ..allowsCellularAccess = false; + final session = URLSession.sessionWithConfiguration(config); + + test('configuration', () { + expect(session.configuration.allowsCellularAccess, false); + }); + + testURLSession(session); + // dataTaskWithCompletionHandler is not supported in background sessions. + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/utils_test.dart b/pkgs/cupertino_http/example/integration_test/utils_test.dart new file mode 100644 index 0000000000..80c2c1caad --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/utils_test.dart @@ -0,0 +1,73 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:cupertino_http/src/utils.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:objective_c/objective_c.dart' as objc; +import 'package:test/test.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('stringNSDictionaryToMap', () { + test('empty input', () { + final d = objc.NSMutableDictionary.new1(); + + expect(stringNSDictionaryToMap(d), {}); + }); + + test('single string input', () { + final d = objc.NSMutableDictionary.new1() + ..setObject_forKey_('value'.toNSString(), 'key'.toNSString()); + + expect(stringNSDictionaryToMap(d), {'key': 'value'}); + }); + + test('multiple string input', () { + final d = objc.NSMutableDictionary.new1() + ..setObject_forKey_('value1'.toNSString(), 'key1'.toNSString()) + ..setObject_forKey_('value2'.toNSString(), 'key2'.toNSString()) + ..setObject_forKey_('value3'.toNSString(), 'key3'.toNSString()); + expect(stringNSDictionaryToMap(d), + {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}); + }); + + test('non-string value', () { + final d = objc.NSMutableDictionary.new1() + ..setObject_forKey_( + objc.NSNumberCreation.numberWithInteger_(5), 'key'.toNSString()); + expect(() => stringNSDictionaryToMap(d), throwsUnsupportedError); + }); + + test('non-string key', () { + final d = objc.NSMutableDictionary.new1() + ..setObject_forKey_( + 'value'.toNSString(), objc.NSNumberCreation.numberWithInteger_(5)); + expect(() => stringNSDictionaryToMap(d), throwsUnsupportedError); + }); + }); + + group('stringIterableToNSArray', () { + test('empty input', () { + final array = stringIterableToNSArray([]); + expect(array.count, 0); + }); + + test('single string input', () { + final array = stringIterableToNSArray(['apple']); + expect(array.count, 1); + expect( + objc.NSString.castFrom(array.objectAtIndex_(0)).toString(), 'apple'); + }); + + test('multiple string input', () { + final array = stringIterableToNSArray(['apple', 'banana']); + expect(array.count, 2); + expect( + objc.NSString.castFrom(array.objectAtIndex_(0)).toString(), 'apple'); + expect( + objc.NSString.castFrom(array.objectAtIndex_(1)).toString(), 'banana'); + }); + }); +} diff --git a/pkgs/cupertino_http/example/integration_test/web_socket_conformance_test.dart b/pkgs/cupertino_http/example/integration_test/web_socket_conformance_test.dart new file mode 100644 index 0000000000..8dff3a2626 --- /dev/null +++ b/pkgs/cupertino_http/example/integration_test/web_socket_conformance_test.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:test/test.dart'; +import 'package:web_socket_conformance_tests/web_socket_conformance_tests.dart'; + +void main() { + testAll(CupertinoWebSocket.connect); + + group('defaultSessionConfiguration', () { + testAll( + CupertinoWebSocket.connect, + ); + }); + group('fromSessionConfiguration', () { + final config = URLSessionConfiguration.ephemeralSessionConfiguration(); + testAll((uri, {protocols}) => + CupertinoWebSocket.connect(uri, protocols: protocols, config: config)); + }); +} diff --git a/pkgs/cupertino_http/example/ios/.gitignore b/pkgs/cupertino_http/example/ios/.gitignore new file mode 100644 index 0000000000..7a7f9873ad --- /dev/null +++ b/pkgs/cupertino_http/example/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/pkgs/cupertino_http/example/ios/Flutter/AppFrameworkInfo.plist b/pkgs/cupertino_http/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000000..1dc6cf7652 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 13.0 + + diff --git a/pkgs/cupertino_http/example/ios/Flutter/Debug.xcconfig b/pkgs/cupertino_http/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000000..ec97fc6f30 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/pkgs/cupertino_http/example/ios/Flutter/Release.xcconfig b/pkgs/cupertino_http/example/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000000..c4855bfe20 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/pkgs/cupertino_http/example/ios/Podfile b/pkgs/cupertino_http/example/ios/Podfile new file mode 100644 index 0000000000..6be20bc436 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Podfile @@ -0,0 +1,40 @@ +platform :ios, '13.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/pkgs/cupertino_http/example/ios/Podfile.lock b/pkgs/cupertino_http/example/ios/Podfile.lock new file mode 100644 index 0000000000..7201c0f962 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Podfile.lock @@ -0,0 +1,35 @@ +PODS: + - cupertino_http (0.0.1): + - Flutter + - FlutterMacOS + - Flutter (1.0.0) + - integration_test (0.0.1): + - Flutter + - objective_c (0.0.1): + - Flutter + +DEPENDENCIES: + - cupertino_http (from `.symlinks/plugins/cupertino_http/darwin`) + - Flutter (from `Flutter`) + - integration_test (from `.symlinks/plugins/integration_test/ios`) + - objective_c (from `.symlinks/plugins/objective_c/ios`) + +EXTERNAL SOURCES: + cupertino_http: + :path: ".symlinks/plugins/cupertino_http/darwin" + Flutter: + :path: Flutter + integration_test: + :path: ".symlinks/plugins/integration_test/ios" + objective_c: + :path: ".symlinks/plugins/objective_c/ios" + +SPEC CHECKSUMS: + cupertino_http: 947a233f40cfea55167a49f2facc18434ea117ba + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573 + objective_c: 77e887b5ba1827970907e10e832eec1683f3431d + +PODFILE CHECKSUM: d2243213672c3c48aae53c36642ba411a6be7309 + +COCOAPODS: 1.15.2 diff --git a/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.pbxproj b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..64fe2b898d --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,555 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 7C206A9A3BC694039D2138A9 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72654D21143300D1CE8849F2 /* Pods_Runner.framework */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 72654D21143300D1CE8849F2 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 82A2867F10522723C33BF204 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B662A93036DFE0C27097C83D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + EF476BC9C6E400C9F137A2DD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7C206A9A3BC694039D2138A9 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 22C15071A6751ECD9F9A0032 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 72654D21143300D1CE8849F2 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 74D0FD79A3AADBBB8D598F3C /* Pods */ = { + isa = PBXGroup; + children = ( + B662A93036DFE0C27097C83D /* Pods-Runner.debug.xcconfig */, + 82A2867F10522723C33BF204 /* Pods-Runner.release.xcconfig */, + EF476BC9C6E400C9F137A2DD /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 74D0FD79A3AADBBB8D598F3C /* Pods */, + 22C15071A6751ECD9F9A0032 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + F2CE40CE03FA321B6919E65A /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 472C20A7B7CCE2521353C0F4 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 472C20A7B7CCE2521353C0F4 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + F2CE40CE03FA321B6919E65A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = KBBRB9X88Q; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.cupertinoHttpExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = KBBRB9X88Q; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.cupertinoHttpExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = KBBRB9X88Q; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.cupertinoHttpExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..919434a625 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000..f9b0d7c5ea --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/pkgs/cupertino_http/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000000..5e31d3d342 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/cupertino_http/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/pkgs/cupertino_http/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..21a3cc14c7 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/pkgs/cupertino_http/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/cupertino_http/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/pkgs/cupertino_http/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/pkgs/cupertino_http/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000..f9b0d7c5ea --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/pkgs/cupertino_http/example/ios/Runner/AppDelegate.swift b/pkgs/cupertino_http/example/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000000..b636303481 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..d36b1fab2d --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000000..dc9ada4725 Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000000..28c6bf0301 Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000000..2ccbfd967d Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000000..f091b6b0bc Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000000..4cde12118d Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000000..d0ef06e7ed Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000000..dcdc2306c2 Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000000..2ccbfd967d Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000000..c8f9ed8f5c Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000000..a6d6b8609d Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000000..a6d6b8609d Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000000..75b2d164a5 Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000000..c4df70d39d Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000000..6a84f41e14 Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000000..d0e1f58536 Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000000..0bedcf2fd4 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000000..9da19eacad Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000000..9da19eacad Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000000..9da19eacad Binary files /dev/null and b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000000..89c2725b70 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/pkgs/cupertino_http/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/pkgs/cupertino_http/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000000..f2e259c7c9 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/cupertino_http/example/ios/Runner/Base.lproj/Main.storyboard b/pkgs/cupertino_http/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000000..f3c28516fb --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/cupertino_http/example/ios/Runner/Info.plist b/pkgs/cupertino_http/example/ios/Runner/Info.plist new file mode 100644 index 0000000000..2f0aaae821 --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner/Info.plist @@ -0,0 +1,51 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Cupertino Http + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + cupertino_http_example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/pkgs/cupertino_http/example/ios/Runner/Runner-Bridging-Header.h b/pkgs/cupertino_http/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000000..308a2a560b --- /dev/null +++ b/pkgs/cupertino_http/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/pkgs/cupertino_http/example/lib/book.dart b/pkgs/cupertino_http/example/lib/book.dart new file mode 100644 index 0000000000..b47ca9e67e --- /dev/null +++ b/pkgs/cupertino_http/example/lib/book.dart @@ -0,0 +1,32 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Book { + String title; + String description; + Uri imageUrl; + + Book(this.title, this.description, this.imageUrl); + + static List listFromJson(Map json) { + final books = []; + + if (json['items'] case final List items) { + for (final item in items) { + if (item case {'volumeInfo': final Map volumeInfo}) { + if (volumeInfo + case { + 'title': final String title, + 'description': final String description, + 'imageLinks': {'smallThumbnail': final String thumbnail} + }) { + books.add(Book(title, description, Uri.parse(thumbnail))); + } + } + } + } + + return books; + } +} diff --git a/pkgs/cupertino_http/example/lib/main.dart b/pkgs/cupertino_http/example/lib/main.dart new file mode 100644 index 0000000000..78fcb9c8ad --- /dev/null +++ b/pkgs/cupertino_http/example/lib/main.dart @@ -0,0 +1,152 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:io'; + +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:flutter/material.dart'; +import 'package:http/http.dart'; +import 'package:http/io_client.dart'; +import 'package:http_image_provider/http_image_provider.dart'; +import 'package:provider/provider.dart'; + +import 'book.dart'; + +void main() { + final Client httpClient; + if (Platform.isIOS || Platform.isMacOS) { + final config = URLSessionConfiguration.ephemeralSessionConfiguration() + ..cache = URLCache.withCapacity(memoryCapacity: 2 * 1024 * 1024) + ..httpAdditionalHeaders = {'User-Agent': 'Book Agent'}; + httpClient = CupertinoClient.fromSessionConfiguration(config); + } else { + httpClient = IOClient(HttpClient()..userAgent = 'Book Agent'); + } + + runApp(Provider( + create: (_) => httpClient, + child: const BookSearchApp(), + dispose: (_, client) => client.close())); +} + +class BookSearchApp extends StatelessWidget { + const BookSearchApp({super.key}); + + @override + Widget build(BuildContext context) => const MaterialApp( + // Remove the debug banner. + debugShowCheckedModeBanner: false, + title: 'Book Search', + home: HomePage(), + ); +} + +class HomePage extends StatefulWidget { + const HomePage({super.key}); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + List? _books; + String? _lastQuery; + late Client _client; + + @override + void initState() { + super.initState(); + _client = context.read(); + } + + // Get the list of books matching `query`. + // The `get` call will automatically use the `client` configured in `main`. + Future> _findMatchingBooks(String query) async { + final response = await _client.get( + Uri.https( + 'www.googleapis.com', + '/books/v1/volumes', + {'q': query, 'maxResults': '20', 'printType': 'books'}, + ), + ); + + final json = jsonDecode(utf8.decode(response.bodyBytes)) as Map; + return Book.listFromJson(json); + } + + void _runSearch(String query) async { + _lastQuery = query; + if (query.isEmpty) { + setState(() { + _books = null; + }); + return; + } + + final books = await _findMatchingBooks(query); + // Avoid the situation where a slow-running query finishes late and + // replaces newer search results. + if (query != _lastQuery) return; + setState(() { + _books = books; + }); + } + + @override + Widget build(BuildContext context) { + final searchResult = _books == null + ? const Text('Please enter a query', style: TextStyle(fontSize: 24)) + : _books!.isNotEmpty + ? BookList(_books!) + : const Text('No results found', style: TextStyle(fontSize: 24)); + + return Scaffold( + appBar: AppBar(title: const Text('Book Search')), + body: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + const SizedBox(height: 20), + TextField( + onChanged: _runSearch, + decoration: const InputDecoration( + labelText: 'Search', + suffixIcon: Icon(Icons.search), + ), + ), + const SizedBox(height: 20), + Expanded(child: searchResult), + ], + ), + ), + ); + } +} + +class BookList extends StatefulWidget { + final List books; + const BookList(this.books, {super.key}); + + @override + State createState() => _BookListState(); +} + +class _BookListState extends State { + @override + Widget build(BuildContext context) => ListView.builder( + itemCount: widget.books.length, + itemBuilder: (context, index) => Card( + key: ValueKey(widget.books[index].title), + child: ListTile( + leading: Image( + image: HttpImageProvider( + widget.books[index].imageUrl.replace(scheme: 'https'), + client: context.read())), + title: Text(widget.books[index].title), + subtitle: Text(widget.books[index].description), + ), + ), + ); +} diff --git a/pkgs/cupertino_http/example/macos/.gitignore b/pkgs/cupertino_http/example/macos/.gitignore new file mode 100644 index 0000000000..746adbb6b9 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/pkgs/cupertino_http/example/macos/Flutter/Flutter-Debug.xcconfig b/pkgs/cupertino_http/example/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000000..4b81f9b2d2 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/pkgs/cupertino_http/example/macos/Flutter/Flutter-Release.xcconfig b/pkgs/cupertino_http/example/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000000..5caa9d1579 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/pkgs/cupertino_http/example/macos/Flutter/GeneratedPluginRegistrant.swift b/pkgs/cupertino_http/example/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000000..cccf817a52 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,10 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { +} diff --git a/pkgs/cupertino_http/example/macos/Podfile b/pkgs/cupertino_http/example/macos/Podfile new file mode 100644 index 0000000000..9ec46f8cd5 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Podfile @@ -0,0 +1,40 @@ +platform :osx, '10.15' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/pkgs/cupertino_http/example/macos/Podfile.lock b/pkgs/cupertino_http/example/macos/Podfile.lock new file mode 100644 index 0000000000..64f62be2b6 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Podfile.lock @@ -0,0 +1,29 @@ +PODS: + - cupertino_http (0.0.1): + - Flutter + - FlutterMacOS + - FlutterMacOS (1.0.0) + - objective_c (0.0.1): + - FlutterMacOS + +DEPENDENCIES: + - cupertino_http (from `Flutter/ephemeral/.symlinks/plugins/cupertino_http/darwin`) + - FlutterMacOS (from `Flutter/ephemeral`) + - objective_c (from `Flutter/ephemeral/.symlinks/plugins/objective_c/macos`) + +EXTERNAL SOURCES: + cupertino_http: + :path: Flutter/ephemeral/.symlinks/plugins/cupertino_http/darwin + FlutterMacOS: + :path: Flutter/ephemeral + objective_c: + :path: Flutter/ephemeral/.symlinks/plugins/objective_c/macos + +SPEC CHECKSUMS: + cupertino_http: 947a233f40cfea55167a49f2facc18434ea117ba + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + objective_c: e5f8194456e8fc943e034d1af00510a1bc29c067 + +PODFILE CHECKSUM: 0d3963a09fc94f580682bd88480486da345dc3f0 + +COCOAPODS: 1.15.2 diff --git a/pkgs/cupertino_http/example/macos/Runner.xcodeproj/project.pbxproj b/pkgs/cupertino_http/example/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..3253d7d4d6 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,633 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 49F61AA6D6717AADC4360336 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C57AE9D0D604FAC3FF33FDD7 /* Pods_Runner.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 11A6429BF8F495D6C3D0BDB1 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* cupertino_http_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = cupertino_http_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 41FACCFD9DAF1C233C094BC7 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + C57AE9D0D604FAC3FF33FDD7 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D9EF80FE0A11844C6FE04F8A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 49F61AA6D6717AADC4360336 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + 9D6A66F4E0852DA9C2AC7D8B /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* cupertino_http_example.app */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + 9D6A66F4E0852DA9C2AC7D8B /* Pods */ = { + isa = PBXGroup; + children = ( + D9EF80FE0A11844C6FE04F8A /* Pods-Runner.debug.xcconfig */, + 11A6429BF8F495D6C3D0BDB1 /* Pods-Runner.release.xcconfig */, + 41FACCFD9DAF1C233C094BC7 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + C57AE9D0D604FAC3FF33FDD7 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + E2928DC3A6801A5E03E356BB /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + C8F164BC22EFF3F17CC2EE25 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* cupertino_http_example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + C8F164BC22EFF3F17CC2EE25 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + E2928DC3A6801A5E03E356BB /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/pkgs/cupertino_http/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/cupertino_http/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/pkgs/cupertino_http/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/pkgs/cupertino_http/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000000..9a00864391 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/cupertino_http/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/pkgs/cupertino_http/example/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..21a3cc14c7 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/pkgs/cupertino_http/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/cupertino_http/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/pkgs/cupertino_http/example/macos/Runner/AppDelegate.swift b/pkgs/cupertino_http/example/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000000..b3c1761412 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Cocoa +import FlutterMacOS + +@main +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } +} diff --git a/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..a2ec33f19f --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000000..3c4935a7ca Binary files /dev/null and b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000000..ed4cc16421 Binary files /dev/null and b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000000..483be61389 Binary files /dev/null and b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000000..bcbf36df2f Binary files /dev/null and b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000000..9c0a652864 Binary files /dev/null and b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000000..e71a726136 Binary files /dev/null and b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000000..8a31fe2dd3 Binary files /dev/null and b/pkgs/cupertino_http/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/pkgs/cupertino_http/example/macos/Runner/Base.lproj/MainMenu.xib b/pkgs/cupertino_http/example/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000000..80e867a4e0 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/cupertino_http/example/macos/Runner/Configs/AppInfo.xcconfig b/pkgs/cupertino_http/example/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000000..5911a2b557 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = cupertino_http_example + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.cupertinoHttpExample + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2022 The Dart project authors. All rights reserved. diff --git a/pkgs/cupertino_http/example/macos/Runner/Configs/Debug.xcconfig b/pkgs/cupertino_http/example/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000000..36b0fd9464 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/pkgs/cupertino_http/example/macos/Runner/Configs/Release.xcconfig b/pkgs/cupertino_http/example/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000000..dff4f49561 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/pkgs/cupertino_http/example/macos/Runner/Configs/Warnings.xcconfig b/pkgs/cupertino_http/example/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000000..42bcbf4780 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/pkgs/cupertino_http/example/macos/Runner/DebugProfile.entitlements b/pkgs/cupertino_http/example/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000000..3ba6c1266f --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,14 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.client + + com.apple.security.network.server + + + diff --git a/pkgs/cupertino_http/example/macos/Runner/Info.plist b/pkgs/cupertino_http/example/macos/Runner/Info.plist new file mode 100644 index 0000000000..4789daa6a4 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/pkgs/cupertino_http/example/macos/Runner/MainFlutterWindow.swift b/pkgs/cupertino_http/example/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000000..2722837ec9 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController.init() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/pkgs/cupertino_http/example/macos/Runner/Release.entitlements b/pkgs/cupertino_http/example/macos/Runner/Release.entitlements new file mode 100644 index 0000000000..ee95ab7e58 --- /dev/null +++ b/pkgs/cupertino_http/example/macos/Runner/Release.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + diff --git a/pkgs/cupertino_http/example/pubspec.yaml b/pkgs/cupertino_http/example/pubspec.yaml new file mode 100644 index 0000000000..b302ff3aec --- /dev/null +++ b/pkgs/cupertino_http/example/pubspec.yaml @@ -0,0 +1,40 @@ +name: cupertino_http_example +description: Demonstrates how to use the cupertino_http plugin. + +publish_to: 'none' + +version: 1.0.0+1 + +environment: + sdk: ^3.4.0 + flutter: '>=3.22.0' + +dependencies: + cupertino_http: + path: ../ + cupertino_icons: ^1.0.2 + flutter: + sdk: flutter + http: ^1.0.0 + http_image_provider: ^1.0.0 + provider: ^6.1.1 + +dev_dependencies: + convert: ^3.1.1 + crypto: ^3.0.3 + dart_flutter_team_lints: ^3.0.0 + ffi: ^2.0.1 + flutter_test: + sdk: flutter + http_client_conformance_tests: + path: ../../http_client_conformance_tests/ + http_profile: ^0.1.0 + integration_test: + sdk: flutter + objective_c: ^4.0.0 + test: ^1.21.1 + web_socket_conformance_tests: + path: ../../web_socket_conformance_tests/ + +flutter: + uses-material-design: true diff --git a/pkgs/cupertino_http/ffigen.yaml b/pkgs/cupertino_http/ffigen.yaml new file mode 100644 index 0000000000..a67084acc4 --- /dev/null +++ b/pkgs/cupertino_http/ffigen.yaml @@ -0,0 +1,66 @@ +# Run with `flutter packages pub run ffigen --config ffigen.yaml`. +name: NativeCupertinoHttp +description: | + Bindings for the Foundation URL Loading System and supporting libraries. + + Regenerate bindings with `flutter packages pub run ffigen --config ffigen.yaml`. +language: 'objc' +output: + bindings: 'lib/src/native_cupertino_bindings.dart' + objc-bindings: 'darwin/cupertino_http/Sources/cupertino_http/native_cupertino_bindings.m' +headers: + entry-points: + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSURLCache.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSURLRequest.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSURLSession.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSURL.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSLock.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSProgress.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSURLResponse.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSHTTPCookieStorage.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSOperation.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSError.h' + - '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSDictionary.h' + - 'darwin/cupertino_http/Sources/cupertino_http/utils.h' +preamble: | + // ignore_for_file: always_specify_types + // ignore_for_file: camel_case_types + // ignore_for_file: non_constant_identifier_names + // ignore_for_file: unused_element + // ignore_for_file: unused_field + // ignore_for_file: return_of_invalid_type +objc-interfaces: + include: + - 'NSCondition' + - 'NSHTTPURLResponse' + - 'NSMutableURLRequest' + - 'NSOperationQueue' + - 'NSURLCache' + - 'NSURLRequest' + - 'NSURLResponse' + - 'NSURLSession' + - 'NSURLSessionConfiguration' + - 'NSURLSessionDownloadTask' + - 'NSURLSessionTask' + - 'NSURLSessionWebSocketMessage' + - 'NSURLSessionWebSocketTask' +objc-protocols: + include: + - 'NSURLSessionDataDelegate' + - 'NSURLSessionDownloadDelegate' + - 'NSURLSessionWebSocketDelegate' +comments: + style: any + length: full +enums: + include: + - 'NSHTTPCookieAcceptPolicy' + - 'NSURLRequestCachePolicy' + - 'NSURLRequestNetworkServiceType' + - 'NSURLSessionMultipathServiceType' + - 'NSURLSessionResponseDisposition' + - 'NSURLSessionTaskState' + - 'NSURLSessionWebSocketMessageType' + as-int: + include: + - 'NSURLSessionWebSocketCloseCode' diff --git a/pkgs/cupertino_http/img/architecture.svg b/pkgs/cupertino_http/img/architecture.svg new file mode 100644 index 0000000000..3d01ae8e3e --- /dev/null +++ b/pkgs/cupertino_http/img/architecture.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pkgs/cupertino_http/lib/cupertino_http.dart b/pkgs/cupertino_http/lib/cupertino_http.dart new file mode 100644 index 0000000000..b85a868b4e --- /dev/null +++ b/pkgs/cupertino_http/lib/cupertino_http.dart @@ -0,0 +1,96 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Provides access to the +/// [Foundation URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system). +/// +/// **NOTE**: If sandboxed with the App Sandbox (the default Flutter +/// configuration on macOS) then the +/// [`com.apple.security.network.client`](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_network_client) +/// entitlement is required to use `package:cupertino_http`. See +/// [Entitlements and the App Sandbox](https://flutter.dev/to/macos-entitlements). +/// +/// # CupertinoClient +/// +/// The most convenient way to `package:cupertino_http` it is through +/// [CupertinoClient]. +/// +/// ``` +/// import 'package:cupertino_http/cupertino_http.dart'; +/// +/// void main() async { +/// var client = CupertinoClient.defaultSessionConfiguration(); +/// final response = await client.get( +/// Uri.https('www.googleapis.com', '/books/v1/volumes', {'q': '{http}'})); +/// if (response.statusCode != 200) { +/// throw HttpException('bad response: ${response.statusCode}'); +/// } +/// +/// final decodedResponse = +/// jsonDecode(utf8.decode(response.bodyBytes)) as Map; +/// +/// final itemCount = decodedResponse['totalItems']; +/// print('Number of books about http: $itemCount.'); +/// for (var i = 0; i < min(itemCount, 10); ++i) { +/// print(decodedResponse['items'][i]['volumeInfo']['title']); +/// } +/// } +/// ``` +/// +/// [CupertinoClient] is an implementation of the `package:http` [Client], +/// which means that it can easily used conditionally based on the current +/// platform. +/// +/// ``` +/// void main() { +/// final Client httpClient; +/// if (Platform.isIOS || Platform.isMacOS) { +/// final config = URLSessionConfiguration.ephemeralSessionConfiguration() +/// ..cache = URLCache.withCapacity(memoryCapacity: 2 * 1024 * 1024) +/// ..httpAdditionalHeaders = {'User-Agent': 'Book Agent'}; +/// httpClient = CupertinoClient.fromSessionConfiguration(config); +/// } else { +/// httpClient = IOClient(HttpClient()..userAgent = 'Book Agent'); +/// } +/// +/// runApp(Provider( +/// create: (_) => httpClient, +/// child: const BookSearchApp(), +/// dispose: (_, client) => client.close())); +/// } +/// ``` +/// +/// # NSURLSession API +/// +/// `package:cupertino_http` also allows direct access to the +/// [Foundation URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system) +/// APIs. +/// +/// ``` +/// void main() { +/// final url = Uri.https('www.example.com', '/'); +/// final session = URLSession.sharedSession(); +/// final task = session.dataTaskWithCompletionHandler( +/// URLRequest.fromUrl(url), +/// (data, response, error) { +/// if (error == null) { +/// if (response != null && response.statusCode == 200) { +/// print(response); // Do something with the response. +/// return; +/// } +/// } +/// print(error); // Handle errors. +/// }); +/// task.resume(); +/// } +/// ``` +library; + +import 'package:http/http.dart'; + +import 'src/cupertino_client.dart'; + +export 'src/cupertino_api.dart'; +export 'src/cupertino_client.dart' show CupertinoClient; +export 'src/cupertino_web_socket.dart'; diff --git a/pkgs/cupertino_http/lib/src/cupertino_api.dart b/pkgs/cupertino_http/lib/src/cupertino_api.dart new file mode 100644 index 0000000000..a87fa9c43d --- /dev/null +++ b/pkgs/cupertino_http/lib/src/cupertino_api.dart @@ -0,0 +1,1218 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Provides access to the +/// [Foundation URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system). +/// +/// For example: +/// ``` +/// void main() { +/// final url = Uri.https('www.example.com', '/'); +/// final session = URLSession.sharedSession(); +/// final task = session.dataTaskWithCompletionHandler( +/// URLRequest.fromUrl(url), +/// (data, response, error) { +/// if (error == null) { +/// if (response != null && response.statusCode == 200) { +/// print(response); // Do something with the response. +/// return; +/// } +/// } +/// print(error); // Handle errors. +/// }); +/// task.resume(); +/// } +/// ``` +library; + +import 'dart:async'; +import 'dart:isolate'; + +import 'package:objective_c/objective_c.dart' as objc; + +import 'native_cupertino_bindings.dart' as ncb; +import 'native_cupertino_bindings.dart' + show + NSHTTPCookieAcceptPolicy, + NSURLRequestCachePolicy, + NSURLRequestNetworkServiceType, + NSURLSessionMultipathServiceType, + NSURLSessionResponseDisposition, + NSURLSessionTaskState, + NSURLSessionWebSocketMessageType; +import 'utils.dart'; + +export 'native_cupertino_bindings.dart' + show + NSHTTPCookieAcceptPolicy, + NSURLRequestCachePolicy, + NSURLRequestNetworkServiceType, + NSURLSessionMultipathServiceType, + NSURLSessionResponseDisposition, + NSURLSessionTaskState, + NSURLSessionWebSocketCloseCode, + NSURLSessionWebSocketMessageType; + +abstract class _ObjectHolder { + final T _nsObject; + + _ObjectHolder(this._nsObject); + + @override + bool operator ==(Object other) { + if (other is _ObjectHolder) { + return _nsObject == other._nsObject; + } + return false; + } + + @override + int get hashCode => _nsObject.hashCode; +} + +/// A cache for [URLRequest]s. Used by [URLSessionConfiguration.cache]. +/// +/// See [NSURLCache](https://developer.apple.com/documentation/foundation/nsurlcache) +class URLCache extends _ObjectHolder { + URLCache._(super.c); + + /// The default URLCache. + /// + /// See [NSURLCache.sharedURLCache](https://developer.apple.com/documentation/foundation/nsurlcache/1413377-sharedurlcache) + static URLCache? get sharedURLCache { + final sharedCache = ncb.NSURLCache.getSharedURLCache(); + return URLCache._(sharedCache); + } + + /// Create a new [URLCache] with the given memory and disk cache sizes. + /// + /// [memoryCapacity] and [diskCapacity] are specified in bytes. + /// + /// [directory] is the file system location where the disk cache will be + /// stored. If `null` then the default directory will be used. + /// + /// See [NSURLCache initWithMemoryCapacity:diskCapacity:directoryURL:](https://developer.apple.com/documentation/foundation/nsurlcache/3240612-initwithmemorycapacity) + factory URLCache.withCapacity( + {int memoryCapacity = 0, int diskCapacity = 0, Uri? directory}) => + URLCache._(ncb.NSURLCache.alloc() + .initWithMemoryCapacity_diskCapacity_directoryURL_(memoryCapacity, + diskCapacity, directory == null ? null : uriToNSURL(directory))); +} + +/// Controls the behavior of a URLSession. +/// +/// See [NSURLSessionConfiguration](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration) +class URLSessionConfiguration + extends _ObjectHolder { + // A configuration created with + // [`backgroundSessionConfigurationWithIdentifier`](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1407496-backgroundsessionconfigurationwi) + final bool _isBackground; + + URLSessionConfiguration._(super.c, {required bool isBackground}) + : _isBackground = isBackground; + + /// A configuration suitable for performing HTTP uploads and downloads in + /// the background. + /// + /// See [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1407496-backgroundsessionconfigurationwi) + factory URLSessionConfiguration.backgroundSession(String identifier) => + URLSessionConfiguration._( + ncb.NSURLSessionConfiguration + .backgroundSessionConfigurationWithIdentifier_( + identifier.toNSString()), + isBackground: true); + + /// A configuration that uses caching and saves cookies and credentials. + /// + /// See [NSURLSessionConfiguration defaultSessionConfiguration](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1411560-defaultsessionconfiguration) + factory URLSessionConfiguration.defaultSessionConfiguration() => + URLSessionConfiguration._( + ncb.NSURLSessionConfiguration.castFrom( + ncb.NSURLSessionConfiguration.getDefaultSessionConfiguration()), + isBackground: false); + + /// A session configuration that uses no persistent storage for caches, + /// cookies, or credentials. + /// + /// See [NSURLSessionConfiguration ephemeralSessionConfiguration](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1410529-ephemeralsessionconfiguration) + factory URLSessionConfiguration.ephemeralSessionConfiguration() => + URLSessionConfiguration._( + ncb.NSURLSessionConfiguration.castFrom( + ncb.NSURLSessionConfiguration.getEphemeralSessionConfiguration()), + isBackground: false); + + /// Whether connections over a cellular network are allowed. + /// + /// See [NSURLSessionConfiguration.allowsCellularAccess](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1409406-allowscellularaccess) + bool get allowsCellularAccess => _nsObject.allowsCellularAccess; + set allowsCellularAccess(bool value) => + _nsObject.allowsCellularAccess = value; + + /// Whether connections are allowed when the user has selected Low Data Mode. + /// + /// See [NSURLSessionConfiguration.allowsConstrainedNetworkAccess](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/3235751-allowsconstrainednetworkaccess) + bool get allowsConstrainedNetworkAccess => + _nsObject.allowsConstrainedNetworkAccess; + set allowsConstrainedNetworkAccess(bool value) => + _nsObject.allowsConstrainedNetworkAccess = value; + + /// Whether connections are allowed over expensive networks. + /// + /// See [NSURLSessionConfiguration.allowsExpensiveNetworkAccess](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/3235752-allowsexpensivenetworkaccess) + bool get allowsExpensiveNetworkAccess => + _nsObject.allowsExpensiveNetworkAccess; + set allowsExpensiveNetworkAccess(bool value) => + _nsObject.allowsExpensiveNetworkAccess = value; + + /// The [URLCache] used to cache the results of [URLSessionTask]s. + /// + /// A value of `nil` indicates that no cache will be used. + /// + /// See [NSURLSessionConfiguration.URLCache](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1410148-urlcache) + URLCache? get cache => + _nsObject.URLCache == null ? null : URLCache._(_nsObject.URLCache!); + set cache(URLCache? cache) => _nsObject.URLCache = cache?._nsObject; + + /// Whether background tasks can be delayed by the system. + /// + /// See [NSURLSessionConfiguration.discretionary](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1411552-discretionary) + bool get discretionary => _nsObject.discretionary; + set discretionary(bool value) => _nsObject.discretionary = value; + + /// Additional headers to send with each request. + /// + /// Note that the getter for this field returns a **copy** of the headers. + /// + /// See [NSURLSessionConfiguration.HTTPAdditionalHeaders](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1411532-httpadditionalheaders) + Map? get httpAdditionalHeaders { + if (_nsObject.HTTPAdditionalHeaders case var additionalHeaders?) { + final headers = objc.NSDictionary.castFrom(additionalHeaders); + return stringNSDictionaryToMap(headers); + } + return null; + } + + set httpAdditionalHeaders(Map? headers) { + if (headers == null) { + _nsObject.HTTPAdditionalHeaders = null; + return; + } + final d = objc.NSMutableDictionary.alloc().init(); + headers.forEach((key, value) { + d.setObject_forKey_(value.toNSString(), key.toNSString()); + }); + _nsObject.HTTPAdditionalHeaders = d; + } + + /// What policy to use when deciding whether to accept cookies. + /// + /// See [NSURLSessionConfiguration.HTTPCookieAcceptPolicy](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1408933-httpcookieacceptpolicy). + NSHTTPCookieAcceptPolicy get httpCookieAcceptPolicy => + _nsObject.HTTPCookieAcceptPolicy; + set httpCookieAcceptPolicy(NSHTTPCookieAcceptPolicy value) => + _nsObject.HTTPCookieAcceptPolicy = value; + + /// The maximum number of connections that a URLSession can have open to the + /// same host. + // + /// See [NSURLSessionConfiguration.HTTPMaximumConnectionsPerHost](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1407597-httpmaximumconnectionsperhost). + int get httpMaximumConnectionsPerHost => + _nsObject.HTTPMaximumConnectionsPerHost; + set httpMaximumConnectionsPerHost(int value) => + _nsObject.HTTPMaximumConnectionsPerHost = value; + + /// Whether requests should include cookies from the cookie store. + /// + /// See [NSURLSessionConfiguration.HTTPShouldSetCookies](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1411589-httpshouldsetcookies) + bool get httpShouldSetCookies => _nsObject.HTTPShouldSetCookies; + set httpShouldSetCookies(bool value) => + _nsObject.HTTPShouldSetCookies = value; + + /// Whether to use [HTTP pipelining](https://en.wikipedia.org/wiki/HTTP_pipelining). + /// + /// See [NSURLSessionConfiguration.HTTPShouldUsePipelining](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1411657-httpshouldusepipelining) + bool get httpShouldUsePipelining => _nsObject.HTTPShouldUsePipelining; + set httpShouldUsePipelining(bool value) => + _nsObject.HTTPShouldUsePipelining = value; + + /// What type of Multipath TCP connections to use. + /// + /// See [NSURLSessionConfiguration.multipathServiceType](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/2875967-multipathservicetype) + NSURLSessionMultipathServiceType get multipathServiceType => + _nsObject.multipathServiceType; + set multipathServiceType(NSURLSessionMultipathServiceType value) => + _nsObject.multipathServiceType = value; + + /// Provides in indication to the operating system on what type of requests + /// are being sent. + /// + /// See [NSURLSessionConfiguration.networkServiceType](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1411606-networkservicetype). + NSURLRequestNetworkServiceType get networkServiceType => + _nsObject.networkServiceType; + set networkServiceType(NSURLRequestNetworkServiceType value) => + _nsObject.networkServiceType = value; + + /// Controls how to deal with response caching. + /// + /// See [NSURLSessionConfiguration.requestCachePolicy](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1411655-requestcachepolicy) + NSURLRequestCachePolicy get requestCachePolicy => + _nsObject.requestCachePolicy; + set requestCachePolicy(NSURLRequestCachePolicy value) => + _nsObject.requestCachePolicy = value; + + /// Whether the app should be resumed when background tasks complete. + /// + /// See [NSURLSessionConfiguration.sessionSendsLaunchEvents](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1617174-sessionsendslaunchevents) + bool get sessionSendsLaunchEvents => _nsObject.sessionSendsLaunchEvents; + set sessionSendsLaunchEvents(bool value) => + _nsObject.sessionSendsLaunchEvents = value; + + /// Whether connections will be preserved if the app moves to the background. + /// + /// See [NSURLSessionConfiguration.shouldUseExtendedBackgroundIdleMode](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1409517-shoulduseextendedbackgroundidlem) + bool get shouldUseExtendedBackgroundIdleMode => + _nsObject.shouldUseExtendedBackgroundIdleMode; + set shouldUseExtendedBackgroundIdleMode(bool value) => + _nsObject.shouldUseExtendedBackgroundIdleMode = value; + + /// The timeout interval if data is not received. + /// + /// See [NSURLSessionConfiguration.timeoutIntervalForRequest](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1408259-timeoutintervalforrequest) + Duration get timeoutIntervalForRequest => Duration( + microseconds: + (_nsObject.timeoutIntervalForRequest * Duration.microsecondsPerSecond) + .round()); + + set timeoutIntervalForRequest(Duration interval) { + _nsObject.timeoutIntervalForRequest = + interval.inMicroseconds.toDouble() / Duration.microsecondsPerSecond; + } + + /// Whether tasks should wait for connectivity or fail immediately. + /// + /// See [NSURLSessionConfiguration.waitsForConnectivity](https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/2908812-waitsforconnectivity) + bool get waitsForConnectivity => _nsObject.waitsForConnectivity; + set waitsForConnectivity(bool value) => + _nsObject.waitsForConnectivity = value; + + @override + String toString() => '[URLSessionConfiguration ' + 'allowsCellularAccess=$allowsCellularAccess ' + 'allowsConstrainedNetworkAccess=$allowsConstrainedNetworkAccess ' + 'allowsExpensiveNetworkAccess=$allowsExpensiveNetworkAccess ' + 'discretionary=$discretionary ' + 'httpAdditionalHeaders=$httpAdditionalHeaders ' + 'httpCookieAcceptPolicy=$httpCookieAcceptPolicy ' + 'httpShouldSetCookies=$httpShouldSetCookies ' + 'httpMaximumConnectionsPerHost=$httpMaximumConnectionsPerHost ' + 'httpShouldUsePipelining=$httpShouldUsePipelining ' + 'requestCachePolicy=$requestCachePolicy ' + 'sessionSendsLaunchEvents=$sessionSendsLaunchEvents ' + 'shouldUseExtendedBackgroundIdleMode=' + '$shouldUseExtendedBackgroundIdleMode ' + 'timeoutIntervalForRequest=$timeoutIntervalForRequest ' + 'waitsForConnectivity=$waitsForConnectivity' + ']'; +} + +/// The response associated with loading an URL. +/// +/// See [NSURLResponse](https://developer.apple.com/documentation/foundation/nsurlresponse) +class URLResponse extends _ObjectHolder { + URLResponse._(super.c); + + factory URLResponse._exactURLResponseType(ncb.NSURLResponse response) { + if (ncb.NSHTTPURLResponse.isInstance(response)) { + return HTTPURLResponse._(ncb.NSHTTPURLResponse.castFrom(response)); + } + return URLResponse._(response); + } + + /// The expected amount of data returned with the response. + /// + /// See [NSURLResponse.expectedContentLength](https://developer.apple.com/documentation/foundation/nsurlresponse/1413507-expectedcontentlength) + int get expectedContentLength => _nsObject.expectedContentLength; + + /// The MIME type of the response. + /// + /// See [NSURLResponse.MIMEType](https://developer.apple.com/documentation/foundation/nsurlresponse/1411613-mimetype) + String? get mimeType => _nsObject.MIMEType?.toString(); + + @override + String toString() => '[URLResponse ' + 'mimeType=$mimeType ' + 'expectedContentLength=$expectedContentLength' + ']'; +} + +/// The response associated with loading a HTTP URL. +/// +/// See [NSHTTPURLResponse](https://developer.apple.com/documentation/foundation/nshttpurlresponse) +class HTTPURLResponse extends URLResponse { + final ncb.NSHTTPURLResponse _httpUrlResponse; + + HTTPURLResponse._(ncb.NSHTTPURLResponse super.c) + : _httpUrlResponse = c, + super._(); + + /// The HTTP status code of the response (e.g. 200). + /// + /// See [HTTPURLResponse.statusCode](https://developer.apple.com/documentation/foundation/nshttpurlresponse/1409395-statuscode) + int get statusCode => _httpUrlResponse.statusCode; + + /// The HTTP headers of the response. + /// + /// See [HTTPURLResponse.allHeaderFields](https://developer.apple.com/documentation/foundation/nshttpurlresponse/1417930-allheaderfields) + Map get allHeaderFields { + final headers = + objc.NSDictionary.castFrom(_httpUrlResponse.allHeaderFields); + return stringNSDictionaryToMap(headers); + } + + @override + String toString() => '[HTTPURLResponse ' + 'statusCode=$statusCode ' + 'mimeType=$mimeType ' + 'expectedContentLength=$expectedContentLength' + ']'; +} + +/// A WebSocket message. +/// +/// See [NSURLSessionWebSocketMessage](https://developer.apple.com/documentation/foundation/nsurlsessionwebsocketmessage) +class URLSessionWebSocketMessage + extends _ObjectHolder { + URLSessionWebSocketMessage._(super.nsObject); + + /// Create a WebSocket data message. + /// + /// See [NSURLSessionWebSocketMessage initWithData:](https://developer.apple.com/documentation/foundation/nsurlsessionwebsocketmessage/3181192-initwithdata) + factory URLSessionWebSocketMessage.fromData(objc.NSData d) => + URLSessionWebSocketMessage._( + ncb.NSURLSessionWebSocketMessage.alloc().initWithData_(d)); + + /// Create a WebSocket string message. + /// + /// See [NSURLSessionWebSocketMessage initWitString:](https://developer.apple.com/documentation/foundation/nsurlsessionwebsocketmessage/3181193-initwithstring) + factory URLSessionWebSocketMessage.fromString(String s) => + URLSessionWebSocketMessage._(ncb.NSURLSessionWebSocketMessage.alloc() + .initWithString_(s.toNSString())); + + /// The data associated with the WebSocket message. + /// + /// Will be `null` if the [URLSessionWebSocketMessage] is a string message. + /// + /// See [NSURLSessionWebSocketMessage.data](https://developer.apple.com/documentation/foundation/nsurlsessionwebsocketmessage/3181191-data) + objc.NSData? get data => _nsObject.data; + + /// The string associated with the WebSocket message. + /// + /// Will be `null` if the [URLSessionWebSocketMessage] is a data message. + /// + /// See [NSURLSessionWebSocketMessage.string](https://developer.apple.com/documentation/foundation/nsurlsessionwebsocketmessage/3181194-string) + String? get string => _nsObject.string?.toString(); + + /// The type of the WebSocket message. + /// + /// See [NSURLSessionWebSocketMessage.type](https://developer.apple.com/documentation/foundation/nsurlsessionwebsocketmessage/3181195-type) + NSURLSessionWebSocketMessageType get type => _nsObject.type; + + @override + String toString() => + '[URLSessionWebSocketMessage type=$type string=$string data=$data]'; +} + +/// A task associated with downloading a URI. +/// +/// See [NSURLSessionTask](https://developer.apple.com/documentation/foundation/nsurlsessiontask) +class URLSessionTask extends _ObjectHolder { + URLSessionTask._(super.c); + + /// Cancels the task. + /// + /// See [NSURLSessionTask cancel](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411591-cancel) + void cancel() { + _nsObject.cancel(); + } + + /// Resumes a suspended task (new tasks start as suspended). + /// + /// See [NSURLSessionTask resume](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411121-resume) + void resume() { + _nsObject.resume(); + } + + /// Suspends a task (prevents it from transferring data). + /// + /// See [NSURLSessionTask suspend](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411565-suspend) + void suspend() { + _nsObject.suspend(); + } + + /// The current state of the task. + /// + /// See [NSURLSessionTask.state](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1409888-state) + NSURLSessionTaskState get state => _nsObject.state; + + /// The relative priority [0, 1] that the host should use to handle the + /// request. + /// + /// See [NSURLSessionTask.priority](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1410569-priority) + double get priority => _nsObject.priority; + + /// The relative priority [0, 1] that the host should use to handle the + /// request. + /// + /// See [NSURLSessionTask.priority](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1410569-priority) + set priority(double value) => _nsObject.priority = value; + + /// The request currently being handled by the task. + /// + /// May be different from [originalRequest] if the server responds with a + /// redirect. + /// + /// See [NSURLSessionTask.currentRequest](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411649-currentrequest) + URLRequest? get currentRequest { + final request = _nsObject.currentRequest; + if (request == null) { + return null; + } else { + return URLRequest._(request); + } + } + + /// The original request associated with the task. + /// + /// May be different from [currentRequest] if the server responds with a + /// redirect. + /// + /// See [NSURLSessionTask.originalRequest](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411572-originalrequest) + URLRequest? get originalRequest { + final request = _nsObject.originalRequest; + if (request == null) { + return null; + } else { + return URLRequest._(request); + } + } + + /// The server response to the request associated with this task. + /// + /// See [NSURLSessionTask.response](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1410586-response) + URLResponse? get response { + final nsResponse = _nsObject.response; + if (nsResponse == null) { + return null; + } + return URLResponse._exactURLResponseType(nsResponse); + } + + /// An error indicating why the task failed or `null` on success. + /// + /// See [NSURLSessionTask.error](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1408145-error) + objc.NSError? get error => _nsObject.error; + + /// The user-assigned description for the task. + /// + /// See [NSURLSessionTask.taskDescription](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1409798-taskdescription) + String get taskDescription => _nsObject.taskDescription.toString(); + + /// The user-assigned description for the task. + /// + /// See [NSURLSessionTask.taskDescription](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1409798-taskdescription) + set taskDescription(String value) => + _nsObject.taskDescription = value.toNSString(); + + /// A unique ID for the [URLSessionTask] in a [URLSession]. + /// + /// See [NSURLSessionTask.taskIdentifier](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411231-taskidentifier) + int get taskIdentifier => _nsObject.taskIdentifier; + + /// The number of content bytes that are expected to be received from the + /// server. + /// + /// See [NSURLSessionTask.countOfBytesReceived](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1410663-countofbytesexpectedtoreceive) + int get countOfBytesExpectedToReceive => + _nsObject.countOfBytesExpectedToReceive; + + /// The number of content bytes that have been received from the server. + /// + /// See [NSURLSessionTask.countOfBytesReceived](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411581-countofbytesreceived) + int get countOfBytesReceived => _nsObject.countOfBytesReceived; + + /// The number of content bytes that the task expects to send to the server. + /// + /// See [NSURLSessionTask.countOfBytesExpectedToSend](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411534-countofbytesexpectedtosend) + int get countOfBytesExpectedToSend => _nsObject.countOfBytesExpectedToSend; + + /// Whether the body of the response should be delivered incrementally or not. + /// + /// [NSURLSessionTask.countOfBytesSent](https://developer.apple.com/documentation/foundation/nsurlsessiontask/1410444-countofbytessent) + int get countOfBytesSent => _nsObject.countOfBytesSent; + + /// Whether the body of the response should be delivered incrementally or not. + /// + /// See [NSURLSessionTask.prefersIncrementalDelivery](https://developer.apple.com/documentation/foundation/nsurlsessiontask/3735881-prefersincrementaldelivery) + bool get prefersIncrementalDelivery => _nsObject.prefersIncrementalDelivery; + + /// Whether the body of the response should be delivered incrementally or not. + /// + /// See [NSURLSessionTask.prefersIncrementalDelivery](https://developer.apple.com/documentation/foundation/nsurlsessiontask/3735881-prefersincrementaldelivery) + set prefersIncrementalDelivery(bool value) => + _nsObject.prefersIncrementalDelivery = value; + + String _toStringHelper(String className) => '[$className ' + 'taskDescription=$taskDescription ' + 'taskIdentifier=$taskIdentifier ' + 'countOfBytesExpectedToReceive=$countOfBytesExpectedToReceive ' + 'countOfBytesReceived=$countOfBytesReceived ' + 'countOfBytesExpectedToSend=$countOfBytesExpectedToSend ' + 'countOfBytesSent=$countOfBytesSent ' + 'priority=$priority ' + 'state=$state ' + 'prefersIncrementalDelivery=$prefersIncrementalDelivery' + ']'; + + @override + String toString() => _toStringHelper('URLSessionTask'); +} + +/// A task associated with downloading a URI to a file. +/// +/// See [NSURLSessionDownloadTask](https://developer.apple.com/documentation/foundation/nsurlsessiondownloadtask) +class URLSessionDownloadTask extends URLSessionTask { + URLSessionDownloadTask._(ncb.NSURLSessionDownloadTask super.c) : super._(); + + @override + String toString() => _toStringHelper('URLSessionDownloadTask'); +} + +/// A task associated with a WebSocket connection. +/// +/// See [NSURLSessionWebSocketTask](https://developer.apple.com/documentation/foundation/nsurlsessionwebsockettask) +class URLSessionWebSocketTask extends URLSessionTask { + final ncb.NSURLSessionWebSocketTask _urlSessionWebSocketTask; + + URLSessionWebSocketTask._(ncb.NSURLSessionWebSocketTask super.c) + : _urlSessionWebSocketTask = c, + super._(); + + /// The close code set when the WebSocket connection is closed. + /// + /// See [NSURLSessionWebSocketTask.closeCode](https://developer.apple.com/documentation/foundation/nsurlsessionwebsockettask/3181201-closecode) + int get closeCode => _urlSessionWebSocketTask.closeCode; + + /// The close reason set when the WebSocket connection is closed. + /// If there is no close reason available this property will be null. + /// + /// See [NSURLSessionWebSocketTask.closeReason](https://developer.apple.com/documentation/foundation/nsurlsessionwebsockettask/3181202-closereason) + objc.NSData? get closeReason => _urlSessionWebSocketTask.closeReason; + + /// Sends a single WebSocket message. + /// + /// The returned future will complete successfully when the message is sent + /// and with an [Error] on failure. + /// + /// See [NSURLSessionWebSocketTask.sendMessage:completionHandler:](https://developer.apple.com/documentation/foundation/nsurlsessionwebsockettask/3181205-sendmessage) + Future sendMessage(URLSessionWebSocketMessage message) async { + final completer = Completer(); + _urlSessionWebSocketTask.sendMessage_completionHandler_(message._nsObject, + ncb.ObjCBlock_ffiVoid_NSError.listener((error) { + if (error == null) { + completer.complete(); + } else { + completer.completeError(error); + } + })); + + await completer.future; + } + + /// Receives a single WebSocket message. + /// + /// Throws an [Error] on failure. + /// + /// See [NSURLSessionWebSocketTask.receiveMessageWithCompletionHandler:](https://developer.apple.com/documentation/foundation/nsurlsessionwebsockettask/3181204-receivemessagewithcompletionhand) + Future receiveMessage() async { + final completer = Completer(); + _urlSessionWebSocketTask.receiveMessageWithCompletionHandler_( + ncb.ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError.listener( + (message, error) { + if (error != null) { + completer.completeError(error); + } else if (message != null) { + completer.complete(URLSessionWebSocketMessage._(message)); + } else { + completer.completeError( + StateError('one of message or error must be non-null')); + } + })); + return completer.future; + } + + /// Sends close frame with the given code and optional reason. + /// + /// See [NSURLSessionWebSocketTask.cancelWithCloseCode:reason:](https://developer.apple.com/documentation/foundation/nsurlsessionwebsockettask/3181200-cancelwithclosecode) + void cancelWithCloseCode(int closeCode, objc.NSData? reason) { + _urlSessionWebSocketTask.cancelWithCloseCode_reason_(closeCode, reason); + } + + @override + String toString() => _toStringHelper('NSURLSessionWebSocketTask'); +} + +/// A request to load a URL. +/// +/// See [NSURLRequest](https://developer.apple.com/documentation/foundation/nsurlrequest) +class URLRequest extends _ObjectHolder { + URLRequest._(super.c); + + /// Creates a request for a URL. + /// + /// See [NSURLRequest.requestWithURL:](https://developer.apple.com/documentation/foundation/nsurlrequest/1528603-requestwithurl) + factory URLRequest.fromUrl(Uri uri) => + URLRequest._(ncb.NSURLRequest.requestWithURL_(uriToNSURL(uri))); + + /// Returns all of the HTTP headers for the request. + /// + /// See [NSURLRequest.allHTTPHeaderFields](https://developer.apple.com/documentation/foundation/nsurlrequest/1418477-allhttpheaderfields) + Map? get allHttpHeaderFields { + if (_nsObject.allHTTPHeaderFields == null) { + return null; + } else { + return stringNSDictionaryToMap(_nsObject.allHTTPHeaderFields!); + } + } + + /// Controls how to deal with caching for the request. + /// + /// See [NSURLSession.cachePolicy](https://developer.apple.com/documentation/foundation/nsurlrequest/1407944-cachepolicy) + NSURLRequestCachePolicy get cachePolicy => _nsObject.cachePolicy; + + /// The body of the request. + /// + /// See [NSURLRequest.HTTPBody](https://developer.apple.com/documentation/foundation/nsurlrequest/1411317-httpbody) + objc.NSData? get httpBody => _nsObject.HTTPBody; + + /// The HTTP request method (e.g. 'GET'). + /// + /// See [NSURLRequest.HTTPMethod](https://developer.apple.com/documentation/foundation/nsurlrequest/1413030-httpmethod) + /// + /// NOTE: The documentation for `NSURLRequest.HTTPMethod` says that the + /// property is nullable but, in practice, assigning it to null will produce + /// an error. + String get httpMethod => _nsObject.HTTPMethod!.toString(); + + /// The timeout interval during the connection attempt. + /// + /// See [NSURLSession.timeoutInterval](https://developer.apple.com/documentation/foundation/nsurlrequest/1418229-timeoutinterval) + Duration get timeoutInterval => Duration( + microseconds: + (_nsObject.timeoutInterval * Duration.microsecondsPerSecond).round()); + + /// The requested URL. + /// + /// See [URLRequest.URL](https://developer.apple.com/documentation/foundation/nsurlrequest/1408996-url) + Uri? get url { + final nsUrl = _nsObject.URL; + if (nsUrl == null) { + return null; + } + return nsurlToUri(nsUrl); + } + + @override + String toString() => '[URLRequest ' + 'allHttpHeaderFields=$allHttpHeaderFields ' + 'cachePolicy=$cachePolicy ' + 'httpBody=$httpBody ' + 'httpMethod=$httpMethod ' + 'timeoutInterval=$timeoutInterval ' + 'url=$url ' + ']'; +} + +/// A mutable request to load a URL. +/// +/// See [NSMutableURLRequest](https://developer.apple.com/documentation/foundation/nsmutableurlrequest) +class MutableURLRequest extends URLRequest { + final ncb.NSMutableURLRequest _mutableUrlRequest; + + MutableURLRequest._(ncb.NSMutableURLRequest super.c) + : _mutableUrlRequest = c, + super._(); + + /// Creates a request for a URL. + /// + /// See [NSMutableURLRequest.requestWithURL:](https://developer.apple.com/documentation/foundation/nsmutableurlrequest/1414617-allhttpheaderfields) + factory MutableURLRequest.fromUrl(Uri uri) { + final url = objc.NSURL.URLWithString_(uri.toString().toNSString())!; + return MutableURLRequest._(ncb.NSMutableURLRequest.requestWithURL_(url)); + } + + set cachePolicy(NSURLRequestCachePolicy value) => + _mutableUrlRequest.cachePolicy = value; + + set httpBody(objc.NSData? data) { + _mutableUrlRequest.HTTPBody = data; + } + + /// Sets the body of the request to the given [Stream]. + /// + /// See [NSMutableURLRequest.HTTPBodyStream](https://developer.apple.com/documentation/foundation/nsurlrequest/1407341-httpbodystream). + set httpBodyStream(objc.NSInputStream stream) { + _mutableUrlRequest.HTTPBodyStream = stream; + } + + set httpMethod(String method) { + _mutableUrlRequest.HTTPMethod = method.toNSString(); + } + + set timeoutInterval(Duration interval) { + _mutableUrlRequest.timeoutInterval = + interval.inMicroseconds.toDouble() / Duration.microsecondsPerSecond; + } + + /// Set the value of a header field. + /// + /// See [NSMutableURLRequest setValue:forHTTPHeaderField:](https://developer.apple.com/documentation/foundation/nsmutableurlrequest/1408793-setvalue) + void setValueForHttpHeaderField(String value, String field) { + _mutableUrlRequest.setValue_forHTTPHeaderField_( + field.toNSString(), value.toNSString()); + } + + @override + String toString() => '[MutableURLRequest ' + 'allHttpHeaderFields=$allHttpHeaderFields ' + 'cachePolicy=$cachePolicy ' + 'httpBody=$httpBody ' + 'httpMethod=$httpMethod ' + 'timeoutInterval=$timeoutInterval ' + 'url=$url ' + ']'; +} + +/// A client that can make network requests to a server. +/// +/// See [NSURLSession](https://developer.apple.com/documentation/foundation/nsurlsession) +class URLSession extends _ObjectHolder { + // Provide our own native delegate to `NSURLSession` because delegates can be + // called on arbitrary threads and Dart code cannot be. + // Indicates if the session is a background session. Copied from the + // [URLSessionConfiguration._isBackground] associated with this [URLSession]. + final bool _isBackground; + final bool _hasDelegate; + // Pending Dart-implemented protocols/blocks do not keep the isolate alive. + // So we create a `ReceivePort` to keep the isolate alive. + // When a new task is created in a `URLSession` with a delegate installed + // (`_hasDelegate`), `_taskCount` is incremented. When a task completes, + // `_taskCount` is decremented. When `_taskCount` is 0 then the `ReceivePort` + // is closed. + static var _taskCount = 0; + static ReceivePort? _port; + + static void _incrementTaskCount() { + _port ??= ReceivePort(); + ++_taskCount; + } + + static void _decrementTaskCount() { + assert(_taskCount > 0); + assert(_port != null); + --_taskCount; + if (_taskCount == 0) { + _port?.close(); + _port = null; + } + } + + static objc.ObjCObjectBase delegate( + bool isBackground, { + URLRequest? Function(URLSession session, URLSessionTask task, + HTTPURLResponse response, URLRequest newRequest)? + onRedirect, + NSURLSessionResponseDisposition Function( + URLSession session, URLSessionTask task, URLResponse response)? + onResponse, + void Function(URLSession session, URLSessionTask task, objc.NSData error)? + onData, + void Function(URLSession session, URLSessionDownloadTask task, Uri uri)? + onFinishedDownloading, + void Function(URLSession session, URLSessionTask task, objc.NSError? error)? + onComplete, + void Function( + URLSession session, URLSessionWebSocketTask task, String? protocol)? + onWebSocketTaskOpened, + void Function(URLSession session, URLSessionWebSocketTask task, + int closeCode, objc.NSData? reason)? + onWebSocketTaskClosed, + }) { + final protoBuilder = objc.ObjCProtocolBuilder(); + + ncb.NSURLSessionDataDelegate.URLSession_task_didCompleteWithError_ + .implementAsListener(protoBuilder, (nsSession, nsTask, nsError) { + _decrementTaskCount(); + if (onComplete != null) { + onComplete( + URLSession._(nsSession, + isBackground: isBackground, hasDelegate: true), + URLSessionTask._(nsTask), + nsError); + } + }); + + if (onRedirect != null) { + ncb + .NSURLSessionDataDelegate + // ignore: lines_longer_than_80_chars + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implementAsListener(protoBuilder, + // ignore: lines_longer_than_80_chars + + (nsSession, nsTask, nsResponse, nsRequest, nsRequestCompleter) { + final request = URLRequest._(nsRequest); + URLRequest? redirectRequest; + + try { + final response = + URLResponse._exactURLResponseType(nsResponse) as HTTPURLResponse; + redirectRequest = onRedirect( + URLSession._(nsSession, + isBackground: isBackground, hasDelegate: true), + URLSessionTask._(nsTask), + response, + request); + nsRequestCompleter.call(redirectRequest?._nsObject); + } catch (e) { + // TODO(https://github.com/dart-lang/ffigen/issues/386): Package + // this exception as an `Error` and call the completion function + // with it. + } + }); + } + + if (onResponse != null) { + ncb.NSURLSessionDataDelegate + .URLSession_dataTask_didReceiveResponse_completionHandler_ + .implementAsListener(protoBuilder, + (nsSession, nsDataTask, nsResponse, nsCompletionHandler) { + final exactResponse = URLResponse._exactURLResponseType(nsResponse); + final disposition = onResponse( + URLSession._(nsSession, + isBackground: isBackground, hasDelegate: true), + URLSessionTask._(nsDataTask), + exactResponse); + nsCompletionHandler.call(disposition); + }); + } + + if (onData != null) { + ncb.NSURLSessionDataDelegate.URLSession_dataTask_didReceiveData_ + .implementAsListener(protoBuilder, (nsSession, nsDataTask, nsData) { + onData( + URLSession._(nsSession, + isBackground: isBackground, hasDelegate: true), + URLSessionTask._(nsDataTask), + nsData); + }); + } + + if (onFinishedDownloading != null) { + final asyncFinishDownloading = + // ignore: lines_longer_than_80_chars + ncb.ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL + .listener((nsCondition, nsSession, nsTask, nsUrl) { + try { + onFinishedDownloading( + URLSession._(nsSession, + isBackground: isBackground, hasDelegate: true), + URLSessionDownloadTask._(nsTask), + nsurlToUri(nsUrl)); + } finally { + nsCondition.unlock(); + } + }); + + final downloadDelegate = objc.getProtocol('NSURLSessionDownloadDelegate'); + final didFinishDownloadingToURL = objc + .registerName('URLSession:downloadTask:didFinishDownloadingToURL:'); + final signature = objc.getProtocolMethodSignature( + downloadDelegate, didFinishDownloadingToURL, + isRequired: true, isInstanceMethod: true)!; + protoBuilder.implementMethod(didFinishDownloadingToURL, signature, + linkedLibs.adaptFinishWithLock(asyncFinishDownloading)); + } + + if (onWebSocketTaskOpened != null) { + ncb.NSURLSessionWebSocketDelegate + .URLSession_webSocketTask_didOpenWithProtocol_ + .implementAsListener(protoBuilder, (nsSession, nsTask, nsProtocol) { + onWebSocketTaskOpened( + URLSession._(nsSession, + isBackground: isBackground, hasDelegate: true), + URLSessionWebSocketTask._(nsTask), + nsProtocol?.toString()); + }); + } + + if (onWebSocketTaskClosed != null) { + ncb.NSURLSessionWebSocketDelegate + .URLSession_webSocketTask_didCloseWithCode_reason_ + .implementAsListener(protoBuilder, + (nsSession, nsTask, closeCode, reason) { + onWebSocketTaskClosed( + URLSession._(nsSession, + isBackground: isBackground, hasDelegate: true), + URLSessionWebSocketTask._(nsTask), + closeCode, + reason); + }); + } + + return protoBuilder.build(); + } + + URLSession._( + super.c, { + required bool isBackground, + required bool hasDelegate, + }) : _isBackground = isBackground, + _hasDelegate = hasDelegate; + + /// A client with reasonable default behavior. + /// + /// See [NSURLSession.sharedSession](https://developer.apple.com/documentation/foundation/nsurlsession/1409000-sharedsession) + factory URLSession.sharedSession() => + URLSession._(ncb.NSURLSession.getSharedSession(), + isBackground: false, hasDelegate: false); + + /// A client with a given configuration. + /// + /// If [onRedirect] is set then it will be called whenever a HTTP + /// request returns a redirect response (e.g. 302). The `response` parameter + /// contains the response from the server. The `newRequest` parameter contains + /// a follow-up request that would honor the server's redirect. If the return + /// value of this function is `null` then the redirect will not occur. + /// Otherwise, the returned [URLRequest] (usually `newRequest`) will be + /// executed. [onRedirect] will not be called for background sessions, which + /// automatically follow redirects. See + /// [URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:](https://developer.apple.com/documentation/foundation/nsurlsessiontaskdelegate/1411626-urlsession) + /// + /// If [onResponse] is set then it will be called whenever a valid response + /// is received. The returned [NSURLSessionResponseDisposition] will decide + /// how the content of the response is processed. See + /// [URLSession:dataTask:didReceiveResponse:completionHandler:](https://developer.apple.com/documentation/foundation/nsurlsessiondatadelegate/1410027-urlsession) + /// + /// If [onData] is set then it will be called whenever response data is + /// received. If the amount of received data is large, then it may be + /// called more than once. See + /// [URLSession:dataTask:didReceiveData:](https://developer.apple.com/documentation/foundation/nsurlsessiondatadelegate/1411528-urlsession) + /// + /// If [onFinishedDownloading] is set then it will be called whenever a + /// [URLSessionDownloadTask] has finished downloading. + /// + /// If [onComplete] is set then it will be called when a task completes. If + /// `error` is `null` then the request completed successfully. See + /// [URLSession:task:didCompleteWithError:](https://developer.apple.com/documentation/foundation/nsurlsessiontaskdelegate/1411610-urlsession) + /// + /// See [sessionWithConfiguration:delegate:delegateQueue:](https://developer.apple.com/documentation/foundation/nsurlsession/1411597-sessionwithconfiguration) + /// + /// If [onWebSocketTaskOpened] is set then it will be called when a + /// [URLSessionWebSocketTask] successfully negotiated the handshake with the + /// server. + /// + /// If [onWebSocketTaskClosed] is set then it will be called if a + /// [URLSessionWebSocketTask] receives a close control frame from the server. + /// NOTE: A [URLSessionWebSocketTask.receiveMessage] must be in flight for + /// [onWebSocketTaskClosed] to be called. + factory URLSession.sessionWithConfiguration( + URLSessionConfiguration config, { + URLRequest? Function(URLSession session, URLSessionTask task, + HTTPURLResponse response, URLRequest newRequest)? + onRedirect, + NSURLSessionResponseDisposition Function( + URLSession session, URLSessionTask task, URLResponse response)? + onResponse, + void Function(URLSession session, URLSessionTask task, objc.NSData data)? + onData, + void Function(URLSession session, URLSessionDownloadTask task, Uri uri)? + onFinishedDownloading, + void Function(URLSession session, URLSessionTask task, objc.NSError? error)? + onComplete, + void Function( + URLSession session, URLSessionWebSocketTask task, String? protocol)? + onWebSocketTaskOpened, + void Function(URLSession session, URLSessionWebSocketTask task, + int? closeCode, objc.NSData? reason)? + onWebSocketTaskClosed, + }) { + // Avoid the complexity of simultaneous or out-of-order delegate callbacks + // by only allowing callbacks to execute sequentially. + // See https://developer.apple.com/forums/thread/47252 + final queue = ncb.NSOperationQueue.new1() + ..maxConcurrentOperationCount = 1 + ..name = 'cupertino_http.NSURLSessionDelegateQueue'.toNSString(); + + final hasDelegate = (onRedirect ?? + onResponse ?? + onData ?? + onFinishedDownloading ?? + onComplete ?? + onWebSocketTaskOpened ?? + onWebSocketTaskClosed) != + null; + + if (hasDelegate) { + return URLSession._( + ncb.NSURLSession.sessionWithConfiguration_delegate_delegateQueue_( + config._nsObject, + delegate(config._isBackground, + onRedirect: onRedirect, + onResponse: onResponse, + onData: onData, + onFinishedDownloading: onFinishedDownloading, + onComplete: onComplete, + onWebSocketTaskOpened: onWebSocketTaskOpened, + onWebSocketTaskClosed: onWebSocketTaskClosed), + queue), + isBackground: config._isBackground, + hasDelegate: true, + ); + } else { + return URLSession._( + ncb.NSURLSession.sessionWithConfiguration_(config._nsObject), + isBackground: config._isBackground, + hasDelegate: false); + } + } + + /// A **copy** of the configuration for this session. + /// + /// See [NSURLSession.configuration](https://developer.apple.com/documentation/foundation/nsurlsession/1411477-configuration) + URLSessionConfiguration get configuration => URLSessionConfiguration._( + ncb.NSURLSessionConfiguration.castFrom(_nsObject.configuration), + isBackground: _isBackground); + + /// A description of the session that may be useful for debugging. + /// + /// See [NSURLSession.sessionDescription](https://developer.apple.com/documentation/foundation/nsurlsession/1408277-sessiondescription) + String? get sessionDescription => _nsObject.sessionDescription?.toString(); + set sessionDescription(String? value) => + _nsObject.sessionDescription = value?.toNSString(); + + /// Create a [URLSessionTask] that accesses a server URL. + /// + /// See [NSURLSession dataTaskWithRequest:](https://developer.apple.com/documentation/foundation/nsurlsession/1410592-datataskwithrequest) + URLSessionTask dataTaskWithRequest(URLRequest request) { + final task = + URLSessionTask._(_nsObject.dataTaskWithRequest_(request._nsObject)); + if (_hasDelegate) { + _incrementTaskCount(); + } + return task; + } + + /// Creates a [URLSessionTask] that accesses a server URL and calls + /// [completion] when done. + /// + /// See [NSURLSession dataTaskWithRequest:completionHandler:](https://developer.apple.com/documentation/foundation/nsurlsession/1407613-datataskwithrequest) + URLSessionTask dataTaskWithCompletionHandler( + URLRequest request, + void Function( + objc.NSData? data, URLResponse? response, objc.NSError? error) + completion) { + if (_isBackground) { + throw UnsupportedError( + 'dataTaskWithCompletionHandler is not supported in background ' + 'sessions'); + } + final completer = + ncb.ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError.listener( + (data, response, error) { + _decrementTaskCount(); + completion( + data, + response == null ? null : URLResponse._exactURLResponseType(response), + error, + ); + }); + + final task = _nsObject.dataTaskWithRequest_completionHandler_( + request._nsObject, + completer, + ); + + _incrementTaskCount(); + return URLSessionTask._(task); + } + + /// Creates a [URLSessionDownloadTask] that downloads the data from a server + /// URL. + /// + /// Provide a `onFinishedDownloading` handler in the [URLSession] factory to + /// receive notifications when the data has completed downloaded. + /// + /// See [NSURLSession downloadTaskWithRequest:](https://developer.apple.com/documentation/foundation/nsurlsession/1411481-downloadtaskwithrequest) + URLSessionDownloadTask downloadTaskWithRequest(URLRequest request) { + final task = URLSessionDownloadTask._( + _nsObject.downloadTaskWithRequest_(request._nsObject)); + if (_hasDelegate) { + _incrementTaskCount(); + } + return task; + } + + /// Creates a [URLSessionWebSocketTask] that represents a connection to a + /// WebSocket endpoint. + /// + /// To add custom protocols, add a "Sec-WebSocket-Protocol" header with a list + /// of protocols to [request]. + /// + /// See [NSURLSession webSocketTaskWithRequest:](https://developer.apple.com/documentation/foundation/nsurlsession/3235750-websockettaskwithrequest) + URLSessionWebSocketTask webSocketTaskWithRequest(URLRequest request) { + if (_isBackground) { + throw UnsupportedError( + 'WebSocket tasks are not supported in background sessions'); + } + final task = URLSessionWebSocketTask._( + _nsObject.webSocketTaskWithRequest_(request._nsObject)); + if (_hasDelegate) { + _incrementTaskCount(); + } + return task; + } + + /// Creates a [URLSessionWebSocketTask] that represents a connection to a + /// WebSocket endpoint. + /// + /// See [NSURLSession webSocketTaskWithURL:protocols:](https://developer.apple.com/documentation/foundation/nsurlsession/3181172-websockettaskwithurl) + URLSessionWebSocketTask webSocketTaskWithURL(Uri uri, + {Iterable? protocols}) { + if (_isBackground) { + throw UnsupportedError( + 'WebSocket tasks are not supported in background sessions'); + } + final URLSessionWebSocketTask task; + if (protocols == null) { + task = URLSessionWebSocketTask._( + _nsObject.webSocketTaskWithURL_(uriToNSURL(uri))); + } else { + task = URLSessionWebSocketTask._( + _nsObject.webSocketTaskWithURL_protocols_( + uriToNSURL(uri), stringIterableToNSArray(protocols))); + } + if (_hasDelegate) { + _incrementTaskCount(); + } + return task; + } + + /// Free resources related to this session after the last task completes. + /// Returns immediately. + /// + /// See [NSURLSession finishTasksAndInvalidate](https://developer.apple.com/documentation/foundation/nsurlsession/1407428-finishtasksandinvalidate) + void finishTasksAndInvalidate() { + _nsObject.finishTasksAndInvalidate(); + } +} diff --git a/pkgs/cupertino_http/lib/src/cupertino_client.dart b/pkgs/cupertino_http/lib/src/cupertino_client.dart new file mode 100644 index 0000000000..041f7f584c --- /dev/null +++ b/pkgs/cupertino_http/lib/src/cupertino_client.dart @@ -0,0 +1,411 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:http_profile/http_profile.dart'; +import 'package:objective_c/objective_c.dart'; + +import 'cupertino_api.dart'; + +final _digitRegex = RegExp(r'^\d+$'); + +/// This class can be removed when `package:http` v2 is released. +class _StreamedResponseWithUrl extends StreamedResponse + implements BaseResponseWithUrl { + @override + final Uri url; + + _StreamedResponseWithUrl(super.stream, super.statusCode, + {required this.url, + super.contentLength, + super.request, + super.headers, + super.isRedirect, + super.reasonPhrase}); +} + +class _TaskTracker { + final responseCompleter = Completer(); + final BaseRequest request; + final responseController = StreamController(); + final HttpClientRequestProfile? profile; + int numRedirects = 0; + Uri? lastUrl; // The last URL redirected to. + + _TaskTracker(this.request, this.profile); + + void close() { + responseController.close(); + } +} + +/// A HTTP [Client] based on the +/// [Foundation URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system). +/// +/// For example: +/// ``` +/// void main() async { +/// var client = CupertinoClient.defaultSessionConfiguration(); +/// final response = await client.get( +/// Uri.https('www.googleapis.com', '/books/v1/volumes', {'q': '{http}'})); +/// if (response.statusCode != 200) { +/// throw HttpException('bad response: ${response.statusCode}'); +/// } +/// +/// final decodedResponse = +/// jsonDecode(utf8.decode(response.bodyBytes)) as Map; +/// +/// final itemCount = decodedResponse['totalItems']; +/// print('Number of books about http: $itemCount.'); +/// for (var i = 0; i < min(itemCount, 10); ++i) { +/// print(decodedResponse['items'][i]['volumeInfo']['title']); +/// } +/// } +/// ``` +class CupertinoClient extends BaseClient { + static final Map _tasks = {}; + + URLSession? _urlSession; + + CupertinoClient._(this._urlSession); + + String? _findReasonPhrase(int statusCode) { + switch (statusCode) { + case HttpStatus.continue_: + return 'Continue'; + case HttpStatus.switchingProtocols: + return 'Switching Protocols'; + case HttpStatus.ok: + return 'OK'; + case HttpStatus.created: + return 'Created'; + case HttpStatus.accepted: + return 'Accepted'; + case HttpStatus.nonAuthoritativeInformation: + return 'Non-Authoritative Information'; + case HttpStatus.noContent: + return 'No Content'; + case HttpStatus.resetContent: + return 'Reset Content'; + case HttpStatus.partialContent: + return 'Partial Content'; + case HttpStatus.multipleChoices: + return 'Multiple Choices'; + case HttpStatus.movedPermanently: + return 'Moved Permanently'; + case HttpStatus.found: + return 'Found'; + case HttpStatus.seeOther: + return 'See Other'; + case HttpStatus.notModified: + return 'Not Modified'; + case HttpStatus.useProxy: + return 'Use Proxy'; + case HttpStatus.temporaryRedirect: + return 'Temporary Redirect'; + case HttpStatus.badRequest: + return 'Bad Request'; + case HttpStatus.unauthorized: + return 'Unauthorized'; + case HttpStatus.paymentRequired: + return 'Payment Required'; + case HttpStatus.forbidden: + return 'Forbidden'; + case HttpStatus.notFound: + return 'Not Found'; + case HttpStatus.methodNotAllowed: + return 'Method Not Allowed'; + case HttpStatus.notAcceptable: + return 'Not Acceptable'; + case HttpStatus.proxyAuthenticationRequired: + return 'Proxy Authentication Required'; + case HttpStatus.requestTimeout: + return 'Request Time-out'; + case HttpStatus.conflict: + return 'Conflict'; + case HttpStatus.gone: + return 'Gone'; + case HttpStatus.lengthRequired: + return 'Length Required'; + case HttpStatus.preconditionFailed: + return 'Precondition Failed'; + case HttpStatus.requestEntityTooLarge: + return 'Request Entity Too Large'; + case HttpStatus.requestUriTooLong: + return 'Request-URI Too Long'; + case HttpStatus.unsupportedMediaType: + return 'Unsupported Media Type'; + case HttpStatus.requestedRangeNotSatisfiable: + return 'Requested range not satisfiable'; + case HttpStatus.expectationFailed: + return 'Expectation Failed'; + case HttpStatus.internalServerError: + return 'Internal Server Error'; + case HttpStatus.notImplemented: + return 'Not Implemented'; + case HttpStatus.badGateway: + return 'Bad Gateway'; + case HttpStatus.serviceUnavailable: + return 'Service Unavailable'; + case HttpStatus.gatewayTimeout: + return 'Gateway Time-out'; + case HttpStatus.httpVersionNotSupported: + return 'Http Version not supported'; + default: + return null; + } + } + + static _TaskTracker _tracker(URLSessionTask task) => _tasks[task]!; + + static void _onComplete( + URLSession session, URLSessionTask task, NSError? error) { + final taskTracker = _tracker(task); + if (error != null) { + final exception = ClientException( + error.localizedDescription.toString(), taskTracker.request.url); + if (taskTracker.profile != null && + taskTracker.profile!.requestData.endTime == null) { + // Error occurred during the request. + taskTracker.profile!.requestData.closeWithError(exception.toString()); + } else { + // Error occurred during the response. + taskTracker.profile?.responseData.closeWithError(exception.toString()); + } + if (taskTracker.responseCompleter.isCompleted) { + taskTracker.responseController.addError(exception); + } else { + taskTracker.responseCompleter.completeError(exception); + } + } else { + assert(taskTracker.profile == null || + taskTracker.profile!.requestData.endTime != null); + + taskTracker.profile?.responseData.close(); + if (!taskTracker.responseCompleter.isCompleted) { + taskTracker.responseCompleter.completeError( + StateError('task completed without an error or response')); + } + } + taskTracker.close(); + _tasks.remove(task); + } + + static void _onData(URLSession session, URLSessionTask task, NSData data) { + final taskTracker = _tracker(task); + taskTracker.responseController.add(data.toList()); + taskTracker.profile?.responseData.bodySink.add(data.toList()); + } + + static URLRequest? _onRedirect(URLSession session, URLSessionTask task, + HTTPURLResponse response, URLRequest request) { + final taskTracker = _tracker(task); + ++taskTracker.numRedirects; + if (taskTracker.request.followRedirects && + taskTracker.numRedirects <= taskTracker.request.maxRedirects) { + taskTracker.profile?.responseData.addRedirect(HttpProfileRedirectData( + statusCode: response.statusCode, + method: request.httpMethod, + location: request.url!.toString())); + taskTracker.lastUrl = request.url; + return request; + } + return null; + } + + static NSURLSessionResponseDisposition _onResponse( + URLSession session, URLSessionTask task, URLResponse response) { + final taskTracker = _tracker(task); + taskTracker.responseCompleter.complete(response); + unawaited(taskTracker.profile?.requestData.close()); + + return NSURLSessionResponseDisposition.NSURLSessionResponseAllow; + } + + /// A [Client] with the default configuration. + factory CupertinoClient.defaultSessionConfiguration() { + final config = URLSessionConfiguration.defaultSessionConfiguration(); + return CupertinoClient.fromSessionConfiguration(config); + } + + /// A [Client] configured with a [URLSessionConfiguration]. + factory CupertinoClient.fromSessionConfiguration( + URLSessionConfiguration config) { + final session = URLSession.sessionWithConfiguration(config, + onComplete: _onComplete, + onData: _onData, + onRedirect: _onRedirect, + onResponse: _onResponse); + return CupertinoClient._(session); + } + + @override + void close() { + _urlSession?.finishTasksAndInvalidate(); + _urlSession = null; + } + + /// Returns true if [stream] includes at least one list with an element. + /// + /// Since [_hasData] consumes [stream], returns a new stream containing the + /// equivalent data. + static Future<(bool, Stream>)> _hasData( + Stream> stream) async { + final queue = StreamQueue(stream); + while (await queue.hasNext && (await queue.peek).isEmpty) { + await queue.next; + } + + return (await queue.hasNext, queue.rest); + } + + HttpClientRequestProfile? _createProfile(BaseRequest request) => + HttpClientRequestProfile.profile( + requestStartTime: DateTime.now(), + requestMethod: request.method, + requestUri: request.url.toString()); + + @override + Future send(BaseRequest request) async { + // The expected success case flow (without redirects) is: + // 1. send is called by BaseClient + // 2. send starts the request with UrlSession.dataTaskWithRequest and waits + // on a Completer + // 3. _onResponse is called with the HTTP headers, status code, etc. + // 4. _onResponse calls complete on the Completer that send is waiting on. + // 5. send continues executing and returns a StreamedResponse. + // StreamedResponse contains a Stream. + // 6. _onData is called one or more times and adds that to the + // StreamController that controls the Stream + // 7. _onComplete is called after all the data is read and closes the + // StreamController + if (_urlSession == null) { + throw ClientException( + 'HTTP request failed. Client is already closed.', request.url); + } + final urlSession = _urlSession!; + + final stream = request.finalize(); + + final profile = _createProfile(request); + profile?.connectionInfo = { + 'package': 'package:cupertino_http', + 'client': 'CupertinoClient', + 'configuration': _urlSession!.configuration.toString(), + }; + profile?.requestData + ?..contentLength = request.contentLength + ..followRedirects = request.followRedirects + ..headersCommaValues = request.headers + ..maxRedirects = request.maxRedirects; + + final urlRequest = MutableURLRequest.fromUrl(request.url) + ..httpMethod = request.method; + + if (request.contentLength != null) { + profile?.requestData.headersListValues = { + 'Content-Length': ['${request.contentLength}'], + ...profile.requestData.headers! + }; + urlRequest.setValueForHttpHeaderField( + 'Content-Length', '${request.contentLength}'); + } + + if (request is Request) { + // Optimize the (typical) `Request` case since assigning to + // `httpBodyStream` requires a lot of expensive setup and data passing. + urlRequest.httpBody = request.bodyBytes.toNSData(); + profile?.requestData.bodySink.add(request.bodyBytes); + } else if (await _hasData(stream) case (true, final s)) { + // If the request is supposed to be bodyless (e.g. GET requests) + // then setting `httpBodyStream` will cause the request to fail - + // even if the stream is empty. + if (profile == null) { + urlRequest.httpBodyStream = s.toNSInputStream(); + } else { + final splitter = StreamSplitter(s); + urlRequest.httpBodyStream = splitter.split().toNSInputStream(); + unawaited(profile.requestData.bodySink.addStream(splitter.split())); + } + } + + // This will preserve Apple default headers - is that what we want? + request.headers.forEach(urlRequest.setValueForHttpHeaderField); + final task = urlSession.dataTaskWithRequest(urlRequest); + final taskTracker = _TaskTracker(request, profile); + _tasks[task] = taskTracker; + task.resume(); + + final maxRedirects = request.followRedirects ? request.maxRedirects : 0; + + late URLResponse result; + result = await taskTracker.responseCompleter.future; + + final response = result as HTTPURLResponse; + + if (request.followRedirects && taskTracker.numRedirects > maxRedirects) { + throw ClientException('Redirect limit exceeded', request.url); + } + + final responseHeaders = response.allHeaderFields + .map((key, value) => MapEntry(key.toLowerCase(), value)); + + if (responseHeaders['content-length'] case final contentLengthHeader? + when !_digitRegex.hasMatch(contentLengthHeader)) { + throw ClientException( + 'Invalid content-length header [$contentLengthHeader].', + request.url, + ); + } + + final contentLength = response.expectedContentLength == -1 + ? null + : response.expectedContentLength; + final isRedirect = !request.followRedirects && taskTracker.numRedirects > 0; + profile?.responseData + ?..contentLength = contentLength + ..headersCommaValues = responseHeaders + ..isRedirect = isRedirect + ..reasonPhrase = _findReasonPhrase(response.statusCode) + ..startTime = DateTime.now() + ..statusCode = response.statusCode; + + return _StreamedResponseWithUrl( + taskTracker.responseController.stream, + response.statusCode, + url: taskTracker.lastUrl ?? request.url, + contentLength: contentLength, + reasonPhrase: _findReasonPhrase(response.statusCode), + request: request, + isRedirect: isRedirect, + headers: responseHeaders, + ); + } +} + +/// A test-only class that makes the [HttpClientRequestProfile] data available. +class CupertinoClientWithProfile extends CupertinoClient { + HttpClientRequestProfile? profile; + + @override + HttpClientRequestProfile? _createProfile(BaseRequest request) => + profile = super._createProfile(request); + + CupertinoClientWithProfile._(super._urlSession) : super._(); + + factory CupertinoClientWithProfile.defaultSessionConfiguration() { + final config = URLSessionConfiguration.defaultSessionConfiguration(); + final session = URLSession.sessionWithConfiguration(config, + onComplete: CupertinoClient._onComplete, + onData: CupertinoClient._onData, + onRedirect: CupertinoClient._onRedirect, + onResponse: CupertinoClient._onResponse); + return CupertinoClientWithProfile._(session); + } +} diff --git a/pkgs/cupertino_http/lib/src/cupertino_web_socket.dart b/pkgs/cupertino_http/lib/src/cupertino_web_socket.dart new file mode 100644 index 0000000000..124e6c5ba2 --- /dev/null +++ b/pkgs/cupertino_http/lib/src/cupertino_web_socket.dart @@ -0,0 +1,246 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:objective_c/objective_c.dart' as objc; +import 'package:web_socket/web_socket.dart'; + +import 'cupertino_api.dart'; + +/// An error occurred while connecting to the peer. +class ConnectionException extends WebSocketException { + final objc.NSError error; + + ConnectionException(super.message, this.error); + + @override + String toString() => 'CupertinoErrorWebSocketException: $message $error'; +} + +/// A [WebSocket] implemented using the +/// [NSURLSessionWebSocketTask API](https://developer.apple.com/documentation/foundation/nsurlsessionwebsockettask). +/// +/// > [!NOTE] +/// > The [WebSocket] interface is currently experimental and may change in the +/// > future. +/// +/// ```dart +/// import 'package:cupertino_http/cupertino_http.dart'; +/// import 'package:web_socket/web_socket.dart'; +/// +/// void main() async { +/// final socket = await CupertinoWebSocket.connect( +/// Uri.parse('wss://ws.postman-echo.com/raw')); +/// +/// socket.events.listen((e) async { +/// switch (e) { +/// case TextDataReceived(text: final text): +/// print('Received Text: $text'); +/// await socket.close(); +/// case BinaryDataReceived(data: final data): +/// print('Received Binary: $data'); +/// case CloseReceived(code: final code, reason: final reason): +/// print('Connection to server closed: $code [$reason]'); +/// } +/// }); +/// } +/// ``` +/// +/// > [!TIP] +/// > [`AdapterWebSocketChannel`](https://pub.dev/documentation/web_socket_channel/latest/adapter_web_socket_channel/AdapterWebSocketChannel-class.html) +/// > can be used to adapt a [CupertinoWebSocket] into a +/// > [`WebSocketChannel`](https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketChannel-class.html). +class CupertinoWebSocket implements WebSocket { + /// Create a new WebSocket connection using the + /// [NSURLSessionWebSocketTask API](https://developer.apple.com/documentation/foundation/nsurlsessionwebsockettask). + /// + /// The URL supplied in [url] must use the scheme ws or wss. + /// + /// If provided, the [protocols] argument indicates that subprotocols that + /// the peer is able to select. See + /// [RFC-6455 1.9](https://datatracker.ietf.org/doc/html/rfc6455#section-1.9). + /// + /// NOTE: the [WebSocket] interface is currently experimental and may change + /// in the future. + static Future connect(Uri url, + {Iterable? protocols, URLSessionConfiguration? config}) async { + if (!url.isScheme('ws') && !url.isScheme('wss')) { + throw ArgumentError.value( + url, 'url', 'only ws: and wss: schemes are supported'); + } + + final readyCompleter = Completer(); + late CupertinoWebSocket webSocket; + + final session = URLSession.sessionWithConfiguration( + config ?? URLSessionConfiguration.defaultSessionConfiguration(), + // In a successful flow, the callbacks will be made in this order: + // onWebSocketTaskOpened(...) // Good connect. + // + // onWebSocketTaskClosed(...) // Optional: peer sent Close frame. + // onComplete(..., error=null) // Disconnected. + // + // In a failure to connect to the peer, the flow will be: + // onComplete(session, task, error=error): + // + // `onComplete` can also be called at any point if the peer is + // disconnected without Close frames being exchanged. + onWebSocketTaskOpened: (session, task, protocol) { + webSocket = CupertinoWebSocket._(task, protocol ?? ''); + readyCompleter.complete(webSocket); + }, onWebSocketTaskClosed: (session, task, closeCode, reason) { + assert(readyCompleter.isCompleted); + webSocket._connectionClosed(closeCode, reason); + }, onComplete: (session, task, error) { + if (!readyCompleter.isCompleted) { + // `onWebSocketTaskOpened should have been called and completed + // `readyCompleter`. So either there was a error creating the connection + // or a logic error. + if (error == null) { + throw AssertionError( + 'expected an error or "onWebSocketTaskOpened" to be called ' + 'first'); + } + readyCompleter.completeError( + ConnectionException('connection ended unexpectedly', error)); + } else { + // There are three possibilities here: + // 1. the peer sent a close Frame, `onWebSocketTaskClosed` was already + // called and `_connectionClosed` is a no-op. + // 2. we sent a close Frame (through `close()`) and `_connectionClosed` + // is a no-op. + // 3. an error occurred (e.g. network failure) and `_connectionClosed` + // will signal that and close `event`. + webSocket._connectionClosed( + 1006, 'abnormal close'.codeUnits.toNSData()); + } + }); + + session.webSocketTaskWithURL(url, protocols: protocols).resume(); + return readyCompleter.future; + } + + final URLSessionWebSocketTask _task; + final String _protocol; + final _events = StreamController(); + + CupertinoWebSocket._(this._task, this._protocol) { + _scheduleReceive(); + } + + /// Handle an incoming message from the peer and schedule receiving the next + /// message. + void _handleMessage(URLSessionWebSocketMessage value) { + if (_events.isClosed) return; + + late WebSocketEvent event; + switch (value.type) { + case NSURLSessionWebSocketMessageType + .NSURLSessionWebSocketMessageTypeString: + event = TextDataReceived(value.string!); + break; + case NSURLSessionWebSocketMessageType + .NSURLSessionWebSocketMessageTypeData: + event = BinaryDataReceived(value.data!.toList()); + break; + } + _events.add(event); + _scheduleReceive(); + } + + void _scheduleReceive() { + unawaited(_task + .receiveMessage() + .then(_handleMessage, onError: _closeConnectionWithError)); + } + + /// Close the WebSocket connection due to an error and send the + /// [CloseReceived] event. + void _closeConnectionWithError(Object e) { + if (e is objc.NSError) { + if (e.domain.toString() == 'NSPOSIXErrorDomain' && e.code == 57) { + // Socket is not connected. + // onWebSocketTaskClosed/onComplete will be invoked and may indicate a + // close code. + return; + } + var (int code, String? reason) = switch ([e.domain.toString(), e.code]) { + ['NSPOSIXErrorDomain', 100] => ( + 1002, + e.localizedDescription.toString() + ), + _ => (1006, e.localizedDescription.toString()) + }; + _task.cancel(); + _connectionClosed(code, reason.codeUnits.toNSData()); + } else { + throw StateError('unexpected error: $e'); + } + } + + void _connectionClosed(int? closeCode, objc.NSData? reason) { + if (!_events.isClosed) { + final closeReason = reason == null ? '' : utf8.decode(reason.toList()); + + _events + ..add(CloseReceived(closeCode, closeReason)) + ..close(); + } + } + + @override + void sendBytes(Uint8List b) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + _task + .sendMessage(URLSessionWebSocketMessage.fromData(b.toNSData())) + .then((value) => value, onError: _closeConnectionWithError); + } + + @override + void sendText(String s) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + _task + .sendMessage(URLSessionWebSocketMessage.fromString(s)) + .then((value) => value, onError: _closeConnectionWithError); + } + + @override + Future close([int? code, String? reason]) async { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + + if (code != null && code != 1000 && !(code >= 3000 && code <= 4999)) { + throw ArgumentError('Invalid argument: $code, close code must be 1000 or ' + 'in the range 3000-4999'); + } + if (reason != null && utf8.encode(reason).length > 123) { + throw ArgumentError.value(reason, 'reason', + 'reason must be <= 123 bytes long when encoded as UTF-8'); + } + + if (!_events.isClosed) { + unawaited(_events.close()); + if (code != null) { + reason = reason ?? ''; + _task.cancelWithCloseCode(code, utf8.encode(reason).toNSData()); + } else { + _task.cancel(); + } + } + } + + @override + Stream get events => _events.stream; + + @override + String get protocol => _protocol; +} diff --git a/pkgs/cupertino_http/lib/src/native_cupertino_bindings.dart b/pkgs/cupertino_http/lib/src/native_cupertino_bindings.dart new file mode 100644 index 0000000000..9cc83b62e0 --- /dev/null +++ b/pkgs/cupertino_http/lib/src/native_cupertino_bindings.dart @@ -0,0 +1,91686 @@ +// ignore_for_file: always_specify_types +// ignore_for_file: camel_case_types +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: return_of_invalid_type + +// AUTO GENERATED FILE, DO NOT EDIT. +// +// Generated by `package:ffigen`. +// ignore_for_file: type=lint +import 'dart:ffi' as ffi; +import 'package:objective_c/objective_c.dart' as objc; +import 'package:ffi/ffi.dart' as pkg_ffi; + +/// Bindings for the Foundation URL Loading System and supporting libraries. +/// +/// Regenerate bindings with `flutter packages pub run ffigen --config ffigen.yaml`. +/// +class NativeCupertinoHttp { + /// Holds the symbol lookup function. + final ffi.Pointer Function(String symbolName) + _lookup; + + /// The symbols are looked up in [dynamicLibrary]. + NativeCupertinoHttp(ffi.DynamicLibrary dynamicLibrary) + : _lookup = dynamicLibrary.lookup; + + /// The symbols are looked up with [lookup]. + NativeCupertinoHttp.fromLookup( + ffi.Pointer Function(String symbolName) + lookup) + : _lookup = lookup; + + ffi.Pointer> signal( + int arg0, + ffi.Pointer> arg1, + ) { + return _signal( + arg0, + arg1, + ); + } + + late final _signalPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer> Function( + ffi.Int, + ffi.Pointer< + ffi.NativeFunction>)>>('signal'); + late final _signal = _signalPtr.asFunction< + ffi.Pointer> Function( + int, ffi.Pointer>)>(); + + int getpriority( + int arg0, + int arg1, + ) { + return _getpriority( + arg0, + arg1, + ); + } + + late final _getpriorityPtr = + _lookup>( + 'getpriority'); + late final _getpriority = + _getpriorityPtr.asFunction(); + + int getiopolicy_np( + int arg0, + int arg1, + ) { + return _getiopolicy_np( + arg0, + arg1, + ); + } + + late final _getiopolicy_npPtr = + _lookup>( + 'getiopolicy_np'); + late final _getiopolicy_np = + _getiopolicy_npPtr.asFunction(); + + int getrlimit( + int arg0, + ffi.Pointer arg1, + ) { + return _getrlimit( + arg0, + arg1, + ); + } + + late final _getrlimitPtr = _lookup< + ffi.NativeFunction)>>( + 'getrlimit'); + late final _getrlimit = + _getrlimitPtr.asFunction)>(); + + int getrusage( + int arg0, + ffi.Pointer arg1, + ) { + return _getrusage( + arg0, + arg1, + ); + } + + late final _getrusagePtr = _lookup< + ffi.NativeFunction)>>( + 'getrusage'); + late final _getrusage = + _getrusagePtr.asFunction)>(); + + int setpriority( + int arg0, + int arg1, + int arg2, + ) { + return _setpriority( + arg0, + arg1, + arg2, + ); + } + + late final _setpriorityPtr = + _lookup>( + 'setpriority'); + late final _setpriority = + _setpriorityPtr.asFunction(); + + int setiopolicy_np( + int arg0, + int arg1, + int arg2, + ) { + return _setiopolicy_np( + arg0, + arg1, + arg2, + ); + } + + late final _setiopolicy_npPtr = + _lookup>( + 'setiopolicy_np'); + late final _setiopolicy_np = + _setiopolicy_npPtr.asFunction(); + + int setrlimit( + int arg0, + ffi.Pointer arg1, + ) { + return _setrlimit( + arg0, + arg1, + ); + } + + late final _setrlimitPtr = _lookup< + ffi.NativeFunction)>>( + 'setrlimit'); + late final _setrlimit = + _setrlimitPtr.asFunction)>(); + + int wait1( + ffi.Pointer arg0, + ) { + return _wait1( + arg0, + ); + } + + late final _wait1Ptr = + _lookup)>>('wait'); + late final _wait1 = + _wait1Ptr.asFunction)>(); + + int waitpid( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _waitpid( + arg0, + arg1, + arg2, + ); + } + + late final _waitpidPtr = _lookup< + ffi.NativeFunction< + pid_t Function(pid_t, ffi.Pointer, ffi.Int)>>('waitpid'); + late final _waitpid = + _waitpidPtr.asFunction, int)>(); + + int waitid( + idtype_t arg0, + Dart__uint32_t arg1, + ffi.Pointer arg2, + int arg3, + ) { + return _waitid( + arg0.value, + arg1, + arg2, + arg3, + ); + } + + late final _waitidPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.UnsignedInt, id_t, ffi.Pointer, + ffi.Int)>>('waitid'); + late final _waitid = _waitidPtr + .asFunction, int)>(); + + int wait3( + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2, + ) { + return _wait3( + arg0, + arg1, + arg2, + ); + } + + late final _wait3Ptr = _lookup< + ffi.NativeFunction< + pid_t Function( + ffi.Pointer, ffi.Int, ffi.Pointer)>>('wait3'); + late final _wait3 = _wait3Ptr.asFunction< + int Function(ffi.Pointer, int, ffi.Pointer)>(); + + int wait4( + int arg0, + ffi.Pointer arg1, + int arg2, + ffi.Pointer arg3, + ) { + return _wait4( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _wait4Ptr = _lookup< + ffi.NativeFunction< + pid_t Function(pid_t, ffi.Pointer, ffi.Int, + ffi.Pointer)>>('wait4'); + late final _wait4 = _wait4Ptr.asFunction< + int Function(int, ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer alloca( + int arg0, + ) { + return _alloca( + arg0, + ); + } + + late final _allocaPtr = + _lookup Function(ffi.Size)>>( + 'alloca'); + late final _alloca = + _allocaPtr.asFunction Function(int)>(); + + late final ffi.Pointer ___mb_cur_max = + _lookup('__mb_cur_max'); + + int get __mb_cur_max => ___mb_cur_max.value; + + set __mb_cur_max(int value) => ___mb_cur_max.value = value; + + ffi.Pointer malloc_type_malloc( + int size, + int type_id, + ) { + return _malloc_type_malloc( + size, + type_id, + ); + } + + late final _malloc_type_mallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Size, malloc_type_id_t)>>('malloc_type_malloc'); + late final _malloc_type_malloc = _malloc_type_mallocPtr + .asFunction Function(int, int)>(); + + ffi.Pointer malloc_type_calloc( + int count, + int size, + int type_id, + ) { + return _malloc_type_calloc( + count, + size, + type_id, + ); + } + + late final _malloc_type_callocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Size, ffi.Size, malloc_type_id_t)>>('malloc_type_calloc'); + late final _malloc_type_calloc = _malloc_type_callocPtr + .asFunction Function(int, int, int)>(); + + void malloc_type_free( + ffi.Pointer ptr, + int type_id, + ) { + return _malloc_type_free( + ptr, + type_id, + ); + } + + late final _malloc_type_freePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, malloc_type_id_t)>>('malloc_type_free'); + late final _malloc_type_free = _malloc_type_freePtr + .asFunction, int)>(); + + ffi.Pointer malloc_type_realloc( + ffi.Pointer ptr, + int size, + int type_id, + ) { + return _malloc_type_realloc( + ptr, + size, + type_id, + ); + } + + late final _malloc_type_reallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + malloc_type_id_t)>>('malloc_type_realloc'); + late final _malloc_type_realloc = _malloc_type_reallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer malloc_type_valloc( + int size, + int type_id, + ) { + return _malloc_type_valloc( + size, + type_id, + ); + } + + late final _malloc_type_vallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Size, malloc_type_id_t)>>('malloc_type_valloc'); + late final _malloc_type_valloc = _malloc_type_vallocPtr + .asFunction Function(int, int)>(); + + ffi.Pointer malloc_type_aligned_alloc( + int alignment, + int size, + int type_id, + ) { + return _malloc_type_aligned_alloc( + alignment, + size, + type_id, + ); + } + + late final _malloc_type_aligned_allocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size, + malloc_type_id_t)>>('malloc_type_aligned_alloc'); + late final _malloc_type_aligned_alloc = _malloc_type_aligned_allocPtr + .asFunction Function(int, int, int)>(); + + int malloc_type_posix_memalign( + ffi.Pointer> memptr, + int alignment, + int size, + int type_id, + ) { + return _malloc_type_posix_memalign( + memptr, + alignment, + size, + type_id, + ); + } + + late final _malloc_type_posix_memalignPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, ffi.Size, + ffi.Size, malloc_type_id_t)>>('malloc_type_posix_memalign'); + late final _malloc_type_posix_memalign = + _malloc_type_posix_memalignPtr.asFunction< + int Function(ffi.Pointer>, int, int, int)>(); + + ffi.Pointer malloc_type_zone_malloc( + ffi.Pointer zone, + int size, + int type_id, + ) { + return _malloc_type_zone_malloc( + zone, + size, + type_id, + ); + } + + late final _malloc_type_zone_mallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + malloc_type_id_t)>>('malloc_type_zone_malloc'); + late final _malloc_type_zone_malloc = _malloc_type_zone_mallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer malloc_type_zone_calloc( + ffi.Pointer zone, + int count, + int size, + int type_id, + ) { + return _malloc_type_zone_calloc( + zone, + count, + size, + type_id, + ); + } + + late final _malloc_type_zone_callocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + ffi.Size, malloc_type_id_t)>>('malloc_type_zone_calloc'); + late final _malloc_type_zone_calloc = _malloc_type_zone_callocPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, int, int)>(); + + void malloc_type_zone_free( + ffi.Pointer zone, + ffi.Pointer ptr, + int type_id, + ) { + return _malloc_type_zone_free( + zone, + ptr, + type_id, + ); + } + + late final _malloc_type_zone_freePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + malloc_type_id_t)>>('malloc_type_zone_free'); + late final _malloc_type_zone_free = _malloc_type_zone_freePtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer malloc_type_zone_realloc( + ffi.Pointer zone, + ffi.Pointer ptr, + int size, + int type_id, + ) { + return _malloc_type_zone_realloc( + zone, + ptr, + size, + type_id, + ); + } + + late final _malloc_type_zone_reallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + malloc_type_id_t)>>('malloc_type_zone_realloc'); + late final _malloc_type_zone_realloc = + _malloc_type_zone_reallocPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int, int)>(); + + ffi.Pointer malloc_type_zone_valloc( + ffi.Pointer zone, + int size, + int type_id, + ) { + return _malloc_type_zone_valloc( + zone, + size, + type_id, + ); + } + + late final _malloc_type_zone_vallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + malloc_type_id_t)>>('malloc_type_zone_valloc'); + late final _malloc_type_zone_valloc = _malloc_type_zone_vallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer malloc_type_zone_memalign( + ffi.Pointer zone, + int alignment, + int size, + int type_id, + ) { + return _malloc_type_zone_memalign( + zone, + alignment, + size, + type_id, + ); + } + + late final _malloc_type_zone_memalignPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + ffi.Size, malloc_type_id_t)>>('malloc_type_zone_memalign'); + late final _malloc_type_zone_memalign = + _malloc_type_zone_memalignPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, int, int)>(); + + ffi.Pointer malloc( + int __size, + ) { + return _malloc( + __size, + ); + } + + late final _mallocPtr = + _lookup Function(ffi.Size)>>( + 'malloc'); + late final _malloc = + _mallocPtr.asFunction Function(int)>(); + + ffi.Pointer calloc( + int __count, + int __size, + ) { + return _calloc( + __count, + __size, + ); + } + + late final _callocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size)>>('calloc'); + late final _calloc = + _callocPtr.asFunction Function(int, int)>(); + + void free( + ffi.Pointer arg0, + ) { + return _free( + arg0, + ); + } + + late final _freePtr = + _lookup)>>( + 'free'); + late final _free = + _freePtr.asFunction)>(); + + ffi.Pointer realloc( + ffi.Pointer __ptr, + int __size, + ) { + return _realloc( + __ptr, + __size, + ); + } + + late final _reallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size)>>('realloc'); + late final _realloc = _reallocPtr + .asFunction Function(ffi.Pointer, int)>(); + + ffi.Pointer reallocf( + ffi.Pointer __ptr, + int __size, + ) { + return _reallocf( + __ptr, + __size, + ); + } + + late final _reallocfPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size)>>('reallocf'); + late final _reallocf = _reallocfPtr + .asFunction Function(ffi.Pointer, int)>(); + + ffi.Pointer valloc( + int arg0, + ) { + return _valloc( + arg0, + ); + } + + late final _vallocPtr = + _lookup Function(ffi.Size)>>( + 'valloc'); + late final _valloc = + _vallocPtr.asFunction Function(int)>(); + + ffi.Pointer aligned_alloc( + int __alignment, + int __size, + ) { + return _aligned_alloc( + __alignment, + __size, + ); + } + + late final _aligned_allocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size)>>('aligned_alloc'); + late final _aligned_alloc = + _aligned_allocPtr.asFunction Function(int, int)>(); + + int posix_memalign( + ffi.Pointer> __memptr, + int __alignment, + int __size, + ) { + return _posix_memalign( + __memptr, + __alignment, + __size, + ); + } + + late final _posix_memalignPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, ffi.Size, + ffi.Size)>>('posix_memalign'); + late final _posix_memalign = _posix_memalignPtr + .asFunction>, int, int)>(); + + void abort() { + return _abort(); + } + + late final _abortPtr = + _lookup>('abort'); + late final _abort = _abortPtr.asFunction(); + + int abs( + int arg0, + ) { + return _abs( + arg0, + ); + } + + late final _absPtr = + _lookup>('abs'); + late final _abs = _absPtr.asFunction(); + + int atexit( + ffi.Pointer> arg0, + ) { + return _atexit( + arg0, + ); + } + + late final _atexitPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>)>>('atexit'); + late final _atexit = _atexitPtr.asFunction< + int Function(ffi.Pointer>)>(); + + double atof( + ffi.Pointer arg0, + ) { + return _atof( + arg0, + ); + } + + late final _atofPtr = + _lookup)>>( + 'atof'); + late final _atof = + _atofPtr.asFunction)>(); + + int atoi( + ffi.Pointer arg0, + ) { + return _atoi( + arg0, + ); + } + + late final _atoiPtr = + _lookup)>>( + 'atoi'); + late final _atoi = _atoiPtr.asFunction)>(); + + int atol( + ffi.Pointer arg0, + ) { + return _atol( + arg0, + ); + } + + late final _atolPtr = + _lookup)>>( + 'atol'); + late final _atol = _atolPtr.asFunction)>(); + + int atoll( + ffi.Pointer arg0, + ) { + return _atoll( + arg0, + ); + } + + late final _atollPtr = + _lookup)>>( + 'atoll'); + late final _atoll = + _atollPtr.asFunction)>(); + + ffi.Pointer bsearch( + ffi.Pointer __key, + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _bsearch( + __key, + __base, + __nel, + __width, + __compar, + ); + } + + late final _bsearchPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('bsearch'); + late final _bsearch = _bsearchPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + div_t div( + int arg0, + int arg1, + ) { + return _div( + arg0, + arg1, + ); + } + + late final _divPtr = + _lookup>('div'); + late final _div = _divPtr.asFunction(); + + void exit( + int arg0, + ) { + return _exit1( + arg0, + ); + } + + late final _exitPtr = + _lookup>('exit'); + late final _exit1 = _exitPtr.asFunction(); + + ffi.Pointer getenv( + ffi.Pointer arg0, + ) { + return _getenv( + arg0, + ); + } + + late final _getenvPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('getenv'); + late final _getenv = _getenvPtr + .asFunction Function(ffi.Pointer)>(); + + int labs( + int arg0, + ) { + return _labs( + arg0, + ); + } + + late final _labsPtr = + _lookup>('labs'); + late final _labs = _labsPtr.asFunction(); + + ldiv_t ldiv( + int arg0, + int arg1, + ) { + return _ldiv( + arg0, + arg1, + ); + } + + late final _ldivPtr = + _lookup>('ldiv'); + late final _ldiv = _ldivPtr.asFunction(); + + int llabs( + int arg0, + ) { + return _llabs( + arg0, + ); + } + + late final _llabsPtr = + _lookup>('llabs'); + late final _llabs = _llabsPtr.asFunction(); + + lldiv_t lldiv( + int arg0, + int arg1, + ) { + return _lldiv( + arg0, + arg1, + ); + } + + late final _lldivPtr = + _lookup>( + 'lldiv'); + late final _lldiv = _lldivPtr.asFunction(); + + int mblen( + ffi.Pointer __s, + int __n, + ) { + return _mblen( + __s, + __n, + ); + } + + late final _mblenPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size)>>('mblen'); + late final _mblen = + _mblenPtr.asFunction, int)>(); + + int mbstowcs( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _mbstowcs( + arg0, + arg1, + arg2, + ); + } + + late final _mbstowcsPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('mbstowcs'); + late final _mbstowcs = _mbstowcsPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int mbtowc( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _mbtowc( + arg0, + arg1, + arg2, + ); + } + + late final _mbtowcPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('mbtowc'); + late final _mbtowc = _mbtowcPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + void qsort( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _qsort( + __base, + __nel, + __width, + __compar, + ); + } + + late final _qsortPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('qsort'); + late final _qsort = _qsortPtr.asFunction< + void Function( + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + int rand() { + return _rand(); + } + + late final _randPtr = _lookup>('rand'); + late final _rand = _randPtr.asFunction(); + + void srand( + int arg0, + ) { + return _srand( + arg0, + ); + } + + late final _srandPtr = + _lookup>('srand'); + late final _srand = _srandPtr.asFunction(); + + double strtod( + ffi.Pointer arg0, + ffi.Pointer> arg1, + ) { + return _strtod( + arg0, + arg1, + ); + } + + late final _strtodPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer>)>>('strtod'); + late final _strtod = _strtodPtr.asFunction< + double Function( + ffi.Pointer, ffi.Pointer>)>(); + + double strtof( + ffi.Pointer arg0, + ffi.Pointer> arg1, + ) { + return _strtof( + arg0, + arg1, + ); + } + + late final _strtofPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer>)>>('strtof'); + late final _strtof = _strtofPtr.asFunction< + double Function( + ffi.Pointer, ffi.Pointer>)>(); + + int strtol( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtol( + __str, + __endptr, + __base, + ); + } + + late final _strtolPtr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtol'); + late final _strtol = _strtolPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int strtoll( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoll( + __str, + __endptr, + __base, + ); + } + + late final _strtollPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoll'); + late final _strtoll = _strtollPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int strtoul( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoul( + __str, + __endptr, + __base, + ); + } + + late final _strtoulPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoul'); + late final _strtoul = _strtoulPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int strtoull( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoull( + __str, + __endptr, + __base, + ); + } + + late final _strtoullPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoull'); + late final _strtoull = _strtoullPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int system( + ffi.Pointer arg0, + ) { + return _system( + arg0, + ); + } + + late final _systemPtr = + _lookup)>>( + 'system'); + late final _system = + _systemPtr.asFunction)>(); + + int wcstombs( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _wcstombs( + arg0, + arg1, + arg2, + ); + } + + late final _wcstombsPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('wcstombs'); + late final _wcstombs = _wcstombsPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int wctomb( + ffi.Pointer arg0, + int arg1, + ) { + return _wctomb( + arg0, + arg1, + ); + } + + late final _wctombPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.WChar)>>('wctomb'); + late final _wctomb = + _wctombPtr.asFunction, int)>(); + + void _Exit( + int arg0, + ) { + return __Exit( + arg0, + ); + } + + late final __ExitPtr = + _lookup>('_Exit'); + late final __Exit = __ExitPtr.asFunction(); + + int a64l( + ffi.Pointer arg0, + ) { + return _a64l( + arg0, + ); + } + + late final _a64lPtr = + _lookup)>>( + 'a64l'); + late final _a64l = _a64lPtr.asFunction)>(); + + double drand48() { + return _drand48(); + } + + late final _drand48Ptr = + _lookup>('drand48'); + late final _drand48 = _drand48Ptr.asFunction(); + + ffi.Pointer ecvt( + double arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ) { + return _ecvt( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _ecvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('ecvt'); + late final _ecvt = _ecvtPtr.asFunction< + ffi.Pointer Function( + double, int, ffi.Pointer, ffi.Pointer)>(); + + double erand48( + ffi.Pointer arg0, + ) { + return _erand48( + arg0, + ); + } + + late final _erand48Ptr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer)>>('erand48'); + late final _erand48 = + _erand48Ptr.asFunction)>(); + + ffi.Pointer fcvt( + double arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ) { + return _fcvt( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _fcvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('fcvt'); + late final _fcvt = _fcvtPtr.asFunction< + ffi.Pointer Function( + double, int, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer gcvt( + double arg0, + int arg1, + ffi.Pointer arg2, + ) { + return _gcvt( + arg0, + arg1, + arg2, + ); + } + + late final _gcvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Double, ffi.Int, ffi.Pointer)>>('gcvt'); + late final _gcvt = _gcvtPtr.asFunction< + ffi.Pointer Function(double, int, ffi.Pointer)>(); + + int getsubopt( + ffi.Pointer> arg0, + ffi.Pointer> arg1, + ffi.Pointer> arg2, + ) { + return _getsubopt( + arg0, + arg1, + arg2, + ); + } + + late final _getsuboptPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Pointer>, + ffi.Pointer>)>>('getsubopt'); + late final _getsubopt = _getsuboptPtr.asFunction< + int Function( + ffi.Pointer>, + ffi.Pointer>, + ffi.Pointer>)>(); + + int grantpt( + int arg0, + ) { + return _grantpt( + arg0, + ); + } + + late final _grantptPtr = + _lookup>('grantpt'); + late final _grantpt = _grantptPtr.asFunction(); + + ffi.Pointer initstate( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _initstate( + arg0, + arg1, + arg2, + ); + } + + late final _initstatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.UnsignedInt, ffi.Pointer, ffi.Size)>>('initstate'); + late final _initstate = _initstatePtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int jrand48( + ffi.Pointer arg0, + ) { + return _jrand48( + arg0, + ); + } + + late final _jrand48Ptr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer)>>('jrand48'); + late final _jrand48 = + _jrand48Ptr.asFunction)>(); + + ffi.Pointer l64a( + int arg0, + ) { + return _l64a( + arg0, + ); + } + + late final _l64aPtr = + _lookup Function(ffi.Long)>>( + 'l64a'); + late final _l64a = _l64aPtr.asFunction Function(int)>(); + + void lcong48( + ffi.Pointer arg0, + ) { + return _lcong48( + arg0, + ); + } + + late final _lcong48Ptr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer)>>('lcong48'); + late final _lcong48 = + _lcong48Ptr.asFunction)>(); + + int lrand48() { + return _lrand48(); + } + + late final _lrand48Ptr = + _lookup>('lrand48'); + late final _lrand48 = _lrand48Ptr.asFunction(); + + ffi.Pointer mktemp( + ffi.Pointer arg0, + ) { + return _mktemp( + arg0, + ); + } + + late final _mktempPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('mktemp'); + late final _mktemp = _mktempPtr + .asFunction Function(ffi.Pointer)>(); + + int mkstemp( + ffi.Pointer arg0, + ) { + return _mkstemp( + arg0, + ); + } + + late final _mkstempPtr = + _lookup)>>( + 'mkstemp'); + late final _mkstemp = + _mkstempPtr.asFunction)>(); + + int mrand48() { + return _mrand48(); + } + + late final _mrand48Ptr = + _lookup>('mrand48'); + late final _mrand48 = _mrand48Ptr.asFunction(); + + int nrand48( + ffi.Pointer arg0, + ) { + return _nrand48( + arg0, + ); + } + + late final _nrand48Ptr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer)>>('nrand48'); + late final _nrand48 = + _nrand48Ptr.asFunction)>(); + + int posix_openpt( + int arg0, + ) { + return _posix_openpt( + arg0, + ); + } + + late final _posix_openptPtr = + _lookup>('posix_openpt'); + late final _posix_openpt = _posix_openptPtr.asFunction(); + + ffi.Pointer ptsname( + int arg0, + ) { + return _ptsname( + arg0, + ); + } + + late final _ptsnamePtr = + _lookup Function(ffi.Int)>>( + 'ptsname'); + late final _ptsname = + _ptsnamePtr.asFunction Function(int)>(); + + int ptsname_r( + int fildes, + ffi.Pointer buffer, + int buflen, + ) { + return _ptsname_r( + fildes, + buffer, + buflen, + ); + } + + late final _ptsname_rPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Size)>>('ptsname_r'); + late final _ptsname_r = + _ptsname_rPtr.asFunction, int)>(); + + int putenv( + ffi.Pointer arg0, + ) { + return _putenv( + arg0, + ); + } + + late final _putenvPtr = + _lookup)>>( + 'putenv'); + late final _putenv = + _putenvPtr.asFunction)>(); + + int random() { + return _random(); + } + + late final _randomPtr = + _lookup>('random'); + late final _random = _randomPtr.asFunction(); + + int rand_r( + ffi.Pointer arg0, + ) { + return _rand_r( + arg0, + ); + } + + late final _rand_rPtr = _lookup< + ffi.NativeFunction)>>( + 'rand_r'); + late final _rand_r = + _rand_rPtr.asFunction)>(); + + ffi.Pointer realpath( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _realpath( + arg0, + arg1, + ); + } + + late final _realpathPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('realpath'); + late final _realpath = _realpathPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer seed48( + ffi.Pointer arg0, + ) { + return _seed48( + arg0, + ); + } + + late final _seed48Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('seed48'); + late final _seed48 = _seed48Ptr.asFunction< + ffi.Pointer Function( + ffi.Pointer)>(); + + int setenv( + ffi.Pointer __name, + ffi.Pointer __value, + int __overwrite, + ) { + return _setenv( + __name, + __value, + __overwrite, + ); + } + + late final _setenvPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Int)>>('setenv'); + late final _setenv = _setenvPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + void setkey( + ffi.Pointer arg0, + ) { + return _setkey( + arg0, + ); + } + + late final _setkeyPtr = + _lookup)>>( + 'setkey'); + late final _setkey = + _setkeyPtr.asFunction)>(); + + ffi.Pointer setstate( + ffi.Pointer arg0, + ) { + return _setstate( + arg0, + ); + } + + late final _setstatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('setstate'); + late final _setstate = _setstatePtr + .asFunction Function(ffi.Pointer)>(); + + void srand48( + int arg0, + ) { + return _srand48( + arg0, + ); + } + + late final _srand48Ptr = + _lookup>('srand48'); + late final _srand48 = _srand48Ptr.asFunction(); + + void srandom( + int arg0, + ) { + return _srandom( + arg0, + ); + } + + late final _srandomPtr = + _lookup>( + 'srandom'); + late final _srandom = _srandomPtr.asFunction(); + + int unlockpt( + int arg0, + ) { + return _unlockpt( + arg0, + ); + } + + late final _unlockptPtr = + _lookup>('unlockpt'); + late final _unlockpt = _unlockptPtr.asFunction(); + + int unsetenv( + ffi.Pointer arg0, + ) { + return _unsetenv( + arg0, + ); + } + + late final _unsetenvPtr = + _lookup)>>( + 'unsetenv'); + late final _unsetenv = + _unsetenvPtr.asFunction)>(); + + int arc4random() { + return _arc4random(); + } + + late final _arc4randomPtr = + _lookup>('arc4random'); + late final _arc4random = _arc4randomPtr.asFunction(); + + void arc4random_addrandom( + ffi.Pointer arg0, + int arg1, + ) { + return _arc4random_addrandom( + arg0, + arg1, + ); + } + + late final _arc4random_addrandomPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, ffi.Int)>>('arc4random_addrandom'); + late final _arc4random_addrandom = _arc4random_addrandomPtr + .asFunction, int)>(); + + void arc4random_buf( + ffi.Pointer __buf, + int __nbytes, + ) { + return _arc4random_buf( + __buf, + __nbytes, + ); + } + + late final _arc4random_bufPtr = _lookup< + ffi + .NativeFunction, ffi.Size)>>( + 'arc4random_buf'); + late final _arc4random_buf = _arc4random_bufPtr + .asFunction, int)>(); + + void arc4random_stir() { + return _arc4random_stir(); + } + + late final _arc4random_stirPtr = + _lookup>('arc4random_stir'); + late final _arc4random_stir = + _arc4random_stirPtr.asFunction(); + + int arc4random_uniform( + int __upper_bound, + ) { + return _arc4random_uniform( + __upper_bound, + ); + } + + late final _arc4random_uniformPtr = + _lookup>( + 'arc4random_uniform'); + late final _arc4random_uniform = + _arc4random_uniformPtr.asFunction(); + + int atexit_b( + objc.ObjCBlock arg0, + ) { + return _atexit_b( + arg0.ref.pointer, + ); + } + + late final _atexit_bPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer)>>('atexit_b'); + late final _atexit_b = + _atexit_bPtr.asFunction)>(); + + ffi.Pointer bsearch_b( + ffi.Pointer __key, + ffi.Pointer __base, + int __nel, + int __width, + objc.ObjCBlock< + ffi.Int Function(ffi.Pointer, ffi.Pointer)> + __compar, + ) { + return _bsearch_b( + __key, + __base, + __nel, + __width, + __compar.ref.pointer, + ); + } + + late final _bsearch_bPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer)>>('bsearch_b'); + late final _bsearch_b = _bsearch_bPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int, int, ffi.Pointer)>(); + + ffi.Pointer cgetcap( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _cgetcap( + arg0, + arg1, + arg2, + ); + } + + late final _cgetcapPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>('cgetcap'); + late final _cgetcap = _cgetcapPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + int cgetclose() { + return _cgetclose(); + } + + late final _cgetclosePtr = + _lookup>('cgetclose'); + late final _cgetclose = _cgetclosePtr.asFunction(); + + int cgetent( + ffi.Pointer> arg0, + ffi.Pointer> arg1, + ffi.Pointer arg2, + ) { + return _cgetent( + arg0, + arg1, + arg2, + ); + } + + late final _cgetentPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Pointer>, + ffi.Pointer)>>('cgetent'); + late final _cgetent = _cgetentPtr.asFunction< + int Function(ffi.Pointer>, + ffi.Pointer>, ffi.Pointer)>(); + + int cgetfirst( + ffi.Pointer> arg0, + ffi.Pointer> arg1, + ) { + return _cgetfirst( + arg0, + arg1, + ); + } + + late final _cgetfirstPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, + ffi.Pointer>)>>('cgetfirst'); + late final _cgetfirst = _cgetfirstPtr.asFunction< + int Function(ffi.Pointer>, + ffi.Pointer>)>(); + + int cgetmatch( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _cgetmatch( + arg0, + arg1, + ); + } + + late final _cgetmatchPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('cgetmatch'); + late final _cgetmatch = _cgetmatchPtr + .asFunction, ffi.Pointer)>(); + + int cgetnext( + ffi.Pointer> arg0, + ffi.Pointer> arg1, + ) { + return _cgetnext( + arg0, + arg1, + ); + } + + late final _cgetnextPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, + ffi.Pointer>)>>('cgetnext'); + late final _cgetnext = _cgetnextPtr.asFunction< + int Function(ffi.Pointer>, + ffi.Pointer>)>(); + + int cgetnum( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _cgetnum( + arg0, + arg1, + arg2, + ); + } + + late final _cgetnumPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>>('cgetnum'); + late final _cgetnum = _cgetnumPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>(); + + int cgetset( + ffi.Pointer arg0, + ) { + return _cgetset( + arg0, + ); + } + + late final _cgetsetPtr = + _lookup)>>( + 'cgetset'); + late final _cgetset = + _cgetsetPtr.asFunction)>(); + + int cgetstr( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + ) { + return _cgetstr( + arg0, + arg1, + arg2, + ); + } + + late final _cgetstrPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>>('cgetstr'); + late final _cgetstr = _cgetstrPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>(); + + int cgetustr( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + ) { + return _cgetustr( + arg0, + arg1, + arg2, + ); + } + + late final _cgetustrPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>>('cgetustr'); + late final _cgetustr = _cgetustrPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>(); + + int daemon( + int arg0, + int arg1, + ) { + return _daemon( + arg0, + arg1, + ); + } + + late final _daemonPtr = + _lookup>('daemon'); + late final _daemon = _daemonPtr.asFunction(); + + ffi.Pointer devname( + int arg0, + int arg1, + ) { + return _devname( + arg0, + arg1, + ); + } + + late final _devnamePtr = _lookup< + ffi.NativeFunction Function(dev_t, mode_t)>>( + 'devname'); + late final _devname = + _devnamePtr.asFunction Function(int, int)>(); + + ffi.Pointer devname_r( + int arg0, + int arg1, + ffi.Pointer buf, + int len, + ) { + return _devname_r( + arg0, + arg1, + buf, + len, + ); + } + + late final _devname_rPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + dev_t, mode_t, ffi.Pointer, ffi.Int)>>('devname_r'); + late final _devname_r = _devname_rPtr.asFunction< + ffi.Pointer Function(int, int, ffi.Pointer, int)>(); + + ffi.Pointer getbsize( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _getbsize( + arg0, + arg1, + ); + } + + late final _getbsizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('getbsize'); + late final _getbsize = _getbsizePtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + int getloadavg( + ffi.Pointer arg0, + int arg1, + ) { + return _getloadavg( + arg0, + arg1, + ); + } + + late final _getloadavgPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int)>>('getloadavg'); + late final _getloadavg = + _getloadavgPtr.asFunction, int)>(); + + ffi.Pointer getprogname() { + return _getprogname(); + } + + late final _getprognamePtr = + _lookup Function()>>( + 'getprogname'); + late final _getprogname = + _getprognamePtr.asFunction Function()>(); + + void setprogname( + ffi.Pointer arg0, + ) { + return _setprogname( + arg0, + ); + } + + late final _setprognamePtr = + _lookup)>>( + 'setprogname'); + late final _setprogname = + _setprognamePtr.asFunction)>(); + + int heapsort( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _heapsort( + __base, + __nel, + __width, + __compar, + ); + } + + late final _heapsortPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('heapsort'); + late final _heapsort = _heapsortPtr.asFunction< + int Function( + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + int heapsort_b( + ffi.Pointer __base, + int __nel, + int __width, + objc.ObjCBlock< + ffi.Int Function(ffi.Pointer, ffi.Pointer)> + __compar, + ) { + return _heapsort_b( + __base, + __nel, + __width, + __compar.ref.pointer, + ); + } + + late final _heapsort_bPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size, ffi.Size, + ffi.Pointer)>>('heapsort_b'); + late final _heapsort_b = _heapsort_bPtr.asFunction< + int Function( + ffi.Pointer, int, int, ffi.Pointer)>(); + + int mergesort( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _mergesort( + __base, + __nel, + __width, + __compar, + ); + } + + late final _mergesortPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('mergesort'); + late final _mergesort = _mergesortPtr.asFunction< + int Function( + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + int mergesort_b( + ffi.Pointer __base, + int __nel, + int __width, + objc.ObjCBlock< + ffi.Int Function(ffi.Pointer, ffi.Pointer)> + __compar, + ) { + return _mergesort_b( + __base, + __nel, + __width, + __compar.ref.pointer, + ); + } + + late final _mergesort_bPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size, ffi.Size, + ffi.Pointer)>>('mergesort_b'); + late final _mergesort_b = _mergesort_bPtr.asFunction< + int Function( + ffi.Pointer, int, int, ffi.Pointer)>(); + + void psort( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _psort( + __base, + __nel, + __width, + __compar, + ); + } + + late final _psortPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('psort'); + late final _psort = _psortPtr.asFunction< + void Function( + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + void psort_b( + ffi.Pointer __base, + int __nel, + int __width, + objc.ObjCBlock< + ffi.Int Function(ffi.Pointer, ffi.Pointer)> + __compar, + ) { + return _psort_b( + __base, + __nel, + __width, + __compar.ref.pointer, + ); + } + + late final _psort_bPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Size, ffi.Size, + ffi.Pointer)>>('psort_b'); + late final _psort_b = _psort_bPtr.asFunction< + void Function( + ffi.Pointer, int, int, ffi.Pointer)>(); + + void psort_r( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer arg3, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>> + __compar, + ) { + return _psort_r( + __base, + __nel, + __width, + arg3, + __compar, + ); + } + + late final _psort_rPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>)>>('psort_r'); + late final _psort_r = _psort_rPtr.asFunction< + void Function( + ffi.Pointer, + int, + int, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>>)>(); + + void qsort_b( + ffi.Pointer __base, + int __nel, + int __width, + objc.ObjCBlock< + ffi.Int Function(ffi.Pointer, ffi.Pointer)> + __compar, + ) { + return _qsort_b( + __base, + __nel, + __width, + __compar.ref.pointer, + ); + } + + late final _qsort_bPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Size, ffi.Size, + ffi.Pointer)>>('qsort_b'); + late final _qsort_b = _qsort_bPtr.asFunction< + void Function( + ffi.Pointer, int, int, ffi.Pointer)>(); + + void qsort_r( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer arg3, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>> + __compar, + ) { + return _qsort_r( + __base, + __nel, + __width, + arg3, + __compar, + ); + } + + late final _qsort_rPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>)>>('qsort_r'); + late final _qsort_r = _qsort_rPtr.asFunction< + void Function( + ffi.Pointer, + int, + int, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>>)>(); + + int radixsort( + ffi.Pointer> __base, + int __nel, + ffi.Pointer __table, + int __endbyte, + ) { + return _radixsort( + __base, + __nel, + __table, + __endbyte, + ); + } + + late final _radixsortPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, ffi.Int, + ffi.Pointer, ffi.UnsignedInt)>>('radixsort'); + late final _radixsort = _radixsortPtr.asFunction< + int Function(ffi.Pointer>, int, + ffi.Pointer, int)>(); + + int rpmatch( + ffi.Pointer arg0, + ) { + return _rpmatch( + arg0, + ); + } + + late final _rpmatchPtr = + _lookup)>>( + 'rpmatch'); + late final _rpmatch = + _rpmatchPtr.asFunction)>(); + + int sradixsort( + ffi.Pointer> __base, + int __nel, + ffi.Pointer __table, + int __endbyte, + ) { + return _sradixsort( + __base, + __nel, + __table, + __endbyte, + ); + } + + late final _sradixsortPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, ffi.Int, + ffi.Pointer, ffi.UnsignedInt)>>('sradixsort'); + late final _sradixsort = _sradixsortPtr.asFunction< + int Function(ffi.Pointer>, int, + ffi.Pointer, int)>(); + + void sranddev() { + return _sranddev(); + } + + late final _sranddevPtr = + _lookup>('sranddev'); + late final _sranddev = _sranddevPtr.asFunction(); + + void srandomdev() { + return _srandomdev(); + } + + late final _srandomdevPtr = + _lookup>('srandomdev'); + late final _srandomdev = _srandomdevPtr.asFunction(); + + int strtonum( + ffi.Pointer __numstr, + int __minval, + int __maxval, + ffi.Pointer> __errstrp, + ) { + return _strtonum( + __numstr, + __minval, + __maxval, + __errstrp, + ); + } + + late final _strtonumPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, ffi.LongLong, + ffi.LongLong, ffi.Pointer>)>>('strtonum'); + late final _strtonum = _strtonumPtr.asFunction< + int Function(ffi.Pointer, int, int, + ffi.Pointer>)>(); + + int strtoq( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoq( + __str, + __endptr, + __base, + ); + } + + late final _strtoqPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoq'); + late final _strtoq = _strtoqPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int strtouq( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtouq( + __str, + __endptr, + __base, + ); + } + + late final _strtouqPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtouq'); + late final _strtouq = _strtouqPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + late final ffi.Pointer> _suboptarg = + _lookup>('suboptarg'); + + ffi.Pointer get suboptarg => _suboptarg.value; + + set suboptarg(ffi.Pointer value) => _suboptarg.value = value; + + int __darwin_check_fd_set_overflow( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return ___darwin_check_fd_set_overflow( + arg0, + arg1, + arg2, + ); + } + + late final ___darwin_check_fd_set_overflowPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, + ffi.Int)>>('__darwin_check_fd_set_overflow'); + late final ___darwin_check_fd_set_overflow = + ___darwin_check_fd_set_overflowPtr + .asFunction, int)>(); + + ffi.Pointer sel_getName( + ffi.Pointer sel, + ) { + return _sel_getName( + sel, + ); + } + + late final _sel_getNamePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('sel_getName'); + late final _sel_getName = _sel_getNamePtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer sel_registerName( + ffi.Pointer str, + ) { + return _sel_registerName( + str, + ); + } + + late final _sel_registerNamePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('sel_registerName'); + late final _sel_registerName = _sel_registerNamePtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer object_getClassName( + objc.ObjCObjectBase? obj, + ) { + return _object_getClassName( + obj?.ref.pointer ?? ffi.nullptr, + ); + } + + late final _object_getClassNamePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('object_getClassName'); + late final _object_getClassName = _object_getClassNamePtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer object_getIndexedIvars( + objc.ObjCObjectBase? obj, + ) { + return _object_getIndexedIvars( + obj?.ref.pointer ?? ffi.nullptr, + ); + } + + late final _object_getIndexedIvarsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('object_getIndexedIvars'); + late final _object_getIndexedIvars = _object_getIndexedIvarsPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + bool sel_isMapped( + ffi.Pointer sel, + ) { + return _sel_isMapped( + sel, + ); + } + + late final _sel_isMappedPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer)>>('sel_isMapped'); + late final _sel_isMapped = _sel_isMappedPtr + .asFunction)>(); + + ffi.Pointer sel_getUid( + ffi.Pointer str, + ) { + return _sel_getUid( + str, + ); + } + + late final _sel_getUidPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('sel_getUid'); + late final _sel_getUid = _sel_getUidPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + objc.ObjCObjectBase? objc_retainedObject( + objc_objectptr_t obj, + ) { + return _objc_retainedObject( + obj, + ).address == + 0 + ? null + : objc.ObjCObjectBase( + _objc_retainedObject( + obj, + ), + retain: true, + release: true); + } + + late final _objc_retainedObjectPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + objc_objectptr_t)>>('objc_retainedObject'); + late final _objc_retainedObject = _objc_retainedObjectPtr + .asFunction Function(objc_objectptr_t)>(); + + objc.ObjCObjectBase? objc_unretainedObject( + objc_objectptr_t obj, + ) { + return _objc_unretainedObject( + obj, + ).address == + 0 + ? null + : objc.ObjCObjectBase( + _objc_unretainedObject( + obj, + ), + retain: true, + release: true); + } + + late final _objc_unretainedObjectPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + objc_objectptr_t)>>('objc_unretainedObject'); + late final _objc_unretainedObject = _objc_unretainedObjectPtr + .asFunction Function(objc_objectptr_t)>(); + + objc_objectptr_t objc_unretainedPointer( + objc.ObjCObjectBase? obj, + ) { + return _objc_unretainedPointer( + obj?.ref.pointer ?? ffi.nullptr, + ); + } + + late final _objc_unretainedPointerPtr = _lookup< + ffi.NativeFunction< + objc_objectptr_t Function( + ffi.Pointer)>>('objc_unretainedPointer'); + late final _objc_unretainedPointer = _objc_unretainedPointerPtr + .asFunction)>(); + + late final ffi.Pointer _NSFoundationVersionNumber = + _lookup('NSFoundationVersionNumber'); + + double get NSFoundationVersionNumber => _NSFoundationVersionNumber.value; + + set NSFoundationVersionNumber(double value) => + _NSFoundationVersionNumber.value = value; + + objc.NSString NSStringFromSelector( + ffi.Pointer aSelector, + ) { + return objc.NSString.castFromPointer( + _NSStringFromSelector( + aSelector, + ), + retain: true, + release: true); + } + + late final _NSStringFromSelectorPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('NSStringFromSelector'); + late final _NSStringFromSelector = _NSStringFromSelectorPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer NSSelectorFromString( + objc.NSString aSelectorName, + ) { + return _NSSelectorFromString( + aSelectorName.ref.pointer, + ); + } + + late final _NSSelectorFromStringPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('NSSelectorFromString'); + late final _NSSelectorFromString = _NSSelectorFromStringPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + objc.NSString NSStringFromClass( + objc.ObjCObjectBase aClass, + ) { + return objc.NSString.castFromPointer( + _NSStringFromClass( + aClass.ref.pointer, + ), + retain: true, + release: true); + } + + late final _NSStringFromClassPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('NSStringFromClass'); + late final _NSStringFromClass = _NSStringFromClassPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + objc.ObjCObjectBase? NSClassFromString( + objc.NSString aClassName, + ) { + return _NSClassFromString( + aClassName.ref.pointer, + ).address == + 0 + ? null + : objc.ObjCObjectBase( + _NSClassFromString( + aClassName.ref.pointer, + ), + retain: true, + release: true); + } + + late final _NSClassFromStringPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('NSClassFromString'); + late final _NSClassFromString = _NSClassFromStringPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + objc.NSString NSStringFromProtocol( + objc.Protocol proto, + ) { + return objc.NSString.castFromPointer( + _NSStringFromProtocol( + proto.ref.pointer, + ), + retain: true, + release: true); + } + + late final _NSStringFromProtocolPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('NSStringFromProtocol'); + late final _NSStringFromProtocol = _NSStringFromProtocolPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + objc.Protocol? NSProtocolFromString( + objc.NSString namestr, + ) { + return _NSProtocolFromString( + namestr.ref.pointer, + ).address == + 0 + ? null + : objc.Protocol.castFromPointer( + _NSProtocolFromString( + namestr.ref.pointer, + ), + retain: true, + release: true); + } + + late final _NSProtocolFromStringPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('NSProtocolFromString'); + late final _NSProtocolFromString = _NSProtocolFromStringPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer NSGetSizeAndAlignment( + ffi.Pointer typePtr, + ffi.Pointer sizep, + ffi.Pointer alignp, + ) { + return _NSGetSizeAndAlignment( + typePtr, + sizep, + alignp, + ); + } + + late final _NSGetSizeAndAlignmentPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('NSGetSizeAndAlignment'); + late final _NSGetSizeAndAlignment = _NSGetSizeAndAlignmentPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + void NSLog( + objc.NSString format, + ) { + return _NSLog( + format.ref.pointer, + ); + } + + late final _NSLogPtr = _lookup< + ffi.NativeFunction)>>( + 'NSLog'); + late final _NSLog = + _NSLogPtr.asFunction)>(); + + void NSLogv( + objc.NSString format, + va_list args, + ) { + return _NSLogv( + format.ref.pointer, + args, + ); + } + + late final _NSLogvPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, va_list)>>('NSLogv'); + late final _NSLogv = _NSLogvPtr.asFunction< + void Function(ffi.Pointer, va_list)>(); + + late final ffi.Pointer _NSNotFound = + _lookup('NSNotFound'); + + DartNSInteger get NSNotFound => _NSNotFound.value; + + ffi.Pointer _Block_copy( + ffi.Pointer aBlock, + ) { + return __Block_copy( + aBlock, + ); + } + + late final __Block_copyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('_Block_copy'); + late final __Block_copy = __Block_copyPtr + .asFunction Function(ffi.Pointer)>(); + + void _Block_release( + ffi.Pointer aBlock, + ) { + return __Block_release( + aBlock, + ); + } + + late final __Block_releasePtr = + _lookup)>>( + '_Block_release'); + late final __Block_release = + __Block_releasePtr.asFunction)>(); + + void _Block_object_assign( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return __Block_object_assign( + arg0, + arg1, + arg2, + ); + } + + late final __Block_object_assignPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + ffi.Int)>>('_Block_object_assign'); + late final __Block_object_assign = __Block_object_assignPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + void _Block_object_dispose( + ffi.Pointer arg0, + int arg1, + ) { + return __Block_object_dispose( + arg0, + arg1, + ); + } + + late final __Block_object_disposePtr = _lookup< + ffi + .NativeFunction, ffi.Int)>>( + '_Block_object_dispose'); + late final __Block_object_dispose = __Block_object_disposePtr + .asFunction, int)>(); + + late final ffi.Pointer>> + __NSConcreteGlobalBlock = + _lookup>>('_NSConcreteGlobalBlock'); + + ffi.Pointer> get _NSConcreteGlobalBlock => + __NSConcreteGlobalBlock.value; + + set _NSConcreteGlobalBlock(ffi.Pointer> value) => + __NSConcreteGlobalBlock.value = value; + + late final ffi.Pointer>> + __NSConcreteStackBlock = + _lookup>>('_NSConcreteStackBlock'); + + ffi.Pointer> get _NSConcreteStackBlock => + __NSConcreteStackBlock.value; + + set _NSConcreteStackBlock(ffi.Pointer> value) => + __NSConcreteStackBlock.value = value; + + void Debugger() { + return _Debugger(); + } + + late final _DebuggerPtr = + _lookup>('Debugger'); + late final _Debugger = _DebuggerPtr.asFunction(); + + void DebugStr( + ConstStr255Param debuggerMsg, + ) { + return _DebugStr( + debuggerMsg, + ); + } + + late final _DebugStrPtr = + _lookup>( + 'DebugStr'); + late final _DebugStr = + _DebugStrPtr.asFunction(); + + void SysBreak() { + return _SysBreak(); + } + + late final _SysBreakPtr = + _lookup>('SysBreak'); + late final _SysBreak = _SysBreakPtr.asFunction(); + + void SysBreakStr( + ConstStr255Param debuggerMsg, + ) { + return _SysBreakStr( + debuggerMsg, + ); + } + + late final _SysBreakStrPtr = + _lookup>( + 'SysBreakStr'); + late final _SysBreakStr = + _SysBreakStrPtr.asFunction(); + + void SysBreakFunc( + ConstStr255Param debuggerMsg, + ) { + return _SysBreakFunc( + debuggerMsg, + ); + } + + late final _SysBreakFuncPtr = + _lookup>( + 'SysBreakFunc'); + late final _SysBreakFunc = + _SysBreakFuncPtr.asFunction(); + + late final ffi.Pointer _kCFCoreFoundationVersionNumber = + _lookup('kCFCoreFoundationVersionNumber'); + + double get kCFCoreFoundationVersionNumber => + _kCFCoreFoundationVersionNumber.value; + + set kCFCoreFoundationVersionNumber(double value) => + _kCFCoreFoundationVersionNumber.value = value; + + late final ffi.Pointer _kCFNotFound = + _lookup('kCFNotFound'); + + DartCFIndex get kCFNotFound => _kCFNotFound.value; + + CFRange __CFRangeMake( + int loc, + int len, + ) { + return ___CFRangeMake( + loc, + len, + ); + } + + late final ___CFRangeMakePtr = + _lookup>( + '__CFRangeMake'); + late final ___CFRangeMake = + ___CFRangeMakePtr.asFunction(); + + int CFNullGetTypeID() { + return _CFNullGetTypeID(); + } + + late final _CFNullGetTypeIDPtr = + _lookup>('CFNullGetTypeID'); + late final _CFNullGetTypeID = + _CFNullGetTypeIDPtr.asFunction(); + + late final ffi.Pointer _kCFNull = _lookup('kCFNull'); + + CFNullRef get kCFNull => _kCFNull.value; + + late final ffi.Pointer _kCFAllocatorDefault = + _lookup('kCFAllocatorDefault'); + + CFAllocatorRef get kCFAllocatorDefault => _kCFAllocatorDefault.value; + + late final ffi.Pointer _kCFAllocatorSystemDefault = + _lookup('kCFAllocatorSystemDefault'); + + CFAllocatorRef get kCFAllocatorSystemDefault => + _kCFAllocatorSystemDefault.value; + + late final ffi.Pointer _kCFAllocatorMalloc = + _lookup('kCFAllocatorMalloc'); + + CFAllocatorRef get kCFAllocatorMalloc => _kCFAllocatorMalloc.value; + + late final ffi.Pointer _kCFAllocatorMallocZone = + _lookup('kCFAllocatorMallocZone'); + + CFAllocatorRef get kCFAllocatorMallocZone => _kCFAllocatorMallocZone.value; + + late final ffi.Pointer _kCFAllocatorNull = + _lookup('kCFAllocatorNull'); + + CFAllocatorRef get kCFAllocatorNull => _kCFAllocatorNull.value; + + late final ffi.Pointer _kCFAllocatorUseContext = + _lookup('kCFAllocatorUseContext'); + + CFAllocatorRef get kCFAllocatorUseContext => _kCFAllocatorUseContext.value; + + int CFAllocatorGetTypeID() { + return _CFAllocatorGetTypeID(); + } + + late final _CFAllocatorGetTypeIDPtr = + _lookup>('CFAllocatorGetTypeID'); + late final _CFAllocatorGetTypeID = + _CFAllocatorGetTypeIDPtr.asFunction(); + + void CFAllocatorSetDefault( + CFAllocatorRef allocator, + ) { + return _CFAllocatorSetDefault( + allocator, + ); + } + + late final _CFAllocatorSetDefaultPtr = + _lookup>( + 'CFAllocatorSetDefault'); + late final _CFAllocatorSetDefault = + _CFAllocatorSetDefaultPtr.asFunction(); + + CFAllocatorRef CFAllocatorGetDefault() { + return _CFAllocatorGetDefault(); + } + + late final _CFAllocatorGetDefaultPtr = + _lookup>( + 'CFAllocatorGetDefault'); + late final _CFAllocatorGetDefault = + _CFAllocatorGetDefaultPtr.asFunction(); + + CFAllocatorRef CFAllocatorCreate( + CFAllocatorRef allocator, + ffi.Pointer context, + ) { + return _CFAllocatorCreate( + allocator, + context, + ); + } + + late final _CFAllocatorCreatePtr = _lookup< + ffi.NativeFunction< + CFAllocatorRef Function(CFAllocatorRef, + ffi.Pointer)>>('CFAllocatorCreate'); + late final _CFAllocatorCreate = _CFAllocatorCreatePtr.asFunction< + CFAllocatorRef Function( + CFAllocatorRef, ffi.Pointer)>(); + + ffi.Pointer CFAllocatorAllocate( + CFAllocatorRef allocator, + int size, + int hint, + ) { + return _CFAllocatorAllocate( + allocator, + size, + hint, + ); + } + + late final _CFAllocatorAllocatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CFAllocatorRef, CFIndex, CFOptionFlags)>>('CFAllocatorAllocate'); + late final _CFAllocatorAllocate = _CFAllocatorAllocatePtr.asFunction< + ffi.Pointer Function(CFAllocatorRef, int, int)>(); + + ffi.Pointer CFAllocatorReallocate( + CFAllocatorRef allocator, + ffi.Pointer ptr, + int newsize, + int hint, + ) { + return _CFAllocatorReallocate( + allocator, + ptr, + newsize, + hint, + ); + } + + late final _CFAllocatorReallocatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(CFAllocatorRef, ffi.Pointer, + CFIndex, CFOptionFlags)>>('CFAllocatorReallocate'); + late final _CFAllocatorReallocate = _CFAllocatorReallocatePtr.asFunction< + ffi.Pointer Function( + CFAllocatorRef, ffi.Pointer, int, int)>(); + + void CFAllocatorDeallocate( + CFAllocatorRef allocator, + ffi.Pointer ptr, + ) { + return _CFAllocatorDeallocate( + allocator, + ptr, + ); + } + + late final _CFAllocatorDeallocatePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFAllocatorRef, ffi.Pointer)>>('CFAllocatorDeallocate'); + late final _CFAllocatorDeallocate = _CFAllocatorDeallocatePtr.asFunction< + void Function(CFAllocatorRef, ffi.Pointer)>(); + + int CFAllocatorGetPreferredSizeForSize( + CFAllocatorRef allocator, + int size, + int hint, + ) { + return _CFAllocatorGetPreferredSizeForSize( + allocator, + size, + hint, + ); + } + + late final _CFAllocatorGetPreferredSizeForSizePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFAllocatorRef, CFIndex, + CFOptionFlags)>>('CFAllocatorGetPreferredSizeForSize'); + late final _CFAllocatorGetPreferredSizeForSize = + _CFAllocatorGetPreferredSizeForSizePtr.asFunction< + int Function(CFAllocatorRef, int, int)>(); + + void CFAllocatorGetContext( + CFAllocatorRef allocator, + ffi.Pointer context, + ) { + return _CFAllocatorGetContext( + allocator, + context, + ); + } + + late final _CFAllocatorGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFAllocatorRef, + ffi.Pointer)>>('CFAllocatorGetContext'); + late final _CFAllocatorGetContext = _CFAllocatorGetContextPtr.asFunction< + void Function(CFAllocatorRef, ffi.Pointer)>(); + + int CFGetTypeID( + CFTypeRef cf, + ) { + return _CFGetTypeID( + cf, + ); + } + + late final _CFGetTypeIDPtr = + _lookup>('CFGetTypeID'); + late final _CFGetTypeID = + _CFGetTypeIDPtr.asFunction(); + + CFStringRef CFCopyTypeIDDescription( + int type_id, + ) { + return _CFCopyTypeIDDescription( + type_id, + ); + } + + late final _CFCopyTypeIDDescriptionPtr = + _lookup>( + 'CFCopyTypeIDDescription'); + late final _CFCopyTypeIDDescription = + _CFCopyTypeIDDescriptionPtr.asFunction(); + + CFTypeRef CFRetain( + CFTypeRef cf, + ) { + return _CFRetain( + cf, + ); + } + + late final _CFRetainPtr = + _lookup>('CFRetain'); + late final _CFRetain = + _CFRetainPtr.asFunction(); + + void CFRelease( + CFTypeRef cf, + ) { + return _CFRelease( + cf, + ); + } + + late final _CFReleasePtr = + _lookup>('CFRelease'); + late final _CFRelease = _CFReleasePtr.asFunction(); + + CFTypeRef CFAutorelease( + CFTypeRef arg, + ) { + return _CFAutorelease( + arg, + ); + } + + late final _CFAutoreleasePtr = + _lookup>( + 'CFAutorelease'); + late final _CFAutorelease = + _CFAutoreleasePtr.asFunction(); + + int CFGetRetainCount( + CFTypeRef cf, + ) { + return _CFGetRetainCount( + cf, + ); + } + + late final _CFGetRetainCountPtr = + _lookup>( + 'CFGetRetainCount'); + late final _CFGetRetainCount = + _CFGetRetainCountPtr.asFunction(); + + int CFEqual( + CFTypeRef cf1, + CFTypeRef cf2, + ) { + return _CFEqual( + cf1, + cf2, + ); + } + + late final _CFEqualPtr = + _lookup>( + 'CFEqual'); + late final _CFEqual = + _CFEqualPtr.asFunction(); + + int CFHash( + CFTypeRef cf, + ) { + return _CFHash( + cf, + ); + } + + late final _CFHashPtr = + _lookup>('CFHash'); + late final _CFHash = _CFHashPtr.asFunction(); + + CFStringRef CFCopyDescription( + CFTypeRef cf, + ) { + return _CFCopyDescription( + cf, + ); + } + + late final _CFCopyDescriptionPtr = + _lookup>( + 'CFCopyDescription'); + late final _CFCopyDescription = + _CFCopyDescriptionPtr.asFunction(); + + CFAllocatorRef CFGetAllocator( + CFTypeRef cf, + ) { + return _CFGetAllocator( + cf, + ); + } + + late final _CFGetAllocatorPtr = + _lookup>( + 'CFGetAllocator'); + late final _CFGetAllocator = + _CFGetAllocatorPtr.asFunction(); + + CFTypeRef CFMakeCollectable( + CFTypeRef cf, + ) { + return _CFMakeCollectable( + cf, + ); + } + + late final _CFMakeCollectablePtr = + _lookup>( + 'CFMakeCollectable'); + late final _CFMakeCollectable = + _CFMakeCollectablePtr.asFunction(); + + ffi.Pointer NSDefaultMallocZone() { + return _NSDefaultMallocZone(); + } + + late final _NSDefaultMallocZonePtr = + _lookup Function()>>( + 'NSDefaultMallocZone'); + late final _NSDefaultMallocZone = + _NSDefaultMallocZonePtr.asFunction Function()>(); + + ffi.Pointer NSCreateZone( + int startSize, + int granularity, + bool canFree, + ) { + return _NSCreateZone( + startSize, + granularity, + canFree, + ); + } + + late final _NSCreateZonePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + NSUInteger, NSUInteger, ffi.Bool)>>('NSCreateZone'); + late final _NSCreateZone = _NSCreateZonePtr.asFunction< + ffi.Pointer Function(int, int, bool)>(); + + void NSRecycleZone( + ffi.Pointer zone, + ) { + return _NSRecycleZone( + zone, + ); + } + + late final _NSRecycleZonePtr = + _lookup)>>( + 'NSRecycleZone'); + late final _NSRecycleZone = + _NSRecycleZonePtr.asFunction)>(); + + void NSSetZoneName( + ffi.Pointer zone, + objc.NSString name, + ) { + return _NSSetZoneName( + zone, + name.ref.pointer, + ); + } + + late final _NSSetZoneNamePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>>('NSSetZoneName'); + late final _NSSetZoneName = _NSSetZoneNamePtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer)>(); + + objc.NSString NSZoneName( + ffi.Pointer zone, + ) { + return objc.NSString.castFromPointer( + _NSZoneName( + zone, + ), + retain: true, + release: true); + } + + late final _NSZoneNamePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('NSZoneName'); + late final _NSZoneName = _NSZoneNamePtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer NSZoneFromPointer( + ffi.Pointer ptr, + ) { + return _NSZoneFromPointer( + ptr, + ); + } + + late final _NSZoneFromPointerPtr = _lookup< + ffi + .NativeFunction Function(ffi.Pointer)>>( + 'NSZoneFromPointer'); + late final _NSZoneFromPointer = _NSZoneFromPointerPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer NSZoneMalloc( + ffi.Pointer zone, + int size, + ) { + return _NSZoneMalloc( + zone, + size, + ); + } + + late final _NSZoneMallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, NSUInteger)>>('NSZoneMalloc'); + late final _NSZoneMalloc = _NSZoneMallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int)>(); + + ffi.Pointer NSZoneCalloc( + ffi.Pointer zone, + int numElems, + int byteSize, + ) { + return _NSZoneCalloc( + zone, + numElems, + byteSize, + ); + } + + late final _NSZoneCallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, NSUInteger, NSUInteger)>>('NSZoneCalloc'); + late final _NSZoneCalloc = _NSZoneCallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer NSZoneRealloc( + ffi.Pointer zone, + ffi.Pointer ptr, + int size, + ) { + return _NSZoneRealloc( + zone, + ptr, + size, + ); + } + + late final _NSZoneReallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>>('NSZoneRealloc'); + late final _NSZoneRealloc = _NSZoneReallocPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + void NSZoneFree( + ffi.Pointer zone, + ffi.Pointer ptr, + ) { + return _NSZoneFree( + zone, + ptr, + ); + } + + late final _NSZoneFreePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)>>('NSZoneFree'); + late final _NSZoneFree = _NSZoneFreePtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer NSAllocateCollectable( + int size, + int options, + ) { + return _NSAllocateCollectable( + size, + options, + ); + } + + late final _NSAllocateCollectablePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + NSUInteger, NSUInteger)>>('NSAllocateCollectable'); + late final _NSAllocateCollectable = _NSAllocateCollectablePtr.asFunction< + ffi.Pointer Function(int, int)>(); + + ffi.Pointer NSReallocateCollectable( + ffi.Pointer ptr, + int size, + int options, + ) { + return _NSReallocateCollectable( + ptr, + size, + options, + ); + } + + late final _NSReallocateCollectablePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, NSUInteger, + NSUInteger)>>('NSReallocateCollectable'); + late final _NSReallocateCollectable = _NSReallocateCollectablePtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + int NSPageSize() { + return _NSPageSize(); + } + + late final _NSPageSizePtr = + _lookup>('NSPageSize'); + late final _NSPageSize = _NSPageSizePtr.asFunction(); + + int NSLogPageSize() { + return _NSLogPageSize(); + } + + late final _NSLogPageSizePtr = + _lookup>('NSLogPageSize'); + late final _NSLogPageSize = _NSLogPageSizePtr.asFunction(); + + int NSRoundUpToMultipleOfPageSize( + int bytes, + ) { + return _NSRoundUpToMultipleOfPageSize( + bytes, + ); + } + + late final _NSRoundUpToMultipleOfPageSizePtr = + _lookup>( + 'NSRoundUpToMultipleOfPageSize'); + late final _NSRoundUpToMultipleOfPageSize = + _NSRoundUpToMultipleOfPageSizePtr.asFunction(); + + int NSRoundDownToMultipleOfPageSize( + int bytes, + ) { + return _NSRoundDownToMultipleOfPageSize( + bytes, + ); + } + + late final _NSRoundDownToMultipleOfPageSizePtr = + _lookup>( + 'NSRoundDownToMultipleOfPageSize'); + late final _NSRoundDownToMultipleOfPageSize = + _NSRoundDownToMultipleOfPageSizePtr.asFunction(); + + ffi.Pointer NSAllocateMemoryPages( + int bytes, + ) { + return _NSAllocateMemoryPages( + bytes, + ); + } + + late final _NSAllocateMemoryPagesPtr = + _lookup Function(NSUInteger)>>( + 'NSAllocateMemoryPages'); + late final _NSAllocateMemoryPages = _NSAllocateMemoryPagesPtr.asFunction< + ffi.Pointer Function(int)>(); + + void NSDeallocateMemoryPages( + ffi.Pointer ptr, + int bytes, + ) { + return _NSDeallocateMemoryPages( + ptr, + bytes, + ); + } + + late final _NSDeallocateMemoryPagesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, NSUInteger)>>('NSDeallocateMemoryPages'); + late final _NSDeallocateMemoryPages = _NSDeallocateMemoryPagesPtr.asFunction< + void Function(ffi.Pointer, int)>(); + + void NSCopyMemoryPages( + ffi.Pointer source, + ffi.Pointer dest, + int bytes, + ) { + return _NSCopyMemoryPages( + source, + dest, + bytes, + ); + } + + late final _NSCopyMemoryPagesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + NSUInteger)>>('NSCopyMemoryPages'); + late final _NSCopyMemoryPages = _NSCopyMemoryPagesPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + int NSRealMemoryAvailable() { + return _NSRealMemoryAvailable(); + } + + late final _NSRealMemoryAvailablePtr = + _lookup>( + 'NSRealMemoryAvailable'); + late final _NSRealMemoryAvailable = + _NSRealMemoryAvailablePtr.asFunction(); + + objc.ObjCObjectBase NSAllocateObject( + objc.ObjCObjectBase aClass, + DartNSUInteger extraBytes, + ffi.Pointer zone, + ) { + return objc.ObjCObjectBase( + _NSAllocateObject( + aClass.ref.pointer, + extraBytes, + zone, + ), + retain: true, + release: true); + } + + late final _NSAllocateObjectPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + NSUInteger, ffi.Pointer)>>('NSAllocateObject'); + late final _NSAllocateObject = _NSAllocateObjectPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + void NSDeallocateObject( + objc.ObjCObjectBase object, + ) { + return _NSDeallocateObject( + object.ref.pointer, + ); + } + + late final _NSDeallocateObjectPtr = _lookup< + ffi.NativeFunction)>>( + 'NSDeallocateObject'); + late final _NSDeallocateObject = _NSDeallocateObjectPtr.asFunction< + void Function(ffi.Pointer)>(); + + objc.ObjCObjectBase NSCopyObject( + objc.ObjCObjectBase object, + DartNSUInteger extraBytes, + ffi.Pointer zone, + ) { + return objc.ObjCObjectBase( + _NSCopyObject( + object.ref.pointer, + extraBytes, + zone, + ), + retain: true, + release: true); + } + + late final _NSCopyObjectPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + NSUInteger, ffi.Pointer)>>('NSCopyObject'); + late final _NSCopyObject = _NSCopyObjectPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + bool NSShouldRetainWithZone( + objc.ObjCObjectBase anObject, + ffi.Pointer requestedZone, + ) { + return _NSShouldRetainWithZone( + anObject.ref.pointer, + requestedZone, + ); + } + + late final _NSShouldRetainWithZonePtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer)>>('NSShouldRetainWithZone'); + late final _NSShouldRetainWithZone = _NSShouldRetainWithZonePtr.asFunction< + bool Function(ffi.Pointer, ffi.Pointer)>(); + + void NSIncrementExtraRefCount( + objc.ObjCObjectBase object, + ) { + return _NSIncrementExtraRefCount( + object.ref.pointer, + ); + } + + late final _NSIncrementExtraRefCountPtr = _lookup< + ffi.NativeFunction)>>( + 'NSIncrementExtraRefCount'); + late final _NSIncrementExtraRefCount = _NSIncrementExtraRefCountPtr + .asFunction)>(); + + bool NSDecrementExtraRefCountWasZero( + objc.ObjCObjectBase object, + ) { + return _NSDecrementExtraRefCountWasZero( + object.ref.pointer, + ); + } + + late final _NSDecrementExtraRefCountWasZeroPtr = _lookup< + ffi.NativeFunction)>>( + 'NSDecrementExtraRefCountWasZero'); + late final _NSDecrementExtraRefCountWasZero = + _NSDecrementExtraRefCountWasZeroPtr.asFunction< + bool Function(ffi.Pointer)>(); + + DartNSUInteger NSExtraRefCount( + objc.ObjCObjectBase object, + ) { + return _NSExtraRefCount( + object.ref.pointer, + ); + } + + late final _NSExtraRefCountPtr = _lookup< + ffi + .NativeFunction)>>( + 'NSExtraRefCount'); + late final _NSExtraRefCount = _NSExtraRefCountPtr.asFunction< + int Function(ffi.Pointer)>(); + + late final ffi.Pointer + _NSSystemClockDidChangeNotification = + _lookup('NSSystemClockDidChangeNotification'); + + DartNSNotificationName get NSSystemClockDidChangeNotification => + objc.NSString.castFromPointer(_NSSystemClockDidChangeNotification.value, + retain: true, release: true); + + set NSSystemClockDidChangeNotification(DartNSNotificationName value) { + objc.NSString.castFromPointer(_NSSystemClockDidChangeNotification.value, + retain: false, release: true) + .ref + .release(); + _NSSystemClockDidChangeNotification.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSHTTPCookieManagerAcceptPolicyChangedNotification = + _lookup( + 'NSHTTPCookieManagerAcceptPolicyChangedNotification'); + + DartNSNotificationName + get NSHTTPCookieManagerAcceptPolicyChangedNotification => + objc.NSString.castFromPointer( + _NSHTTPCookieManagerAcceptPolicyChangedNotification.value, + retain: true, + release: true); + + set NSHTTPCookieManagerAcceptPolicyChangedNotification( + DartNSNotificationName value) { + objc.NSString.castFromPointer( + _NSHTTPCookieManagerAcceptPolicyChangedNotification.value, + retain: false, + release: true) + .ref + .release(); + _NSHTTPCookieManagerAcceptPolicyChangedNotification.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSHTTPCookieManagerCookiesChangedNotification = + _lookup( + 'NSHTTPCookieManagerCookiesChangedNotification'); + + DartNSNotificationName get NSHTTPCookieManagerCookiesChangedNotification => + objc.NSString.castFromPointer( + _NSHTTPCookieManagerCookiesChangedNotification.value, + retain: true, + release: true); + + set NSHTTPCookieManagerCookiesChangedNotification( + DartNSNotificationName value) { + objc.NSString.castFromPointer( + _NSHTTPCookieManagerCookiesChangedNotification.value, + retain: false, + release: true) + .ref + .release(); + _NSHTTPCookieManagerCookiesChangedNotification.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressEstimatedTimeRemainingKey = + _lookup('NSProgressEstimatedTimeRemainingKey'); + + DartNSProgressUserInfoKey get NSProgressEstimatedTimeRemainingKey => + objc.NSString.castFromPointer(_NSProgressEstimatedTimeRemainingKey.value, + retain: true, release: true); + + set NSProgressEstimatedTimeRemainingKey(DartNSProgressUserInfoKey value) { + objc.NSString.castFromPointer(_NSProgressEstimatedTimeRemainingKey.value, + retain: false, release: true) + .ref + .release(); + _NSProgressEstimatedTimeRemainingKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSProgressThroughputKey = + _lookup('NSProgressThroughputKey'); + + DartNSProgressUserInfoKey get NSProgressThroughputKey => + objc.NSString.castFromPointer(_NSProgressThroughputKey.value, + retain: true, release: true); + + set NSProgressThroughputKey(DartNSProgressUserInfoKey value) { + objc.NSString.castFromPointer(_NSProgressThroughputKey.value, + retain: false, release: true) + .ref + .release(); + _NSProgressThroughputKey.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSProgressKindFile = + _lookup('NSProgressKindFile'); + + DartNSProgressKind get NSProgressKindFile => + objc.NSString.castFromPointer(_NSProgressKindFile.value, + retain: true, release: true); + + set NSProgressKindFile(DartNSProgressKind value) { + objc.NSString.castFromPointer(_NSProgressKindFile.value, + retain: false, release: true) + .ref + .release(); + _NSProgressKindFile.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileOperationKindKey = + _lookup('NSProgressFileOperationKindKey'); + + DartNSProgressUserInfoKey get NSProgressFileOperationKindKey => + objc.NSString.castFromPointer(_NSProgressFileOperationKindKey.value, + retain: true, release: true); + + set NSProgressFileOperationKindKey(DartNSProgressUserInfoKey value) { + objc.NSString.castFromPointer(_NSProgressFileOperationKindKey.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileOperationKindKey.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileOperationKindDownloading = + _lookup( + 'NSProgressFileOperationKindDownloading'); + + DartNSProgressFileOperationKind get NSProgressFileOperationKindDownloading => + objc.NSString.castFromPointer( + _NSProgressFileOperationKindDownloading.value, + retain: true, + release: true); + + set NSProgressFileOperationKindDownloading( + DartNSProgressFileOperationKind value) { + objc.NSString.castFromPointer(_NSProgressFileOperationKindDownloading.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileOperationKindDownloading.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileOperationKindDecompressingAfterDownloading = + _lookup( + 'NSProgressFileOperationKindDecompressingAfterDownloading'); + + DartNSProgressFileOperationKind + get NSProgressFileOperationKindDecompressingAfterDownloading => + objc.NSString.castFromPointer( + _NSProgressFileOperationKindDecompressingAfterDownloading.value, + retain: true, + release: true); + + set NSProgressFileOperationKindDecompressingAfterDownloading( + DartNSProgressFileOperationKind value) { + objc.NSString.castFromPointer( + _NSProgressFileOperationKindDecompressingAfterDownloading.value, + retain: false, + release: true) + .ref + .release(); + _NSProgressFileOperationKindDecompressingAfterDownloading.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileOperationKindReceiving = + _lookup( + 'NSProgressFileOperationKindReceiving'); + + DartNSProgressFileOperationKind get NSProgressFileOperationKindReceiving => + objc.NSString.castFromPointer(_NSProgressFileOperationKindReceiving.value, + retain: true, release: true); + + set NSProgressFileOperationKindReceiving( + DartNSProgressFileOperationKind value) { + objc.NSString.castFromPointer(_NSProgressFileOperationKindReceiving.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileOperationKindReceiving.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileOperationKindCopying = + _lookup( + 'NSProgressFileOperationKindCopying'); + + DartNSProgressFileOperationKind get NSProgressFileOperationKindCopying => + objc.NSString.castFromPointer(_NSProgressFileOperationKindCopying.value, + retain: true, release: true); + + set NSProgressFileOperationKindCopying( + DartNSProgressFileOperationKind value) { + objc.NSString.castFromPointer(_NSProgressFileOperationKindCopying.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileOperationKindCopying.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileOperationKindUploading = + _lookup( + 'NSProgressFileOperationKindUploading'); + + DartNSProgressFileOperationKind get NSProgressFileOperationKindUploading => + objc.NSString.castFromPointer(_NSProgressFileOperationKindUploading.value, + retain: true, release: true); + + set NSProgressFileOperationKindUploading( + DartNSProgressFileOperationKind value) { + objc.NSString.castFromPointer(_NSProgressFileOperationKindUploading.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileOperationKindUploading.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileOperationKindDuplicating = + _lookup( + 'NSProgressFileOperationKindDuplicating'); + + DartNSProgressFileOperationKind get NSProgressFileOperationKindDuplicating => + objc.NSString.castFromPointer( + _NSProgressFileOperationKindDuplicating.value, + retain: true, + release: true); + + set NSProgressFileOperationKindDuplicating( + DartNSProgressFileOperationKind value) { + objc.NSString.castFromPointer(_NSProgressFileOperationKindDuplicating.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileOperationKindDuplicating.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSProgressFileURLKey = + _lookup('NSProgressFileURLKey'); + + DartNSProgressUserInfoKey get NSProgressFileURLKey => + objc.NSString.castFromPointer(_NSProgressFileURLKey.value, + retain: true, release: true); + + set NSProgressFileURLKey(DartNSProgressUserInfoKey value) { + objc.NSString.castFromPointer(_NSProgressFileURLKey.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileURLKey.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSProgressFileTotalCountKey = + _lookup('NSProgressFileTotalCountKey'); + + DartNSProgressUserInfoKey get NSProgressFileTotalCountKey => + objc.NSString.castFromPointer(_NSProgressFileTotalCountKey.value, + retain: true, release: true); + + set NSProgressFileTotalCountKey(DartNSProgressUserInfoKey value) { + objc.NSString.castFromPointer(_NSProgressFileTotalCountKey.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileTotalCountKey.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileCompletedCountKey = + _lookup('NSProgressFileCompletedCountKey'); + + DartNSProgressUserInfoKey get NSProgressFileCompletedCountKey => + objc.NSString.castFromPointer(_NSProgressFileCompletedCountKey.value, + retain: true, release: true); + + set NSProgressFileCompletedCountKey(DartNSProgressUserInfoKey value) { + objc.NSString.castFromPointer(_NSProgressFileCompletedCountKey.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileCompletedCountKey.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileAnimationImageKey = + _lookup('NSProgressFileAnimationImageKey'); + + DartNSProgressUserInfoKey get NSProgressFileAnimationImageKey => + objc.NSString.castFromPointer(_NSProgressFileAnimationImageKey.value, + retain: true, release: true); + + set NSProgressFileAnimationImageKey(DartNSProgressUserInfoKey value) { + objc.NSString.castFromPointer(_NSProgressFileAnimationImageKey.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileAnimationImageKey.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSProgressFileAnimationImageOriginalRectKey = + _lookup( + 'NSProgressFileAnimationImageOriginalRectKey'); + + DartNSProgressUserInfoKey get NSProgressFileAnimationImageOriginalRectKey => + objc.NSString.castFromPointer( + _NSProgressFileAnimationImageOriginalRectKey.value, + retain: true, + release: true); + + set NSProgressFileAnimationImageOriginalRectKey( + DartNSProgressUserInfoKey value) { + objc.NSString.castFromPointer( + _NSProgressFileAnimationImageOriginalRectKey.value, + retain: false, + release: true) + .ref + .release(); + _NSProgressFileAnimationImageOriginalRectKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSProgressFileIconKey = + _lookup('NSProgressFileIconKey'); + + DartNSProgressUserInfoKey get NSProgressFileIconKey => + objc.NSString.castFromPointer(_NSProgressFileIconKey.value, + retain: true, release: true); + + set NSProgressFileIconKey(DartNSProgressUserInfoKey value) { + objc.NSString.castFromPointer(_NSProgressFileIconKey.value, + retain: false, release: true) + .ref + .release(); + _NSProgressFileIconKey.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _kCFTypeArrayCallBacks = + _lookup('kCFTypeArrayCallBacks'); + + CFArrayCallBacks get kCFTypeArrayCallBacks => _kCFTypeArrayCallBacks.ref; + + int CFArrayGetTypeID() { + return _CFArrayGetTypeID(); + } + + late final _CFArrayGetTypeIDPtr = + _lookup>('CFArrayGetTypeID'); + late final _CFArrayGetTypeID = + _CFArrayGetTypeIDPtr.asFunction(); + + CFArrayRef CFArrayCreate( + CFAllocatorRef allocator, + ffi.Pointer> values, + int numValues, + ffi.Pointer callBacks, + ) { + return _CFArrayCreate( + allocator, + values, + numValues, + callBacks, + ); + } + + late final _CFArrayCreatePtr = _lookup< + ffi.NativeFunction< + CFArrayRef Function( + CFAllocatorRef, + ffi.Pointer>, + CFIndex, + ffi.Pointer)>>('CFArrayCreate'); + late final _CFArrayCreate = _CFArrayCreatePtr.asFunction< + CFArrayRef Function(CFAllocatorRef, ffi.Pointer>, + int, ffi.Pointer)>(); + + CFArrayRef CFArrayCreateCopy( + CFAllocatorRef allocator, + CFArrayRef theArray, + ) { + return _CFArrayCreateCopy( + allocator, + theArray, + ); + } + + late final _CFArrayCreateCopyPtr = _lookup< + ffi.NativeFunction>( + 'CFArrayCreateCopy'); + late final _CFArrayCreateCopy = _CFArrayCreateCopyPtr.asFunction< + CFArrayRef Function(CFAllocatorRef, CFArrayRef)>(); + + CFMutableArrayRef CFArrayCreateMutable( + CFAllocatorRef allocator, + int capacity, + ffi.Pointer callBacks, + ) { + return _CFArrayCreateMutable( + allocator, + capacity, + callBacks, + ); + } + + late final _CFArrayCreateMutablePtr = _lookup< + ffi.NativeFunction< + CFMutableArrayRef Function(CFAllocatorRef, CFIndex, + ffi.Pointer)>>('CFArrayCreateMutable'); + late final _CFArrayCreateMutable = _CFArrayCreateMutablePtr.asFunction< + CFMutableArrayRef Function( + CFAllocatorRef, int, ffi.Pointer)>(); + + CFMutableArrayRef CFArrayCreateMutableCopy( + CFAllocatorRef allocator, + int capacity, + CFArrayRef theArray, + ) { + return _CFArrayCreateMutableCopy( + allocator, + capacity, + theArray, + ); + } + + late final _CFArrayCreateMutableCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableArrayRef Function(CFAllocatorRef, CFIndex, + CFArrayRef)>>('CFArrayCreateMutableCopy'); + late final _CFArrayCreateMutableCopy = + _CFArrayCreateMutableCopyPtr.asFunction< + CFMutableArrayRef Function(CFAllocatorRef, int, CFArrayRef)>(); + + int CFArrayGetCount( + CFArrayRef theArray, + ) { + return _CFArrayGetCount( + theArray, + ); + } + + late final _CFArrayGetCountPtr = + _lookup>( + 'CFArrayGetCount'); + late final _CFArrayGetCount = + _CFArrayGetCountPtr.asFunction(); + + int CFArrayGetCountOfValue( + CFArrayRef theArray, + CFRange range, + ffi.Pointer value, + ) { + return _CFArrayGetCountOfValue( + theArray, + range, + value, + ); + } + + late final _CFArrayGetCountOfValuePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFArrayRef, CFRange, + ffi.Pointer)>>('CFArrayGetCountOfValue'); + late final _CFArrayGetCountOfValue = _CFArrayGetCountOfValuePtr.asFunction< + int Function(CFArrayRef, CFRange, ffi.Pointer)>(); + + int CFArrayContainsValue( + CFArrayRef theArray, + CFRange range, + ffi.Pointer value, + ) { + return _CFArrayContainsValue( + theArray, + range, + value, + ); + } + + late final _CFArrayContainsValuePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFArrayRef, CFRange, + ffi.Pointer)>>('CFArrayContainsValue'); + late final _CFArrayContainsValue = _CFArrayContainsValuePtr.asFunction< + int Function(CFArrayRef, CFRange, ffi.Pointer)>(); + + ffi.Pointer CFArrayGetValueAtIndex( + CFArrayRef theArray, + int idx, + ) { + return _CFArrayGetValueAtIndex( + theArray, + idx, + ); + } + + late final _CFArrayGetValueAtIndexPtr = _lookup< + ffi + .NativeFunction Function(CFArrayRef, CFIndex)>>( + 'CFArrayGetValueAtIndex'); + late final _CFArrayGetValueAtIndex = _CFArrayGetValueAtIndexPtr.asFunction< + ffi.Pointer Function(CFArrayRef, int)>(); + + void CFArrayGetValues( + CFArrayRef theArray, + CFRange range, + ffi.Pointer> values, + ) { + return _CFArrayGetValues( + theArray, + range, + values, + ); + } + + late final _CFArrayGetValuesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFArrayRef, CFRange, + ffi.Pointer>)>>('CFArrayGetValues'); + late final _CFArrayGetValues = _CFArrayGetValuesPtr.asFunction< + void Function(CFArrayRef, CFRange, ffi.Pointer>)>(); + + void CFArrayApplyFunction( + CFArrayRef theArray, + CFRange range, + CFArrayApplierFunction applier, + ffi.Pointer context, + ) { + return _CFArrayApplyFunction( + theArray, + range, + applier, + context, + ); + } + + late final _CFArrayApplyFunctionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFArrayRef, CFRange, CFArrayApplierFunction, + ffi.Pointer)>>('CFArrayApplyFunction'); + late final _CFArrayApplyFunction = _CFArrayApplyFunctionPtr.asFunction< + void Function(CFArrayRef, CFRange, CFArrayApplierFunction, + ffi.Pointer)>(); + + int CFArrayGetFirstIndexOfValue( + CFArrayRef theArray, + CFRange range, + ffi.Pointer value, + ) { + return _CFArrayGetFirstIndexOfValue( + theArray, + range, + value, + ); + } + + late final _CFArrayGetFirstIndexOfValuePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFArrayRef, CFRange, + ffi.Pointer)>>('CFArrayGetFirstIndexOfValue'); + late final _CFArrayGetFirstIndexOfValue = _CFArrayGetFirstIndexOfValuePtr + .asFunction)>(); + + int CFArrayGetLastIndexOfValue( + CFArrayRef theArray, + CFRange range, + ffi.Pointer value, + ) { + return _CFArrayGetLastIndexOfValue( + theArray, + range, + value, + ); + } + + late final _CFArrayGetLastIndexOfValuePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFArrayRef, CFRange, + ffi.Pointer)>>('CFArrayGetLastIndexOfValue'); + late final _CFArrayGetLastIndexOfValue = _CFArrayGetLastIndexOfValuePtr + .asFunction)>(); + + int CFArrayBSearchValues( + CFArrayRef theArray, + CFRange range, + ffi.Pointer value, + CFComparatorFunction comparator, + ffi.Pointer context, + ) { + return _CFArrayBSearchValues( + theArray, + range, + value, + comparator, + context, + ); + } + + late final _CFArrayBSearchValuesPtr = _lookup< + ffi.NativeFunction< + CFIndex Function( + CFArrayRef, + CFRange, + ffi.Pointer, + CFComparatorFunction, + ffi.Pointer)>>('CFArrayBSearchValues'); + late final _CFArrayBSearchValues = _CFArrayBSearchValuesPtr.asFunction< + int Function(CFArrayRef, CFRange, ffi.Pointer, + CFComparatorFunction, ffi.Pointer)>(); + + void CFArrayAppendValue( + CFMutableArrayRef theArray, + ffi.Pointer value, + ) { + return _CFArrayAppendValue( + theArray, + value, + ); + } + + late final _CFArrayAppendValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableArrayRef, ffi.Pointer)>>('CFArrayAppendValue'); + late final _CFArrayAppendValue = _CFArrayAppendValuePtr.asFunction< + void Function(CFMutableArrayRef, ffi.Pointer)>(); + + void CFArrayInsertValueAtIndex( + CFMutableArrayRef theArray, + int idx, + ffi.Pointer value, + ) { + return _CFArrayInsertValueAtIndex( + theArray, + idx, + value, + ); + } + + late final _CFArrayInsertValueAtIndexPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableArrayRef, CFIndex, + ffi.Pointer)>>('CFArrayInsertValueAtIndex'); + late final _CFArrayInsertValueAtIndex = + _CFArrayInsertValueAtIndexPtr.asFunction< + void Function(CFMutableArrayRef, int, ffi.Pointer)>(); + + void CFArraySetValueAtIndex( + CFMutableArrayRef theArray, + int idx, + ffi.Pointer value, + ) { + return _CFArraySetValueAtIndex( + theArray, + idx, + value, + ); + } + + late final _CFArraySetValueAtIndexPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableArrayRef, CFIndex, + ffi.Pointer)>>('CFArraySetValueAtIndex'); + late final _CFArraySetValueAtIndex = _CFArraySetValueAtIndexPtr.asFunction< + void Function(CFMutableArrayRef, int, ffi.Pointer)>(); + + void CFArrayRemoveValueAtIndex( + CFMutableArrayRef theArray, + int idx, + ) { + return _CFArrayRemoveValueAtIndex( + theArray, + idx, + ); + } + + late final _CFArrayRemoveValueAtIndexPtr = _lookup< + ffi.NativeFunction>( + 'CFArrayRemoveValueAtIndex'); + late final _CFArrayRemoveValueAtIndex = _CFArrayRemoveValueAtIndexPtr + .asFunction(); + + void CFArrayRemoveAllValues( + CFMutableArrayRef theArray, + ) { + return _CFArrayRemoveAllValues( + theArray, + ); + } + + late final _CFArrayRemoveAllValuesPtr = + _lookup>( + 'CFArrayRemoveAllValues'); + late final _CFArrayRemoveAllValues = + _CFArrayRemoveAllValuesPtr.asFunction(); + + void CFArrayReplaceValues( + CFMutableArrayRef theArray, + CFRange range, + ffi.Pointer> newValues, + int newCount, + ) { + return _CFArrayReplaceValues( + theArray, + range, + newValues, + newCount, + ); + } + + late final _CFArrayReplaceValuesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableArrayRef, + CFRange, + ffi.Pointer>, + CFIndex)>>('CFArrayReplaceValues'); + late final _CFArrayReplaceValues = _CFArrayReplaceValuesPtr.asFunction< + void Function(CFMutableArrayRef, CFRange, + ffi.Pointer>, int)>(); + + void CFArrayExchangeValuesAtIndices( + CFMutableArrayRef theArray, + int idx1, + int idx2, + ) { + return _CFArrayExchangeValuesAtIndices( + theArray, + idx1, + idx2, + ); + } + + late final _CFArrayExchangeValuesAtIndicesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableArrayRef, CFIndex, + CFIndex)>>('CFArrayExchangeValuesAtIndices'); + late final _CFArrayExchangeValuesAtIndices = + _CFArrayExchangeValuesAtIndicesPtr.asFunction< + void Function(CFMutableArrayRef, int, int)>(); + + void CFArraySortValues( + CFMutableArrayRef theArray, + CFRange range, + CFComparatorFunction comparator, + ffi.Pointer context, + ) { + return _CFArraySortValues( + theArray, + range, + comparator, + context, + ); + } + + late final _CFArraySortValuesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableArrayRef, CFRange, CFComparatorFunction, + ffi.Pointer)>>('CFArraySortValues'); + late final _CFArraySortValues = _CFArraySortValuesPtr.asFunction< + void Function(CFMutableArrayRef, CFRange, CFComparatorFunction, + ffi.Pointer)>(); + + void CFArrayAppendArray( + CFMutableArrayRef theArray, + CFArrayRef otherArray, + CFRange otherRange, + ) { + return _CFArrayAppendArray( + theArray, + otherArray, + otherRange, + ); + } + + late final _CFArrayAppendArrayPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableArrayRef, CFArrayRef, CFRange)>>('CFArrayAppendArray'); + late final _CFArrayAppendArray = _CFArrayAppendArrayPtr.asFunction< + void Function(CFMutableArrayRef, CFArrayRef, CFRange)>(); + + ffi.Pointer os_retain( + ffi.Pointer object, + ) { + return _os_retain( + object, + ); + } + + late final _os_retainPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('os_retain'); + late final _os_retain = _os_retainPtr + .asFunction Function(ffi.Pointer)>(); + + void os_release( + ffi.Pointer object, + ) { + return _os_release( + object, + ); + } + + late final _os_releasePtr = + _lookup)>>( + 'os_release'); + late final _os_release = + _os_releasePtr.asFunction)>(); + + ffi.Pointer sec_retain( + ffi.Pointer obj, + ) { + return _sec_retain( + obj, + ); + } + + late final _sec_retainPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('sec_retain'); + late final _sec_retain = _sec_retainPtr + .asFunction Function(ffi.Pointer)>(); + + void sec_release( + ffi.Pointer obj, + ) { + return _sec_release( + obj, + ); + } + + late final _sec_releasePtr = + _lookup)>>( + 'sec_release'); + late final _sec_release = + _sec_releasePtr.asFunction)>(); + + CFStringRef SecCopyErrorMessageString( + int status, + ffi.Pointer reserved, + ) { + return _SecCopyErrorMessageString( + status, + reserved, + ); + } + + late final _SecCopyErrorMessageStringPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function( + OSStatus, ffi.Pointer)>>('SecCopyErrorMessageString'); + late final _SecCopyErrorMessageString = _SecCopyErrorMessageStringPtr + .asFunction)>(); + + void __assert_rtn( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ffi.Pointer arg3, + ) { + return ___assert_rtn( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final ___assert_rtnPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + ffi.Int, ffi.Pointer)>>('__assert_rtn'); + late final ___assert_rtn = ___assert_rtnPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int, + ffi.Pointer)>(); + + late final ffi.Pointer<_RuneLocale> __DefaultRuneLocale = + _lookup<_RuneLocale>('_DefaultRuneLocale'); + + _RuneLocale get _DefaultRuneLocale => __DefaultRuneLocale.ref; + + late final ffi.Pointer> __CurrentRuneLocale = + _lookup>('_CurrentRuneLocale'); + + ffi.Pointer<_RuneLocale> get _CurrentRuneLocale => __CurrentRuneLocale.value; + + set _CurrentRuneLocale(ffi.Pointer<_RuneLocale> value) => + __CurrentRuneLocale.value = value; + + int ___runetype( + int arg0, + ) { + return ____runetype( + arg0, + ); + } + + late final ____runetypePtr = _lookup< + ffi.NativeFunction>( + '___runetype'); + late final ____runetype = ____runetypePtr.asFunction(); + + int ___tolower( + int arg0, + ) { + return ____tolower( + arg0, + ); + } + + late final ____tolowerPtr = _lookup< + ffi.NativeFunction<__darwin_ct_rune_t Function(__darwin_ct_rune_t)>>( + '___tolower'); + late final ____tolower = ____tolowerPtr.asFunction(); + + int ___toupper( + int arg0, + ) { + return ____toupper( + arg0, + ); + } + + late final ____toupperPtr = _lookup< + ffi.NativeFunction<__darwin_ct_rune_t Function(__darwin_ct_rune_t)>>( + '___toupper'); + late final ____toupper = ____toupperPtr.asFunction(); + + int __maskrune( + int arg0, + int arg1, + ) { + return ___maskrune( + arg0, + arg1, + ); + } + + late final ___maskrunePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + __darwin_ct_rune_t, ffi.UnsignedLong)>>('__maskrune'); + late final ___maskrune = ___maskrunePtr.asFunction(); + + int __toupper( + int arg0, + ) { + return ___toupper1( + arg0, + ); + } + + late final ___toupperPtr = _lookup< + ffi.NativeFunction<__darwin_ct_rune_t Function(__darwin_ct_rune_t)>>( + '__toupper'); + late final ___toupper1 = ___toupperPtr.asFunction(); + + int __tolower( + int arg0, + ) { + return ___tolower1( + arg0, + ); + } + + late final ___tolowerPtr = _lookup< + ffi.NativeFunction<__darwin_ct_rune_t Function(__darwin_ct_rune_t)>>( + '__tolower'); + late final ___tolower1 = ___tolowerPtr.asFunction(); + + ffi.Pointer __error() { + return ___error(); + } + + late final ___errorPtr = + _lookup Function()>>('__error'); + late final ___error = + ___errorPtr.asFunction Function()>(); + + ffi.Pointer localeconv() { + return _localeconv(); + } + + late final _localeconvPtr = + _lookup Function()>>('localeconv'); + late final _localeconv = + _localeconvPtr.asFunction Function()>(); + + ffi.Pointer setlocale( + int arg0, + ffi.Pointer arg1, + ) { + return _setlocale( + arg0, + arg1, + ); + } + + late final _setlocalePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Pointer)>>('setlocale'); + late final _setlocale = _setlocalePtr + .asFunction Function(int, ffi.Pointer)>(); + + int __math_errhandling() { + return ___math_errhandling(); + } + + late final ___math_errhandlingPtr = + _lookup>('__math_errhandling'); + late final ___math_errhandling = + ___math_errhandlingPtr.asFunction(); + + int __fpclassifyf( + double arg0, + ) { + return ___fpclassifyf( + arg0, + ); + } + + late final ___fpclassifyfPtr = + _lookup>('__fpclassifyf'); + late final ___fpclassifyf = + ___fpclassifyfPtr.asFunction(); + + int __fpclassifyd( + double arg0, + ) { + return ___fpclassifyd( + arg0, + ); + } + + late final ___fpclassifydPtr = + _lookup>( + '__fpclassifyd'); + late final ___fpclassifyd = + ___fpclassifydPtr.asFunction(); + + double acosf( + double arg0, + ) { + return _acosf( + arg0, + ); + } + + late final _acosfPtr = + _lookup>('acosf'); + late final _acosf = _acosfPtr.asFunction(); + + double acos( + double arg0, + ) { + return _acos( + arg0, + ); + } + + late final _acosPtr = + _lookup>('acos'); + late final _acos = _acosPtr.asFunction(); + + double asinf( + double arg0, + ) { + return _asinf( + arg0, + ); + } + + late final _asinfPtr = + _lookup>('asinf'); + late final _asinf = _asinfPtr.asFunction(); + + double asin( + double arg0, + ) { + return _asin( + arg0, + ); + } + + late final _asinPtr = + _lookup>('asin'); + late final _asin = _asinPtr.asFunction(); + + double atanf( + double arg0, + ) { + return _atanf( + arg0, + ); + } + + late final _atanfPtr = + _lookup>('atanf'); + late final _atanf = _atanfPtr.asFunction(); + + double atan( + double arg0, + ) { + return _atan( + arg0, + ); + } + + late final _atanPtr = + _lookup>('atan'); + late final _atan = _atanPtr.asFunction(); + + double atan2f( + double arg0, + double arg1, + ) { + return _atan2f( + arg0, + arg1, + ); + } + + late final _atan2fPtr = + _lookup>( + 'atan2f'); + late final _atan2f = _atan2fPtr.asFunction(); + + double atan2( + double arg0, + double arg1, + ) { + return _atan2( + arg0, + arg1, + ); + } + + late final _atan2Ptr = + _lookup>( + 'atan2'); + late final _atan2 = _atan2Ptr.asFunction(); + + double cosf( + double arg0, + ) { + return _cosf( + arg0, + ); + } + + late final _cosfPtr = + _lookup>('cosf'); + late final _cosf = _cosfPtr.asFunction(); + + double cos( + double arg0, + ) { + return _cos( + arg0, + ); + } + + late final _cosPtr = + _lookup>('cos'); + late final _cos = _cosPtr.asFunction(); + + double sinf( + double arg0, + ) { + return _sinf( + arg0, + ); + } + + late final _sinfPtr = + _lookup>('sinf'); + late final _sinf = _sinfPtr.asFunction(); + + double sin( + double arg0, + ) { + return _sin( + arg0, + ); + } + + late final _sinPtr = + _lookup>('sin'); + late final _sin = _sinPtr.asFunction(); + + double tanf( + double arg0, + ) { + return _tanf( + arg0, + ); + } + + late final _tanfPtr = + _lookup>('tanf'); + late final _tanf = _tanfPtr.asFunction(); + + double tan( + double arg0, + ) { + return _tan( + arg0, + ); + } + + late final _tanPtr = + _lookup>('tan'); + late final _tan = _tanPtr.asFunction(); + + double acoshf( + double arg0, + ) { + return _acoshf( + arg0, + ); + } + + late final _acoshfPtr = + _lookup>('acoshf'); + late final _acoshf = _acoshfPtr.asFunction(); + + double acosh( + double arg0, + ) { + return _acosh( + arg0, + ); + } + + late final _acoshPtr = + _lookup>('acosh'); + late final _acosh = _acoshPtr.asFunction(); + + double asinhf( + double arg0, + ) { + return _asinhf( + arg0, + ); + } + + late final _asinhfPtr = + _lookup>('asinhf'); + late final _asinhf = _asinhfPtr.asFunction(); + + double asinh( + double arg0, + ) { + return _asinh( + arg0, + ); + } + + late final _asinhPtr = + _lookup>('asinh'); + late final _asinh = _asinhPtr.asFunction(); + + double atanhf( + double arg0, + ) { + return _atanhf( + arg0, + ); + } + + late final _atanhfPtr = + _lookup>('atanhf'); + late final _atanhf = _atanhfPtr.asFunction(); + + double atanh( + double arg0, + ) { + return _atanh( + arg0, + ); + } + + late final _atanhPtr = + _lookup>('atanh'); + late final _atanh = _atanhPtr.asFunction(); + + double coshf( + double arg0, + ) { + return _coshf( + arg0, + ); + } + + late final _coshfPtr = + _lookup>('coshf'); + late final _coshf = _coshfPtr.asFunction(); + + double cosh( + double arg0, + ) { + return _cosh( + arg0, + ); + } + + late final _coshPtr = + _lookup>('cosh'); + late final _cosh = _coshPtr.asFunction(); + + double sinhf( + double arg0, + ) { + return _sinhf( + arg0, + ); + } + + late final _sinhfPtr = + _lookup>('sinhf'); + late final _sinhf = _sinhfPtr.asFunction(); + + double sinh( + double arg0, + ) { + return _sinh( + arg0, + ); + } + + late final _sinhPtr = + _lookup>('sinh'); + late final _sinh = _sinhPtr.asFunction(); + + double tanhf( + double arg0, + ) { + return _tanhf( + arg0, + ); + } + + late final _tanhfPtr = + _lookup>('tanhf'); + late final _tanhf = _tanhfPtr.asFunction(); + + double tanh( + double arg0, + ) { + return _tanh( + arg0, + ); + } + + late final _tanhPtr = + _lookup>('tanh'); + late final _tanh = _tanhPtr.asFunction(); + + double expf( + double arg0, + ) { + return _expf( + arg0, + ); + } + + late final _expfPtr = + _lookup>('expf'); + late final _expf = _expfPtr.asFunction(); + + double exp( + double arg0, + ) { + return _exp( + arg0, + ); + } + + late final _expPtr = + _lookup>('exp'); + late final _exp = _expPtr.asFunction(); + + double exp2f( + double arg0, + ) { + return _exp2f( + arg0, + ); + } + + late final _exp2fPtr = + _lookup>('exp2f'); + late final _exp2f = _exp2fPtr.asFunction(); + + double exp2( + double arg0, + ) { + return _exp2( + arg0, + ); + } + + late final _exp2Ptr = + _lookup>('exp2'); + late final _exp2 = _exp2Ptr.asFunction(); + + double expm1f( + double arg0, + ) { + return _expm1f( + arg0, + ); + } + + late final _expm1fPtr = + _lookup>('expm1f'); + late final _expm1f = _expm1fPtr.asFunction(); + + double expm1( + double arg0, + ) { + return _expm1( + arg0, + ); + } + + late final _expm1Ptr = + _lookup>('expm1'); + late final _expm1 = _expm1Ptr.asFunction(); + + double logf( + double arg0, + ) { + return _logf( + arg0, + ); + } + + late final _logfPtr = + _lookup>('logf'); + late final _logf = _logfPtr.asFunction(); + + double log( + double arg0, + ) { + return _log( + arg0, + ); + } + + late final _logPtr = + _lookup>('log'); + late final _log = _logPtr.asFunction(); + + double log10f( + double arg0, + ) { + return _log10f( + arg0, + ); + } + + late final _log10fPtr = + _lookup>('log10f'); + late final _log10f = _log10fPtr.asFunction(); + + double log10( + double arg0, + ) { + return _log10( + arg0, + ); + } + + late final _log10Ptr = + _lookup>('log10'); + late final _log10 = _log10Ptr.asFunction(); + + double log2f( + double arg0, + ) { + return _log2f( + arg0, + ); + } + + late final _log2fPtr = + _lookup>('log2f'); + late final _log2f = _log2fPtr.asFunction(); + + double log2( + double arg0, + ) { + return _log2( + arg0, + ); + } + + late final _log2Ptr = + _lookup>('log2'); + late final _log2 = _log2Ptr.asFunction(); + + double log1pf( + double arg0, + ) { + return _log1pf( + arg0, + ); + } + + late final _log1pfPtr = + _lookup>('log1pf'); + late final _log1pf = _log1pfPtr.asFunction(); + + double log1p( + double arg0, + ) { + return _log1p( + arg0, + ); + } + + late final _log1pPtr = + _lookup>('log1p'); + late final _log1p = _log1pPtr.asFunction(); + + double logbf( + double arg0, + ) { + return _logbf( + arg0, + ); + } + + late final _logbfPtr = + _lookup>('logbf'); + late final _logbf = _logbfPtr.asFunction(); + + double logb( + double arg0, + ) { + return _logb( + arg0, + ); + } + + late final _logbPtr = + _lookup>('logb'); + late final _logb = _logbPtr.asFunction(); + + double modff( + double arg0, + ffi.Pointer arg1, + ) { + return _modff( + arg0, + arg1, + ); + } + + late final _modffPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function(ffi.Float, ffi.Pointer)>>('modff'); + late final _modff = + _modffPtr.asFunction)>(); + + double modf( + double arg0, + ffi.Pointer arg1, + ) { + return _modf( + arg0, + arg1, + ); + } + + late final _modfPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Double, ffi.Pointer)>>('modf'); + late final _modf = + _modfPtr.asFunction)>(); + + double ldexpf( + double arg0, + int arg1, + ) { + return _ldexpf( + arg0, + arg1, + ); + } + + late final _ldexpfPtr = + _lookup>( + 'ldexpf'); + late final _ldexpf = _ldexpfPtr.asFunction(); + + double ldexp( + double arg0, + int arg1, + ) { + return _ldexp( + arg0, + arg1, + ); + } + + late final _ldexpPtr = + _lookup>( + 'ldexp'); + late final _ldexp = _ldexpPtr.asFunction(); + + double frexpf( + double arg0, + ffi.Pointer arg1, + ) { + return _frexpf( + arg0, + arg1, + ); + } + + late final _frexpfPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function(ffi.Float, ffi.Pointer)>>('frexpf'); + late final _frexpf = + _frexpfPtr.asFunction)>(); + + double frexp( + double arg0, + ffi.Pointer arg1, + ) { + return _frexp( + arg0, + arg1, + ); + } + + late final _frexpPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Double, ffi.Pointer)>>('frexp'); + late final _frexp = + _frexpPtr.asFunction)>(); + + int ilogbf( + double arg0, + ) { + return _ilogbf( + arg0, + ); + } + + late final _ilogbfPtr = + _lookup>('ilogbf'); + late final _ilogbf = _ilogbfPtr.asFunction(); + + int ilogb( + double arg0, + ) { + return _ilogb( + arg0, + ); + } + + late final _ilogbPtr = + _lookup>('ilogb'); + late final _ilogb = _ilogbPtr.asFunction(); + + double scalbnf( + double arg0, + int arg1, + ) { + return _scalbnf( + arg0, + arg1, + ); + } + + late final _scalbnfPtr = + _lookup>( + 'scalbnf'); + late final _scalbnf = _scalbnfPtr.asFunction(); + + double scalbn( + double arg0, + int arg1, + ) { + return _scalbn( + arg0, + arg1, + ); + } + + late final _scalbnPtr = + _lookup>( + 'scalbn'); + late final _scalbn = _scalbnPtr.asFunction(); + + double scalblnf( + double arg0, + int arg1, + ) { + return _scalblnf( + arg0, + arg1, + ); + } + + late final _scalblnfPtr = + _lookup>( + 'scalblnf'); + late final _scalblnf = + _scalblnfPtr.asFunction(); + + double scalbln( + double arg0, + int arg1, + ) { + return _scalbln( + arg0, + arg1, + ); + } + + late final _scalblnPtr = + _lookup>( + 'scalbln'); + late final _scalbln = _scalblnPtr.asFunction(); + + double fabsf( + double arg0, + ) { + return _fabsf( + arg0, + ); + } + + late final _fabsfPtr = + _lookup>('fabsf'); + late final _fabsf = _fabsfPtr.asFunction(); + + double fabs( + double arg0, + ) { + return _fabs( + arg0, + ); + } + + late final _fabsPtr = + _lookup>('fabs'); + late final _fabs = _fabsPtr.asFunction(); + + double cbrtf( + double arg0, + ) { + return _cbrtf( + arg0, + ); + } + + late final _cbrtfPtr = + _lookup>('cbrtf'); + late final _cbrtf = _cbrtfPtr.asFunction(); + + double cbrt( + double arg0, + ) { + return _cbrt( + arg0, + ); + } + + late final _cbrtPtr = + _lookup>('cbrt'); + late final _cbrt = _cbrtPtr.asFunction(); + + double hypotf( + double arg0, + double arg1, + ) { + return _hypotf( + arg0, + arg1, + ); + } + + late final _hypotfPtr = + _lookup>( + 'hypotf'); + late final _hypotf = _hypotfPtr.asFunction(); + + double hypot( + double arg0, + double arg1, + ) { + return _hypot( + arg0, + arg1, + ); + } + + late final _hypotPtr = + _lookup>( + 'hypot'); + late final _hypot = _hypotPtr.asFunction(); + + double powf( + double arg0, + double arg1, + ) { + return _powf( + arg0, + arg1, + ); + } + + late final _powfPtr = + _lookup>( + 'powf'); + late final _powf = _powfPtr.asFunction(); + + double pow( + double arg0, + double arg1, + ) { + return _pow( + arg0, + arg1, + ); + } + + late final _powPtr = + _lookup>( + 'pow'); + late final _pow = _powPtr.asFunction(); + + double sqrtf( + double arg0, + ) { + return _sqrtf( + arg0, + ); + } + + late final _sqrtfPtr = + _lookup>('sqrtf'); + late final _sqrtf = _sqrtfPtr.asFunction(); + + double sqrt( + double arg0, + ) { + return _sqrt( + arg0, + ); + } + + late final _sqrtPtr = + _lookup>('sqrt'); + late final _sqrt = _sqrtPtr.asFunction(); + + double erff( + double arg0, + ) { + return _erff( + arg0, + ); + } + + late final _erffPtr = + _lookup>('erff'); + late final _erff = _erffPtr.asFunction(); + + double erf( + double arg0, + ) { + return _erf( + arg0, + ); + } + + late final _erfPtr = + _lookup>('erf'); + late final _erf = _erfPtr.asFunction(); + + double erfcf( + double arg0, + ) { + return _erfcf( + arg0, + ); + } + + late final _erfcfPtr = + _lookup>('erfcf'); + late final _erfcf = _erfcfPtr.asFunction(); + + double erfc( + double arg0, + ) { + return _erfc( + arg0, + ); + } + + late final _erfcPtr = + _lookup>('erfc'); + late final _erfc = _erfcPtr.asFunction(); + + double lgammaf( + double arg0, + ) { + return _lgammaf( + arg0, + ); + } + + late final _lgammafPtr = + _lookup>('lgammaf'); + late final _lgammaf = _lgammafPtr.asFunction(); + + double lgamma( + double arg0, + ) { + return _lgamma( + arg0, + ); + } + + late final _lgammaPtr = + _lookup>('lgamma'); + late final _lgamma = _lgammaPtr.asFunction(); + + double tgammaf( + double arg0, + ) { + return _tgammaf( + arg0, + ); + } + + late final _tgammafPtr = + _lookup>('tgammaf'); + late final _tgammaf = _tgammafPtr.asFunction(); + + double tgamma( + double arg0, + ) { + return _tgamma( + arg0, + ); + } + + late final _tgammaPtr = + _lookup>('tgamma'); + late final _tgamma = _tgammaPtr.asFunction(); + + double ceilf( + double arg0, + ) { + return _ceilf( + arg0, + ); + } + + late final _ceilfPtr = + _lookup>('ceilf'); + late final _ceilf = _ceilfPtr.asFunction(); + + double ceil( + double arg0, + ) { + return _ceil( + arg0, + ); + } + + late final _ceilPtr = + _lookup>('ceil'); + late final _ceil = _ceilPtr.asFunction(); + + double floorf( + double arg0, + ) { + return _floorf( + arg0, + ); + } + + late final _floorfPtr = + _lookup>('floorf'); + late final _floorf = _floorfPtr.asFunction(); + + double floor( + double arg0, + ) { + return _floor( + arg0, + ); + } + + late final _floorPtr = + _lookup>('floor'); + late final _floor = _floorPtr.asFunction(); + + double nearbyintf( + double arg0, + ) { + return _nearbyintf( + arg0, + ); + } + + late final _nearbyintfPtr = + _lookup>('nearbyintf'); + late final _nearbyintf = _nearbyintfPtr.asFunction(); + + double nearbyint( + double arg0, + ) { + return _nearbyint( + arg0, + ); + } + + late final _nearbyintPtr = + _lookup>('nearbyint'); + late final _nearbyint = _nearbyintPtr.asFunction(); + + double rintf( + double arg0, + ) { + return _rintf( + arg0, + ); + } + + late final _rintfPtr = + _lookup>('rintf'); + late final _rintf = _rintfPtr.asFunction(); + + double rint( + double arg0, + ) { + return _rint( + arg0, + ); + } + + late final _rintPtr = + _lookup>('rint'); + late final _rint = _rintPtr.asFunction(); + + int lrintf( + double arg0, + ) { + return _lrintf( + arg0, + ); + } + + late final _lrintfPtr = + _lookup>('lrintf'); + late final _lrintf = _lrintfPtr.asFunction(); + + int lrint( + double arg0, + ) { + return _lrint( + arg0, + ); + } + + late final _lrintPtr = + _lookup>('lrint'); + late final _lrint = _lrintPtr.asFunction(); + + double roundf( + double arg0, + ) { + return _roundf( + arg0, + ); + } + + late final _roundfPtr = + _lookup>('roundf'); + late final _roundf = _roundfPtr.asFunction(); + + double round( + double arg0, + ) { + return _round( + arg0, + ); + } + + late final _roundPtr = + _lookup>('round'); + late final _round = _roundPtr.asFunction(); + + int lroundf( + double arg0, + ) { + return _lroundf( + arg0, + ); + } + + late final _lroundfPtr = + _lookup>('lroundf'); + late final _lroundf = _lroundfPtr.asFunction(); + + int lround( + double arg0, + ) { + return _lround( + arg0, + ); + } + + late final _lroundPtr = + _lookup>('lround'); + late final _lround = _lroundPtr.asFunction(); + + int llrintf( + double arg0, + ) { + return _llrintf( + arg0, + ); + } + + late final _llrintfPtr = + _lookup>('llrintf'); + late final _llrintf = _llrintfPtr.asFunction(); + + int llrint( + double arg0, + ) { + return _llrint( + arg0, + ); + } + + late final _llrintPtr = + _lookup>('llrint'); + late final _llrint = _llrintPtr.asFunction(); + + int llroundf( + double arg0, + ) { + return _llroundf( + arg0, + ); + } + + late final _llroundfPtr = + _lookup>('llroundf'); + late final _llroundf = _llroundfPtr.asFunction(); + + int llround( + double arg0, + ) { + return _llround( + arg0, + ); + } + + late final _llroundPtr = + _lookup>('llround'); + late final _llround = _llroundPtr.asFunction(); + + double truncf( + double arg0, + ) { + return _truncf( + arg0, + ); + } + + late final _truncfPtr = + _lookup>('truncf'); + late final _truncf = _truncfPtr.asFunction(); + + double trunc( + double arg0, + ) { + return _trunc( + arg0, + ); + } + + late final _truncPtr = + _lookup>('trunc'); + late final _trunc = _truncPtr.asFunction(); + + double fmodf( + double arg0, + double arg1, + ) { + return _fmodf( + arg0, + arg1, + ); + } + + late final _fmodfPtr = + _lookup>( + 'fmodf'); + late final _fmodf = _fmodfPtr.asFunction(); + + double fmod( + double arg0, + double arg1, + ) { + return _fmod( + arg0, + arg1, + ); + } + + late final _fmodPtr = + _lookup>( + 'fmod'); + late final _fmod = _fmodPtr.asFunction(); + + double remainderf( + double arg0, + double arg1, + ) { + return _remainderf( + arg0, + arg1, + ); + } + + late final _remainderfPtr = + _lookup>( + 'remainderf'); + late final _remainderf = + _remainderfPtr.asFunction(); + + double remainder( + double arg0, + double arg1, + ) { + return _remainder( + arg0, + arg1, + ); + } + + late final _remainderPtr = + _lookup>( + 'remainder'); + late final _remainder = + _remainderPtr.asFunction(); + + double remquof( + double arg0, + double arg1, + ffi.Pointer arg2, + ) { + return _remquof( + arg0, + arg1, + arg2, + ); + } + + late final _remquofPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function( + ffi.Float, ffi.Float, ffi.Pointer)>>('remquof'); + late final _remquof = _remquofPtr + .asFunction)>(); + + double remquo( + double arg0, + double arg1, + ffi.Pointer arg2, + ) { + return _remquo( + arg0, + arg1, + arg2, + ); + } + + late final _remquoPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function( + ffi.Double, ffi.Double, ffi.Pointer)>>('remquo'); + late final _remquo = _remquoPtr + .asFunction)>(); + + double copysignf( + double arg0, + double arg1, + ) { + return _copysignf( + arg0, + arg1, + ); + } + + late final _copysignfPtr = + _lookup>( + 'copysignf'); + late final _copysignf = + _copysignfPtr.asFunction(); + + double copysign( + double arg0, + double arg1, + ) { + return _copysign( + arg0, + arg1, + ); + } + + late final _copysignPtr = + _lookup>( + 'copysign'); + late final _copysign = + _copysignPtr.asFunction(); + + double nanf( + ffi.Pointer arg0, + ) { + return _nanf( + arg0, + ); + } + + late final _nanfPtr = + _lookup)>>( + 'nanf'); + late final _nanf = + _nanfPtr.asFunction)>(); + + double nan( + ffi.Pointer arg0, + ) { + return _nan( + arg0, + ); + } + + late final _nanPtr = + _lookup)>>( + 'nan'); + late final _nan = + _nanPtr.asFunction)>(); + + double nextafterf( + double arg0, + double arg1, + ) { + return _nextafterf( + arg0, + arg1, + ); + } + + late final _nextafterfPtr = + _lookup>( + 'nextafterf'); + late final _nextafterf = + _nextafterfPtr.asFunction(); + + double nextafter( + double arg0, + double arg1, + ) { + return _nextafter( + arg0, + arg1, + ); + } + + late final _nextafterPtr = + _lookup>( + 'nextafter'); + late final _nextafter = + _nextafterPtr.asFunction(); + + double fdimf( + double arg0, + double arg1, + ) { + return _fdimf( + arg0, + arg1, + ); + } + + late final _fdimfPtr = + _lookup>( + 'fdimf'); + late final _fdimf = _fdimfPtr.asFunction(); + + double fdim( + double arg0, + double arg1, + ) { + return _fdim( + arg0, + arg1, + ); + } + + late final _fdimPtr = + _lookup>( + 'fdim'); + late final _fdim = _fdimPtr.asFunction(); + + double fmaxf( + double arg0, + double arg1, + ) { + return _fmaxf( + arg0, + arg1, + ); + } + + late final _fmaxfPtr = + _lookup>( + 'fmaxf'); + late final _fmaxf = _fmaxfPtr.asFunction(); + + double fmax( + double arg0, + double arg1, + ) { + return _fmax( + arg0, + arg1, + ); + } + + late final _fmaxPtr = + _lookup>( + 'fmax'); + late final _fmax = _fmaxPtr.asFunction(); + + double fminf( + double arg0, + double arg1, + ) { + return _fminf( + arg0, + arg1, + ); + } + + late final _fminfPtr = + _lookup>( + 'fminf'); + late final _fminf = _fminfPtr.asFunction(); + + double fmin( + double arg0, + double arg1, + ) { + return _fmin( + arg0, + arg1, + ); + } + + late final _fminPtr = + _lookup>( + 'fmin'); + late final _fmin = _fminPtr.asFunction(); + + double fmaf( + double arg0, + double arg1, + double arg2, + ) { + return _fmaf( + arg0, + arg1, + arg2, + ); + } + + late final _fmafPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function(ffi.Float, ffi.Float, ffi.Float)>>('fmaf'); + late final _fmaf = + _fmafPtr.asFunction(); + + double fma( + double arg0, + double arg1, + double arg2, + ) { + return _fma( + arg0, + arg1, + arg2, + ); + } + + late final _fmaPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Double, ffi.Double, ffi.Double)>>('fma'); + late final _fma = + _fmaPtr.asFunction(); + + double __exp10f( + double arg0, + ) { + return ___exp10f( + arg0, + ); + } + + late final ___exp10fPtr = + _lookup>('__exp10f'); + late final ___exp10f = ___exp10fPtr.asFunction(); + + double __exp10( + double arg0, + ) { + return ___exp10( + arg0, + ); + } + + late final ___exp10Ptr = + _lookup>('__exp10'); + late final ___exp10 = ___exp10Ptr.asFunction(); + + double __cospif( + double arg0, + ) { + return ___cospif( + arg0, + ); + } + + late final ___cospifPtr = + _lookup>('__cospif'); + late final ___cospif = ___cospifPtr.asFunction(); + + double __cospi( + double arg0, + ) { + return ___cospi( + arg0, + ); + } + + late final ___cospiPtr = + _lookup>('__cospi'); + late final ___cospi = ___cospiPtr.asFunction(); + + double __sinpif( + double arg0, + ) { + return ___sinpif( + arg0, + ); + } + + late final ___sinpifPtr = + _lookup>('__sinpif'); + late final ___sinpif = ___sinpifPtr.asFunction(); + + double __sinpi( + double arg0, + ) { + return ___sinpi( + arg0, + ); + } + + late final ___sinpiPtr = + _lookup>('__sinpi'); + late final ___sinpi = ___sinpiPtr.asFunction(); + + double __tanpif( + double arg0, + ) { + return ___tanpif( + arg0, + ); + } + + late final ___tanpifPtr = + _lookup>('__tanpif'); + late final ___tanpif = ___tanpifPtr.asFunction(); + + double __tanpi( + double arg0, + ) { + return ___tanpi( + arg0, + ); + } + + late final ___tanpiPtr = + _lookup>('__tanpi'); + late final ___tanpi = ___tanpiPtr.asFunction(); + + __float2 __sincosf_stret( + double arg0, + ) { + return ___sincosf_stret( + arg0, + ); + } + + late final ___sincosf_stretPtr = + _lookup>( + '__sincosf_stret'); + late final ___sincosf_stret = + ___sincosf_stretPtr.asFunction<__float2 Function(double)>(); + + __double2 __sincos_stret( + double arg0, + ) { + return ___sincos_stret( + arg0, + ); + } + + late final ___sincos_stretPtr = + _lookup>( + '__sincos_stret'); + late final ___sincos_stret = + ___sincos_stretPtr.asFunction<__double2 Function(double)>(); + + __float2 __sincospif_stret( + double arg0, + ) { + return ___sincospif_stret( + arg0, + ); + } + + late final ___sincospif_stretPtr = + _lookup>( + '__sincospif_stret'); + late final ___sincospif_stret = + ___sincospif_stretPtr.asFunction<__float2 Function(double)>(); + + __double2 __sincospi_stret( + double arg0, + ) { + return ___sincospi_stret( + arg0, + ); + } + + late final ___sincospi_stretPtr = + _lookup>( + '__sincospi_stret'); + late final ___sincospi_stret = + ___sincospi_stretPtr.asFunction<__double2 Function(double)>(); + + double j0( + double arg0, + ) { + return _j0( + arg0, + ); + } + + late final _j0Ptr = + _lookup>('j0'); + late final _j0 = _j0Ptr.asFunction(); + + double j1( + double arg0, + ) { + return _j1( + arg0, + ); + } + + late final _j1Ptr = + _lookup>('j1'); + late final _j1 = _j1Ptr.asFunction(); + + double jn( + int arg0, + double arg1, + ) { + return _jn( + arg0, + arg1, + ); + } + + late final _jnPtr = + _lookup>( + 'jn'); + late final _jn = _jnPtr.asFunction(); + + double y0( + double arg0, + ) { + return _y0( + arg0, + ); + } + + late final _y0Ptr = + _lookup>('y0'); + late final _y0 = _y0Ptr.asFunction(); + + double y1( + double arg0, + ) { + return _y1( + arg0, + ); + } + + late final _y1Ptr = + _lookup>('y1'); + late final _y1 = _y1Ptr.asFunction(); + + double yn( + int arg0, + double arg1, + ) { + return _yn( + arg0, + arg1, + ); + } + + late final _ynPtr = + _lookup>( + 'yn'); + late final _yn = _ynPtr.asFunction(); + + double scalb( + double arg0, + double arg1, + ) { + return _scalb( + arg0, + arg1, + ); + } + + late final _scalbPtr = + _lookup>( + 'scalb'); + late final _scalb = _scalbPtr.asFunction(); + + late final ffi.Pointer _signgam = _lookup('signgam'); + + int get signgam => _signgam.value; + + set signgam(int value) => _signgam.value = value; + + int setjmp( + ffi.Pointer arg0, + ) { + return _setjmp1( + arg0, + ); + } + + late final _setjmpPtr = + _lookup)>>( + 'setjmp'); + late final _setjmp1 = + _setjmpPtr.asFunction)>(); + + void longjmp( + ffi.Pointer arg0, + int arg1, + ) { + return _longjmp1( + arg0, + arg1, + ); + } + + late final _longjmpPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'longjmp'); + late final _longjmp1 = + _longjmpPtr.asFunction, int)>(); + + int _setjmp( + ffi.Pointer arg0, + ) { + return __setjmp( + arg0, + ); + } + + late final __setjmpPtr = + _lookup)>>( + '_setjmp'); + late final __setjmp = + __setjmpPtr.asFunction)>(); + + void _longjmp( + ffi.Pointer arg0, + int arg1, + ) { + return __longjmp( + arg0, + arg1, + ); + } + + late final __longjmpPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + '_longjmp'); + late final __longjmp = + __longjmpPtr.asFunction, int)>(); + + int sigsetjmp( + ffi.Pointer arg0, + int arg1, + ) { + return _sigsetjmp( + arg0, + arg1, + ); + } + + late final _sigsetjmpPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'sigsetjmp'); + late final _sigsetjmp = + _sigsetjmpPtr.asFunction, int)>(); + + void siglongjmp( + ffi.Pointer arg0, + int arg1, + ) { + return _siglongjmp( + arg0, + arg1, + ); + } + + late final _siglongjmpPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'siglongjmp'); + late final _siglongjmp = + _siglongjmpPtr.asFunction, int)>(); + + void longjmperror() { + return _longjmperror(); + } + + late final _longjmperrorPtr = + _lookup>('longjmperror'); + late final _longjmperror = _longjmperrorPtr.asFunction(); + + late final ffi.Pointer>> _sys_signame = + _lookup>>('sys_signame'); + + ffi.Pointer> get sys_signame => _sys_signame.value; + + set sys_signame(ffi.Pointer> value) => + _sys_signame.value = value; + + late final ffi.Pointer>> _sys_siglist = + _lookup>>('sys_siglist'); + + ffi.Pointer> get sys_siglist => _sys_siglist.value; + + set sys_siglist(ffi.Pointer> value) => + _sys_siglist.value = value; + + int raise( + int arg0, + ) { + return _raise( + arg0, + ); + } + + late final _raisePtr = + _lookup>('raise'); + late final _raise = _raisePtr.asFunction(); + + ffi.Pointer> bsd_signal( + int arg0, + ffi.Pointer> arg1, + ) { + return _bsd_signal( + arg0, + arg1, + ); + } + + late final _bsd_signalPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer> Function( + ffi.Int, + ffi.Pointer< + ffi + .NativeFunction>)>>('bsd_signal'); + late final _bsd_signal = _bsd_signalPtr.asFunction< + ffi.Pointer> Function( + int, ffi.Pointer>)>(); + + int kill( + int arg0, + int arg1, + ) { + return _kill( + arg0, + arg1, + ); + } + + late final _killPtr = + _lookup>('kill'); + late final _kill = _killPtr.asFunction(); + + int killpg( + int arg0, + int arg1, + ) { + return _killpg( + arg0, + arg1, + ); + } + + late final _killpgPtr = + _lookup>('killpg'); + late final _killpg = _killpgPtr.asFunction(); + + int pthread_kill( + pthread_t arg0, + int arg1, + ) { + return _pthread_kill( + arg0, + arg1, + ); + } + + late final _pthread_killPtr = + _lookup>( + 'pthread_kill'); + late final _pthread_kill = + _pthread_killPtr.asFunction(); + + int pthread_sigmask( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _pthread_sigmask( + arg0, + arg1, + arg2, + ); + } + + late final _pthread_sigmaskPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, + ffi.Pointer)>>('pthread_sigmask'); + late final _pthread_sigmask = _pthread_sigmaskPtr.asFunction< + int Function(int, ffi.Pointer, ffi.Pointer)>(); + + int sigaction1( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _sigaction1( + arg0, + arg1, + arg2, + ); + } + + late final _sigaction1Ptr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, + ffi.Pointer)>>('sigaction'); + late final _sigaction1 = _sigaction1Ptr.asFunction< + int Function(int, ffi.Pointer, ffi.Pointer)>(); + + int sigaddset( + ffi.Pointer arg0, + int arg1, + ) { + return _sigaddset( + arg0, + arg1, + ); + } + + late final _sigaddsetPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'sigaddset'); + late final _sigaddset = + _sigaddsetPtr.asFunction, int)>(); + + int sigaltstack( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _sigaltstack( + arg0, + arg1, + ); + } + + late final _sigaltstackPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('sigaltstack'); + late final _sigaltstack = _sigaltstackPtr + .asFunction, ffi.Pointer)>(); + + int sigdelset( + ffi.Pointer arg0, + int arg1, + ) { + return _sigdelset( + arg0, + arg1, + ); + } + + late final _sigdelsetPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'sigdelset'); + late final _sigdelset = + _sigdelsetPtr.asFunction, int)>(); + + int sigemptyset( + ffi.Pointer arg0, + ) { + return _sigemptyset( + arg0, + ); + } + + late final _sigemptysetPtr = + _lookup)>>( + 'sigemptyset'); + late final _sigemptyset = + _sigemptysetPtr.asFunction)>(); + + int sigfillset( + ffi.Pointer arg0, + ) { + return _sigfillset( + arg0, + ); + } + + late final _sigfillsetPtr = + _lookup)>>( + 'sigfillset'); + late final _sigfillset = + _sigfillsetPtr.asFunction)>(); + + int sighold( + int arg0, + ) { + return _sighold( + arg0, + ); + } + + late final _sigholdPtr = + _lookup>('sighold'); + late final _sighold = _sigholdPtr.asFunction(); + + int sigignore( + int arg0, + ) { + return _sigignore( + arg0, + ); + } + + late final _sigignorePtr = + _lookup>('sigignore'); + late final _sigignore = _sigignorePtr.asFunction(); + + int siginterrupt( + int arg0, + int arg1, + ) { + return _siginterrupt( + arg0, + arg1, + ); + } + + late final _siginterruptPtr = + _lookup>( + 'siginterrupt'); + late final _siginterrupt = + _siginterruptPtr.asFunction(); + + int sigismember( + ffi.Pointer arg0, + int arg1, + ) { + return _sigismember( + arg0, + arg1, + ); + } + + late final _sigismemberPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'sigismember'); + late final _sigismember = + _sigismemberPtr.asFunction, int)>(); + + int sigpause( + int arg0, + ) { + return _sigpause( + arg0, + ); + } + + late final _sigpausePtr = + _lookup>('sigpause'); + late final _sigpause = _sigpausePtr.asFunction(); + + int sigpending( + ffi.Pointer arg0, + ) { + return _sigpending( + arg0, + ); + } + + late final _sigpendingPtr = + _lookup)>>( + 'sigpending'); + late final _sigpending = + _sigpendingPtr.asFunction)>(); + + int sigprocmask( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _sigprocmask( + arg0, + arg1, + arg2, + ); + } + + late final _sigprocmaskPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, + ffi.Pointer)>>('sigprocmask'); + late final _sigprocmask = _sigprocmaskPtr.asFunction< + int Function(int, ffi.Pointer, ffi.Pointer)>(); + + int sigrelse( + int arg0, + ) { + return _sigrelse( + arg0, + ); + } + + late final _sigrelsePtr = + _lookup>('sigrelse'); + late final _sigrelse = _sigrelsePtr.asFunction(); + + ffi.Pointer> sigset( + int arg0, + ffi.Pointer> arg1, + ) { + return _sigset( + arg0, + arg1, + ); + } + + late final _sigsetPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer> Function( + ffi.Int, + ffi.Pointer< + ffi.NativeFunction>)>>('sigset'); + late final _sigset = _sigsetPtr.asFunction< + ffi.Pointer> Function( + int, ffi.Pointer>)>(); + + int sigsuspend( + ffi.Pointer arg0, + ) { + return _sigsuspend( + arg0, + ); + } + + late final _sigsuspendPtr = + _lookup)>>( + 'sigsuspend'); + late final _sigsuspend = + _sigsuspendPtr.asFunction)>(); + + int sigwait( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _sigwait( + arg0, + arg1, + ); + } + + late final _sigwaitPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('sigwait'); + late final _sigwait = _sigwaitPtr + .asFunction, ffi.Pointer)>(); + + void psignal( + int arg0, + ffi.Pointer arg1, + ) { + return _psignal( + arg0, + arg1, + ); + } + + late final _psignalPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int, ffi.Pointer)>>('psignal'); + late final _psignal = + _psignalPtr.asFunction)>(); + + int sigblock( + int arg0, + ) { + return _sigblock( + arg0, + ); + } + + late final _sigblockPtr = + _lookup>('sigblock'); + late final _sigblock = _sigblockPtr.asFunction(); + + int sigsetmask( + int arg0, + ) { + return _sigsetmask( + arg0, + ); + } + + late final _sigsetmaskPtr = + _lookup>('sigsetmask'); + late final _sigsetmask = _sigsetmaskPtr.asFunction(); + + int sigvec1( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _sigvec1( + arg0, + arg1, + arg2, + ); + } + + late final _sigvec1Ptr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Pointer)>>('sigvec'); + late final _sigvec1 = _sigvec1Ptr.asFunction< + int Function(int, ffi.Pointer, ffi.Pointer)>(); + + int renameat( + int arg0, + ffi.Pointer arg1, + int arg2, + ffi.Pointer arg3, + ) { + return _renameat( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _renameatPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, ffi.Int, + ffi.Pointer)>>('renameat'); + late final _renameat = _renameatPtr.asFunction< + int Function(int, ffi.Pointer, int, ffi.Pointer)>(); + + int renamex_np( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _renamex_np( + arg0, + arg1, + arg2, + ); + } + + late final _renamex_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.UnsignedInt)>>('renamex_np'); + late final _renamex_np = _renamex_npPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int renameatx_np( + int arg0, + ffi.Pointer arg1, + int arg2, + ffi.Pointer arg3, + int arg4, + ) { + return _renameatx_np( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _renameatx_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, ffi.Int, + ffi.Pointer, ffi.UnsignedInt)>>('renameatx_np'); + late final _renameatx_np = _renameatx_npPtr.asFunction< + int Function( + int, ffi.Pointer, int, ffi.Pointer, int)>(); + + late final ffi.Pointer> ___stdinp = + _lookup>('__stdinp'); + + ffi.Pointer get __stdinp => ___stdinp.value; + + set __stdinp(ffi.Pointer value) => ___stdinp.value = value; + + late final ffi.Pointer> ___stdoutp = + _lookup>('__stdoutp'); + + ffi.Pointer get __stdoutp => ___stdoutp.value; + + set __stdoutp(ffi.Pointer value) => ___stdoutp.value = value; + + late final ffi.Pointer> ___stderrp = + _lookup>('__stderrp'); + + ffi.Pointer get __stderrp => ___stderrp.value; + + set __stderrp(ffi.Pointer value) => ___stderrp.value = value; + + void clearerr( + ffi.Pointer arg0, + ) { + return _clearerr( + arg0, + ); + } + + late final _clearerrPtr = + _lookup)>>( + 'clearerr'); + late final _clearerr = + _clearerrPtr.asFunction)>(); + + int fclose( + ffi.Pointer arg0, + ) { + return _fclose( + arg0, + ); + } + + late final _fclosePtr = + _lookup)>>( + 'fclose'); + late final _fclose = _fclosePtr.asFunction)>(); + + int feof( + ffi.Pointer arg0, + ) { + return _feof( + arg0, + ); + } + + late final _feofPtr = + _lookup)>>('feof'); + late final _feof = _feofPtr.asFunction)>(); + + int ferror( + ffi.Pointer arg0, + ) { + return _ferror( + arg0, + ); + } + + late final _ferrorPtr = + _lookup)>>( + 'ferror'); + late final _ferror = _ferrorPtr.asFunction)>(); + + int fflush( + ffi.Pointer arg0, + ) { + return _fflush( + arg0, + ); + } + + late final _fflushPtr = + _lookup)>>( + 'fflush'); + late final _fflush = _fflushPtr.asFunction)>(); + + int fgetc( + ffi.Pointer arg0, + ) { + return _fgetc( + arg0, + ); + } + + late final _fgetcPtr = + _lookup)>>('fgetc'); + late final _fgetc = _fgetcPtr.asFunction)>(); + + int fgetpos( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _fgetpos( + arg0, + arg1, + ); + } + + late final _fgetposPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>>('fgetpos'); + late final _fgetpos = _fgetposPtr + .asFunction, ffi.Pointer)>(); + + ffi.Pointer fgets( + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2, + ) { + return _fgets( + arg0, + arg1, + arg2, + ); + } + + late final _fgetsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int, ffi.Pointer)>>('fgets'); + late final _fgets = _fgetsPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer fopen( + ffi.Pointer __filename, + ffi.Pointer __mode, + ) { + return _fopen( + __filename, + __mode, + ); + } + + late final _fopenPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('fopen'); + late final _fopen = _fopenPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + int fprintf( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _fprintf( + arg0, + arg1, + ); + } + + late final _fprintfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('fprintf'); + late final _fprintf = _fprintfPtr + .asFunction, ffi.Pointer)>(); + + int fputc( + int arg0, + ffi.Pointer arg1, + ) { + return _fputc( + arg0, + arg1, + ); + } + + late final _fputcPtr = + _lookup)>>( + 'fputc'); + late final _fputc = + _fputcPtr.asFunction)>(); + + int fputs( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _fputs( + arg0, + arg1, + ); + } + + late final _fputsPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>>('fputs'); + late final _fputs = _fputsPtr + .asFunction, ffi.Pointer)>(); + + int fread( + ffi.Pointer __ptr, + int __size, + int __nitems, + ffi.Pointer __stream, + ) { + return _fread( + __ptr, + __size, + __nitems, + __stream, + ); + } + + late final _freadPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, ffi.Size, ffi.Size, + ffi.Pointer)>>('fread'); + late final _fread = _freadPtr.asFunction< + int Function(ffi.Pointer, int, int, ffi.Pointer)>(); + + ffi.Pointer freopen( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _freopen( + arg0, + arg1, + arg2, + ); + } + + late final _freopenPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>('freopen'); + late final _freopen = _freopenPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); + + int fscanf( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _fscanf( + arg0, + arg1, + ); + } + + late final _fscanfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('fscanf'); + late final _fscanf = _fscanfPtr + .asFunction, ffi.Pointer)>(); + + int fseek( + ffi.Pointer arg0, + int arg1, + int arg2, + ) { + return _fseek( + arg0, + arg1, + arg2, + ); + } + + late final _fseekPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Long, ffi.Int)>>('fseek'); + late final _fseek = + _fseekPtr.asFunction, int, int)>(); + + int fsetpos( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _fsetpos( + arg0, + arg1, + ); + } + + late final _fsetposPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>>('fsetpos'); + late final _fsetpos = _fsetposPtr + .asFunction, ffi.Pointer)>(); + + int ftell( + ffi.Pointer arg0, + ) { + return _ftell( + arg0, + ); + } + + late final _ftellPtr = + _lookup)>>( + 'ftell'); + late final _ftell = _ftellPtr.asFunction)>(); + + int fwrite( + ffi.Pointer __ptr, + int __size, + int __nitems, + ffi.Pointer __stream, + ) { + return _fwrite( + __ptr, + __size, + __nitems, + __stream, + ); + } + + late final _fwritePtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, ffi.Size, ffi.Size, + ffi.Pointer)>>('fwrite'); + late final _fwrite = _fwritePtr.asFunction< + int Function(ffi.Pointer, int, int, ffi.Pointer)>(); + + int getc( + ffi.Pointer arg0, + ) { + return _getc( + arg0, + ); + } + + late final _getcPtr = + _lookup)>>('getc'); + late final _getc = _getcPtr.asFunction)>(); + + int getchar() { + return _getchar(); + } + + late final _getcharPtr = + _lookup>('getchar'); + late final _getchar = _getcharPtr.asFunction(); + + ffi.Pointer gets( + ffi.Pointer arg0, + ) { + return _gets( + arg0, + ); + } + + late final _getsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('gets'); + late final _gets = _getsPtr + .asFunction Function(ffi.Pointer)>(); + + void perror( + ffi.Pointer arg0, + ) { + return _perror( + arg0, + ); + } + + late final _perrorPtr = + _lookup)>>( + 'perror'); + late final _perror = + _perrorPtr.asFunction)>(); + + int printf( + ffi.Pointer arg0, + ) { + return _printf( + arg0, + ); + } + + late final _printfPtr = + _lookup)>>( + 'printf'); + late final _printf = + _printfPtr.asFunction)>(); + + int putc( + int arg0, + ffi.Pointer arg1, + ) { + return _putc( + arg0, + arg1, + ); + } + + late final _putcPtr = + _lookup)>>( + 'putc'); + late final _putc = + _putcPtr.asFunction)>(); + + int putchar( + int arg0, + ) { + return _putchar( + arg0, + ); + } + + late final _putcharPtr = + _lookup>('putchar'); + late final _putchar = _putcharPtr.asFunction(); + + int puts( + ffi.Pointer arg0, + ) { + return _puts( + arg0, + ); + } + + late final _putsPtr = + _lookup)>>( + 'puts'); + late final _puts = _putsPtr.asFunction)>(); + + int remove( + ffi.Pointer arg0, + ) { + return _remove( + arg0, + ); + } + + late final _removePtr = + _lookup)>>( + 'remove'); + late final _remove = + _removePtr.asFunction)>(); + + int rename( + ffi.Pointer __old, + ffi.Pointer __new, + ) { + return _rename( + __old, + __new, + ); + } + + late final _renamePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('rename'); + late final _rename = _renamePtr + .asFunction, ffi.Pointer)>(); + + void rewind( + ffi.Pointer arg0, + ) { + return _rewind( + arg0, + ); + } + + late final _rewindPtr = + _lookup)>>( + 'rewind'); + late final _rewind = + _rewindPtr.asFunction)>(); + + int scanf( + ffi.Pointer arg0, + ) { + return _scanf( + arg0, + ); + } + + late final _scanfPtr = + _lookup)>>( + 'scanf'); + late final _scanf = + _scanfPtr.asFunction)>(); + + void setbuf( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _setbuf( + arg0, + arg1, + ); + } + + late final _setbufPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)>>('setbuf'); + late final _setbuf = _setbufPtr + .asFunction, ffi.Pointer)>(); + + int setvbuf( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + int arg3, + ) { + return _setvbuf( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _setvbufPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, ffi.Int, + ffi.Size)>>('setvbuf'); + late final _setvbuf = _setvbufPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int, int)>(); + + int sprintf( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _sprintf( + arg0, + arg1, + ); + } + + late final _sprintfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('sprintf'); + late final _sprintf = _sprintfPtr + .asFunction, ffi.Pointer)>(); + + int sscanf( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _sscanf( + arg0, + arg1, + ); + } + + late final _sscanfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('sscanf'); + late final _sscanf = _sscanfPtr + .asFunction, ffi.Pointer)>(); + + ffi.Pointer tmpfile() { + return _tmpfile(); + } + + late final _tmpfilePtr = + _lookup Function()>>('tmpfile'); + late final _tmpfile = _tmpfilePtr.asFunction Function()>(); + + ffi.Pointer tmpnam( + ffi.Pointer arg0, + ) { + return _tmpnam( + arg0, + ); + } + + late final _tmpnamPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('tmpnam'); + late final _tmpnam = _tmpnamPtr + .asFunction Function(ffi.Pointer)>(); + + int ungetc( + int arg0, + ffi.Pointer arg1, + ) { + return _ungetc( + arg0, + arg1, + ); + } + + late final _ungetcPtr = + _lookup)>>( + 'ungetc'); + late final _ungetc = + _ungetcPtr.asFunction)>(); + + int vfprintf( + ffi.Pointer arg0, + ffi.Pointer arg1, + va_list arg2, + ) { + return _vfprintf( + arg0, + arg1, + arg2, + ); + } + + late final _vfprintfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer, va_list)>>('vfprintf'); + late final _vfprintf = _vfprintfPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, va_list)>(); + + int vprintf( + ffi.Pointer arg0, + va_list arg1, + ) { + return _vprintf( + arg0, + arg1, + ); + } + + late final _vprintfPtr = _lookup< + ffi.NativeFunction, va_list)>>( + 'vprintf'); + late final _vprintf = + _vprintfPtr.asFunction, va_list)>(); + + int vsprintf( + ffi.Pointer arg0, + ffi.Pointer arg1, + va_list arg2, + ) { + return _vsprintf( + arg0, + arg1, + arg2, + ); + } + + late final _vsprintfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + va_list)>>('vsprintf'); + late final _vsprintf = _vsprintfPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, va_list)>(); + + ffi.Pointer ctermid( + ffi.Pointer arg0, + ) { + return _ctermid( + arg0, + ); + } + + late final _ctermidPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('ctermid'); + late final _ctermid = _ctermidPtr + .asFunction Function(ffi.Pointer)>(); + + ffi.Pointer fdopen( + int arg0, + ffi.Pointer arg1, + ) { + return _fdopen( + arg0, + arg1, + ); + } + + late final _fdopenPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Pointer)>>('fdopen'); + late final _fdopen = _fdopenPtr + .asFunction Function(int, ffi.Pointer)>(); + + int fileno( + ffi.Pointer arg0, + ) { + return _fileno( + arg0, + ); + } + + late final _filenoPtr = + _lookup)>>( + 'fileno'); + late final _fileno = _filenoPtr.asFunction)>(); + + int pclose( + ffi.Pointer arg0, + ) { + return _pclose( + arg0, + ); + } + + late final _pclosePtr = + _lookup)>>( + 'pclose'); + late final _pclose = _pclosePtr.asFunction)>(); + + ffi.Pointer popen( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _popen( + arg0, + arg1, + ); + } + + late final _popenPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('popen'); + late final _popen = _popenPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + int __srget( + ffi.Pointer arg0, + ) { + return ___srget( + arg0, + ); + } + + late final ___srgetPtr = + _lookup)>>( + '__srget'); + late final ___srget = + ___srgetPtr.asFunction)>(); + + int __svfscanf( + ffi.Pointer arg0, + ffi.Pointer arg1, + va_list arg2, + ) { + return ___svfscanf( + arg0, + arg1, + arg2, + ); + } + + late final ___svfscanfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + va_list)>>('__svfscanf'); + late final ___svfscanf = ___svfscanfPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, va_list)>(); + + int __swbuf( + int arg0, + ffi.Pointer arg1, + ) { + return ___swbuf( + arg0, + arg1, + ); + } + + late final ___swbufPtr = + _lookup)>>( + '__swbuf'); + late final ___swbuf = + ___swbufPtr.asFunction)>(); + + void flockfile( + ffi.Pointer arg0, + ) { + return _flockfile( + arg0, + ); + } + + late final _flockfilePtr = + _lookup)>>( + 'flockfile'); + late final _flockfile = + _flockfilePtr.asFunction)>(); + + int ftrylockfile( + ffi.Pointer arg0, + ) { + return _ftrylockfile( + arg0, + ); + } + + late final _ftrylockfilePtr = + _lookup)>>( + 'ftrylockfile'); + late final _ftrylockfile = + _ftrylockfilePtr.asFunction)>(); + + void funlockfile( + ffi.Pointer arg0, + ) { + return _funlockfile( + arg0, + ); + } + + late final _funlockfilePtr = + _lookup)>>( + 'funlockfile'); + late final _funlockfile = + _funlockfilePtr.asFunction)>(); + + int getc_unlocked( + ffi.Pointer arg0, + ) { + return _getc_unlocked( + arg0, + ); + } + + late final _getc_unlockedPtr = + _lookup)>>( + 'getc_unlocked'); + late final _getc_unlocked = + _getc_unlockedPtr.asFunction)>(); + + int getchar_unlocked() { + return _getchar_unlocked(); + } + + late final _getchar_unlockedPtr = + _lookup>('getchar_unlocked'); + late final _getchar_unlocked = + _getchar_unlockedPtr.asFunction(); + + int putc_unlocked( + int arg0, + ffi.Pointer arg1, + ) { + return _putc_unlocked( + arg0, + arg1, + ); + } + + late final _putc_unlockedPtr = + _lookup)>>( + 'putc_unlocked'); + late final _putc_unlocked = + _putc_unlockedPtr.asFunction)>(); + + int putchar_unlocked( + int arg0, + ) { + return _putchar_unlocked( + arg0, + ); + } + + late final _putchar_unlockedPtr = + _lookup>( + 'putchar_unlocked'); + late final _putchar_unlocked = + _putchar_unlockedPtr.asFunction(); + + int getw( + ffi.Pointer arg0, + ) { + return _getw( + arg0, + ); + } + + late final _getwPtr = + _lookup)>>('getw'); + late final _getw = _getwPtr.asFunction)>(); + + int putw( + int arg0, + ffi.Pointer arg1, + ) { + return _putw( + arg0, + arg1, + ); + } + + late final _putwPtr = + _lookup)>>( + 'putw'); + late final _putw = + _putwPtr.asFunction)>(); + + ffi.Pointer tempnam( + ffi.Pointer __dir, + ffi.Pointer __prefix, + ) { + return _tempnam( + __dir, + __prefix, + ); + } + + late final _tempnamPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('tempnam'); + late final _tempnam = _tempnamPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + int fseeko( + ffi.Pointer __stream, + int __offset, + int __whence, + ) { + return _fseeko( + __stream, + __offset, + __whence, + ); + } + + late final _fseekoPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, off_t, ffi.Int)>>('fseeko'); + late final _fseeko = + _fseekoPtr.asFunction, int, int)>(); + + int ftello( + ffi.Pointer __stream, + ) { + return _ftello( + __stream, + ); + } + + late final _ftelloPtr = + _lookup)>>('ftello'); + late final _ftello = _ftelloPtr.asFunction)>(); + + int snprintf( + ffi.Pointer __str, + int __size, + ffi.Pointer __format, + ) { + return _snprintf( + __str, + __size, + __format, + ); + } + + late final _snprintfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size, + ffi.Pointer)>>('snprintf'); + late final _snprintf = _snprintfPtr.asFunction< + int Function(ffi.Pointer, int, ffi.Pointer)>(); + + int vfscanf( + ffi.Pointer __stream, + ffi.Pointer __format, + va_list arg2, + ) { + return _vfscanf( + __stream, + __format, + arg2, + ); + } + + late final _vfscanfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer, va_list)>>('vfscanf'); + late final _vfscanf = _vfscanfPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, va_list)>(); + + int vscanf( + ffi.Pointer __format, + va_list arg1, + ) { + return _vscanf( + __format, + arg1, + ); + } + + late final _vscanfPtr = _lookup< + ffi.NativeFunction, va_list)>>( + 'vscanf'); + late final _vscanf = + _vscanfPtr.asFunction, va_list)>(); + + int vsnprintf( + ffi.Pointer __str, + int __size, + ffi.Pointer __format, + va_list arg3, + ) { + return _vsnprintf( + __str, + __size, + __format, + arg3, + ); + } + + late final _vsnprintfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size, + ffi.Pointer, va_list)>>('vsnprintf'); + late final _vsnprintf = _vsnprintfPtr.asFunction< + int Function( + ffi.Pointer, int, ffi.Pointer, va_list)>(); + + int vsscanf( + ffi.Pointer __str, + ffi.Pointer __format, + va_list arg2, + ) { + return _vsscanf( + __str, + __format, + arg2, + ); + } + + late final _vsscanfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + va_list)>>('vsscanf'); + late final _vsscanf = _vsscanfPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, va_list)>(); + + int dprintf( + int arg0, + ffi.Pointer arg1, + ) { + return _dprintf( + arg0, + arg1, + ); + } + + late final _dprintfPtr = _lookup< + ffi.NativeFunction)>>( + 'dprintf'); + late final _dprintf = + _dprintfPtr.asFunction)>(); + + int vdprintf( + int arg0, + ffi.Pointer arg1, + va_list arg2, + ) { + return _vdprintf( + arg0, + arg1, + arg2, + ); + } + + late final _vdprintfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, va_list)>>('vdprintf'); + late final _vdprintf = _vdprintfPtr + .asFunction, va_list)>(); + + int getdelim( + ffi.Pointer> __linep, + ffi.Pointer __linecapp, + int __delimiter, + ffi.Pointer __stream, + ) { + return _getdelim( + __linep, + __linecapp, + __delimiter, + __stream, + ); + } + + late final _getdelimPtr = _lookup< + ffi.NativeFunction< + ssize_t Function(ffi.Pointer>, + ffi.Pointer, ffi.Int, ffi.Pointer)>>('getdelim'); + late final _getdelim = _getdelimPtr.asFunction< + int Function(ffi.Pointer>, ffi.Pointer, + int, ffi.Pointer)>(); + + int getline( + ffi.Pointer> __linep, + ffi.Pointer __linecapp, + ffi.Pointer __stream, + ) { + return _getline( + __linep, + __linecapp, + __stream, + ); + } + + late final _getlinePtr = _lookup< + ffi.NativeFunction< + ssize_t Function(ffi.Pointer>, + ffi.Pointer, ffi.Pointer)>>('getline'); + late final _getline = _getlinePtr.asFunction< + int Function(ffi.Pointer>, ffi.Pointer, + ffi.Pointer)>(); + + ffi.Pointer fmemopen( + ffi.Pointer __buf, + int __size, + ffi.Pointer __mode, + ) { + return _fmemopen( + __buf, + __size, + __mode, + ); + } + + late final _fmemopenPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + ffi.Pointer)>>('fmemopen'); + late final _fmemopen = _fmemopenPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer open_memstream( + ffi.Pointer> __bufp, + ffi.Pointer __sizep, + ) { + return _open_memstream( + __bufp, + __sizep, + ); + } + + late final _open_memstreamPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer>, + ffi.Pointer)>>('open_memstream'); + late final _open_memstream = _open_memstreamPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer>, ffi.Pointer)>(); + + late final ffi.Pointer _sys_nerr = _lookup('sys_nerr'); + + int get sys_nerr => _sys_nerr.value; + + late final ffi.Pointer>> _sys_errlist = + _lookup>>('sys_errlist'); + + ffi.Pointer> get sys_errlist => _sys_errlist.value; + + set sys_errlist(ffi.Pointer> value) => + _sys_errlist.value = value; + + int asprintf( + ffi.Pointer> arg0, + ffi.Pointer arg1, + ) { + return _asprintf( + arg0, + arg1, + ); + } + + late final _asprintfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, + ffi.Pointer)>>('asprintf'); + late final _asprintf = _asprintfPtr.asFunction< + int Function( + ffi.Pointer>, ffi.Pointer)>(); + + ffi.Pointer ctermid_r( + ffi.Pointer arg0, + ) { + return _ctermid_r( + arg0, + ); + } + + late final _ctermid_rPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('ctermid_r'); + late final _ctermid_r = _ctermid_rPtr + .asFunction Function(ffi.Pointer)>(); + + ffi.Pointer fgetln( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _fgetln( + arg0, + arg1, + ); + } + + late final _fgetlnPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('fgetln'); + late final _fgetln = _fgetlnPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer fmtcheck( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _fmtcheck( + arg0, + arg1, + ); + } + + late final _fmtcheckPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('fmtcheck'); + late final _fmtcheck = _fmtcheckPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + int fpurge( + ffi.Pointer arg0, + ) { + return _fpurge( + arg0, + ); + } + + late final _fpurgePtr = + _lookup)>>( + 'fpurge'); + late final _fpurge = _fpurgePtr.asFunction)>(); + + void setbuffer( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _setbuffer( + arg0, + arg1, + arg2, + ); + } + + late final _setbufferPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Int)>>('setbuffer'); + late final _setbuffer = _setbufferPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + int setlinebuf( + ffi.Pointer arg0, + ) { + return _setlinebuf( + arg0, + ); + } + + late final _setlinebufPtr = + _lookup)>>( + 'setlinebuf'); + late final _setlinebuf = + _setlinebufPtr.asFunction)>(); + + int vasprintf( + ffi.Pointer> arg0, + ffi.Pointer arg1, + va_list arg2, + ) { + return _vasprintf( + arg0, + arg1, + arg2, + ); + } + + late final _vasprintfPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, + ffi.Pointer, va_list)>>('vasprintf'); + late final _vasprintf = _vasprintfPtr.asFunction< + int Function(ffi.Pointer>, ffi.Pointer, + va_list)>(); + + ffi.Pointer funopen( + ffi.Pointer arg0, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer, ffi.Int)>> + arg1, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer, ffi.Int)>> + arg2, + ffi.Pointer< + ffi.NativeFunction< + fpos_t Function(ffi.Pointer, fpos_t, ffi.Int)>> + arg3, + ffi.Pointer)>> + arg4, + ) { + return _funopen( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _funopenPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>, + ffi.Pointer< + ffi.NativeFunction< + fpos_t Function(ffi.Pointer, fpos_t, ffi.Int)>>, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer)>>)>>('funopen'); + late final _funopen = _funopenPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer, ffi.Int)>>, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer, ffi.Int)>>, + ffi.Pointer< + ffi.NativeFunction< + fpos_t Function(ffi.Pointer, fpos_t, ffi.Int)>>, + ffi.Pointer< + ffi.NativeFunction)>>)>(); + + int __sprintf_chk( + ffi.Pointer arg0, + int arg1, + int arg2, + ffi.Pointer arg3, + ) { + return ___sprintf_chk( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final ___sprintf_chkPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int, ffi.Size, + ffi.Pointer)>>('__sprintf_chk'); + late final ___sprintf_chk = ___sprintf_chkPtr.asFunction< + int Function(ffi.Pointer, int, int, ffi.Pointer)>(); + + int __snprintf_chk( + ffi.Pointer arg0, + int arg1, + int arg2, + int arg3, + ffi.Pointer arg4, + ) { + return ___snprintf_chk( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final ___snprintf_chkPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size, ffi.Int, ffi.Size, + ffi.Pointer)>>('__snprintf_chk'); + late final ___snprintf_chk = ___snprintf_chkPtr.asFunction< + int Function( + ffi.Pointer, int, int, int, ffi.Pointer)>(); + + int __vsprintf_chk( + ffi.Pointer arg0, + int arg1, + int arg2, + ffi.Pointer arg3, + va_list arg4, + ) { + return ___vsprintf_chk( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final ___vsprintf_chkPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int, ffi.Size, + ffi.Pointer, va_list)>>('__vsprintf_chk'); + late final ___vsprintf_chk = ___vsprintf_chkPtr.asFunction< + int Function( + ffi.Pointer, int, int, ffi.Pointer, va_list)>(); + + int __vsnprintf_chk( + ffi.Pointer arg0, + int arg1, + int arg2, + int arg3, + ffi.Pointer arg4, + va_list arg5, + ) { + return ___vsnprintf_chk( + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + ); + } + + late final ___vsnprintf_chkPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size, ffi.Int, ffi.Size, + ffi.Pointer, va_list)>>('__vsnprintf_chk'); + late final ___vsnprintf_chk = ___vsnprintf_chkPtr.asFunction< + int Function(ffi.Pointer, int, int, int, ffi.Pointer, + va_list)>(); + + ffi.Pointer memchr( + ffi.Pointer __s, + int __c, + int __n, + ) { + return _memchr( + __s, + __c, + __n, + ); + } + + late final _memchrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int, ffi.Size)>>('memchr'); + late final _memchr = _memchrPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + int memcmp( + ffi.Pointer __s1, + ffi.Pointer __s2, + int __n, + ) { + return _memcmp( + __s1, + __s2, + __n, + ); + } + + late final _memcmpPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('memcmp'); + late final _memcmp = _memcmpPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer memcpy( + ffi.Pointer __dst, + ffi.Pointer __src, + int __n, + ) { + return _memcpy( + __dst, + __src, + __n, + ); + } + + late final _memcpyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('memcpy'); + late final _memcpy = _memcpyPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer memmove( + ffi.Pointer __dst, + ffi.Pointer __src, + int __len, + ) { + return _memmove( + __dst, + __src, + __len, + ); + } + + late final _memmovePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('memmove'); + late final _memmove = _memmovePtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer memset( + ffi.Pointer __b, + int __c, + int __len, + ) { + return _memset( + __b, + __c, + __len, + ); + } + + late final _memsetPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int, ffi.Size)>>('memset'); + late final _memset = _memsetPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer strcat( + ffi.Pointer __s1, + ffi.Pointer __s2, + ) { + return _strcat( + __s1, + __s2, + ); + } + + late final _strcatPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('strcat'); + late final _strcat = _strcatPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer strchr( + ffi.Pointer __s, + int __c, + ) { + return _strchr( + __s, + __c, + ); + } + + late final _strchrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int)>>('strchr'); + late final _strchr = _strchrPtr + .asFunction Function(ffi.Pointer, int)>(); + + int strcmp( + ffi.Pointer __s1, + ffi.Pointer __s2, + ) { + return _strcmp( + __s1, + __s2, + ); + } + + late final _strcmpPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('strcmp'); + late final _strcmp = _strcmpPtr + .asFunction, ffi.Pointer)>(); + + int strcoll( + ffi.Pointer __s1, + ffi.Pointer __s2, + ) { + return _strcoll( + __s1, + __s2, + ); + } + + late final _strcollPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('strcoll'); + late final _strcoll = _strcollPtr + .asFunction, ffi.Pointer)>(); + + ffi.Pointer strcpy( + ffi.Pointer __dst, + ffi.Pointer __src, + ) { + return _strcpy( + __dst, + __src, + ); + } + + late final _strcpyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('strcpy'); + late final _strcpy = _strcpyPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + int strcspn( + ffi.Pointer __s, + ffi.Pointer __charset, + ) { + return _strcspn( + __s, + __charset, + ); + } + + late final _strcspnPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, ffi.Pointer)>>('strcspn'); + late final _strcspn = _strcspnPtr + .asFunction, ffi.Pointer)>(); + + ffi.Pointer strerror( + int __errnum, + ) { + return _strerror( + __errnum, + ); + } + + late final _strerrorPtr = + _lookup Function(ffi.Int)>>( + 'strerror'); + late final _strerror = + _strerrorPtr.asFunction Function(int)>(); + + int strlen( + ffi.Pointer __s, + ) { + return _strlen( + __s, + ); + } + + late final _strlenPtr = _lookup< + ffi.NativeFunction)>>( + 'strlen'); + late final _strlen = + _strlenPtr.asFunction)>(); + + ffi.Pointer strncat( + ffi.Pointer __s1, + ffi.Pointer __s2, + int __n, + ) { + return _strncat( + __s1, + __s2, + __n, + ); + } + + late final _strncatPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('strncat'); + late final _strncat = _strncatPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + int strncmp( + ffi.Pointer __s1, + ffi.Pointer __s2, + int __n, + ) { + return _strncmp( + __s1, + __s2, + __n, + ); + } + + late final _strncmpPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('strncmp'); + late final _strncmp = _strncmpPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer strncpy( + ffi.Pointer __dst, + ffi.Pointer __src, + int __n, + ) { + return _strncpy( + __dst, + __src, + __n, + ); + } + + late final _strncpyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('strncpy'); + late final _strncpy = _strncpyPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer strpbrk( + ffi.Pointer __s, + ffi.Pointer __charset, + ) { + return _strpbrk( + __s, + __charset, + ); + } + + late final _strpbrkPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('strpbrk'); + late final _strpbrk = _strpbrkPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer strrchr( + ffi.Pointer __s, + int __c, + ) { + return _strrchr( + __s, + __c, + ); + } + + late final _strrchrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int)>>('strrchr'); + late final _strrchr = _strrchrPtr + .asFunction Function(ffi.Pointer, int)>(); + + int strspn( + ffi.Pointer __s, + ffi.Pointer __charset, + ) { + return _strspn( + __s, + __charset, + ); + } + + late final _strspnPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, ffi.Pointer)>>('strspn'); + late final _strspn = _strspnPtr + .asFunction, ffi.Pointer)>(); + + ffi.Pointer strstr( + ffi.Pointer __big, + ffi.Pointer __little, + ) { + return _strstr( + __big, + __little, + ); + } + + late final _strstrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('strstr'); + late final _strstr = _strstrPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer strtok( + ffi.Pointer __str, + ffi.Pointer __sep, + ) { + return _strtok( + __str, + __sep, + ); + } + + late final _strtokPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('strtok'); + late final _strtok = _strtokPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + int strxfrm( + ffi.Pointer __s1, + ffi.Pointer __s2, + int __n, + ) { + return _strxfrm( + __s1, + __s2, + __n, + ); + } + + late final _strxfrmPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('strxfrm'); + late final _strxfrm = _strxfrmPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer strtok_r( + ffi.Pointer __str, + ffi.Pointer __sep, + ffi.Pointer> __lasts, + ) { + return _strtok_r( + __str, + __sep, + __lasts, + ); + } + + late final _strtok_rPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>('strtok_r'); + late final _strtok_r = _strtok_rPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer>)>(); + + int strerror_r( + int __errnum, + ffi.Pointer __strerrbuf, + int __buflen, + ) { + return _strerror_r( + __errnum, + __strerrbuf, + __buflen, + ); + } + + late final _strerror_rPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Size)>>('strerror_r'); + late final _strerror_r = _strerror_rPtr + .asFunction, int)>(); + + ffi.Pointer strdup( + ffi.Pointer __s1, + ) { + return _strdup( + __s1, + ); + } + + late final _strdupPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('strdup'); + late final _strdup = _strdupPtr + .asFunction Function(ffi.Pointer)>(); + + ffi.Pointer memccpy( + ffi.Pointer __dst, + ffi.Pointer __src, + int __c, + int __n, + ) { + return _memccpy( + __dst, + __src, + __c, + __n, + ); + } + + late final _memccpyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int, ffi.Size)>>('memccpy'); + late final _memccpy = _memccpyPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int, int)>(); + + ffi.Pointer stpcpy( + ffi.Pointer __dst, + ffi.Pointer __src, + ) { + return _stpcpy( + __dst, + __src, + ); + } + + late final _stpcpyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('stpcpy'); + late final _stpcpy = _stpcpyPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer stpncpy( + ffi.Pointer __dst, + ffi.Pointer __src, + int __n, + ) { + return _stpncpy( + __dst, + __src, + __n, + ); + } + + late final _stpncpyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('stpncpy'); + late final _stpncpy = _stpncpyPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer strndup( + ffi.Pointer __s1, + int __n, + ) { + return _strndup( + __s1, + __n, + ); + } + + late final _strndupPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size)>>('strndup'); + late final _strndup = _strndupPtr + .asFunction Function(ffi.Pointer, int)>(); + + int strnlen( + ffi.Pointer __s1, + int __n, + ) { + return _strnlen( + __s1, + __n, + ); + } + + late final _strnlenPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Size)>>('strnlen'); + late final _strnlen = + _strnlenPtr.asFunction, int)>(); + + ffi.Pointer strsignal( + int __sig, + ) { + return _strsignal( + __sig, + ); + } + + late final _strsignalPtr = + _lookup Function(ffi.Int)>>( + 'strsignal'); + late final _strsignal = + _strsignalPtr.asFunction Function(int)>(); + + int memset_s( + ffi.Pointer __s, + int __smax, + int __c, + int __n, + ) { + return _memset_s( + __s, + __smax, + __c, + __n, + ); + } + + late final _memset_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer, rsize_t, ffi.Int, rsize_t)>>('memset_s'); + late final _memset_s = _memset_sPtr + .asFunction, int, int, int)>(); + + ffi.Pointer memmem( + ffi.Pointer __big, + int __big_len, + ffi.Pointer __little, + int __little_len, + ) { + return _memmem( + __big, + __big_len, + __little, + __little_len, + ); + } + + late final _memmemPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + ffi.Pointer, ffi.Size)>>('memmem'); + late final _memmem = _memmemPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer, int)>(); + + void memset_pattern4( + ffi.Pointer __b, + ffi.Pointer __pattern4, + int __len, + ) { + return _memset_pattern4( + __b, + __pattern4, + __len, + ); + } + + late final _memset_pattern4Ptr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('memset_pattern4'); + late final _memset_pattern4 = _memset_pattern4Ptr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + void memset_pattern8( + ffi.Pointer __b, + ffi.Pointer __pattern8, + int __len, + ) { + return _memset_pattern8( + __b, + __pattern8, + __len, + ); + } + + late final _memset_pattern8Ptr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('memset_pattern8'); + late final _memset_pattern8 = _memset_pattern8Ptr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + void memset_pattern16( + ffi.Pointer __b, + ffi.Pointer __pattern16, + int __len, + ) { + return _memset_pattern16( + __b, + __pattern16, + __len, + ); + } + + late final _memset_pattern16Ptr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('memset_pattern16'); + late final _memset_pattern16 = _memset_pattern16Ptr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer strcasestr( + ffi.Pointer __big, + ffi.Pointer __little, + ) { + return _strcasestr( + __big, + __little, + ); + } + + late final _strcasestrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('strcasestr'); + late final _strcasestr = _strcasestrPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer strnstr( + ffi.Pointer __big, + ffi.Pointer __little, + int __len, + ) { + return _strnstr( + __big, + __little, + __len, + ); + } + + late final _strnstrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('strnstr'); + late final _strnstr = _strnstrPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + int strlcat( + ffi.Pointer __dst, + ffi.Pointer __source, + int __size, + ) { + return _strlcat( + __dst, + __source, + __size, + ); + } + + late final _strlcatPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('strlcat'); + late final _strlcat = _strlcatPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int strlcpy( + ffi.Pointer __dst, + ffi.Pointer __source, + int __size, + ) { + return _strlcpy( + __dst, + __source, + __size, + ); + } + + late final _strlcpyPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('strlcpy'); + late final _strlcpy = _strlcpyPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + void strmode( + int __mode, + ffi.Pointer __bp, + ) { + return _strmode( + __mode, + __bp, + ); + } + + late final _strmodePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int, ffi.Pointer)>>('strmode'); + late final _strmode = + _strmodePtr.asFunction)>(); + + ffi.Pointer strsep( + ffi.Pointer> __stringp, + ffi.Pointer __delim, + ) { + return _strsep( + __stringp, + __delim, + ); + } + + late final _strsepPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer>, + ffi.Pointer)>>('strsep'); + late final _strsep = _strsepPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer>, ffi.Pointer)>(); + + void swab( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _swab( + arg0, + arg1, + arg2, + ); + } + + late final _swabPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, ffi.Pointer, ssize_t)>>('swab'); + late final _swab = _swabPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + int timingsafe_bcmp( + ffi.Pointer __b1, + ffi.Pointer __b2, + int __len, + ) { + return _timingsafe_bcmp( + __b1, + __b2, + __len, + ); + } + + late final _timingsafe_bcmpPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('timingsafe_bcmp'); + late final _timingsafe_bcmp = _timingsafe_bcmpPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int strsignal_r( + int __sig, + ffi.Pointer __strsignalbuf, + int __buflen, + ) { + return _strsignal_r( + __sig, + __strsignalbuf, + __buflen, + ); + } + + late final _strsignal_rPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Size)>>('strsignal_r'); + late final _strsignal_r = _strsignal_rPtr + .asFunction, int)>(); + + int bcmp( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _bcmp( + arg0, + arg1, + arg2, + ); + } + + late final _bcmpPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer, ffi.Size)>>('bcmp'); + late final _bcmp = _bcmpPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + void bcopy( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _bcopy( + arg0, + arg1, + arg2, + ); + } + + late final _bcopyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('bcopy'); + late final _bcopy = _bcopyPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + void bzero( + ffi.Pointer arg0, + int arg1, + ) { + return _bzero( + arg0, + arg1, + ); + } + + late final _bzeroPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Size)>>('bzero'); + late final _bzero = + _bzeroPtr.asFunction, int)>(); + + ffi.Pointer index( + ffi.Pointer arg0, + int arg1, + ) { + return _index( + arg0, + arg1, + ); + } + + late final _indexPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int)>>('index'); + late final _index = _indexPtr + .asFunction Function(ffi.Pointer, int)>(); + + ffi.Pointer rindex( + ffi.Pointer arg0, + int arg1, + ) { + return _rindex( + arg0, + arg1, + ); + } + + late final _rindexPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int)>>('rindex'); + late final _rindex = _rindexPtr + .asFunction Function(ffi.Pointer, int)>(); + + int ffs( + int arg0, + ) { + return _ffs( + arg0, + ); + } + + late final _ffsPtr = + _lookup>('ffs'); + late final _ffs = _ffsPtr.asFunction(); + + int strcasecmp( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _strcasecmp( + arg0, + arg1, + ); + } + + late final _strcasecmpPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('strcasecmp'); + late final _strcasecmp = _strcasecmpPtr + .asFunction, ffi.Pointer)>(); + + int strncasecmp( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _strncasecmp( + arg0, + arg1, + arg2, + ); + } + + late final _strncasecmpPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('strncasecmp'); + late final _strncasecmp = _strncasecmpPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int ffsl( + int arg0, + ) { + return _ffsl( + arg0, + ); + } + + late final _ffslPtr = + _lookup>('ffsl'); + late final _ffsl = _ffslPtr.asFunction(); + + int ffsll( + int arg0, + ) { + return _ffsll( + arg0, + ); + } + + late final _ffsllPtr = + _lookup>('ffsll'); + late final _ffsll = _ffsllPtr.asFunction(); + + int fls( + int arg0, + ) { + return _fls( + arg0, + ); + } + + late final _flsPtr = + _lookup>('fls'); + late final _fls = _flsPtr.asFunction(); + + int flsl( + int arg0, + ) { + return _flsl( + arg0, + ); + } + + late final _flslPtr = + _lookup>('flsl'); + late final _flsl = _flslPtr.asFunction(); + + int flsll( + int arg0, + ) { + return _flsll( + arg0, + ); + } + + late final _flsllPtr = + _lookup>('flsll'); + late final _flsll = _flsllPtr.asFunction(); + + late final ffi.Pointer>> _tzname = + _lookup>>('tzname'); + + ffi.Pointer> get tzname => _tzname.value; + + set tzname(ffi.Pointer> value) => _tzname.value = value; + + late final ffi.Pointer _getdate_err = + _lookup('getdate_err'); + + int get getdate_err => _getdate_err.value; + + set getdate_err(int value) => _getdate_err.value = value; + + late final ffi.Pointer _timezone = _lookup('timezone'); + + int get timezone => _timezone.value; + + set timezone(int value) => _timezone.value = value; + + late final ffi.Pointer _daylight = _lookup('daylight'); + + int get daylight => _daylight.value; + + set daylight(int value) => _daylight.value = value; + + ffi.Pointer asctime( + ffi.Pointer arg0, + ) { + return _asctime( + arg0, + ); + } + + late final _asctimePtr = _lookup< + ffi.NativeFunction Function(ffi.Pointer)>>( + 'asctime'); + late final _asctime = + _asctimePtr.asFunction Function(ffi.Pointer)>(); + + int clock() { + return _clock(); + } + + late final _clockPtr = + _lookup>('clock'); + late final _clock = _clockPtr.asFunction(); + + ffi.Pointer ctime( + ffi.Pointer arg0, + ) { + return _ctime( + arg0, + ); + } + + late final _ctimePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('ctime'); + late final _ctime = _ctimePtr + .asFunction Function(ffi.Pointer)>(); + + double difftime( + int arg0, + int arg1, + ) { + return _difftime( + arg0, + arg1, + ); + } + + late final _difftimePtr = + _lookup>( + 'difftime'); + late final _difftime = _difftimePtr.asFunction(); + + ffi.Pointer getdate( + ffi.Pointer arg0, + ) { + return _getdate( + arg0, + ); + } + + late final _getdatePtr = _lookup< + ffi.NativeFunction Function(ffi.Pointer)>>( + 'getdate'); + late final _getdate = + _getdatePtr.asFunction Function(ffi.Pointer)>(); + + ffi.Pointer gmtime( + ffi.Pointer arg0, + ) { + return _gmtime( + arg0, + ); + } + + late final _gmtimePtr = _lookup< + ffi + .NativeFunction Function(ffi.Pointer)>>('gmtime'); + late final _gmtime = + _gmtimePtr.asFunction Function(ffi.Pointer)>(); + + ffi.Pointer localtime( + ffi.Pointer arg0, + ) { + return _localtime( + arg0, + ); + } + + late final _localtimePtr = _lookup< + ffi.NativeFunction Function(ffi.Pointer)>>( + 'localtime'); + late final _localtime = + _localtimePtr.asFunction Function(ffi.Pointer)>(); + + int mktime( + ffi.Pointer arg0, + ) { + return _mktime( + arg0, + ); + } + + late final _mktimePtr = + _lookup)>>('mktime'); + late final _mktime = _mktimePtr.asFunction)>(); + + int strftime( + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ) { + return _strftime( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _strftimePtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Size, + ffi.Pointer, ffi.Pointer)>>('strftime'); + late final _strftime = _strftimePtr.asFunction< + int Function(ffi.Pointer, int, ffi.Pointer, + ffi.Pointer)>(); + + ffi.Pointer strptime( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _strptime( + arg0, + arg1, + arg2, + ); + } + + late final _strptimePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>('strptime'); + late final _strptime = _strptimePtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); + + int time( + ffi.Pointer arg0, + ) { + return _time( + arg0, + ); + } + + late final _timePtr = + _lookup)>>('time'); + late final _time = _timePtr.asFunction)>(); + + void tzset() { + return _tzset(); + } + + late final _tzsetPtr = + _lookup>('tzset'); + late final _tzset = _tzsetPtr.asFunction(); + + ffi.Pointer asctime_r( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _asctime_r( + arg0, + arg1, + ); + } + + late final _asctime_rPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('asctime_r'); + late final _asctime_r = _asctime_rPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer ctime_r( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _ctime_r( + arg0, + arg1, + ); + } + + late final _ctime_rPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('ctime_r'); + late final _ctime_r = _ctime_rPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer gmtime_r( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _gmtime_r( + arg0, + arg1, + ); + } + + late final _gmtime_rPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('gmtime_r'); + late final _gmtime_r = _gmtime_rPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer localtime_r( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _localtime_r( + arg0, + arg1, + ); + } + + late final _localtime_rPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('localtime_r'); + late final _localtime_r = _localtime_rPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Pointer)>(); + + int posix2time( + int arg0, + ) { + return _posix2time( + arg0, + ); + } + + late final _posix2timePtr = + _lookup>('posix2time'); + late final _posix2time = _posix2timePtr.asFunction(); + + void tzsetwall() { + return _tzsetwall(); + } + + late final _tzsetwallPtr = + _lookup>('tzsetwall'); + late final _tzsetwall = _tzsetwallPtr.asFunction(); + + int time2posix( + int arg0, + ) { + return _time2posix( + arg0, + ); + } + + late final _time2posixPtr = + _lookup>('time2posix'); + late final _time2posix = _time2posixPtr.asFunction(); + + int timelocal( + ffi.Pointer arg0, + ) { + return _timelocal( + arg0, + ); + } + + late final _timelocalPtr = + _lookup)>>( + 'timelocal'); + late final _timelocal = + _timelocalPtr.asFunction)>(); + + int timegm( + ffi.Pointer arg0, + ) { + return _timegm( + arg0, + ); + } + + late final _timegmPtr = + _lookup)>>('timegm'); + late final _timegm = _timegmPtr.asFunction)>(); + + int nanosleep( + ffi.Pointer __rqtp, + ffi.Pointer __rmtp, + ) { + return _nanosleep( + __rqtp, + __rmtp, + ); + } + + late final _nanosleepPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('nanosleep'); + late final _nanosleep = _nanosleepPtr + .asFunction, ffi.Pointer)>(); + + int clock_getres( + clockid_t __clock_id, + ffi.Pointer __res, + ) { + return _clock_getres( + __clock_id.value, + __res, + ); + } + + late final _clock_getresPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.UnsignedInt, ffi.Pointer)>>('clock_getres'); + late final _clock_getres = + _clock_getresPtr.asFunction)>(); + + int clock_gettime( + clockid_t __clock_id, + ffi.Pointer __tp, + ) { + return _clock_gettime( + __clock_id.value, + __tp, + ); + } + + late final _clock_gettimePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.UnsignedInt, ffi.Pointer)>>('clock_gettime'); + late final _clock_gettime = + _clock_gettimePtr.asFunction)>(); + + Dart__uint64_t clock_gettime_nsec_np( + clockid_t __clock_id, + ) { + return _clock_gettime_nsec_np( + __clock_id.value, + ); + } + + late final _clock_gettime_nsec_npPtr = + _lookup>( + 'clock_gettime_nsec_np'); + late final _clock_gettime_nsec_np = + _clock_gettime_nsec_npPtr.asFunction(); + + int clock_settime( + clockid_t __clock_id, + ffi.Pointer __tp, + ) { + return _clock_settime( + __clock_id.value, + __tp, + ); + } + + late final _clock_settimePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.UnsignedInt, ffi.Pointer)>>('clock_settime'); + late final _clock_settime = + _clock_settimePtr.asFunction)>(); + + int timespec_get( + ffi.Pointer ts, + int base, + ) { + return _timespec_get( + ts, + base, + ); + } + + late final _timespec_getPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'timespec_get'); + late final _timespec_get = + _timespec_getPtr.asFunction, int)>(); + + int imaxabs( + int j, + ) { + return _imaxabs( + j, + ); + } + + late final _imaxabsPtr = + _lookup>('imaxabs'); + late final _imaxabs = _imaxabsPtr.asFunction(); + + imaxdiv_t imaxdiv( + int __numer, + int __denom, + ) { + return _imaxdiv( + __numer, + __denom, + ); + } + + late final _imaxdivPtr = + _lookup>( + 'imaxdiv'); + late final _imaxdiv = _imaxdivPtr.asFunction(); + + int strtoimax( + ffi.Pointer __nptr, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoimax( + __nptr, + __endptr, + __base, + ); + } + + late final _strtoimaxPtr = _lookup< + ffi.NativeFunction< + intmax_t Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoimax'); + late final _strtoimax = _strtoimaxPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int strtoumax( + ffi.Pointer __nptr, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoumax( + __nptr, + __endptr, + __base, + ); + } + + late final _strtoumaxPtr = _lookup< + ffi.NativeFunction< + uintmax_t Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoumax'); + late final _strtoumax = _strtoumaxPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int wcstoimax( + ffi.Pointer __nptr, + ffi.Pointer> __endptr, + int __base, + ) { + return _wcstoimax( + __nptr, + __endptr, + __base, + ); + } + + late final _wcstoimaxPtr = _lookup< + ffi.NativeFunction< + intmax_t Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('wcstoimax'); + late final _wcstoimax = _wcstoimaxPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int wcstoumax( + ffi.Pointer __nptr, + ffi.Pointer> __endptr, + int __base, + ) { + return _wcstoumax( + __nptr, + __endptr, + __base, + ); + } + + late final _wcstoumaxPtr = _lookup< + ffi.NativeFunction< + uintmax_t Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('wcstoumax'); + late final _wcstoumax = _wcstoumaxPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + late final ffi.Pointer _kCFTypeBagCallBacks = + _lookup('kCFTypeBagCallBacks'); + + CFBagCallBacks get kCFTypeBagCallBacks => _kCFTypeBagCallBacks.ref; + + late final ffi.Pointer _kCFCopyStringBagCallBacks = + _lookup('kCFCopyStringBagCallBacks'); + + CFBagCallBacks get kCFCopyStringBagCallBacks => + _kCFCopyStringBagCallBacks.ref; + + int CFBagGetTypeID() { + return _CFBagGetTypeID(); + } + + late final _CFBagGetTypeIDPtr = + _lookup>('CFBagGetTypeID'); + late final _CFBagGetTypeID = _CFBagGetTypeIDPtr.asFunction(); + + CFBagRef CFBagCreate( + CFAllocatorRef allocator, + ffi.Pointer> values, + int numValues, + ffi.Pointer callBacks, + ) { + return _CFBagCreate( + allocator, + values, + numValues, + callBacks, + ); + } + + late final _CFBagCreatePtr = _lookup< + ffi.NativeFunction< + CFBagRef Function(CFAllocatorRef, ffi.Pointer>, + CFIndex, ffi.Pointer)>>('CFBagCreate'); + late final _CFBagCreate = _CFBagCreatePtr.asFunction< + CFBagRef Function(CFAllocatorRef, ffi.Pointer>, int, + ffi.Pointer)>(); + + CFBagRef CFBagCreateCopy( + CFAllocatorRef allocator, + CFBagRef theBag, + ) { + return _CFBagCreateCopy( + allocator, + theBag, + ); + } + + late final _CFBagCreateCopyPtr = + _lookup>( + 'CFBagCreateCopy'); + late final _CFBagCreateCopy = _CFBagCreateCopyPtr.asFunction< + CFBagRef Function(CFAllocatorRef, CFBagRef)>(); + + CFMutableBagRef CFBagCreateMutable( + CFAllocatorRef allocator, + int capacity, + ffi.Pointer callBacks, + ) { + return _CFBagCreateMutable( + allocator, + capacity, + callBacks, + ); + } + + late final _CFBagCreateMutablePtr = _lookup< + ffi.NativeFunction< + CFMutableBagRef Function(CFAllocatorRef, CFIndex, + ffi.Pointer)>>('CFBagCreateMutable'); + late final _CFBagCreateMutable = _CFBagCreateMutablePtr.asFunction< + CFMutableBagRef Function( + CFAllocatorRef, int, ffi.Pointer)>(); + + CFMutableBagRef CFBagCreateMutableCopy( + CFAllocatorRef allocator, + int capacity, + CFBagRef theBag, + ) { + return _CFBagCreateMutableCopy( + allocator, + capacity, + theBag, + ); + } + + late final _CFBagCreateMutableCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableBagRef Function( + CFAllocatorRef, CFIndex, CFBagRef)>>('CFBagCreateMutableCopy'); + late final _CFBagCreateMutableCopy = _CFBagCreateMutableCopyPtr.asFunction< + CFMutableBagRef Function(CFAllocatorRef, int, CFBagRef)>(); + + int CFBagGetCount( + CFBagRef theBag, + ) { + return _CFBagGetCount( + theBag, + ); + } + + late final _CFBagGetCountPtr = + _lookup>('CFBagGetCount'); + late final _CFBagGetCount = + _CFBagGetCountPtr.asFunction(); + + int CFBagGetCountOfValue( + CFBagRef theBag, + ffi.Pointer value, + ) { + return _CFBagGetCountOfValue( + theBag, + value, + ); + } + + late final _CFBagGetCountOfValuePtr = _lookup< + ffi + .NativeFunction)>>( + 'CFBagGetCountOfValue'); + late final _CFBagGetCountOfValue = _CFBagGetCountOfValuePtr.asFunction< + int Function(CFBagRef, ffi.Pointer)>(); + + int CFBagContainsValue( + CFBagRef theBag, + ffi.Pointer value, + ) { + return _CFBagContainsValue( + theBag, + value, + ); + } + + late final _CFBagContainsValuePtr = _lookup< + ffi + .NativeFunction)>>( + 'CFBagContainsValue'); + late final _CFBagContainsValue = _CFBagContainsValuePtr.asFunction< + int Function(CFBagRef, ffi.Pointer)>(); + + ffi.Pointer CFBagGetValue( + CFBagRef theBag, + ffi.Pointer value, + ) { + return _CFBagGetValue( + theBag, + value, + ); + } + + late final _CFBagGetValuePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CFBagRef, ffi.Pointer)>>('CFBagGetValue'); + late final _CFBagGetValue = _CFBagGetValuePtr.asFunction< + ffi.Pointer Function(CFBagRef, ffi.Pointer)>(); + + int CFBagGetValueIfPresent( + CFBagRef theBag, + ffi.Pointer candidate, + ffi.Pointer> value, + ) { + return _CFBagGetValueIfPresent( + theBag, + candidate, + value, + ); + } + + late final _CFBagGetValueIfPresentPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFBagRef, ffi.Pointer, + ffi.Pointer>)>>('CFBagGetValueIfPresent'); + late final _CFBagGetValueIfPresent = _CFBagGetValueIfPresentPtr.asFunction< + int Function(CFBagRef, ffi.Pointer, + ffi.Pointer>)>(); + + void CFBagGetValues( + CFBagRef theBag, + ffi.Pointer> values, + ) { + return _CFBagGetValues( + theBag, + values, + ); + } + + late final _CFBagGetValuesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFBagRef, ffi.Pointer>)>>('CFBagGetValues'); + late final _CFBagGetValues = _CFBagGetValuesPtr.asFunction< + void Function(CFBagRef, ffi.Pointer>)>(); + + void CFBagApplyFunction( + CFBagRef theBag, + CFBagApplierFunction applier, + ffi.Pointer context, + ) { + return _CFBagApplyFunction( + theBag, + applier, + context, + ); + } + + late final _CFBagApplyFunctionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFBagRef, CFBagApplierFunction, + ffi.Pointer)>>('CFBagApplyFunction'); + late final _CFBagApplyFunction = _CFBagApplyFunctionPtr.asFunction< + void Function(CFBagRef, CFBagApplierFunction, ffi.Pointer)>(); + + void CFBagAddValue( + CFMutableBagRef theBag, + ffi.Pointer value, + ) { + return _CFBagAddValue( + theBag, + value, + ); + } + + late final _CFBagAddValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableBagRef, ffi.Pointer)>>('CFBagAddValue'); + late final _CFBagAddValue = _CFBagAddValuePtr.asFunction< + void Function(CFMutableBagRef, ffi.Pointer)>(); + + void CFBagReplaceValue( + CFMutableBagRef theBag, + ffi.Pointer value, + ) { + return _CFBagReplaceValue( + theBag, + value, + ); + } + + late final _CFBagReplaceValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableBagRef, ffi.Pointer)>>('CFBagReplaceValue'); + late final _CFBagReplaceValue = _CFBagReplaceValuePtr.asFunction< + void Function(CFMutableBagRef, ffi.Pointer)>(); + + void CFBagSetValue( + CFMutableBagRef theBag, + ffi.Pointer value, + ) { + return _CFBagSetValue( + theBag, + value, + ); + } + + late final _CFBagSetValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableBagRef, ffi.Pointer)>>('CFBagSetValue'); + late final _CFBagSetValue = _CFBagSetValuePtr.asFunction< + void Function(CFMutableBagRef, ffi.Pointer)>(); + + void CFBagRemoveValue( + CFMutableBagRef theBag, + ffi.Pointer value, + ) { + return _CFBagRemoveValue( + theBag, + value, + ); + } + + late final _CFBagRemoveValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableBagRef, ffi.Pointer)>>('CFBagRemoveValue'); + late final _CFBagRemoveValue = _CFBagRemoveValuePtr.asFunction< + void Function(CFMutableBagRef, ffi.Pointer)>(); + + void CFBagRemoveAllValues( + CFMutableBagRef theBag, + ) { + return _CFBagRemoveAllValues( + theBag, + ); + } + + late final _CFBagRemoveAllValuesPtr = + _lookup>( + 'CFBagRemoveAllValues'); + late final _CFBagRemoveAllValues = + _CFBagRemoveAllValuesPtr.asFunction(); + + late final ffi.Pointer _kCFStringBinaryHeapCallBacks = + _lookup('kCFStringBinaryHeapCallBacks'); + + CFBinaryHeapCallBacks get kCFStringBinaryHeapCallBacks => + _kCFStringBinaryHeapCallBacks.ref; + + int CFBinaryHeapGetTypeID() { + return _CFBinaryHeapGetTypeID(); + } + + late final _CFBinaryHeapGetTypeIDPtr = + _lookup>('CFBinaryHeapGetTypeID'); + late final _CFBinaryHeapGetTypeID = + _CFBinaryHeapGetTypeIDPtr.asFunction(); + + CFBinaryHeapRef CFBinaryHeapCreate( + CFAllocatorRef allocator, + int capacity, + ffi.Pointer callBacks, + ffi.Pointer compareContext, + ) { + return _CFBinaryHeapCreate( + allocator, + capacity, + callBacks, + compareContext, + ); + } + + late final _CFBinaryHeapCreatePtr = _lookup< + ffi.NativeFunction< + CFBinaryHeapRef Function( + CFAllocatorRef, + CFIndex, + ffi.Pointer, + ffi.Pointer)>>('CFBinaryHeapCreate'); + late final _CFBinaryHeapCreate = _CFBinaryHeapCreatePtr.asFunction< + CFBinaryHeapRef Function( + CFAllocatorRef, + int, + ffi.Pointer, + ffi.Pointer)>(); + + CFBinaryHeapRef CFBinaryHeapCreateCopy( + CFAllocatorRef allocator, + int capacity, + CFBinaryHeapRef heap, + ) { + return _CFBinaryHeapCreateCopy( + allocator, + capacity, + heap, + ); + } + + late final _CFBinaryHeapCreateCopyPtr = _lookup< + ffi.NativeFunction< + CFBinaryHeapRef Function(CFAllocatorRef, CFIndex, + CFBinaryHeapRef)>>('CFBinaryHeapCreateCopy'); + late final _CFBinaryHeapCreateCopy = _CFBinaryHeapCreateCopyPtr.asFunction< + CFBinaryHeapRef Function(CFAllocatorRef, int, CFBinaryHeapRef)>(); + + int CFBinaryHeapGetCount( + CFBinaryHeapRef heap, + ) { + return _CFBinaryHeapGetCount( + heap, + ); + } + + late final _CFBinaryHeapGetCountPtr = + _lookup>( + 'CFBinaryHeapGetCount'); + late final _CFBinaryHeapGetCount = + _CFBinaryHeapGetCountPtr.asFunction(); + + int CFBinaryHeapGetCountOfValue( + CFBinaryHeapRef heap, + ffi.Pointer value, + ) { + return _CFBinaryHeapGetCountOfValue( + heap, + value, + ); + } + + late final _CFBinaryHeapGetCountOfValuePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFBinaryHeapRef, + ffi.Pointer)>>('CFBinaryHeapGetCountOfValue'); + late final _CFBinaryHeapGetCountOfValue = _CFBinaryHeapGetCountOfValuePtr + .asFunction)>(); + + int CFBinaryHeapContainsValue( + CFBinaryHeapRef heap, + ffi.Pointer value, + ) { + return _CFBinaryHeapContainsValue( + heap, + value, + ); + } + + late final _CFBinaryHeapContainsValuePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFBinaryHeapRef, + ffi.Pointer)>>('CFBinaryHeapContainsValue'); + late final _CFBinaryHeapContainsValue = _CFBinaryHeapContainsValuePtr + .asFunction)>(); + + ffi.Pointer CFBinaryHeapGetMinimum( + CFBinaryHeapRef heap, + ) { + return _CFBinaryHeapGetMinimum( + heap, + ); + } + + late final _CFBinaryHeapGetMinimumPtr = _lookup< + ffi.NativeFunction Function(CFBinaryHeapRef)>>( + 'CFBinaryHeapGetMinimum'); + late final _CFBinaryHeapGetMinimum = _CFBinaryHeapGetMinimumPtr.asFunction< + ffi.Pointer Function(CFBinaryHeapRef)>(); + + int CFBinaryHeapGetMinimumIfPresent( + CFBinaryHeapRef heap, + ffi.Pointer> value, + ) { + return _CFBinaryHeapGetMinimumIfPresent( + heap, + value, + ); + } + + late final _CFBinaryHeapGetMinimumIfPresentPtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFBinaryHeapRef, ffi.Pointer>)>>( + 'CFBinaryHeapGetMinimumIfPresent'); + late final _CFBinaryHeapGetMinimumIfPresent = + _CFBinaryHeapGetMinimumIfPresentPtr.asFunction< + int Function(CFBinaryHeapRef, ffi.Pointer>)>(); + + void CFBinaryHeapGetValues( + CFBinaryHeapRef heap, + ffi.Pointer> values, + ) { + return _CFBinaryHeapGetValues( + heap, + values, + ); + } + + late final _CFBinaryHeapGetValuesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFBinaryHeapRef, + ffi.Pointer>)>>('CFBinaryHeapGetValues'); + late final _CFBinaryHeapGetValues = _CFBinaryHeapGetValuesPtr.asFunction< + void Function(CFBinaryHeapRef, ffi.Pointer>)>(); + + void CFBinaryHeapApplyFunction( + CFBinaryHeapRef heap, + CFBinaryHeapApplierFunction applier, + ffi.Pointer context, + ) { + return _CFBinaryHeapApplyFunction( + heap, + applier, + context, + ); + } + + late final _CFBinaryHeapApplyFunctionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFBinaryHeapRef, CFBinaryHeapApplierFunction, + ffi.Pointer)>>('CFBinaryHeapApplyFunction'); + late final _CFBinaryHeapApplyFunction = + _CFBinaryHeapApplyFunctionPtr.asFunction< + void Function(CFBinaryHeapRef, CFBinaryHeapApplierFunction, + ffi.Pointer)>(); + + void CFBinaryHeapAddValue( + CFBinaryHeapRef heap, + ffi.Pointer value, + ) { + return _CFBinaryHeapAddValue( + heap, + value, + ); + } + + late final _CFBinaryHeapAddValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFBinaryHeapRef, ffi.Pointer)>>('CFBinaryHeapAddValue'); + late final _CFBinaryHeapAddValue = _CFBinaryHeapAddValuePtr.asFunction< + void Function(CFBinaryHeapRef, ffi.Pointer)>(); + + void CFBinaryHeapRemoveMinimumValue( + CFBinaryHeapRef heap, + ) { + return _CFBinaryHeapRemoveMinimumValue( + heap, + ); + } + + late final _CFBinaryHeapRemoveMinimumValuePtr = + _lookup>( + 'CFBinaryHeapRemoveMinimumValue'); + late final _CFBinaryHeapRemoveMinimumValue = + _CFBinaryHeapRemoveMinimumValuePtr.asFunction< + void Function(CFBinaryHeapRef)>(); + + void CFBinaryHeapRemoveAllValues( + CFBinaryHeapRef heap, + ) { + return _CFBinaryHeapRemoveAllValues( + heap, + ); + } + + late final _CFBinaryHeapRemoveAllValuesPtr = + _lookup>( + 'CFBinaryHeapRemoveAllValues'); + late final _CFBinaryHeapRemoveAllValues = _CFBinaryHeapRemoveAllValuesPtr + .asFunction(); + + int CFBitVectorGetTypeID() { + return _CFBitVectorGetTypeID(); + } + + late final _CFBitVectorGetTypeIDPtr = + _lookup>('CFBitVectorGetTypeID'); + late final _CFBitVectorGetTypeID = + _CFBitVectorGetTypeIDPtr.asFunction(); + + CFBitVectorRef CFBitVectorCreate( + CFAllocatorRef allocator, + ffi.Pointer bytes, + int numBits, + ) { + return _CFBitVectorCreate( + allocator, + bytes, + numBits, + ); + } + + late final _CFBitVectorCreatePtr = _lookup< + ffi.NativeFunction< + CFBitVectorRef Function(CFAllocatorRef, ffi.Pointer, + CFIndex)>>('CFBitVectorCreate'); + late final _CFBitVectorCreate = _CFBitVectorCreatePtr.asFunction< + CFBitVectorRef Function(CFAllocatorRef, ffi.Pointer, int)>(); + + CFBitVectorRef CFBitVectorCreateCopy( + CFAllocatorRef allocator, + CFBitVectorRef bv, + ) { + return _CFBitVectorCreateCopy( + allocator, + bv, + ); + } + + late final _CFBitVectorCreateCopyPtr = _lookup< + ffi.NativeFunction< + CFBitVectorRef Function( + CFAllocatorRef, CFBitVectorRef)>>('CFBitVectorCreateCopy'); + late final _CFBitVectorCreateCopy = _CFBitVectorCreateCopyPtr.asFunction< + CFBitVectorRef Function(CFAllocatorRef, CFBitVectorRef)>(); + + CFMutableBitVectorRef CFBitVectorCreateMutable( + CFAllocatorRef allocator, + int capacity, + ) { + return _CFBitVectorCreateMutable( + allocator, + capacity, + ); + } + + late final _CFBitVectorCreateMutablePtr = _lookup< + ffi.NativeFunction< + CFMutableBitVectorRef Function( + CFAllocatorRef, CFIndex)>>('CFBitVectorCreateMutable'); + late final _CFBitVectorCreateMutable = _CFBitVectorCreateMutablePtr + .asFunction(); + + CFMutableBitVectorRef CFBitVectorCreateMutableCopy( + CFAllocatorRef allocator, + int capacity, + CFBitVectorRef bv, + ) { + return _CFBitVectorCreateMutableCopy( + allocator, + capacity, + bv, + ); + } + + late final _CFBitVectorCreateMutableCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableBitVectorRef Function(CFAllocatorRef, CFIndex, + CFBitVectorRef)>>('CFBitVectorCreateMutableCopy'); + late final _CFBitVectorCreateMutableCopy = + _CFBitVectorCreateMutableCopyPtr.asFunction< + CFMutableBitVectorRef Function( + CFAllocatorRef, int, CFBitVectorRef)>(); + + int CFBitVectorGetCount( + CFBitVectorRef bv, + ) { + return _CFBitVectorGetCount( + bv, + ); + } + + late final _CFBitVectorGetCountPtr = + _lookup>( + 'CFBitVectorGetCount'); + late final _CFBitVectorGetCount = + _CFBitVectorGetCountPtr.asFunction(); + + int CFBitVectorGetCountOfBit( + CFBitVectorRef bv, + CFRange range, + int value, + ) { + return _CFBitVectorGetCountOfBit( + bv, + range, + value, + ); + } + + late final _CFBitVectorGetCountOfBitPtr = _lookup< + ffi.NativeFunction>( + 'CFBitVectorGetCountOfBit'); + late final _CFBitVectorGetCountOfBit = _CFBitVectorGetCountOfBitPtr + .asFunction(); + + int CFBitVectorContainsBit( + CFBitVectorRef bv, + CFRange range, + int value, + ) { + return _CFBitVectorContainsBit( + bv, + range, + value, + ); + } + + late final _CFBitVectorContainsBitPtr = _lookup< + ffi.NativeFunction>( + 'CFBitVectorContainsBit'); + late final _CFBitVectorContainsBit = _CFBitVectorContainsBitPtr.asFunction< + int Function(CFBitVectorRef, CFRange, int)>(); + + int CFBitVectorGetBitAtIndex( + CFBitVectorRef bv, + int idx, + ) { + return _CFBitVectorGetBitAtIndex( + bv, + idx, + ); + } + + late final _CFBitVectorGetBitAtIndexPtr = + _lookup>( + 'CFBitVectorGetBitAtIndex'); + late final _CFBitVectorGetBitAtIndex = _CFBitVectorGetBitAtIndexPtr + .asFunction(); + + void CFBitVectorGetBits( + CFBitVectorRef bv, + CFRange range, + ffi.Pointer bytes, + ) { + return _CFBitVectorGetBits( + bv, + range, + bytes, + ); + } + + late final _CFBitVectorGetBitsPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFBitVectorRef, CFRange, + ffi.Pointer)>>('CFBitVectorGetBits'); + late final _CFBitVectorGetBits = _CFBitVectorGetBitsPtr.asFunction< + void Function(CFBitVectorRef, CFRange, ffi.Pointer)>(); + + int CFBitVectorGetFirstIndexOfBit( + CFBitVectorRef bv, + CFRange range, + int value, + ) { + return _CFBitVectorGetFirstIndexOfBit( + bv, + range, + value, + ); + } + + late final _CFBitVectorGetFirstIndexOfBitPtr = _lookup< + ffi.NativeFunction>( + 'CFBitVectorGetFirstIndexOfBit'); + late final _CFBitVectorGetFirstIndexOfBit = _CFBitVectorGetFirstIndexOfBitPtr + .asFunction(); + + int CFBitVectorGetLastIndexOfBit( + CFBitVectorRef bv, + CFRange range, + int value, + ) { + return _CFBitVectorGetLastIndexOfBit( + bv, + range, + value, + ); + } + + late final _CFBitVectorGetLastIndexOfBitPtr = _lookup< + ffi.NativeFunction>( + 'CFBitVectorGetLastIndexOfBit'); + late final _CFBitVectorGetLastIndexOfBit = _CFBitVectorGetLastIndexOfBitPtr + .asFunction(); + + void CFBitVectorSetCount( + CFMutableBitVectorRef bv, + int count, + ) { + return _CFBitVectorSetCount( + bv, + count, + ); + } + + late final _CFBitVectorSetCountPtr = _lookup< + ffi + .NativeFunction>( + 'CFBitVectorSetCount'); + late final _CFBitVectorSetCount = _CFBitVectorSetCountPtr.asFunction< + void Function(CFMutableBitVectorRef, int)>(); + + void CFBitVectorFlipBitAtIndex( + CFMutableBitVectorRef bv, + int idx, + ) { + return _CFBitVectorFlipBitAtIndex( + bv, + idx, + ); + } + + late final _CFBitVectorFlipBitAtIndexPtr = _lookup< + ffi + .NativeFunction>( + 'CFBitVectorFlipBitAtIndex'); + late final _CFBitVectorFlipBitAtIndex = _CFBitVectorFlipBitAtIndexPtr + .asFunction(); + + void CFBitVectorFlipBits( + CFMutableBitVectorRef bv, + CFRange range, + ) { + return _CFBitVectorFlipBits( + bv, + range, + ); + } + + late final _CFBitVectorFlipBitsPtr = _lookup< + ffi + .NativeFunction>( + 'CFBitVectorFlipBits'); + late final _CFBitVectorFlipBits = _CFBitVectorFlipBitsPtr.asFunction< + void Function(CFMutableBitVectorRef, CFRange)>(); + + void CFBitVectorSetBitAtIndex( + CFMutableBitVectorRef bv, + int idx, + int value, + ) { + return _CFBitVectorSetBitAtIndex( + bv, + idx, + value, + ); + } + + late final _CFBitVectorSetBitAtIndexPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableBitVectorRef, CFIndex, + CFBit)>>('CFBitVectorSetBitAtIndex'); + late final _CFBitVectorSetBitAtIndex = _CFBitVectorSetBitAtIndexPtr + .asFunction(); + + void CFBitVectorSetBits( + CFMutableBitVectorRef bv, + CFRange range, + int value, + ) { + return _CFBitVectorSetBits( + bv, + range, + value, + ); + } + + late final _CFBitVectorSetBitsPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableBitVectorRef, CFRange, CFBit)>>('CFBitVectorSetBits'); + late final _CFBitVectorSetBits = _CFBitVectorSetBitsPtr.asFunction< + void Function(CFMutableBitVectorRef, CFRange, int)>(); + + void CFBitVectorSetAllBits( + CFMutableBitVectorRef bv, + int value, + ) { + return _CFBitVectorSetAllBits( + bv, + value, + ); + } + + late final _CFBitVectorSetAllBitsPtr = _lookup< + ffi.NativeFunction>( + 'CFBitVectorSetAllBits'); + late final _CFBitVectorSetAllBits = _CFBitVectorSetAllBitsPtr.asFunction< + void Function(CFMutableBitVectorRef, int)>(); + + late final ffi.Pointer + _kCFTypeDictionaryKeyCallBacks = + _lookup('kCFTypeDictionaryKeyCallBacks'); + + CFDictionaryKeyCallBacks get kCFTypeDictionaryKeyCallBacks => + _kCFTypeDictionaryKeyCallBacks.ref; + + late final ffi.Pointer + _kCFCopyStringDictionaryKeyCallBacks = + _lookup('kCFCopyStringDictionaryKeyCallBacks'); + + CFDictionaryKeyCallBacks get kCFCopyStringDictionaryKeyCallBacks => + _kCFCopyStringDictionaryKeyCallBacks.ref; + + late final ffi.Pointer + _kCFTypeDictionaryValueCallBacks = + _lookup('kCFTypeDictionaryValueCallBacks'); + + CFDictionaryValueCallBacks get kCFTypeDictionaryValueCallBacks => + _kCFTypeDictionaryValueCallBacks.ref; + + int CFDictionaryGetTypeID() { + return _CFDictionaryGetTypeID(); + } + + late final _CFDictionaryGetTypeIDPtr = + _lookup>('CFDictionaryGetTypeID'); + late final _CFDictionaryGetTypeID = + _CFDictionaryGetTypeIDPtr.asFunction(); + + CFDictionaryRef CFDictionaryCreate( + CFAllocatorRef allocator, + ffi.Pointer> keys, + ffi.Pointer> values, + int numValues, + ffi.Pointer keyCallBacks, + ffi.Pointer valueCallBacks, + ) { + return _CFDictionaryCreate( + allocator, + keys, + values, + numValues, + keyCallBacks, + valueCallBacks, + ); + } + + late final _CFDictionaryCreatePtr = _lookup< + ffi.NativeFunction< + CFDictionaryRef Function( + CFAllocatorRef, + ffi.Pointer>, + ffi.Pointer>, + CFIndex, + ffi.Pointer, + ffi.Pointer)>>('CFDictionaryCreate'); + late final _CFDictionaryCreate = _CFDictionaryCreatePtr.asFunction< + CFDictionaryRef Function( + CFAllocatorRef, + ffi.Pointer>, + ffi.Pointer>, + int, + ffi.Pointer, + ffi.Pointer)>(); + + CFDictionaryRef CFDictionaryCreateCopy( + CFAllocatorRef allocator, + CFDictionaryRef theDict, + ) { + return _CFDictionaryCreateCopy( + allocator, + theDict, + ); + } + + late final _CFDictionaryCreateCopyPtr = _lookup< + ffi.NativeFunction< + CFDictionaryRef Function( + CFAllocatorRef, CFDictionaryRef)>>('CFDictionaryCreateCopy'); + late final _CFDictionaryCreateCopy = _CFDictionaryCreateCopyPtr.asFunction< + CFDictionaryRef Function(CFAllocatorRef, CFDictionaryRef)>(); + + CFMutableDictionaryRef CFDictionaryCreateMutable( + CFAllocatorRef allocator, + int capacity, + ffi.Pointer keyCallBacks, + ffi.Pointer valueCallBacks, + ) { + return _CFDictionaryCreateMutable( + allocator, + capacity, + keyCallBacks, + valueCallBacks, + ); + } + + late final _CFDictionaryCreateMutablePtr = _lookup< + ffi.NativeFunction< + CFMutableDictionaryRef Function( + CFAllocatorRef, + CFIndex, + ffi.Pointer, + ffi.Pointer)>>( + 'CFDictionaryCreateMutable'); + late final _CFDictionaryCreateMutable = + _CFDictionaryCreateMutablePtr.asFunction< + CFMutableDictionaryRef Function( + CFAllocatorRef, + int, + ffi.Pointer, + ffi.Pointer)>(); + + CFMutableDictionaryRef CFDictionaryCreateMutableCopy( + CFAllocatorRef allocator, + int capacity, + CFDictionaryRef theDict, + ) { + return _CFDictionaryCreateMutableCopy( + allocator, + capacity, + theDict, + ); + } + + late final _CFDictionaryCreateMutableCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableDictionaryRef Function(CFAllocatorRef, CFIndex, + CFDictionaryRef)>>('CFDictionaryCreateMutableCopy'); + late final _CFDictionaryCreateMutableCopy = + _CFDictionaryCreateMutableCopyPtr.asFunction< + CFMutableDictionaryRef Function( + CFAllocatorRef, int, CFDictionaryRef)>(); + + int CFDictionaryGetCount( + CFDictionaryRef theDict, + ) { + return _CFDictionaryGetCount( + theDict, + ); + } + + late final _CFDictionaryGetCountPtr = + _lookup>( + 'CFDictionaryGetCount'); + late final _CFDictionaryGetCount = + _CFDictionaryGetCountPtr.asFunction(); + + int CFDictionaryGetCountOfKey( + CFDictionaryRef theDict, + ffi.Pointer key, + ) { + return _CFDictionaryGetCountOfKey( + theDict, + key, + ); + } + + late final _CFDictionaryGetCountOfKeyPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFDictionaryRef, + ffi.Pointer)>>('CFDictionaryGetCountOfKey'); + late final _CFDictionaryGetCountOfKey = _CFDictionaryGetCountOfKeyPtr + .asFunction)>(); + + int CFDictionaryGetCountOfValue( + CFDictionaryRef theDict, + ffi.Pointer value, + ) { + return _CFDictionaryGetCountOfValue( + theDict, + value, + ); + } + + late final _CFDictionaryGetCountOfValuePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFDictionaryRef, + ffi.Pointer)>>('CFDictionaryGetCountOfValue'); + late final _CFDictionaryGetCountOfValue = _CFDictionaryGetCountOfValuePtr + .asFunction)>(); + + int CFDictionaryContainsKey( + CFDictionaryRef theDict, + ffi.Pointer key, + ) { + return _CFDictionaryContainsKey( + theDict, + key, + ); + } + + late final _CFDictionaryContainsKeyPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFDictionaryRef, + ffi.Pointer)>>('CFDictionaryContainsKey'); + late final _CFDictionaryContainsKey = _CFDictionaryContainsKeyPtr.asFunction< + int Function(CFDictionaryRef, ffi.Pointer)>(); + + int CFDictionaryContainsValue( + CFDictionaryRef theDict, + ffi.Pointer value, + ) { + return _CFDictionaryContainsValue( + theDict, + value, + ); + } + + late final _CFDictionaryContainsValuePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFDictionaryRef, + ffi.Pointer)>>('CFDictionaryContainsValue'); + late final _CFDictionaryContainsValue = _CFDictionaryContainsValuePtr + .asFunction)>(); + + ffi.Pointer CFDictionaryGetValue( + CFDictionaryRef theDict, + ffi.Pointer key, + ) { + return _CFDictionaryGetValue( + theDict, + key, + ); + } + + late final _CFDictionaryGetValuePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CFDictionaryRef, ffi.Pointer)>>('CFDictionaryGetValue'); + late final _CFDictionaryGetValue = _CFDictionaryGetValuePtr.asFunction< + ffi.Pointer Function(CFDictionaryRef, ffi.Pointer)>(); + + int CFDictionaryGetValueIfPresent( + CFDictionaryRef theDict, + ffi.Pointer key, + ffi.Pointer> value, + ) { + return _CFDictionaryGetValueIfPresent( + theDict, + key, + value, + ); + } + + late final _CFDictionaryGetValueIfPresentPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFDictionaryRef, ffi.Pointer, + ffi.Pointer>)>>( + 'CFDictionaryGetValueIfPresent'); + late final _CFDictionaryGetValueIfPresent = + _CFDictionaryGetValueIfPresentPtr.asFunction< + int Function(CFDictionaryRef, ffi.Pointer, + ffi.Pointer>)>(); + + void CFDictionaryGetKeysAndValues( + CFDictionaryRef theDict, + ffi.Pointer> keys, + ffi.Pointer> values, + ) { + return _CFDictionaryGetKeysAndValues( + theDict, + keys, + values, + ); + } + + late final _CFDictionaryGetKeysAndValuesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFDictionaryRef, + ffi.Pointer>, + ffi.Pointer>)>>( + 'CFDictionaryGetKeysAndValues'); + late final _CFDictionaryGetKeysAndValues = + _CFDictionaryGetKeysAndValuesPtr.asFunction< + void Function(CFDictionaryRef, ffi.Pointer>, + ffi.Pointer>)>(); + + void CFDictionaryApplyFunction( + CFDictionaryRef theDict, + CFDictionaryApplierFunction applier, + ffi.Pointer context, + ) { + return _CFDictionaryApplyFunction( + theDict, + applier, + context, + ); + } + + late final _CFDictionaryApplyFunctionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFDictionaryRef, CFDictionaryApplierFunction, + ffi.Pointer)>>('CFDictionaryApplyFunction'); + late final _CFDictionaryApplyFunction = + _CFDictionaryApplyFunctionPtr.asFunction< + void Function(CFDictionaryRef, CFDictionaryApplierFunction, + ffi.Pointer)>(); + + void CFDictionaryAddValue( + CFMutableDictionaryRef theDict, + ffi.Pointer key, + ffi.Pointer value, + ) { + return _CFDictionaryAddValue( + theDict, + key, + value, + ); + } + + late final _CFDictionaryAddValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableDictionaryRef, ffi.Pointer, + ffi.Pointer)>>('CFDictionaryAddValue'); + late final _CFDictionaryAddValue = _CFDictionaryAddValuePtr.asFunction< + void Function(CFMutableDictionaryRef, ffi.Pointer, + ffi.Pointer)>(); + + void CFDictionarySetValue( + CFMutableDictionaryRef theDict, + ffi.Pointer key, + ffi.Pointer value, + ) { + return _CFDictionarySetValue( + theDict, + key, + value, + ); + } + + late final _CFDictionarySetValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableDictionaryRef, ffi.Pointer, + ffi.Pointer)>>('CFDictionarySetValue'); + late final _CFDictionarySetValue = _CFDictionarySetValuePtr.asFunction< + void Function(CFMutableDictionaryRef, ffi.Pointer, + ffi.Pointer)>(); + + void CFDictionaryReplaceValue( + CFMutableDictionaryRef theDict, + ffi.Pointer key, + ffi.Pointer value, + ) { + return _CFDictionaryReplaceValue( + theDict, + key, + value, + ); + } + + late final _CFDictionaryReplaceValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableDictionaryRef, ffi.Pointer, + ffi.Pointer)>>('CFDictionaryReplaceValue'); + late final _CFDictionaryReplaceValue = + _CFDictionaryReplaceValuePtr.asFunction< + void Function(CFMutableDictionaryRef, ffi.Pointer, + ffi.Pointer)>(); + + void CFDictionaryRemoveValue( + CFMutableDictionaryRef theDict, + ffi.Pointer key, + ) { + return _CFDictionaryRemoveValue( + theDict, + key, + ); + } + + late final _CFDictionaryRemoveValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableDictionaryRef, + ffi.Pointer)>>('CFDictionaryRemoveValue'); + late final _CFDictionaryRemoveValue = _CFDictionaryRemoveValuePtr.asFunction< + void Function(CFMutableDictionaryRef, ffi.Pointer)>(); + + void CFDictionaryRemoveAllValues( + CFMutableDictionaryRef theDict, + ) { + return _CFDictionaryRemoveAllValues( + theDict, + ); + } + + late final _CFDictionaryRemoveAllValuesPtr = + _lookup>( + 'CFDictionaryRemoveAllValues'); + late final _CFDictionaryRemoveAllValues = _CFDictionaryRemoveAllValuesPtr + .asFunction(); + + int CFNotificationCenterGetTypeID() { + return _CFNotificationCenterGetTypeID(); + } + + late final _CFNotificationCenterGetTypeIDPtr = + _lookup>( + 'CFNotificationCenterGetTypeID'); + late final _CFNotificationCenterGetTypeID = + _CFNotificationCenterGetTypeIDPtr.asFunction(); + + CFNotificationCenterRef CFNotificationCenterGetLocalCenter() { + return _CFNotificationCenterGetLocalCenter(); + } + + late final _CFNotificationCenterGetLocalCenterPtr = + _lookup>( + 'CFNotificationCenterGetLocalCenter'); + late final _CFNotificationCenterGetLocalCenter = + _CFNotificationCenterGetLocalCenterPtr.asFunction< + CFNotificationCenterRef Function()>(); + + CFNotificationCenterRef CFNotificationCenterGetDistributedCenter() { + return _CFNotificationCenterGetDistributedCenter(); + } + + late final _CFNotificationCenterGetDistributedCenterPtr = + _lookup>( + 'CFNotificationCenterGetDistributedCenter'); + late final _CFNotificationCenterGetDistributedCenter = + _CFNotificationCenterGetDistributedCenterPtr.asFunction< + CFNotificationCenterRef Function()>(); + + CFNotificationCenterRef CFNotificationCenterGetDarwinNotifyCenter() { + return _CFNotificationCenterGetDarwinNotifyCenter(); + } + + late final _CFNotificationCenterGetDarwinNotifyCenterPtr = + _lookup>( + 'CFNotificationCenterGetDarwinNotifyCenter'); + late final _CFNotificationCenterGetDarwinNotifyCenter = + _CFNotificationCenterGetDarwinNotifyCenterPtr.asFunction< + CFNotificationCenterRef Function()>(); + + void CFNotificationCenterAddObserver( + CFNotificationCenterRef center, + ffi.Pointer observer, + CFNotificationCallback callBack, + CFStringRef name, + ffi.Pointer object, + CFNotificationSuspensionBehavior suspensionBehavior, + ) { + return _CFNotificationCenterAddObserver( + center, + observer, + callBack, + name, + object, + suspensionBehavior.value, + ); + } + + late final _CFNotificationCenterAddObserverPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFNotificationCenterRef, + ffi.Pointer, + CFNotificationCallback, + CFStringRef, + ffi.Pointer, + CFIndex)>>('CFNotificationCenterAddObserver'); + late final _CFNotificationCenterAddObserver = + _CFNotificationCenterAddObserverPtr.asFunction< + void Function( + CFNotificationCenterRef, + ffi.Pointer, + CFNotificationCallback, + CFStringRef, + ffi.Pointer, + int)>(); + + void CFNotificationCenterRemoveObserver( + CFNotificationCenterRef center, + ffi.Pointer observer, + CFNotificationName name, + ffi.Pointer object, + ) { + return _CFNotificationCenterRemoveObserver( + center, + observer, + name, + object, + ); + } + + late final _CFNotificationCenterRemoveObserverPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFNotificationCenterRef, + ffi.Pointer, + CFNotificationName, + ffi.Pointer)>>('CFNotificationCenterRemoveObserver'); + late final _CFNotificationCenterRemoveObserver = + _CFNotificationCenterRemoveObserverPtr.asFunction< + void Function(CFNotificationCenterRef, ffi.Pointer, + CFNotificationName, ffi.Pointer)>(); + + void CFNotificationCenterRemoveEveryObserver( + CFNotificationCenterRef center, + ffi.Pointer observer, + ) { + return _CFNotificationCenterRemoveEveryObserver( + center, + observer, + ); + } + + late final _CFNotificationCenterRemoveEveryObserverPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFNotificationCenterRef, ffi.Pointer)>>( + 'CFNotificationCenterRemoveEveryObserver'); + late final _CFNotificationCenterRemoveEveryObserver = + _CFNotificationCenterRemoveEveryObserverPtr.asFunction< + void Function(CFNotificationCenterRef, ffi.Pointer)>(); + + void CFNotificationCenterPostNotification( + CFNotificationCenterRef center, + CFNotificationName name, + ffi.Pointer object, + CFDictionaryRef userInfo, + int deliverImmediately, + ) { + return _CFNotificationCenterPostNotification( + center, + name, + object, + userInfo, + deliverImmediately, + ); + } + + late final _CFNotificationCenterPostNotificationPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFNotificationCenterRef, + CFNotificationName, + ffi.Pointer, + CFDictionaryRef, + Boolean)>>('CFNotificationCenterPostNotification'); + late final _CFNotificationCenterPostNotification = + _CFNotificationCenterPostNotificationPtr.asFunction< + void Function(CFNotificationCenterRef, CFNotificationName, + ffi.Pointer, CFDictionaryRef, int)>(); + + void CFNotificationCenterPostNotificationWithOptions( + CFNotificationCenterRef center, + CFNotificationName name, + ffi.Pointer object, + CFDictionaryRef userInfo, + int options, + ) { + return _CFNotificationCenterPostNotificationWithOptions( + center, + name, + object, + userInfo, + options, + ); + } + + late final _CFNotificationCenterPostNotificationWithOptionsPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFNotificationCenterRef, CFNotificationName, + ffi.Pointer, CFDictionaryRef, CFOptionFlags)>>( + 'CFNotificationCenterPostNotificationWithOptions'); + late final _CFNotificationCenterPostNotificationWithOptions = + _CFNotificationCenterPostNotificationWithOptionsPtr.asFunction< + void Function(CFNotificationCenterRef, CFNotificationName, + ffi.Pointer, CFDictionaryRef, int)>(); + + int CFLocaleGetTypeID() { + return _CFLocaleGetTypeID(); + } + + late final _CFLocaleGetTypeIDPtr = + _lookup>('CFLocaleGetTypeID'); + late final _CFLocaleGetTypeID = + _CFLocaleGetTypeIDPtr.asFunction(); + + CFLocaleRef CFLocaleGetSystem() { + return _CFLocaleGetSystem(); + } + + late final _CFLocaleGetSystemPtr = + _lookup>('CFLocaleGetSystem'); + late final _CFLocaleGetSystem = + _CFLocaleGetSystemPtr.asFunction(); + + CFLocaleRef CFLocaleCopyCurrent() { + return _CFLocaleCopyCurrent(); + } + + late final _CFLocaleCopyCurrentPtr = + _lookup>( + 'CFLocaleCopyCurrent'); + late final _CFLocaleCopyCurrent = + _CFLocaleCopyCurrentPtr.asFunction(); + + CFArrayRef CFLocaleCopyAvailableLocaleIdentifiers() { + return _CFLocaleCopyAvailableLocaleIdentifiers(); + } + + late final _CFLocaleCopyAvailableLocaleIdentifiersPtr = + _lookup>( + 'CFLocaleCopyAvailableLocaleIdentifiers'); + late final _CFLocaleCopyAvailableLocaleIdentifiers = + _CFLocaleCopyAvailableLocaleIdentifiersPtr.asFunction< + CFArrayRef Function()>(); + + CFArrayRef CFLocaleCopyISOLanguageCodes() { + return _CFLocaleCopyISOLanguageCodes(); + } + + late final _CFLocaleCopyISOLanguageCodesPtr = + _lookup>( + 'CFLocaleCopyISOLanguageCodes'); + late final _CFLocaleCopyISOLanguageCodes = + _CFLocaleCopyISOLanguageCodesPtr.asFunction(); + + CFArrayRef CFLocaleCopyISOCountryCodes() { + return _CFLocaleCopyISOCountryCodes(); + } + + late final _CFLocaleCopyISOCountryCodesPtr = + _lookup>( + 'CFLocaleCopyISOCountryCodes'); + late final _CFLocaleCopyISOCountryCodes = + _CFLocaleCopyISOCountryCodesPtr.asFunction(); + + CFArrayRef CFLocaleCopyISOCurrencyCodes() { + return _CFLocaleCopyISOCurrencyCodes(); + } + + late final _CFLocaleCopyISOCurrencyCodesPtr = + _lookup>( + 'CFLocaleCopyISOCurrencyCodes'); + late final _CFLocaleCopyISOCurrencyCodes = + _CFLocaleCopyISOCurrencyCodesPtr.asFunction(); + + CFArrayRef CFLocaleCopyCommonISOCurrencyCodes() { + return _CFLocaleCopyCommonISOCurrencyCodes(); + } + + late final _CFLocaleCopyCommonISOCurrencyCodesPtr = + _lookup>( + 'CFLocaleCopyCommonISOCurrencyCodes'); + late final _CFLocaleCopyCommonISOCurrencyCodes = + _CFLocaleCopyCommonISOCurrencyCodesPtr.asFunction< + CFArrayRef Function()>(); + + CFArrayRef CFLocaleCopyPreferredLanguages() { + return _CFLocaleCopyPreferredLanguages(); + } + + late final _CFLocaleCopyPreferredLanguagesPtr = + _lookup>( + 'CFLocaleCopyPreferredLanguages'); + late final _CFLocaleCopyPreferredLanguages = + _CFLocaleCopyPreferredLanguagesPtr.asFunction(); + + CFLocaleIdentifier CFLocaleCreateCanonicalLanguageIdentifierFromString( + CFAllocatorRef allocator, + CFStringRef localeIdentifier, + ) { + return _CFLocaleCreateCanonicalLanguageIdentifierFromString( + allocator, + localeIdentifier, + ); + } + + late final _CFLocaleCreateCanonicalLanguageIdentifierFromStringPtr = _lookup< + ffi.NativeFunction< + CFLocaleIdentifier Function(CFAllocatorRef, CFStringRef)>>( + 'CFLocaleCreateCanonicalLanguageIdentifierFromString'); + late final _CFLocaleCreateCanonicalLanguageIdentifierFromString = + _CFLocaleCreateCanonicalLanguageIdentifierFromStringPtr.asFunction< + CFLocaleIdentifier Function(CFAllocatorRef, CFStringRef)>(); + + CFLocaleIdentifier CFLocaleCreateCanonicalLocaleIdentifierFromString( + CFAllocatorRef allocator, + CFStringRef localeIdentifier, + ) { + return _CFLocaleCreateCanonicalLocaleIdentifierFromString( + allocator, + localeIdentifier, + ); + } + + late final _CFLocaleCreateCanonicalLocaleIdentifierFromStringPtr = _lookup< + ffi.NativeFunction< + CFLocaleIdentifier Function(CFAllocatorRef, CFStringRef)>>( + 'CFLocaleCreateCanonicalLocaleIdentifierFromString'); + late final _CFLocaleCreateCanonicalLocaleIdentifierFromString = + _CFLocaleCreateCanonicalLocaleIdentifierFromStringPtr.asFunction< + CFLocaleIdentifier Function(CFAllocatorRef, CFStringRef)>(); + + CFLocaleIdentifier + CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes( + CFAllocatorRef allocator, + int lcode, + int rcode, + ) { + return _CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes( + allocator, + lcode, + rcode, + ); + } + + late final _CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodesPtr = + _lookup< + ffi.NativeFunction< + CFLocaleIdentifier Function( + CFAllocatorRef, LangCode, RegionCode)>>( + 'CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes'); + late final _CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes = + _CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodesPtr + .asFunction(); + + CFLocaleIdentifier CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode( + CFAllocatorRef allocator, + int lcid, + ) { + return _CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode( + allocator, + lcid, + ); + } + + late final _CFLocaleCreateLocaleIdentifierFromWindowsLocaleCodePtr = _lookup< + ffi.NativeFunction< + CFLocaleIdentifier Function(CFAllocatorRef, ffi.Uint32)>>( + 'CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode'); + late final _CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode = + _CFLocaleCreateLocaleIdentifierFromWindowsLocaleCodePtr.asFunction< + CFLocaleIdentifier Function(CFAllocatorRef, int)>(); + + int CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier( + CFLocaleIdentifier localeIdentifier, + ) { + return _CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier( + localeIdentifier, + ); + } + + late final _CFLocaleGetWindowsLocaleCodeFromLocaleIdentifierPtr = + _lookup>( + 'CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier'); + late final _CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier = + _CFLocaleGetWindowsLocaleCodeFromLocaleIdentifierPtr.asFunction< + int Function(CFLocaleIdentifier)>(); + + CFLocaleLanguageDirection CFLocaleGetLanguageCharacterDirection( + CFStringRef isoLangCode, + ) { + return CFLocaleLanguageDirection.fromValue( + _CFLocaleGetLanguageCharacterDirection( + isoLangCode, + )); + } + + late final _CFLocaleGetLanguageCharacterDirectionPtr = + _lookup>( + 'CFLocaleGetLanguageCharacterDirection'); + late final _CFLocaleGetLanguageCharacterDirection = + _CFLocaleGetLanguageCharacterDirectionPtr.asFunction< + int Function(CFStringRef)>(); + + CFLocaleLanguageDirection CFLocaleGetLanguageLineDirection( + CFStringRef isoLangCode, + ) { + return CFLocaleLanguageDirection.fromValue( + _CFLocaleGetLanguageLineDirection( + isoLangCode, + )); + } + + late final _CFLocaleGetLanguageLineDirectionPtr = + _lookup>( + 'CFLocaleGetLanguageLineDirection'); + late final _CFLocaleGetLanguageLineDirection = + _CFLocaleGetLanguageLineDirectionPtr.asFunction< + int Function(CFStringRef)>(); + + CFDictionaryRef CFLocaleCreateComponentsFromLocaleIdentifier( + CFAllocatorRef allocator, + CFLocaleIdentifier localeID, + ) { + return _CFLocaleCreateComponentsFromLocaleIdentifier( + allocator, + localeID, + ); + } + + late final _CFLocaleCreateComponentsFromLocaleIdentifierPtr = _lookup< + ffi.NativeFunction< + CFDictionaryRef Function(CFAllocatorRef, CFLocaleIdentifier)>>( + 'CFLocaleCreateComponentsFromLocaleIdentifier'); + late final _CFLocaleCreateComponentsFromLocaleIdentifier = + _CFLocaleCreateComponentsFromLocaleIdentifierPtr.asFunction< + CFDictionaryRef Function(CFAllocatorRef, CFLocaleIdentifier)>(); + + CFLocaleIdentifier CFLocaleCreateLocaleIdentifierFromComponents( + CFAllocatorRef allocator, + CFDictionaryRef dictionary, + ) { + return _CFLocaleCreateLocaleIdentifierFromComponents( + allocator, + dictionary, + ); + } + + late final _CFLocaleCreateLocaleIdentifierFromComponentsPtr = _lookup< + ffi.NativeFunction< + CFLocaleIdentifier Function(CFAllocatorRef, CFDictionaryRef)>>( + 'CFLocaleCreateLocaleIdentifierFromComponents'); + late final _CFLocaleCreateLocaleIdentifierFromComponents = + _CFLocaleCreateLocaleIdentifierFromComponentsPtr.asFunction< + CFLocaleIdentifier Function(CFAllocatorRef, CFDictionaryRef)>(); + + CFLocaleRef CFLocaleCreate( + CFAllocatorRef allocator, + CFLocaleIdentifier localeIdentifier, + ) { + return _CFLocaleCreate( + allocator, + localeIdentifier, + ); + } + + late final _CFLocaleCreatePtr = _lookup< + ffi.NativeFunction< + CFLocaleRef Function( + CFAllocatorRef, CFLocaleIdentifier)>>('CFLocaleCreate'); + late final _CFLocaleCreate = _CFLocaleCreatePtr.asFunction< + CFLocaleRef Function(CFAllocatorRef, CFLocaleIdentifier)>(); + + CFLocaleRef CFLocaleCreateCopy( + CFAllocatorRef allocator, + CFLocaleRef locale, + ) { + return _CFLocaleCreateCopy( + allocator, + locale, + ); + } + + late final _CFLocaleCreateCopyPtr = _lookup< + ffi + .NativeFunction>( + 'CFLocaleCreateCopy'); + late final _CFLocaleCreateCopy = _CFLocaleCreateCopyPtr.asFunction< + CFLocaleRef Function(CFAllocatorRef, CFLocaleRef)>(); + + CFLocaleIdentifier CFLocaleGetIdentifier( + CFLocaleRef locale, + ) { + return _CFLocaleGetIdentifier( + locale, + ); + } + + late final _CFLocaleGetIdentifierPtr = + _lookup>( + 'CFLocaleGetIdentifier'); + late final _CFLocaleGetIdentifier = _CFLocaleGetIdentifierPtr.asFunction< + CFLocaleIdentifier Function(CFLocaleRef)>(); + + CFTypeRef CFLocaleGetValue( + CFLocaleRef locale, + CFLocaleKey key, + ) { + return _CFLocaleGetValue( + locale, + key, + ); + } + + late final _CFLocaleGetValuePtr = + _lookup>( + 'CFLocaleGetValue'); + late final _CFLocaleGetValue = _CFLocaleGetValuePtr.asFunction< + CFTypeRef Function(CFLocaleRef, CFLocaleKey)>(); + + CFStringRef CFLocaleCopyDisplayNameForPropertyValue( + CFLocaleRef displayLocale, + CFLocaleKey key, + CFStringRef value, + ) { + return _CFLocaleCopyDisplayNameForPropertyValue( + displayLocale, + key, + value, + ); + } + + late final _CFLocaleCopyDisplayNameForPropertyValuePtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFLocaleRef, CFLocaleKey, + CFStringRef)>>('CFLocaleCopyDisplayNameForPropertyValue'); + late final _CFLocaleCopyDisplayNameForPropertyValue = + _CFLocaleCopyDisplayNameForPropertyValuePtr.asFunction< + CFStringRef Function(CFLocaleRef, CFLocaleKey, CFStringRef)>(); + + late final ffi.Pointer + _kCFLocaleCurrentLocaleDidChangeNotification = + _lookup( + 'kCFLocaleCurrentLocaleDidChangeNotification'); + + CFNotificationName get kCFLocaleCurrentLocaleDidChangeNotification => + _kCFLocaleCurrentLocaleDidChangeNotification.value; + + late final ffi.Pointer _kCFLocaleIdentifier = + _lookup('kCFLocaleIdentifier'); + + CFLocaleKey get kCFLocaleIdentifier => _kCFLocaleIdentifier.value; + + late final ffi.Pointer _kCFLocaleLanguageCode = + _lookup('kCFLocaleLanguageCode'); + + CFLocaleKey get kCFLocaleLanguageCode => _kCFLocaleLanguageCode.value; + + late final ffi.Pointer _kCFLocaleCountryCode = + _lookup('kCFLocaleCountryCode'); + + CFLocaleKey get kCFLocaleCountryCode => _kCFLocaleCountryCode.value; + + late final ffi.Pointer _kCFLocaleScriptCode = + _lookup('kCFLocaleScriptCode'); + + CFLocaleKey get kCFLocaleScriptCode => _kCFLocaleScriptCode.value; + + late final ffi.Pointer _kCFLocaleVariantCode = + _lookup('kCFLocaleVariantCode'); + + CFLocaleKey get kCFLocaleVariantCode => _kCFLocaleVariantCode.value; + + late final ffi.Pointer _kCFLocaleExemplarCharacterSet = + _lookup('kCFLocaleExemplarCharacterSet'); + + CFLocaleKey get kCFLocaleExemplarCharacterSet => + _kCFLocaleExemplarCharacterSet.value; + + late final ffi.Pointer _kCFLocaleCalendarIdentifier = + _lookup('kCFLocaleCalendarIdentifier'); + + CFLocaleKey get kCFLocaleCalendarIdentifier => + _kCFLocaleCalendarIdentifier.value; + + late final ffi.Pointer _kCFLocaleCalendar = + _lookup('kCFLocaleCalendar'); + + CFLocaleKey get kCFLocaleCalendar => _kCFLocaleCalendar.value; + + late final ffi.Pointer _kCFLocaleCollationIdentifier = + _lookup('kCFLocaleCollationIdentifier'); + + CFLocaleKey get kCFLocaleCollationIdentifier => + _kCFLocaleCollationIdentifier.value; + + late final ffi.Pointer _kCFLocaleUsesMetricSystem = + _lookup('kCFLocaleUsesMetricSystem'); + + CFLocaleKey get kCFLocaleUsesMetricSystem => _kCFLocaleUsesMetricSystem.value; + + late final ffi.Pointer _kCFLocaleMeasurementSystem = + _lookup('kCFLocaleMeasurementSystem'); + + CFLocaleKey get kCFLocaleMeasurementSystem => + _kCFLocaleMeasurementSystem.value; + + late final ffi.Pointer _kCFLocaleDecimalSeparator = + _lookup('kCFLocaleDecimalSeparator'); + + CFLocaleKey get kCFLocaleDecimalSeparator => _kCFLocaleDecimalSeparator.value; + + late final ffi.Pointer _kCFLocaleGroupingSeparator = + _lookup('kCFLocaleGroupingSeparator'); + + CFLocaleKey get kCFLocaleGroupingSeparator => + _kCFLocaleGroupingSeparator.value; + + late final ffi.Pointer _kCFLocaleCurrencySymbol = + _lookup('kCFLocaleCurrencySymbol'); + + CFLocaleKey get kCFLocaleCurrencySymbol => _kCFLocaleCurrencySymbol.value; + + late final ffi.Pointer _kCFLocaleCurrencyCode = + _lookup('kCFLocaleCurrencyCode'); + + CFLocaleKey get kCFLocaleCurrencyCode => _kCFLocaleCurrencyCode.value; + + late final ffi.Pointer _kCFLocaleCollatorIdentifier = + _lookup('kCFLocaleCollatorIdentifier'); + + CFLocaleKey get kCFLocaleCollatorIdentifier => + _kCFLocaleCollatorIdentifier.value; + + late final ffi.Pointer _kCFLocaleQuotationBeginDelimiterKey = + _lookup('kCFLocaleQuotationBeginDelimiterKey'); + + CFLocaleKey get kCFLocaleQuotationBeginDelimiterKey => + _kCFLocaleQuotationBeginDelimiterKey.value; + + late final ffi.Pointer _kCFLocaleQuotationEndDelimiterKey = + _lookup('kCFLocaleQuotationEndDelimiterKey'); + + CFLocaleKey get kCFLocaleQuotationEndDelimiterKey => + _kCFLocaleQuotationEndDelimiterKey.value; + + late final ffi.Pointer + _kCFLocaleAlternateQuotationBeginDelimiterKey = + _lookup('kCFLocaleAlternateQuotationBeginDelimiterKey'); + + CFLocaleKey get kCFLocaleAlternateQuotationBeginDelimiterKey => + _kCFLocaleAlternateQuotationBeginDelimiterKey.value; + + late final ffi.Pointer + _kCFLocaleAlternateQuotationEndDelimiterKey = + _lookup('kCFLocaleAlternateQuotationEndDelimiterKey'); + + CFLocaleKey get kCFLocaleAlternateQuotationEndDelimiterKey => + _kCFLocaleAlternateQuotationEndDelimiterKey.value; + + late final ffi.Pointer _kCFGregorianCalendar = + _lookup('kCFGregorianCalendar'); + + CFCalendarIdentifier get kCFGregorianCalendar => _kCFGregorianCalendar.value; + + late final ffi.Pointer _kCFBuddhistCalendar = + _lookup('kCFBuddhistCalendar'); + + CFCalendarIdentifier get kCFBuddhistCalendar => _kCFBuddhistCalendar.value; + + late final ffi.Pointer _kCFChineseCalendar = + _lookup('kCFChineseCalendar'); + + CFCalendarIdentifier get kCFChineseCalendar => _kCFChineseCalendar.value; + + late final ffi.Pointer _kCFHebrewCalendar = + _lookup('kCFHebrewCalendar'); + + CFCalendarIdentifier get kCFHebrewCalendar => _kCFHebrewCalendar.value; + + late final ffi.Pointer _kCFIslamicCalendar = + _lookup('kCFIslamicCalendar'); + + CFCalendarIdentifier get kCFIslamicCalendar => _kCFIslamicCalendar.value; + + late final ffi.Pointer _kCFIslamicCivilCalendar = + _lookup('kCFIslamicCivilCalendar'); + + CFCalendarIdentifier get kCFIslamicCivilCalendar => + _kCFIslamicCivilCalendar.value; + + late final ffi.Pointer _kCFJapaneseCalendar = + _lookup('kCFJapaneseCalendar'); + + CFCalendarIdentifier get kCFJapaneseCalendar => _kCFJapaneseCalendar.value; + + late final ffi.Pointer _kCFRepublicOfChinaCalendar = + _lookup('kCFRepublicOfChinaCalendar'); + + CFCalendarIdentifier get kCFRepublicOfChinaCalendar => + _kCFRepublicOfChinaCalendar.value; + + late final ffi.Pointer _kCFPersianCalendar = + _lookup('kCFPersianCalendar'); + + CFCalendarIdentifier get kCFPersianCalendar => _kCFPersianCalendar.value; + + late final ffi.Pointer _kCFIndianCalendar = + _lookup('kCFIndianCalendar'); + + CFCalendarIdentifier get kCFIndianCalendar => _kCFIndianCalendar.value; + + late final ffi.Pointer _kCFISO8601Calendar = + _lookup('kCFISO8601Calendar'); + + CFCalendarIdentifier get kCFISO8601Calendar => _kCFISO8601Calendar.value; + + late final ffi.Pointer _kCFIslamicTabularCalendar = + _lookup('kCFIslamicTabularCalendar'); + + CFCalendarIdentifier get kCFIslamicTabularCalendar => + _kCFIslamicTabularCalendar.value; + + late final ffi.Pointer _kCFIslamicUmmAlQuraCalendar = + _lookup('kCFIslamicUmmAlQuraCalendar'); + + CFCalendarIdentifier get kCFIslamicUmmAlQuraCalendar => + _kCFIslamicUmmAlQuraCalendar.value; + + double CFAbsoluteTimeGetCurrent() { + return _CFAbsoluteTimeGetCurrent(); + } + + late final _CFAbsoluteTimeGetCurrentPtr = + _lookup>( + 'CFAbsoluteTimeGetCurrent'); + late final _CFAbsoluteTimeGetCurrent = + _CFAbsoluteTimeGetCurrentPtr.asFunction(); + + late final ffi.Pointer _kCFAbsoluteTimeIntervalSince1970 = + _lookup('kCFAbsoluteTimeIntervalSince1970'); + + DartCFTimeInterval get kCFAbsoluteTimeIntervalSince1970 => + _kCFAbsoluteTimeIntervalSince1970.value; + + late final ffi.Pointer _kCFAbsoluteTimeIntervalSince1904 = + _lookup('kCFAbsoluteTimeIntervalSince1904'); + + DartCFTimeInterval get kCFAbsoluteTimeIntervalSince1904 => + _kCFAbsoluteTimeIntervalSince1904.value; + + int CFDateGetTypeID() { + return _CFDateGetTypeID(); + } + + late final _CFDateGetTypeIDPtr = + _lookup>('CFDateGetTypeID'); + late final _CFDateGetTypeID = + _CFDateGetTypeIDPtr.asFunction(); + + CFDateRef CFDateCreate( + CFAllocatorRef allocator, + double at, + ) { + return _CFDateCreate( + allocator, + at, + ); + } + + late final _CFDateCreatePtr = _lookup< + ffi.NativeFunction< + CFDateRef Function(CFAllocatorRef, CFAbsoluteTime)>>('CFDateCreate'); + late final _CFDateCreate = + _CFDateCreatePtr.asFunction(); + + double CFDateGetAbsoluteTime( + CFDateRef theDate, + ) { + return _CFDateGetAbsoluteTime( + theDate, + ); + } + + late final _CFDateGetAbsoluteTimePtr = + _lookup>( + 'CFDateGetAbsoluteTime'); + late final _CFDateGetAbsoluteTime = + _CFDateGetAbsoluteTimePtr.asFunction(); + + double CFDateGetTimeIntervalSinceDate( + CFDateRef theDate, + CFDateRef otherDate, + ) { + return _CFDateGetTimeIntervalSinceDate( + theDate, + otherDate, + ); + } + + late final _CFDateGetTimeIntervalSinceDatePtr = _lookup< + ffi.NativeFunction>( + 'CFDateGetTimeIntervalSinceDate'); + late final _CFDateGetTimeIntervalSinceDate = + _CFDateGetTimeIntervalSinceDatePtr.asFunction< + double Function(CFDateRef, CFDateRef)>(); + + CFComparisonResult CFDateCompare( + CFDateRef theDate, + CFDateRef otherDate, + ffi.Pointer context, + ) { + return CFComparisonResult.fromValue(_CFDateCompare( + theDate, + otherDate, + context, + )); + } + + late final _CFDateComparePtr = _lookup< + ffi.NativeFunction< + CFIndex Function( + CFDateRef, CFDateRef, ffi.Pointer)>>('CFDateCompare'); + late final _CFDateCompare = _CFDateComparePtr.asFunction< + int Function(CFDateRef, CFDateRef, ffi.Pointer)>(); + + int CFGregorianDateIsValid( + CFGregorianDate gdate, + int unitFlags, + ) { + return _CFGregorianDateIsValid( + gdate, + unitFlags, + ); + } + + late final _CFGregorianDateIsValidPtr = _lookup< + ffi.NativeFunction>( + 'CFGregorianDateIsValid'); + late final _CFGregorianDateIsValid = _CFGregorianDateIsValidPtr.asFunction< + int Function(CFGregorianDate, int)>(); + + double CFGregorianDateGetAbsoluteTime( + CFGregorianDate gdate, + CFTimeZoneRef tz, + ) { + return _CFGregorianDateGetAbsoluteTime( + gdate, + tz, + ); + } + + late final _CFGregorianDateGetAbsoluteTimePtr = _lookup< + ffi.NativeFunction< + CFAbsoluteTime Function(CFGregorianDate, + CFTimeZoneRef)>>('CFGregorianDateGetAbsoluteTime'); + late final _CFGregorianDateGetAbsoluteTime = + _CFGregorianDateGetAbsoluteTimePtr.asFunction< + double Function(CFGregorianDate, CFTimeZoneRef)>(); + + CFGregorianDate CFAbsoluteTimeGetGregorianDate( + double at, + CFTimeZoneRef tz, + ) { + return _CFAbsoluteTimeGetGregorianDate( + at, + tz, + ); + } + + late final _CFAbsoluteTimeGetGregorianDatePtr = _lookup< + ffi.NativeFunction< + CFGregorianDate Function(CFAbsoluteTime, + CFTimeZoneRef)>>('CFAbsoluteTimeGetGregorianDate'); + late final _CFAbsoluteTimeGetGregorianDate = + _CFAbsoluteTimeGetGregorianDatePtr.asFunction< + CFGregorianDate Function(double, CFTimeZoneRef)>(); + + double CFAbsoluteTimeAddGregorianUnits( + double at, + CFTimeZoneRef tz, + CFGregorianUnits units, + ) { + return _CFAbsoluteTimeAddGregorianUnits( + at, + tz, + units, + ); + } + + late final _CFAbsoluteTimeAddGregorianUnitsPtr = _lookup< + ffi.NativeFunction< + CFAbsoluteTime Function(CFAbsoluteTime, CFTimeZoneRef, + CFGregorianUnits)>>('CFAbsoluteTimeAddGregorianUnits'); + late final _CFAbsoluteTimeAddGregorianUnits = + _CFAbsoluteTimeAddGregorianUnitsPtr.asFunction< + double Function(double, CFTimeZoneRef, CFGregorianUnits)>(); + + CFGregorianUnits CFAbsoluteTimeGetDifferenceAsGregorianUnits( + double at1, + double at2, + CFTimeZoneRef tz, + int unitFlags, + ) { + return _CFAbsoluteTimeGetDifferenceAsGregorianUnits( + at1, + at2, + tz, + unitFlags, + ); + } + + late final _CFAbsoluteTimeGetDifferenceAsGregorianUnitsPtr = _lookup< + ffi.NativeFunction< + CFGregorianUnits Function( + CFAbsoluteTime, + CFAbsoluteTime, + CFTimeZoneRef, + CFOptionFlags)>>('CFAbsoluteTimeGetDifferenceAsGregorianUnits'); + late final _CFAbsoluteTimeGetDifferenceAsGregorianUnits = + _CFAbsoluteTimeGetDifferenceAsGregorianUnitsPtr.asFunction< + CFGregorianUnits Function(double, double, CFTimeZoneRef, int)>(); + + int CFAbsoluteTimeGetDayOfWeek( + double at, + CFTimeZoneRef tz, + ) { + return _CFAbsoluteTimeGetDayOfWeek( + at, + tz, + ); + } + + late final _CFAbsoluteTimeGetDayOfWeekPtr = _lookup< + ffi.NativeFunction>( + 'CFAbsoluteTimeGetDayOfWeek'); + late final _CFAbsoluteTimeGetDayOfWeek = _CFAbsoluteTimeGetDayOfWeekPtr + .asFunction(); + + int CFAbsoluteTimeGetDayOfYear( + double at, + CFTimeZoneRef tz, + ) { + return _CFAbsoluteTimeGetDayOfYear( + at, + tz, + ); + } + + late final _CFAbsoluteTimeGetDayOfYearPtr = _lookup< + ffi.NativeFunction>( + 'CFAbsoluteTimeGetDayOfYear'); + late final _CFAbsoluteTimeGetDayOfYear = _CFAbsoluteTimeGetDayOfYearPtr + .asFunction(); + + int CFAbsoluteTimeGetWeekOfYear( + double at, + CFTimeZoneRef tz, + ) { + return _CFAbsoluteTimeGetWeekOfYear( + at, + tz, + ); + } + + late final _CFAbsoluteTimeGetWeekOfYearPtr = _lookup< + ffi.NativeFunction>( + 'CFAbsoluteTimeGetWeekOfYear'); + late final _CFAbsoluteTimeGetWeekOfYear = _CFAbsoluteTimeGetWeekOfYearPtr + .asFunction(); + + int CFDataGetTypeID() { + return _CFDataGetTypeID(); + } + + late final _CFDataGetTypeIDPtr = + _lookup>('CFDataGetTypeID'); + late final _CFDataGetTypeID = + _CFDataGetTypeIDPtr.asFunction(); + + CFDataRef CFDataCreate( + CFAllocatorRef allocator, + ffi.Pointer bytes, + int length, + ) { + return _CFDataCreate( + allocator, + bytes, + length, + ); + } + + late final _CFDataCreatePtr = _lookup< + ffi.NativeFunction< + CFDataRef Function( + CFAllocatorRef, ffi.Pointer, CFIndex)>>('CFDataCreate'); + late final _CFDataCreate = _CFDataCreatePtr.asFunction< + CFDataRef Function(CFAllocatorRef, ffi.Pointer, int)>(); + + CFDataRef CFDataCreateWithBytesNoCopy( + CFAllocatorRef allocator, + ffi.Pointer bytes, + int length, + CFAllocatorRef bytesDeallocator, + ) { + return _CFDataCreateWithBytesNoCopy( + allocator, + bytes, + length, + bytesDeallocator, + ); + } + + late final _CFDataCreateWithBytesNoCopyPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(CFAllocatorRef, ffi.Pointer, CFIndex, + CFAllocatorRef)>>('CFDataCreateWithBytesNoCopy'); + late final _CFDataCreateWithBytesNoCopy = + _CFDataCreateWithBytesNoCopyPtr.asFunction< + CFDataRef Function( + CFAllocatorRef, ffi.Pointer, int, CFAllocatorRef)>(); + + CFDataRef CFDataCreateCopy( + CFAllocatorRef allocator, + CFDataRef theData, + ) { + return _CFDataCreateCopy( + allocator, + theData, + ); + } + + late final _CFDataCreateCopyPtr = _lookup< + ffi.NativeFunction>( + 'CFDataCreateCopy'); + late final _CFDataCreateCopy = _CFDataCreateCopyPtr.asFunction< + CFDataRef Function(CFAllocatorRef, CFDataRef)>(); + + CFMutableDataRef CFDataCreateMutable( + CFAllocatorRef allocator, + int capacity, + ) { + return _CFDataCreateMutable( + allocator, + capacity, + ); + } + + late final _CFDataCreateMutablePtr = _lookup< + ffi + .NativeFunction>( + 'CFDataCreateMutable'); + late final _CFDataCreateMutable = _CFDataCreateMutablePtr.asFunction< + CFMutableDataRef Function(CFAllocatorRef, int)>(); + + CFMutableDataRef CFDataCreateMutableCopy( + CFAllocatorRef allocator, + int capacity, + CFDataRef theData, + ) { + return _CFDataCreateMutableCopy( + allocator, + capacity, + theData, + ); + } + + late final _CFDataCreateMutableCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableDataRef Function( + CFAllocatorRef, CFIndex, CFDataRef)>>('CFDataCreateMutableCopy'); + late final _CFDataCreateMutableCopy = _CFDataCreateMutableCopyPtr.asFunction< + CFMutableDataRef Function(CFAllocatorRef, int, CFDataRef)>(); + + int CFDataGetLength( + CFDataRef theData, + ) { + return _CFDataGetLength( + theData, + ); + } + + late final _CFDataGetLengthPtr = + _lookup>( + 'CFDataGetLength'); + late final _CFDataGetLength = + _CFDataGetLengthPtr.asFunction(); + + ffi.Pointer CFDataGetBytePtr( + CFDataRef theData, + ) { + return _CFDataGetBytePtr( + theData, + ); + } + + late final _CFDataGetBytePtrPtr = + _lookup Function(CFDataRef)>>( + 'CFDataGetBytePtr'); + late final _CFDataGetBytePtr = + _CFDataGetBytePtrPtr.asFunction Function(CFDataRef)>(); + + ffi.Pointer CFDataGetMutableBytePtr( + CFMutableDataRef theData, + ) { + return _CFDataGetMutableBytePtr( + theData, + ); + } + + late final _CFDataGetMutableBytePtrPtr = _lookup< + ffi.NativeFunction Function(CFMutableDataRef)>>( + 'CFDataGetMutableBytePtr'); + late final _CFDataGetMutableBytePtr = _CFDataGetMutableBytePtrPtr.asFunction< + ffi.Pointer Function(CFMutableDataRef)>(); + + void CFDataGetBytes( + CFDataRef theData, + CFRange range, + ffi.Pointer buffer, + ) { + return _CFDataGetBytes( + theData, + range, + buffer, + ); + } + + late final _CFDataGetBytesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFDataRef, CFRange, ffi.Pointer)>>('CFDataGetBytes'); + late final _CFDataGetBytes = _CFDataGetBytesPtr.asFunction< + void Function(CFDataRef, CFRange, ffi.Pointer)>(); + + void CFDataSetLength( + CFMutableDataRef theData, + int length, + ) { + return _CFDataSetLength( + theData, + length, + ); + } + + late final _CFDataSetLengthPtr = + _lookup>( + 'CFDataSetLength'); + late final _CFDataSetLength = + _CFDataSetLengthPtr.asFunction(); + + void CFDataIncreaseLength( + CFMutableDataRef theData, + int extraLength, + ) { + return _CFDataIncreaseLength( + theData, + extraLength, + ); + } + + late final _CFDataIncreaseLengthPtr = + _lookup>( + 'CFDataIncreaseLength'); + late final _CFDataIncreaseLength = _CFDataIncreaseLengthPtr.asFunction< + void Function(CFMutableDataRef, int)>(); + + void CFDataAppendBytes( + CFMutableDataRef theData, + ffi.Pointer bytes, + int length, + ) { + return _CFDataAppendBytes( + theData, + bytes, + length, + ); + } + + late final _CFDataAppendBytesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableDataRef, ffi.Pointer, + CFIndex)>>('CFDataAppendBytes'); + late final _CFDataAppendBytes = _CFDataAppendBytesPtr.asFunction< + void Function(CFMutableDataRef, ffi.Pointer, int)>(); + + void CFDataReplaceBytes( + CFMutableDataRef theData, + CFRange range, + ffi.Pointer newBytes, + int newLength, + ) { + return _CFDataReplaceBytes( + theData, + range, + newBytes, + newLength, + ); + } + + late final _CFDataReplaceBytesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableDataRef, CFRange, ffi.Pointer, + CFIndex)>>('CFDataReplaceBytes'); + late final _CFDataReplaceBytes = _CFDataReplaceBytesPtr.asFunction< + void Function(CFMutableDataRef, CFRange, ffi.Pointer, int)>(); + + void CFDataDeleteBytes( + CFMutableDataRef theData, + CFRange range, + ) { + return _CFDataDeleteBytes( + theData, + range, + ); + } + + late final _CFDataDeleteBytesPtr = + _lookup>( + 'CFDataDeleteBytes'); + late final _CFDataDeleteBytes = _CFDataDeleteBytesPtr.asFunction< + void Function(CFMutableDataRef, CFRange)>(); + + CFRange CFDataFind( + CFDataRef theData, + CFDataRef dataToFind, + CFRange searchRange, + CFDataSearchFlags compareOptions, + ) { + return _CFDataFind( + theData, + dataToFind, + searchRange, + compareOptions.value, + ); + } + + late final _CFDataFindPtr = _lookup< + ffi.NativeFunction< + CFRange Function( + CFDataRef, CFDataRef, CFRange, CFOptionFlags)>>('CFDataFind'); + late final _CFDataFind = _CFDataFindPtr.asFunction< + CFRange Function(CFDataRef, CFDataRef, CFRange, int)>(); + + int CFCharacterSetGetTypeID() { + return _CFCharacterSetGetTypeID(); + } + + late final _CFCharacterSetGetTypeIDPtr = + _lookup>( + 'CFCharacterSetGetTypeID'); + late final _CFCharacterSetGetTypeID = + _CFCharacterSetGetTypeIDPtr.asFunction(); + + CFCharacterSetRef CFCharacterSetGetPredefined( + CFCharacterSetPredefinedSet theSetIdentifier, + ) { + return _CFCharacterSetGetPredefined( + theSetIdentifier.value, + ); + } + + late final _CFCharacterSetGetPredefinedPtr = + _lookup>( + 'CFCharacterSetGetPredefined'); + late final _CFCharacterSetGetPredefined = _CFCharacterSetGetPredefinedPtr + .asFunction(); + + CFCharacterSetRef CFCharacterSetCreateWithCharactersInRange( + CFAllocatorRef alloc, + CFRange theRange, + ) { + return _CFCharacterSetCreateWithCharactersInRange( + alloc, + theRange, + ); + } + + late final _CFCharacterSetCreateWithCharactersInRangePtr = _lookup< + ffi + .NativeFunction>( + 'CFCharacterSetCreateWithCharactersInRange'); + late final _CFCharacterSetCreateWithCharactersInRange = + _CFCharacterSetCreateWithCharactersInRangePtr.asFunction< + CFCharacterSetRef Function(CFAllocatorRef, CFRange)>(); + + CFCharacterSetRef CFCharacterSetCreateWithCharactersInString( + CFAllocatorRef alloc, + CFStringRef theString, + ) { + return _CFCharacterSetCreateWithCharactersInString( + alloc, + theString, + ); + } + + late final _CFCharacterSetCreateWithCharactersInStringPtr = _lookup< + ffi.NativeFunction< + CFCharacterSetRef Function(CFAllocatorRef, + CFStringRef)>>('CFCharacterSetCreateWithCharactersInString'); + late final _CFCharacterSetCreateWithCharactersInString = + _CFCharacterSetCreateWithCharactersInStringPtr.asFunction< + CFCharacterSetRef Function(CFAllocatorRef, CFStringRef)>(); + + CFCharacterSetRef CFCharacterSetCreateWithBitmapRepresentation( + CFAllocatorRef alloc, + CFDataRef theData, + ) { + return _CFCharacterSetCreateWithBitmapRepresentation( + alloc, + theData, + ); + } + + late final _CFCharacterSetCreateWithBitmapRepresentationPtr = _lookup< + ffi.NativeFunction< + CFCharacterSetRef Function(CFAllocatorRef, + CFDataRef)>>('CFCharacterSetCreateWithBitmapRepresentation'); + late final _CFCharacterSetCreateWithBitmapRepresentation = + _CFCharacterSetCreateWithBitmapRepresentationPtr.asFunction< + CFCharacterSetRef Function(CFAllocatorRef, CFDataRef)>(); + + CFCharacterSetRef CFCharacterSetCreateInvertedSet( + CFAllocatorRef alloc, + CFCharacterSetRef theSet, + ) { + return _CFCharacterSetCreateInvertedSet( + alloc, + theSet, + ); + } + + late final _CFCharacterSetCreateInvertedSetPtr = _lookup< + ffi.NativeFunction< + CFCharacterSetRef Function(CFAllocatorRef, + CFCharacterSetRef)>>('CFCharacterSetCreateInvertedSet'); + late final _CFCharacterSetCreateInvertedSet = + _CFCharacterSetCreateInvertedSetPtr.asFunction< + CFCharacterSetRef Function(CFAllocatorRef, CFCharacterSetRef)>(); + + int CFCharacterSetIsSupersetOfSet( + CFCharacterSetRef theSet, + CFCharacterSetRef theOtherset, + ) { + return _CFCharacterSetIsSupersetOfSet( + theSet, + theOtherset, + ); + } + + late final _CFCharacterSetIsSupersetOfSetPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFCharacterSetRef, + CFCharacterSetRef)>>('CFCharacterSetIsSupersetOfSet'); + late final _CFCharacterSetIsSupersetOfSet = _CFCharacterSetIsSupersetOfSetPtr + .asFunction(); + + int CFCharacterSetHasMemberInPlane( + CFCharacterSetRef theSet, + int thePlane, + ) { + return _CFCharacterSetHasMemberInPlane( + theSet, + thePlane, + ); + } + + late final _CFCharacterSetHasMemberInPlanePtr = + _lookup>( + 'CFCharacterSetHasMemberInPlane'); + late final _CFCharacterSetHasMemberInPlane = + _CFCharacterSetHasMemberInPlanePtr.asFunction< + int Function(CFCharacterSetRef, int)>(); + + CFMutableCharacterSetRef CFCharacterSetCreateMutable( + CFAllocatorRef alloc, + ) { + return _CFCharacterSetCreateMutable( + alloc, + ); + } + + late final _CFCharacterSetCreateMutablePtr = _lookup< + ffi + .NativeFunction>( + 'CFCharacterSetCreateMutable'); + late final _CFCharacterSetCreateMutable = _CFCharacterSetCreateMutablePtr + .asFunction(); + + CFCharacterSetRef CFCharacterSetCreateCopy( + CFAllocatorRef alloc, + CFCharacterSetRef theSet, + ) { + return _CFCharacterSetCreateCopy( + alloc, + theSet, + ); + } + + late final _CFCharacterSetCreateCopyPtr = _lookup< + ffi.NativeFunction< + CFCharacterSetRef Function( + CFAllocatorRef, CFCharacterSetRef)>>('CFCharacterSetCreateCopy'); + late final _CFCharacterSetCreateCopy = + _CFCharacterSetCreateCopyPtr.asFunction< + CFCharacterSetRef Function(CFAllocatorRef, CFCharacterSetRef)>(); + + CFMutableCharacterSetRef CFCharacterSetCreateMutableCopy( + CFAllocatorRef alloc, + CFCharacterSetRef theSet, + ) { + return _CFCharacterSetCreateMutableCopy( + alloc, + theSet, + ); + } + + late final _CFCharacterSetCreateMutableCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableCharacterSetRef Function(CFAllocatorRef, + CFCharacterSetRef)>>('CFCharacterSetCreateMutableCopy'); + late final _CFCharacterSetCreateMutableCopy = + _CFCharacterSetCreateMutableCopyPtr.asFunction< + CFMutableCharacterSetRef Function( + CFAllocatorRef, CFCharacterSetRef)>(); + + int CFCharacterSetIsCharacterMember( + CFCharacterSetRef theSet, + int theChar, + ) { + return _CFCharacterSetIsCharacterMember( + theSet, + theChar, + ); + } + + late final _CFCharacterSetIsCharacterMemberPtr = + _lookup>( + 'CFCharacterSetIsCharacterMember'); + late final _CFCharacterSetIsCharacterMember = + _CFCharacterSetIsCharacterMemberPtr.asFunction< + int Function(CFCharacterSetRef, int)>(); + + int CFCharacterSetIsLongCharacterMember( + CFCharacterSetRef theSet, + int theChar, + ) { + return _CFCharacterSetIsLongCharacterMember( + theSet, + theChar, + ); + } + + late final _CFCharacterSetIsLongCharacterMemberPtr = _lookup< + ffi.NativeFunction>( + 'CFCharacterSetIsLongCharacterMember'); + late final _CFCharacterSetIsLongCharacterMember = + _CFCharacterSetIsLongCharacterMemberPtr.asFunction< + int Function(CFCharacterSetRef, int)>(); + + CFDataRef CFCharacterSetCreateBitmapRepresentation( + CFAllocatorRef alloc, + CFCharacterSetRef theSet, + ) { + return _CFCharacterSetCreateBitmapRepresentation( + alloc, + theSet, + ); + } + + late final _CFCharacterSetCreateBitmapRepresentationPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(CFAllocatorRef, + CFCharacterSetRef)>>('CFCharacterSetCreateBitmapRepresentation'); + late final _CFCharacterSetCreateBitmapRepresentation = + _CFCharacterSetCreateBitmapRepresentationPtr.asFunction< + CFDataRef Function(CFAllocatorRef, CFCharacterSetRef)>(); + + void CFCharacterSetAddCharactersInRange( + CFMutableCharacterSetRef theSet, + CFRange theRange, + ) { + return _CFCharacterSetAddCharactersInRange( + theSet, + theRange, + ); + } + + late final _CFCharacterSetAddCharactersInRangePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableCharacterSetRef, + CFRange)>>('CFCharacterSetAddCharactersInRange'); + late final _CFCharacterSetAddCharactersInRange = + _CFCharacterSetAddCharactersInRangePtr.asFunction< + void Function(CFMutableCharacterSetRef, CFRange)>(); + + void CFCharacterSetRemoveCharactersInRange( + CFMutableCharacterSetRef theSet, + CFRange theRange, + ) { + return _CFCharacterSetRemoveCharactersInRange( + theSet, + theRange, + ); + } + + late final _CFCharacterSetRemoveCharactersInRangePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableCharacterSetRef, + CFRange)>>('CFCharacterSetRemoveCharactersInRange'); + late final _CFCharacterSetRemoveCharactersInRange = + _CFCharacterSetRemoveCharactersInRangePtr.asFunction< + void Function(CFMutableCharacterSetRef, CFRange)>(); + + void CFCharacterSetAddCharactersInString( + CFMutableCharacterSetRef theSet, + CFStringRef theString, + ) { + return _CFCharacterSetAddCharactersInString( + theSet, + theString, + ); + } + + late final _CFCharacterSetAddCharactersInStringPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableCharacterSetRef, + CFStringRef)>>('CFCharacterSetAddCharactersInString'); + late final _CFCharacterSetAddCharactersInString = + _CFCharacterSetAddCharactersInStringPtr.asFunction< + void Function(CFMutableCharacterSetRef, CFStringRef)>(); + + void CFCharacterSetRemoveCharactersInString( + CFMutableCharacterSetRef theSet, + CFStringRef theString, + ) { + return _CFCharacterSetRemoveCharactersInString( + theSet, + theString, + ); + } + + late final _CFCharacterSetRemoveCharactersInStringPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableCharacterSetRef, + CFStringRef)>>('CFCharacterSetRemoveCharactersInString'); + late final _CFCharacterSetRemoveCharactersInString = + _CFCharacterSetRemoveCharactersInStringPtr.asFunction< + void Function(CFMutableCharacterSetRef, CFStringRef)>(); + + void CFCharacterSetUnion( + CFMutableCharacterSetRef theSet, + CFCharacterSetRef theOtherSet, + ) { + return _CFCharacterSetUnion( + theSet, + theOtherSet, + ); + } + + late final _CFCharacterSetUnionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableCharacterSetRef, + CFCharacterSetRef)>>('CFCharacterSetUnion'); + late final _CFCharacterSetUnion = _CFCharacterSetUnionPtr.asFunction< + void Function(CFMutableCharacterSetRef, CFCharacterSetRef)>(); + + void CFCharacterSetIntersect( + CFMutableCharacterSetRef theSet, + CFCharacterSetRef theOtherSet, + ) { + return _CFCharacterSetIntersect( + theSet, + theOtherSet, + ); + } + + late final _CFCharacterSetIntersectPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableCharacterSetRef, + CFCharacterSetRef)>>('CFCharacterSetIntersect'); + late final _CFCharacterSetIntersect = _CFCharacterSetIntersectPtr.asFunction< + void Function(CFMutableCharacterSetRef, CFCharacterSetRef)>(); + + void CFCharacterSetInvert( + CFMutableCharacterSetRef theSet, + ) { + return _CFCharacterSetInvert( + theSet, + ); + } + + late final _CFCharacterSetInvertPtr = + _lookup>( + 'CFCharacterSetInvert'); + late final _CFCharacterSetInvert = _CFCharacterSetInvertPtr.asFunction< + void Function(CFMutableCharacterSetRef)>(); + + int CFErrorGetTypeID() { + return _CFErrorGetTypeID(); + } + + late final _CFErrorGetTypeIDPtr = + _lookup>('CFErrorGetTypeID'); + late final _CFErrorGetTypeID = + _CFErrorGetTypeIDPtr.asFunction(); + + late final ffi.Pointer _kCFErrorDomainPOSIX = + _lookup('kCFErrorDomainPOSIX'); + + CFErrorDomain get kCFErrorDomainPOSIX => _kCFErrorDomainPOSIX.value; + + late final ffi.Pointer _kCFErrorDomainOSStatus = + _lookup('kCFErrorDomainOSStatus'); + + CFErrorDomain get kCFErrorDomainOSStatus => _kCFErrorDomainOSStatus.value; + + late final ffi.Pointer _kCFErrorDomainMach = + _lookup('kCFErrorDomainMach'); + + CFErrorDomain get kCFErrorDomainMach => _kCFErrorDomainMach.value; + + late final ffi.Pointer _kCFErrorDomainCocoa = + _lookup('kCFErrorDomainCocoa'); + + CFErrorDomain get kCFErrorDomainCocoa => _kCFErrorDomainCocoa.value; + + late final ffi.Pointer _kCFErrorLocalizedDescriptionKey = + _lookup('kCFErrorLocalizedDescriptionKey'); + + CFStringRef get kCFErrorLocalizedDescriptionKey => + _kCFErrorLocalizedDescriptionKey.value; + + late final ffi.Pointer _kCFErrorLocalizedFailureKey = + _lookup('kCFErrorLocalizedFailureKey'); + + CFStringRef get kCFErrorLocalizedFailureKey => + _kCFErrorLocalizedFailureKey.value; + + late final ffi.Pointer _kCFErrorLocalizedFailureReasonKey = + _lookup('kCFErrorLocalizedFailureReasonKey'); + + CFStringRef get kCFErrorLocalizedFailureReasonKey => + _kCFErrorLocalizedFailureReasonKey.value; + + late final ffi.Pointer _kCFErrorLocalizedRecoverySuggestionKey = + _lookup('kCFErrorLocalizedRecoverySuggestionKey'); + + CFStringRef get kCFErrorLocalizedRecoverySuggestionKey => + _kCFErrorLocalizedRecoverySuggestionKey.value; + + late final ffi.Pointer _kCFErrorDescriptionKey = + _lookup('kCFErrorDescriptionKey'); + + CFStringRef get kCFErrorDescriptionKey => _kCFErrorDescriptionKey.value; + + late final ffi.Pointer _kCFErrorUnderlyingErrorKey = + _lookup('kCFErrorUnderlyingErrorKey'); + + CFStringRef get kCFErrorUnderlyingErrorKey => + _kCFErrorUnderlyingErrorKey.value; + + late final ffi.Pointer _kCFErrorURLKey = + _lookup('kCFErrorURLKey'); + + CFStringRef get kCFErrorURLKey => _kCFErrorURLKey.value; + + late final ffi.Pointer _kCFErrorFilePathKey = + _lookup('kCFErrorFilePathKey'); + + CFStringRef get kCFErrorFilePathKey => _kCFErrorFilePathKey.value; + + CFErrorRef CFErrorCreate( + CFAllocatorRef allocator, + CFErrorDomain domain, + int code, + CFDictionaryRef userInfo, + ) { + return _CFErrorCreate( + allocator, + domain, + code, + userInfo, + ); + } + + late final _CFErrorCreatePtr = _lookup< + ffi.NativeFunction< + CFErrorRef Function(CFAllocatorRef, CFErrorDomain, CFIndex, + CFDictionaryRef)>>('CFErrorCreate'); + late final _CFErrorCreate = _CFErrorCreatePtr.asFunction< + CFErrorRef Function( + CFAllocatorRef, CFErrorDomain, int, CFDictionaryRef)>(); + + CFErrorRef CFErrorCreateWithUserInfoKeysAndValues( + CFAllocatorRef allocator, + CFErrorDomain domain, + int code, + ffi.Pointer> userInfoKeys, + ffi.Pointer> userInfoValues, + int numUserInfoValues, + ) { + return _CFErrorCreateWithUserInfoKeysAndValues( + allocator, + domain, + code, + userInfoKeys, + userInfoValues, + numUserInfoValues, + ); + } + + late final _CFErrorCreateWithUserInfoKeysAndValuesPtr = _lookup< + ffi.NativeFunction< + CFErrorRef Function( + CFAllocatorRef, + CFErrorDomain, + CFIndex, + ffi.Pointer>, + ffi.Pointer>, + CFIndex)>>('CFErrorCreateWithUserInfoKeysAndValues'); + late final _CFErrorCreateWithUserInfoKeysAndValues = + _CFErrorCreateWithUserInfoKeysAndValuesPtr.asFunction< + CFErrorRef Function( + CFAllocatorRef, + CFErrorDomain, + int, + ffi.Pointer>, + ffi.Pointer>, + int)>(); + + CFErrorDomain CFErrorGetDomain( + CFErrorRef err, + ) { + return _CFErrorGetDomain( + err, + ); + } + + late final _CFErrorGetDomainPtr = + _lookup>( + 'CFErrorGetDomain'); + late final _CFErrorGetDomain = + _CFErrorGetDomainPtr.asFunction(); + + int CFErrorGetCode( + CFErrorRef err, + ) { + return _CFErrorGetCode( + err, + ); + } + + late final _CFErrorGetCodePtr = + _lookup>( + 'CFErrorGetCode'); + late final _CFErrorGetCode = + _CFErrorGetCodePtr.asFunction(); + + CFDictionaryRef CFErrorCopyUserInfo( + CFErrorRef err, + ) { + return _CFErrorCopyUserInfo( + err, + ); + } + + late final _CFErrorCopyUserInfoPtr = + _lookup>( + 'CFErrorCopyUserInfo'); + late final _CFErrorCopyUserInfo = _CFErrorCopyUserInfoPtr.asFunction< + CFDictionaryRef Function(CFErrorRef)>(); + + CFStringRef CFErrorCopyDescription( + CFErrorRef err, + ) { + return _CFErrorCopyDescription( + err, + ); + } + + late final _CFErrorCopyDescriptionPtr = + _lookup>( + 'CFErrorCopyDescription'); + late final _CFErrorCopyDescription = + _CFErrorCopyDescriptionPtr.asFunction(); + + CFStringRef CFErrorCopyFailureReason( + CFErrorRef err, + ) { + return _CFErrorCopyFailureReason( + err, + ); + } + + late final _CFErrorCopyFailureReasonPtr = + _lookup>( + 'CFErrorCopyFailureReason'); + late final _CFErrorCopyFailureReason = _CFErrorCopyFailureReasonPtr + .asFunction(); + + CFStringRef CFErrorCopyRecoverySuggestion( + CFErrorRef err, + ) { + return _CFErrorCopyRecoverySuggestion( + err, + ); + } + + late final _CFErrorCopyRecoverySuggestionPtr = + _lookup>( + 'CFErrorCopyRecoverySuggestion'); + late final _CFErrorCopyRecoverySuggestion = _CFErrorCopyRecoverySuggestionPtr + .asFunction(); + + int CFStringGetTypeID() { + return _CFStringGetTypeID(); + } + + late final _CFStringGetTypeIDPtr = + _lookup>('CFStringGetTypeID'); + late final _CFStringGetTypeID = + _CFStringGetTypeIDPtr.asFunction(); + + CFStringRef CFStringCreateWithPascalString( + CFAllocatorRef alloc, + ConstStr255Param pStr, + int encoding, + ) { + return _CFStringCreateWithPascalString( + alloc, + pStr, + encoding, + ); + } + + late final _CFStringCreateWithPascalStringPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, ConstStr255Param, + CFStringEncoding)>>('CFStringCreateWithPascalString'); + late final _CFStringCreateWithPascalString = + _CFStringCreateWithPascalStringPtr.asFunction< + CFStringRef Function(CFAllocatorRef, ConstStr255Param, int)>(); + + CFStringRef CFStringCreateWithCString( + CFAllocatorRef alloc, + ffi.Pointer cStr, + int encoding, + ) { + return _CFStringCreateWithCString( + alloc, + cStr, + encoding, + ); + } + + late final _CFStringCreateWithCStringPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, ffi.Pointer, + CFStringEncoding)>>('CFStringCreateWithCString'); + late final _CFStringCreateWithCString = + _CFStringCreateWithCStringPtr.asFunction< + CFStringRef Function(CFAllocatorRef, ffi.Pointer, int)>(); + + CFStringRef CFStringCreateWithBytes( + CFAllocatorRef alloc, + ffi.Pointer bytes, + int numBytes, + int encoding, + int isExternalRepresentation, + ) { + return _CFStringCreateWithBytes( + alloc, + bytes, + numBytes, + encoding, + isExternalRepresentation, + ); + } + + late final _CFStringCreateWithBytesPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, ffi.Pointer, CFIndex, + CFStringEncoding, Boolean)>>('CFStringCreateWithBytes'); + late final _CFStringCreateWithBytes = _CFStringCreateWithBytesPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, ffi.Pointer, int, int, int)>(); + + CFStringRef CFStringCreateWithCharacters( + CFAllocatorRef alloc, + ffi.Pointer chars, + int numChars, + ) { + return _CFStringCreateWithCharacters( + alloc, + chars, + numChars, + ); + } + + late final _CFStringCreateWithCharactersPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, ffi.Pointer, + CFIndex)>>('CFStringCreateWithCharacters'); + late final _CFStringCreateWithCharacters = + _CFStringCreateWithCharactersPtr.asFunction< + CFStringRef Function(CFAllocatorRef, ffi.Pointer, int)>(); + + CFStringRef CFStringCreateWithPascalStringNoCopy( + CFAllocatorRef alloc, + ConstStr255Param pStr, + int encoding, + CFAllocatorRef contentsDeallocator, + ) { + return _CFStringCreateWithPascalStringNoCopy( + alloc, + pStr, + encoding, + contentsDeallocator, + ); + } + + late final _CFStringCreateWithPascalStringNoCopyPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function( + CFAllocatorRef, + ConstStr255Param, + CFStringEncoding, + CFAllocatorRef)>>('CFStringCreateWithPascalStringNoCopy'); + late final _CFStringCreateWithPascalStringNoCopy = + _CFStringCreateWithPascalStringNoCopyPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, ConstStr255Param, int, CFAllocatorRef)>(); + + CFStringRef CFStringCreateWithCStringNoCopy( + CFAllocatorRef alloc, + ffi.Pointer cStr, + int encoding, + CFAllocatorRef contentsDeallocator, + ) { + return _CFStringCreateWithCStringNoCopy( + alloc, + cStr, + encoding, + contentsDeallocator, + ); + } + + late final _CFStringCreateWithCStringNoCopyPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function( + CFAllocatorRef, + ffi.Pointer, + CFStringEncoding, + CFAllocatorRef)>>('CFStringCreateWithCStringNoCopy'); + late final _CFStringCreateWithCStringNoCopy = + _CFStringCreateWithCStringNoCopyPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, ffi.Pointer, int, CFAllocatorRef)>(); + + CFStringRef CFStringCreateWithBytesNoCopy( + CFAllocatorRef alloc, + ffi.Pointer bytes, + int numBytes, + int encoding, + int isExternalRepresentation, + CFAllocatorRef contentsDeallocator, + ) { + return _CFStringCreateWithBytesNoCopy( + alloc, + bytes, + numBytes, + encoding, + isExternalRepresentation, + contentsDeallocator, + ); + } + + late final _CFStringCreateWithBytesNoCopyPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function( + CFAllocatorRef, + ffi.Pointer, + CFIndex, + CFStringEncoding, + Boolean, + CFAllocatorRef)>>('CFStringCreateWithBytesNoCopy'); + late final _CFStringCreateWithBytesNoCopy = + _CFStringCreateWithBytesNoCopyPtr.asFunction< + CFStringRef Function(CFAllocatorRef, ffi.Pointer, int, int, + int, CFAllocatorRef)>(); + + CFStringRef CFStringCreateWithCharactersNoCopy( + CFAllocatorRef alloc, + ffi.Pointer chars, + int numChars, + CFAllocatorRef contentsDeallocator, + ) { + return _CFStringCreateWithCharactersNoCopy( + alloc, + chars, + numChars, + contentsDeallocator, + ); + } + + late final _CFStringCreateWithCharactersNoCopyPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, ffi.Pointer, CFIndex, + CFAllocatorRef)>>('CFStringCreateWithCharactersNoCopy'); + late final _CFStringCreateWithCharactersNoCopy = + _CFStringCreateWithCharactersNoCopyPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, ffi.Pointer, int, CFAllocatorRef)>(); + + CFStringRef CFStringCreateWithSubstring( + CFAllocatorRef alloc, + CFStringRef str, + CFRange range, + ) { + return _CFStringCreateWithSubstring( + alloc, + str, + range, + ); + } + + late final _CFStringCreateWithSubstringPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef, + CFRange)>>('CFStringCreateWithSubstring'); + late final _CFStringCreateWithSubstring = _CFStringCreateWithSubstringPtr + .asFunction(); + + CFStringRef CFStringCreateCopy( + CFAllocatorRef alloc, + CFStringRef theString, + ) { + return _CFStringCreateCopy( + alloc, + theString, + ); + } + + late final _CFStringCreateCopyPtr = _lookup< + ffi + .NativeFunction>( + 'CFStringCreateCopy'); + late final _CFStringCreateCopy = _CFStringCreateCopyPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef)>(); + + CFStringRef CFStringCreateWithFormat( + CFAllocatorRef alloc, + CFDictionaryRef formatOptions, + CFStringRef format, + ) { + return _CFStringCreateWithFormat( + alloc, + formatOptions, + format, + ); + } + + late final _CFStringCreateWithFormatPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFDictionaryRef, + CFStringRef)>>('CFStringCreateWithFormat'); + late final _CFStringCreateWithFormat = + _CFStringCreateWithFormatPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFDictionaryRef, CFStringRef)>(); + + CFStringRef CFStringCreateWithFormatAndArguments( + CFAllocatorRef alloc, + CFDictionaryRef formatOptions, + CFStringRef format, + va_list arguments, + ) { + return _CFStringCreateWithFormatAndArguments( + alloc, + formatOptions, + format, + arguments, + ); + } + + late final _CFStringCreateWithFormatAndArgumentsPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFDictionaryRef, CFStringRef, + va_list)>>('CFStringCreateWithFormatAndArguments'); + late final _CFStringCreateWithFormatAndArguments = + _CFStringCreateWithFormatAndArgumentsPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, CFDictionaryRef, CFStringRef, va_list)>(); + + CFStringRef CFStringCreateStringWithValidatedFormat( + CFAllocatorRef alloc, + CFDictionaryRef formatOptions, + CFStringRef validFormatSpecifiers, + CFStringRef format, + ffi.Pointer errorPtr, + ) { + return _CFStringCreateStringWithValidatedFormat( + alloc, + formatOptions, + validFormatSpecifiers, + format, + errorPtr, + ); + } + + late final _CFStringCreateStringWithValidatedFormatPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFDictionaryRef, CFStringRef, + CFStringRef, ffi.Pointer)>>( + 'CFStringCreateStringWithValidatedFormat'); + late final _CFStringCreateStringWithValidatedFormat = + _CFStringCreateStringWithValidatedFormatPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFDictionaryRef, CFStringRef, + CFStringRef, ffi.Pointer)>(); + + CFStringRef CFStringCreateStringWithValidatedFormatAndArguments( + CFAllocatorRef alloc, + CFDictionaryRef formatOptions, + CFStringRef validFormatSpecifiers, + CFStringRef format, + va_list arguments, + ffi.Pointer errorPtr, + ) { + return _CFStringCreateStringWithValidatedFormatAndArguments( + alloc, + formatOptions, + validFormatSpecifiers, + format, + arguments, + errorPtr, + ); + } + + late final _CFStringCreateStringWithValidatedFormatAndArgumentsPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFDictionaryRef, CFStringRef, + CFStringRef, va_list, ffi.Pointer)>>( + 'CFStringCreateStringWithValidatedFormatAndArguments'); + late final _CFStringCreateStringWithValidatedFormatAndArguments = + _CFStringCreateStringWithValidatedFormatAndArgumentsPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFDictionaryRef, CFStringRef, + CFStringRef, va_list, ffi.Pointer)>(); + + CFMutableStringRef CFStringCreateMutable( + CFAllocatorRef alloc, + int maxLength, + ) { + return _CFStringCreateMutable( + alloc, + maxLength, + ); + } + + late final _CFStringCreateMutablePtr = _lookup< + ffi.NativeFunction< + CFMutableStringRef Function( + CFAllocatorRef, CFIndex)>>('CFStringCreateMutable'); + late final _CFStringCreateMutable = _CFStringCreateMutablePtr.asFunction< + CFMutableStringRef Function(CFAllocatorRef, int)>(); + + CFMutableStringRef CFStringCreateMutableCopy( + CFAllocatorRef alloc, + int maxLength, + CFStringRef theString, + ) { + return _CFStringCreateMutableCopy( + alloc, + maxLength, + theString, + ); + } + + late final _CFStringCreateMutableCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableStringRef Function(CFAllocatorRef, CFIndex, + CFStringRef)>>('CFStringCreateMutableCopy'); + late final _CFStringCreateMutableCopy = + _CFStringCreateMutableCopyPtr.asFunction< + CFMutableStringRef Function(CFAllocatorRef, int, CFStringRef)>(); + + CFMutableStringRef CFStringCreateMutableWithExternalCharactersNoCopy( + CFAllocatorRef alloc, + ffi.Pointer chars, + int numChars, + int capacity, + CFAllocatorRef externalCharactersAllocator, + ) { + return _CFStringCreateMutableWithExternalCharactersNoCopy( + alloc, + chars, + numChars, + capacity, + externalCharactersAllocator, + ); + } + + late final _CFStringCreateMutableWithExternalCharactersNoCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableStringRef Function(CFAllocatorRef, ffi.Pointer, + CFIndex, CFIndex, CFAllocatorRef)>>( + 'CFStringCreateMutableWithExternalCharactersNoCopy'); + late final _CFStringCreateMutableWithExternalCharactersNoCopy = + _CFStringCreateMutableWithExternalCharactersNoCopyPtr.asFunction< + CFMutableStringRef Function(CFAllocatorRef, ffi.Pointer, int, + int, CFAllocatorRef)>(); + + int CFStringGetLength( + CFStringRef theString, + ) { + return _CFStringGetLength( + theString, + ); + } + + late final _CFStringGetLengthPtr = + _lookup>( + 'CFStringGetLength'); + late final _CFStringGetLength = + _CFStringGetLengthPtr.asFunction(); + + int CFStringGetCharacterAtIndex( + CFStringRef theString, + int idx, + ) { + return _CFStringGetCharacterAtIndex( + theString, + idx, + ); + } + + late final _CFStringGetCharacterAtIndexPtr = + _lookup>( + 'CFStringGetCharacterAtIndex'); + late final _CFStringGetCharacterAtIndex = _CFStringGetCharacterAtIndexPtr + .asFunction(); + + void CFStringGetCharacters( + CFStringRef theString, + CFRange range, + ffi.Pointer buffer, + ) { + return _CFStringGetCharacters( + theString, + range, + buffer, + ); + } + + late final _CFStringGetCharactersPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFStringRef, CFRange, + ffi.Pointer)>>('CFStringGetCharacters'); + late final _CFStringGetCharacters = _CFStringGetCharactersPtr.asFunction< + void Function(CFStringRef, CFRange, ffi.Pointer)>(); + + int CFStringGetPascalString( + CFStringRef theString, + StringPtr buffer, + int bufferSize, + int encoding, + ) { + return _CFStringGetPascalString( + theString, + buffer, + bufferSize, + encoding, + ); + } + + late final _CFStringGetPascalStringPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFStringRef, StringPtr, CFIndex, + CFStringEncoding)>>('CFStringGetPascalString'); + late final _CFStringGetPascalString = _CFStringGetPascalStringPtr.asFunction< + int Function(CFStringRef, StringPtr, int, int)>(); + + int CFStringGetCString( + CFStringRef theString, + ffi.Pointer buffer, + int bufferSize, + int encoding, + ) { + return _CFStringGetCString( + theString, + buffer, + bufferSize, + encoding, + ); + } + + late final _CFStringGetCStringPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFStringRef, ffi.Pointer, CFIndex, + CFStringEncoding)>>('CFStringGetCString'); + late final _CFStringGetCString = _CFStringGetCStringPtr.asFunction< + int Function(CFStringRef, ffi.Pointer, int, int)>(); + + ConstStringPtr CFStringGetPascalStringPtr( + CFStringRef theString, + int encoding, + ) { + return _CFStringGetPascalStringPtr1( + theString, + encoding, + ); + } + + late final _CFStringGetPascalStringPtrPtr = _lookup< + ffi.NativeFunction< + ConstStringPtr Function( + CFStringRef, CFStringEncoding)>>('CFStringGetPascalStringPtr'); + late final _CFStringGetPascalStringPtr1 = _CFStringGetPascalStringPtrPtr + .asFunction(); + + ffi.Pointer CFStringGetCStringPtr( + CFStringRef theString, + int encoding, + ) { + return _CFStringGetCStringPtr1( + theString, + encoding, + ); + } + + late final _CFStringGetCStringPtrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CFStringRef, CFStringEncoding)>>('CFStringGetCStringPtr'); + late final _CFStringGetCStringPtr1 = _CFStringGetCStringPtrPtr.asFunction< + ffi.Pointer Function(CFStringRef, int)>(); + + ffi.Pointer CFStringGetCharactersPtr( + CFStringRef theString, + ) { + return _CFStringGetCharactersPtr1( + theString, + ); + } + + late final _CFStringGetCharactersPtrPtr = + _lookup Function(CFStringRef)>>( + 'CFStringGetCharactersPtr'); + late final _CFStringGetCharactersPtr1 = _CFStringGetCharactersPtrPtr + .asFunction Function(CFStringRef)>(); + + int CFStringGetBytes( + CFStringRef theString, + CFRange range, + int encoding, + int lossByte, + int isExternalRepresentation, + ffi.Pointer buffer, + int maxBufLen, + ffi.Pointer usedBufLen, + ) { + return _CFStringGetBytes( + theString, + range, + encoding, + lossByte, + isExternalRepresentation, + buffer, + maxBufLen, + usedBufLen, + ); + } + + late final _CFStringGetBytesPtr = _lookup< + ffi.NativeFunction< + CFIndex Function( + CFStringRef, + CFRange, + CFStringEncoding, + UInt8, + Boolean, + ffi.Pointer, + CFIndex, + ffi.Pointer)>>('CFStringGetBytes'); + late final _CFStringGetBytes = _CFStringGetBytesPtr.asFunction< + int Function(CFStringRef, CFRange, int, int, int, ffi.Pointer, int, + ffi.Pointer)>(); + + CFStringRef CFStringCreateFromExternalRepresentation( + CFAllocatorRef alloc, + CFDataRef data, + int encoding, + ) { + return _CFStringCreateFromExternalRepresentation( + alloc, + data, + encoding, + ); + } + + late final _CFStringCreateFromExternalRepresentationPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFDataRef, + CFStringEncoding)>>('CFStringCreateFromExternalRepresentation'); + late final _CFStringCreateFromExternalRepresentation = + _CFStringCreateFromExternalRepresentationPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFDataRef, int)>(); + + CFDataRef CFStringCreateExternalRepresentation( + CFAllocatorRef alloc, + CFStringRef theString, + int encoding, + int lossByte, + ) { + return _CFStringCreateExternalRepresentation( + alloc, + theString, + encoding, + lossByte, + ); + } + + late final _CFStringCreateExternalRepresentationPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(CFAllocatorRef, CFStringRef, CFStringEncoding, + UInt8)>>('CFStringCreateExternalRepresentation'); + late final _CFStringCreateExternalRepresentation = + _CFStringCreateExternalRepresentationPtr.asFunction< + CFDataRef Function(CFAllocatorRef, CFStringRef, int, int)>(); + + int CFStringGetSmallestEncoding( + CFStringRef theString, + ) { + return _CFStringGetSmallestEncoding( + theString, + ); + } + + late final _CFStringGetSmallestEncodingPtr = + _lookup>( + 'CFStringGetSmallestEncoding'); + late final _CFStringGetSmallestEncoding = + _CFStringGetSmallestEncodingPtr.asFunction(); + + int CFStringGetFastestEncoding( + CFStringRef theString, + ) { + return _CFStringGetFastestEncoding( + theString, + ); + } + + late final _CFStringGetFastestEncodingPtr = + _lookup>( + 'CFStringGetFastestEncoding'); + late final _CFStringGetFastestEncoding = + _CFStringGetFastestEncodingPtr.asFunction(); + + int CFStringGetSystemEncoding() { + return _CFStringGetSystemEncoding(); + } + + late final _CFStringGetSystemEncodingPtr = + _lookup>( + 'CFStringGetSystemEncoding'); + late final _CFStringGetSystemEncoding = + _CFStringGetSystemEncodingPtr.asFunction(); + + int CFStringGetMaximumSizeForEncoding( + int length, + int encoding, + ) { + return _CFStringGetMaximumSizeForEncoding( + length, + encoding, + ); + } + + late final _CFStringGetMaximumSizeForEncodingPtr = + _lookup>( + 'CFStringGetMaximumSizeForEncoding'); + late final _CFStringGetMaximumSizeForEncoding = + _CFStringGetMaximumSizeForEncodingPtr.asFunction< + int Function(int, int)>(); + + int CFStringGetFileSystemRepresentation( + CFStringRef string, + ffi.Pointer buffer, + int maxBufLen, + ) { + return _CFStringGetFileSystemRepresentation( + string, + buffer, + maxBufLen, + ); + } + + late final _CFStringGetFileSystemRepresentationPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFStringRef, ffi.Pointer, + CFIndex)>>('CFStringGetFileSystemRepresentation'); + late final _CFStringGetFileSystemRepresentation = + _CFStringGetFileSystemRepresentationPtr.asFunction< + int Function(CFStringRef, ffi.Pointer, int)>(); + + int CFStringGetMaximumSizeOfFileSystemRepresentation( + CFStringRef string, + ) { + return _CFStringGetMaximumSizeOfFileSystemRepresentation( + string, + ); + } + + late final _CFStringGetMaximumSizeOfFileSystemRepresentationPtr = + _lookup>( + 'CFStringGetMaximumSizeOfFileSystemRepresentation'); + late final _CFStringGetMaximumSizeOfFileSystemRepresentation = + _CFStringGetMaximumSizeOfFileSystemRepresentationPtr.asFunction< + int Function(CFStringRef)>(); + + CFStringRef CFStringCreateWithFileSystemRepresentation( + CFAllocatorRef alloc, + ffi.Pointer buffer, + ) { + return _CFStringCreateWithFileSystemRepresentation( + alloc, + buffer, + ); + } + + late final _CFStringCreateWithFileSystemRepresentationPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, ffi.Pointer)>>( + 'CFStringCreateWithFileSystemRepresentation'); + late final _CFStringCreateWithFileSystemRepresentation = + _CFStringCreateWithFileSystemRepresentationPtr.asFunction< + CFStringRef Function(CFAllocatorRef, ffi.Pointer)>(); + + CFComparisonResult CFStringCompareWithOptionsAndLocale( + CFStringRef theString1, + CFStringRef theString2, + CFRange rangeToCompare, + CFStringCompareFlags compareOptions, + CFLocaleRef locale, + ) { + return CFComparisonResult.fromValue(_CFStringCompareWithOptionsAndLocale( + theString1, + theString2, + rangeToCompare, + compareOptions.value, + locale, + )); + } + + late final _CFStringCompareWithOptionsAndLocalePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFStringRef, CFStringRef, CFRange, CFOptionFlags, + CFLocaleRef)>>('CFStringCompareWithOptionsAndLocale'); + late final _CFStringCompareWithOptionsAndLocale = + _CFStringCompareWithOptionsAndLocalePtr.asFunction< + int Function(CFStringRef, CFStringRef, CFRange, int, CFLocaleRef)>(); + + CFComparisonResult CFStringCompareWithOptions( + CFStringRef theString1, + CFStringRef theString2, + CFRange rangeToCompare, + CFStringCompareFlags compareOptions, + ) { + return CFComparisonResult.fromValue(_CFStringCompareWithOptions( + theString1, + theString2, + rangeToCompare, + compareOptions.value, + )); + } + + late final _CFStringCompareWithOptionsPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFStringRef, CFStringRef, CFRange, + CFOptionFlags)>>('CFStringCompareWithOptions'); + late final _CFStringCompareWithOptions = _CFStringCompareWithOptionsPtr + .asFunction(); + + CFComparisonResult CFStringCompare( + CFStringRef theString1, + CFStringRef theString2, + CFStringCompareFlags compareOptions, + ) { + return CFComparisonResult.fromValue(_CFStringCompare( + theString1, + theString2, + compareOptions.value, + )); + } + + late final _CFStringComparePtr = _lookup< + ffi.NativeFunction< + CFIndex Function( + CFStringRef, CFStringRef, CFOptionFlags)>>('CFStringCompare'); + late final _CFStringCompare = _CFStringComparePtr.asFunction< + int Function(CFStringRef, CFStringRef, int)>(); + + DartBoolean CFStringFindWithOptionsAndLocale( + CFStringRef theString, + CFStringRef stringToFind, + CFRange rangeToSearch, + CFStringCompareFlags searchOptions, + CFLocaleRef locale, + ffi.Pointer result, + ) { + return _CFStringFindWithOptionsAndLocale( + theString, + stringToFind, + rangeToSearch, + searchOptions.value, + locale, + result, + ); + } + + late final _CFStringFindWithOptionsAndLocalePtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFStringRef, + CFStringRef, + CFRange, + CFOptionFlags, + CFLocaleRef, + ffi.Pointer)>>('CFStringFindWithOptionsAndLocale'); + late final _CFStringFindWithOptionsAndLocale = + _CFStringFindWithOptionsAndLocalePtr.asFunction< + int Function(CFStringRef, CFStringRef, CFRange, int, CFLocaleRef, + ffi.Pointer)>(); + + DartBoolean CFStringFindWithOptions( + CFStringRef theString, + CFStringRef stringToFind, + CFRange rangeToSearch, + CFStringCompareFlags searchOptions, + ffi.Pointer result, + ) { + return _CFStringFindWithOptions( + theString, + stringToFind, + rangeToSearch, + searchOptions.value, + result, + ); + } + + late final _CFStringFindWithOptionsPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFStringRef, CFStringRef, CFRange, CFOptionFlags, + ffi.Pointer)>>('CFStringFindWithOptions'); + late final _CFStringFindWithOptions = _CFStringFindWithOptionsPtr.asFunction< + int Function( + CFStringRef, CFStringRef, CFRange, int, ffi.Pointer)>(); + + CFArrayRef CFStringCreateArrayWithFindResults( + CFAllocatorRef alloc, + CFStringRef theString, + CFStringRef stringToFind, + CFRange rangeToSearch, + CFStringCompareFlags compareOptions, + ) { + return _CFStringCreateArrayWithFindResults( + alloc, + theString, + stringToFind, + rangeToSearch, + compareOptions.value, + ); + } + + late final _CFStringCreateArrayWithFindResultsPtr = _lookup< + ffi.NativeFunction< + CFArrayRef Function(CFAllocatorRef, CFStringRef, CFStringRef, CFRange, + CFOptionFlags)>>('CFStringCreateArrayWithFindResults'); + late final _CFStringCreateArrayWithFindResults = + _CFStringCreateArrayWithFindResultsPtr.asFunction< + CFArrayRef Function( + CFAllocatorRef, CFStringRef, CFStringRef, CFRange, int)>(); + + CFRange CFStringFind( + CFStringRef theString, + CFStringRef stringToFind, + CFStringCompareFlags compareOptions, + ) { + return _CFStringFind( + theString, + stringToFind, + compareOptions.value, + ); + } + + late final _CFStringFindPtr = _lookup< + ffi.NativeFunction< + CFRange Function( + CFStringRef, CFStringRef, CFOptionFlags)>>('CFStringFind'); + late final _CFStringFind = _CFStringFindPtr.asFunction< + CFRange Function(CFStringRef, CFStringRef, int)>(); + + int CFStringHasPrefix( + CFStringRef theString, + CFStringRef prefix, + ) { + return _CFStringHasPrefix( + theString, + prefix, + ); + } + + late final _CFStringHasPrefixPtr = + _lookup>( + 'CFStringHasPrefix'); + late final _CFStringHasPrefix = _CFStringHasPrefixPtr.asFunction< + int Function(CFStringRef, CFStringRef)>(); + + int CFStringHasSuffix( + CFStringRef theString, + CFStringRef suffix, + ) { + return _CFStringHasSuffix( + theString, + suffix, + ); + } + + late final _CFStringHasSuffixPtr = + _lookup>( + 'CFStringHasSuffix'); + late final _CFStringHasSuffix = _CFStringHasSuffixPtr.asFunction< + int Function(CFStringRef, CFStringRef)>(); + + CFRange CFStringGetRangeOfComposedCharactersAtIndex( + CFStringRef theString, + int theIndex, + ) { + return _CFStringGetRangeOfComposedCharactersAtIndex( + theString, + theIndex, + ); + } + + late final _CFStringGetRangeOfComposedCharactersAtIndexPtr = + _lookup>( + 'CFStringGetRangeOfComposedCharactersAtIndex'); + late final _CFStringGetRangeOfComposedCharactersAtIndex = + _CFStringGetRangeOfComposedCharactersAtIndexPtr.asFunction< + CFRange Function(CFStringRef, int)>(); + + DartBoolean CFStringFindCharacterFromSet( + CFStringRef theString, + CFCharacterSetRef theSet, + CFRange rangeToSearch, + CFStringCompareFlags searchOptions, + ffi.Pointer result, + ) { + return _CFStringFindCharacterFromSet( + theString, + theSet, + rangeToSearch, + searchOptions.value, + result, + ); + } + + late final _CFStringFindCharacterFromSetPtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFStringRef, + CFCharacterSetRef, + CFRange, + CFOptionFlags, + ffi.Pointer)>>('CFStringFindCharacterFromSet'); + late final _CFStringFindCharacterFromSet = + _CFStringFindCharacterFromSetPtr.asFunction< + int Function(CFStringRef, CFCharacterSetRef, CFRange, int, + ffi.Pointer)>(); + + void CFStringGetLineBounds( + CFStringRef theString, + CFRange range, + ffi.Pointer lineBeginIndex, + ffi.Pointer lineEndIndex, + ffi.Pointer contentsEndIndex, + ) { + return _CFStringGetLineBounds( + theString, + range, + lineBeginIndex, + lineEndIndex, + contentsEndIndex, + ); + } + + late final _CFStringGetLineBoundsPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFStringRef, + CFRange, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('CFStringGetLineBounds'); + late final _CFStringGetLineBounds = _CFStringGetLineBoundsPtr.asFunction< + void Function(CFStringRef, CFRange, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + void CFStringGetParagraphBounds( + CFStringRef string, + CFRange range, + ffi.Pointer parBeginIndex, + ffi.Pointer parEndIndex, + ffi.Pointer contentsEndIndex, + ) { + return _CFStringGetParagraphBounds( + string, + range, + parBeginIndex, + parEndIndex, + contentsEndIndex, + ); + } + + late final _CFStringGetParagraphBoundsPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFStringRef, + CFRange, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('CFStringGetParagraphBounds'); + late final _CFStringGetParagraphBounds = + _CFStringGetParagraphBoundsPtr.asFunction< + void Function(CFStringRef, CFRange, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + int CFStringGetHyphenationLocationBeforeIndex( + CFStringRef string, + int location, + CFRange limitRange, + int options, + CFLocaleRef locale, + ffi.Pointer character, + ) { + return _CFStringGetHyphenationLocationBeforeIndex( + string, + location, + limitRange, + options, + locale, + character, + ); + } + + late final _CFStringGetHyphenationLocationBeforeIndexPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFStringRef, CFIndex, CFRange, CFOptionFlags, + CFLocaleRef, ffi.Pointer)>>( + 'CFStringGetHyphenationLocationBeforeIndex'); + late final _CFStringGetHyphenationLocationBeforeIndex = + _CFStringGetHyphenationLocationBeforeIndexPtr.asFunction< + int Function(CFStringRef, int, CFRange, int, CFLocaleRef, + ffi.Pointer)>(); + + int CFStringIsHyphenationAvailableForLocale( + CFLocaleRef locale, + ) { + return _CFStringIsHyphenationAvailableForLocale( + locale, + ); + } + + late final _CFStringIsHyphenationAvailableForLocalePtr = + _lookup>( + 'CFStringIsHyphenationAvailableForLocale'); + late final _CFStringIsHyphenationAvailableForLocale = + _CFStringIsHyphenationAvailableForLocalePtr.asFunction< + int Function(CFLocaleRef)>(); + + CFStringRef CFStringCreateByCombiningStrings( + CFAllocatorRef alloc, + CFArrayRef theArray, + CFStringRef separatorString, + ) { + return _CFStringCreateByCombiningStrings( + alloc, + theArray, + separatorString, + ); + } + + late final _CFStringCreateByCombiningStringsPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFArrayRef, + CFStringRef)>>('CFStringCreateByCombiningStrings'); + late final _CFStringCreateByCombiningStrings = + _CFStringCreateByCombiningStringsPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFArrayRef, CFStringRef)>(); + + CFArrayRef CFStringCreateArrayBySeparatingStrings( + CFAllocatorRef alloc, + CFStringRef theString, + CFStringRef separatorString, + ) { + return _CFStringCreateArrayBySeparatingStrings( + alloc, + theString, + separatorString, + ); + } + + late final _CFStringCreateArrayBySeparatingStringsPtr = _lookup< + ffi.NativeFunction< + CFArrayRef Function(CFAllocatorRef, CFStringRef, + CFStringRef)>>('CFStringCreateArrayBySeparatingStrings'); + late final _CFStringCreateArrayBySeparatingStrings = + _CFStringCreateArrayBySeparatingStringsPtr.asFunction< + CFArrayRef Function(CFAllocatorRef, CFStringRef, CFStringRef)>(); + + int CFStringGetIntValue( + CFStringRef str, + ) { + return _CFStringGetIntValue( + str, + ); + } + + late final _CFStringGetIntValuePtr = + _lookup>( + 'CFStringGetIntValue'); + late final _CFStringGetIntValue = + _CFStringGetIntValuePtr.asFunction(); + + double CFStringGetDoubleValue( + CFStringRef str, + ) { + return _CFStringGetDoubleValue( + str, + ); + } + + late final _CFStringGetDoubleValuePtr = + _lookup>( + 'CFStringGetDoubleValue'); + late final _CFStringGetDoubleValue = + _CFStringGetDoubleValuePtr.asFunction(); + + void CFStringAppend( + CFMutableStringRef theString, + CFStringRef appendedString, + ) { + return _CFStringAppend( + theString, + appendedString, + ); + } + + late final _CFStringAppendPtr = _lookup< + ffi + .NativeFunction>( + 'CFStringAppend'); + late final _CFStringAppend = _CFStringAppendPtr.asFunction< + void Function(CFMutableStringRef, CFStringRef)>(); + + void CFStringAppendCharacters( + CFMutableStringRef theString, + ffi.Pointer chars, + int numChars, + ) { + return _CFStringAppendCharacters( + theString, + chars, + numChars, + ); + } + + late final _CFStringAppendCharactersPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableStringRef, ffi.Pointer, + CFIndex)>>('CFStringAppendCharacters'); + late final _CFStringAppendCharacters = + _CFStringAppendCharactersPtr.asFunction< + void Function(CFMutableStringRef, ffi.Pointer, int)>(); + + void CFStringAppendPascalString( + CFMutableStringRef theString, + ConstStr255Param pStr, + int encoding, + ) { + return _CFStringAppendPascalString( + theString, + pStr, + encoding, + ); + } + + late final _CFStringAppendPascalStringPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableStringRef, ConstStr255Param, + CFStringEncoding)>>('CFStringAppendPascalString'); + late final _CFStringAppendPascalString = _CFStringAppendPascalStringPtr + .asFunction(); + + void CFStringAppendCString( + CFMutableStringRef theString, + ffi.Pointer cStr, + int encoding, + ) { + return _CFStringAppendCString( + theString, + cStr, + encoding, + ); + } + + late final _CFStringAppendCStringPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableStringRef, ffi.Pointer, + CFStringEncoding)>>('CFStringAppendCString'); + late final _CFStringAppendCString = _CFStringAppendCStringPtr.asFunction< + void Function(CFMutableStringRef, ffi.Pointer, int)>(); + + void CFStringAppendFormat( + CFMutableStringRef theString, + CFDictionaryRef formatOptions, + CFStringRef format, + ) { + return _CFStringAppendFormat( + theString, + formatOptions, + format, + ); + } + + late final _CFStringAppendFormatPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableStringRef, CFDictionaryRef, + CFStringRef)>>('CFStringAppendFormat'); + late final _CFStringAppendFormat = _CFStringAppendFormatPtr.asFunction< + void Function(CFMutableStringRef, CFDictionaryRef, CFStringRef)>(); + + void CFStringAppendFormatAndArguments( + CFMutableStringRef theString, + CFDictionaryRef formatOptions, + CFStringRef format, + va_list arguments, + ) { + return _CFStringAppendFormatAndArguments( + theString, + formatOptions, + format, + arguments, + ); + } + + late final _CFStringAppendFormatAndArgumentsPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableStringRef, CFDictionaryRef, CFStringRef, + va_list)>>('CFStringAppendFormatAndArguments'); + late final _CFStringAppendFormatAndArguments = + _CFStringAppendFormatAndArgumentsPtr.asFunction< + void Function( + CFMutableStringRef, CFDictionaryRef, CFStringRef, va_list)>(); + + void CFStringInsert( + CFMutableStringRef str, + int idx, + CFStringRef insertedStr, + ) { + return _CFStringInsert( + str, + idx, + insertedStr, + ); + } + + late final _CFStringInsertPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableStringRef, CFIndex, CFStringRef)>>('CFStringInsert'); + late final _CFStringInsert = _CFStringInsertPtr.asFunction< + void Function(CFMutableStringRef, int, CFStringRef)>(); + + void CFStringDelete( + CFMutableStringRef theString, + CFRange range, + ) { + return _CFStringDelete( + theString, + range, + ); + } + + late final _CFStringDeletePtr = _lookup< + ffi.NativeFunction>( + 'CFStringDelete'); + late final _CFStringDelete = _CFStringDeletePtr.asFunction< + void Function(CFMutableStringRef, CFRange)>(); + + void CFStringReplace( + CFMutableStringRef theString, + CFRange range, + CFStringRef replacement, + ) { + return _CFStringReplace( + theString, + range, + replacement, + ); + } + + late final _CFStringReplacePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableStringRef, CFRange, CFStringRef)>>('CFStringReplace'); + late final _CFStringReplace = _CFStringReplacePtr.asFunction< + void Function(CFMutableStringRef, CFRange, CFStringRef)>(); + + void CFStringReplaceAll( + CFMutableStringRef theString, + CFStringRef replacement, + ) { + return _CFStringReplaceAll( + theString, + replacement, + ); + } + + late final _CFStringReplaceAllPtr = _lookup< + ffi + .NativeFunction>( + 'CFStringReplaceAll'); + late final _CFStringReplaceAll = _CFStringReplaceAllPtr.asFunction< + void Function(CFMutableStringRef, CFStringRef)>(); + + DartCFIndex CFStringFindAndReplace( + CFMutableStringRef theString, + CFStringRef stringToFind, + CFStringRef replacementString, + CFRange rangeToSearch, + CFStringCompareFlags compareOptions, + ) { + return _CFStringFindAndReplace( + theString, + stringToFind, + replacementString, + rangeToSearch, + compareOptions.value, + ); + } + + late final _CFStringFindAndReplacePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFMutableStringRef, CFStringRef, CFStringRef, + CFRange, CFOptionFlags)>>('CFStringFindAndReplace'); + late final _CFStringFindAndReplace = _CFStringFindAndReplacePtr.asFunction< + int Function( + CFMutableStringRef, CFStringRef, CFStringRef, CFRange, int)>(); + + void CFStringSetExternalCharactersNoCopy( + CFMutableStringRef theString, + ffi.Pointer chars, + int length, + int capacity, + ) { + return _CFStringSetExternalCharactersNoCopy( + theString, + chars, + length, + capacity, + ); + } + + late final _CFStringSetExternalCharactersNoCopyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableStringRef, ffi.Pointer, CFIndex, + CFIndex)>>('CFStringSetExternalCharactersNoCopy'); + late final _CFStringSetExternalCharactersNoCopy = + _CFStringSetExternalCharactersNoCopyPtr.asFunction< + void Function(CFMutableStringRef, ffi.Pointer, int, int)>(); + + void CFStringPad( + CFMutableStringRef theString, + CFStringRef padString, + int length, + int indexIntoPad, + ) { + return _CFStringPad( + theString, + padString, + length, + indexIntoPad, + ); + } + + late final _CFStringPadPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableStringRef, CFStringRef, CFIndex, + CFIndex)>>('CFStringPad'); + late final _CFStringPad = _CFStringPadPtr.asFunction< + void Function(CFMutableStringRef, CFStringRef, int, int)>(); + + void CFStringTrim( + CFMutableStringRef theString, + CFStringRef trimString, + ) { + return _CFStringTrim( + theString, + trimString, + ); + } + + late final _CFStringTrimPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableStringRef, CFStringRef)>>('CFStringTrim'); + late final _CFStringTrim = _CFStringTrimPtr.asFunction< + void Function(CFMutableStringRef, CFStringRef)>(); + + void CFStringTrimWhitespace( + CFMutableStringRef theString, + ) { + return _CFStringTrimWhitespace( + theString, + ); + } + + late final _CFStringTrimWhitespacePtr = + _lookup>( + 'CFStringTrimWhitespace'); + late final _CFStringTrimWhitespace = _CFStringTrimWhitespacePtr.asFunction< + void Function(CFMutableStringRef)>(); + + void CFStringLowercase( + CFMutableStringRef theString, + CFLocaleRef locale, + ) { + return _CFStringLowercase( + theString, + locale, + ); + } + + late final _CFStringLowercasePtr = _lookup< + ffi + .NativeFunction>( + 'CFStringLowercase'); + late final _CFStringLowercase = _CFStringLowercasePtr.asFunction< + void Function(CFMutableStringRef, CFLocaleRef)>(); + + void CFStringUppercase( + CFMutableStringRef theString, + CFLocaleRef locale, + ) { + return _CFStringUppercase( + theString, + locale, + ); + } + + late final _CFStringUppercasePtr = _lookup< + ffi + .NativeFunction>( + 'CFStringUppercase'); + late final _CFStringUppercase = _CFStringUppercasePtr.asFunction< + void Function(CFMutableStringRef, CFLocaleRef)>(); + + void CFStringCapitalize( + CFMutableStringRef theString, + CFLocaleRef locale, + ) { + return _CFStringCapitalize( + theString, + locale, + ); + } + + late final _CFStringCapitalizePtr = _lookup< + ffi + .NativeFunction>( + 'CFStringCapitalize'); + late final _CFStringCapitalize = _CFStringCapitalizePtr.asFunction< + void Function(CFMutableStringRef, CFLocaleRef)>(); + + void CFStringNormalize( + CFMutableStringRef theString, + CFStringNormalizationForm theForm, + ) { + return _CFStringNormalize( + theString, + theForm.value, + ); + } + + late final _CFStringNormalizePtr = _lookup< + ffi.NativeFunction>( + 'CFStringNormalize'); + late final _CFStringNormalize = _CFStringNormalizePtr.asFunction< + void Function(CFMutableStringRef, int)>(); + + void CFStringFold( + CFMutableStringRef theString, + CFStringCompareFlags theFlags, + CFLocaleRef theLocale, + ) { + return _CFStringFold( + theString, + theFlags.value, + theLocale, + ); + } + + late final _CFStringFoldPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableStringRef, CFOptionFlags, CFLocaleRef)>>('CFStringFold'); + late final _CFStringFold = _CFStringFoldPtr.asFunction< + void Function(CFMutableStringRef, int, CFLocaleRef)>(); + + int CFStringTransform( + CFMutableStringRef string, + ffi.Pointer range, + CFStringRef transform, + int reverse, + ) { + return _CFStringTransform( + string, + range, + transform, + reverse, + ); + } + + late final _CFStringTransformPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFMutableStringRef, ffi.Pointer, + CFStringRef, Boolean)>>('CFStringTransform'); + late final _CFStringTransform = _CFStringTransformPtr.asFunction< + int Function( + CFMutableStringRef, ffi.Pointer, CFStringRef, int)>(); + + late final ffi.Pointer _kCFStringTransformStripCombiningMarks = + _lookup('kCFStringTransformStripCombiningMarks'); + + CFStringRef get kCFStringTransformStripCombiningMarks => + _kCFStringTransformStripCombiningMarks.value; + + late final ffi.Pointer _kCFStringTransformToLatin = + _lookup('kCFStringTransformToLatin'); + + CFStringRef get kCFStringTransformToLatin => _kCFStringTransformToLatin.value; + + late final ffi.Pointer _kCFStringTransformFullwidthHalfwidth = + _lookup('kCFStringTransformFullwidthHalfwidth'); + + CFStringRef get kCFStringTransformFullwidthHalfwidth => + _kCFStringTransformFullwidthHalfwidth.value; + + late final ffi.Pointer _kCFStringTransformLatinKatakana = + _lookup('kCFStringTransformLatinKatakana'); + + CFStringRef get kCFStringTransformLatinKatakana => + _kCFStringTransformLatinKatakana.value; + + late final ffi.Pointer _kCFStringTransformLatinHiragana = + _lookup('kCFStringTransformLatinHiragana'); + + CFStringRef get kCFStringTransformLatinHiragana => + _kCFStringTransformLatinHiragana.value; + + late final ffi.Pointer _kCFStringTransformHiraganaKatakana = + _lookup('kCFStringTransformHiraganaKatakana'); + + CFStringRef get kCFStringTransformHiraganaKatakana => + _kCFStringTransformHiraganaKatakana.value; + + late final ffi.Pointer _kCFStringTransformMandarinLatin = + _lookup('kCFStringTransformMandarinLatin'); + + CFStringRef get kCFStringTransformMandarinLatin => + _kCFStringTransformMandarinLatin.value; + + late final ffi.Pointer _kCFStringTransformLatinHangul = + _lookup('kCFStringTransformLatinHangul'); + + CFStringRef get kCFStringTransformLatinHangul => + _kCFStringTransformLatinHangul.value; + + late final ffi.Pointer _kCFStringTransformLatinArabic = + _lookup('kCFStringTransformLatinArabic'); + + CFStringRef get kCFStringTransformLatinArabic => + _kCFStringTransformLatinArabic.value; + + late final ffi.Pointer _kCFStringTransformLatinHebrew = + _lookup('kCFStringTransformLatinHebrew'); + + CFStringRef get kCFStringTransformLatinHebrew => + _kCFStringTransformLatinHebrew.value; + + late final ffi.Pointer _kCFStringTransformLatinThai = + _lookup('kCFStringTransformLatinThai'); + + CFStringRef get kCFStringTransformLatinThai => + _kCFStringTransformLatinThai.value; + + late final ffi.Pointer _kCFStringTransformLatinCyrillic = + _lookup('kCFStringTransformLatinCyrillic'); + + CFStringRef get kCFStringTransformLatinCyrillic => + _kCFStringTransformLatinCyrillic.value; + + late final ffi.Pointer _kCFStringTransformLatinGreek = + _lookup('kCFStringTransformLatinGreek'); + + CFStringRef get kCFStringTransformLatinGreek => + _kCFStringTransformLatinGreek.value; + + late final ffi.Pointer _kCFStringTransformToXMLHex = + _lookup('kCFStringTransformToXMLHex'); + + CFStringRef get kCFStringTransformToXMLHex => + _kCFStringTransformToXMLHex.value; + + late final ffi.Pointer _kCFStringTransformToUnicodeName = + _lookup('kCFStringTransformToUnicodeName'); + + CFStringRef get kCFStringTransformToUnicodeName => + _kCFStringTransformToUnicodeName.value; + + late final ffi.Pointer _kCFStringTransformStripDiacritics = + _lookup('kCFStringTransformStripDiacritics'); + + CFStringRef get kCFStringTransformStripDiacritics => + _kCFStringTransformStripDiacritics.value; + + int CFStringIsEncodingAvailable( + int encoding, + ) { + return _CFStringIsEncodingAvailable( + encoding, + ); + } + + late final _CFStringIsEncodingAvailablePtr = + _lookup>( + 'CFStringIsEncodingAvailable'); + late final _CFStringIsEncodingAvailable = + _CFStringIsEncodingAvailablePtr.asFunction(); + + ffi.Pointer CFStringGetListOfAvailableEncodings() { + return _CFStringGetListOfAvailableEncodings(); + } + + late final _CFStringGetListOfAvailableEncodingsPtr = + _lookup Function()>>( + 'CFStringGetListOfAvailableEncodings'); + late final _CFStringGetListOfAvailableEncodings = + _CFStringGetListOfAvailableEncodingsPtr.asFunction< + ffi.Pointer Function()>(); + + CFStringRef CFStringGetNameOfEncoding( + int encoding, + ) { + return _CFStringGetNameOfEncoding( + encoding, + ); + } + + late final _CFStringGetNameOfEncodingPtr = + _lookup>( + 'CFStringGetNameOfEncoding'); + late final _CFStringGetNameOfEncoding = + _CFStringGetNameOfEncodingPtr.asFunction(); + + int CFStringConvertEncodingToNSStringEncoding( + int encoding, + ) { + return _CFStringConvertEncodingToNSStringEncoding( + encoding, + ); + } + + late final _CFStringConvertEncodingToNSStringEncodingPtr = + _lookup>( + 'CFStringConvertEncodingToNSStringEncoding'); + late final _CFStringConvertEncodingToNSStringEncoding = + _CFStringConvertEncodingToNSStringEncodingPtr.asFunction< + int Function(int)>(); + + int CFStringConvertNSStringEncodingToEncoding( + int encoding, + ) { + return _CFStringConvertNSStringEncodingToEncoding( + encoding, + ); + } + + late final _CFStringConvertNSStringEncodingToEncodingPtr = + _lookup>( + 'CFStringConvertNSStringEncodingToEncoding'); + late final _CFStringConvertNSStringEncodingToEncoding = + _CFStringConvertNSStringEncodingToEncodingPtr.asFunction< + int Function(int)>(); + + int CFStringConvertEncodingToWindowsCodepage( + int encoding, + ) { + return _CFStringConvertEncodingToWindowsCodepage( + encoding, + ); + } + + late final _CFStringConvertEncodingToWindowsCodepagePtr = + _lookup>( + 'CFStringConvertEncodingToWindowsCodepage'); + late final _CFStringConvertEncodingToWindowsCodepage = + _CFStringConvertEncodingToWindowsCodepagePtr.asFunction< + int Function(int)>(); + + int CFStringConvertWindowsCodepageToEncoding( + int codepage, + ) { + return _CFStringConvertWindowsCodepageToEncoding( + codepage, + ); + } + + late final _CFStringConvertWindowsCodepageToEncodingPtr = + _lookup>( + 'CFStringConvertWindowsCodepageToEncoding'); + late final _CFStringConvertWindowsCodepageToEncoding = + _CFStringConvertWindowsCodepageToEncodingPtr.asFunction< + int Function(int)>(); + + int CFStringConvertIANACharSetNameToEncoding( + CFStringRef theString, + ) { + return _CFStringConvertIANACharSetNameToEncoding( + theString, + ); + } + + late final _CFStringConvertIANACharSetNameToEncodingPtr = + _lookup>( + 'CFStringConvertIANACharSetNameToEncoding'); + late final _CFStringConvertIANACharSetNameToEncoding = + _CFStringConvertIANACharSetNameToEncodingPtr.asFunction< + int Function(CFStringRef)>(); + + CFStringRef CFStringConvertEncodingToIANACharSetName( + int encoding, + ) { + return _CFStringConvertEncodingToIANACharSetName( + encoding, + ); + } + + late final _CFStringConvertEncodingToIANACharSetNamePtr = + _lookup>( + 'CFStringConvertEncodingToIANACharSetName'); + late final _CFStringConvertEncodingToIANACharSetName = + _CFStringConvertEncodingToIANACharSetNamePtr.asFunction< + CFStringRef Function(int)>(); + + int CFStringGetMostCompatibleMacStringEncoding( + int encoding, + ) { + return _CFStringGetMostCompatibleMacStringEncoding( + encoding, + ); + } + + late final _CFStringGetMostCompatibleMacStringEncodingPtr = + _lookup>( + 'CFStringGetMostCompatibleMacStringEncoding'); + late final _CFStringGetMostCompatibleMacStringEncoding = + _CFStringGetMostCompatibleMacStringEncodingPtr.asFunction< + int Function(int)>(); + + void CFShow( + CFTypeRef obj, + ) { + return _CFShow( + obj, + ); + } + + late final _CFShowPtr = + _lookup>('CFShow'); + late final _CFShow = _CFShowPtr.asFunction(); + + void CFShowStr( + CFStringRef str, + ) { + return _CFShowStr( + str, + ); + } + + late final _CFShowStrPtr = + _lookup>('CFShowStr'); + late final _CFShowStr = + _CFShowStrPtr.asFunction(); + + CFStringRef __CFStringMakeConstantString( + ffi.Pointer cStr, + ) { + return ___CFStringMakeConstantString( + cStr, + ); + } + + late final ___CFStringMakeConstantStringPtr = + _lookup)>>( + '__CFStringMakeConstantString'); + late final ___CFStringMakeConstantString = ___CFStringMakeConstantStringPtr + .asFunction)>(); + + int CFTimeZoneGetTypeID() { + return _CFTimeZoneGetTypeID(); + } + + late final _CFTimeZoneGetTypeIDPtr = + _lookup>('CFTimeZoneGetTypeID'); + late final _CFTimeZoneGetTypeID = + _CFTimeZoneGetTypeIDPtr.asFunction(); + + CFTimeZoneRef CFTimeZoneCopySystem() { + return _CFTimeZoneCopySystem(); + } + + late final _CFTimeZoneCopySystemPtr = + _lookup>( + 'CFTimeZoneCopySystem'); + late final _CFTimeZoneCopySystem = + _CFTimeZoneCopySystemPtr.asFunction(); + + void CFTimeZoneResetSystem() { + return _CFTimeZoneResetSystem(); + } + + late final _CFTimeZoneResetSystemPtr = + _lookup>('CFTimeZoneResetSystem'); + late final _CFTimeZoneResetSystem = + _CFTimeZoneResetSystemPtr.asFunction(); + + CFTimeZoneRef CFTimeZoneCopyDefault() { + return _CFTimeZoneCopyDefault(); + } + + late final _CFTimeZoneCopyDefaultPtr = + _lookup>( + 'CFTimeZoneCopyDefault'); + late final _CFTimeZoneCopyDefault = + _CFTimeZoneCopyDefaultPtr.asFunction(); + + void CFTimeZoneSetDefault( + CFTimeZoneRef tz, + ) { + return _CFTimeZoneSetDefault( + tz, + ); + } + + late final _CFTimeZoneSetDefaultPtr = + _lookup>( + 'CFTimeZoneSetDefault'); + late final _CFTimeZoneSetDefault = + _CFTimeZoneSetDefaultPtr.asFunction(); + + CFArrayRef CFTimeZoneCopyKnownNames() { + return _CFTimeZoneCopyKnownNames(); + } + + late final _CFTimeZoneCopyKnownNamesPtr = + _lookup>( + 'CFTimeZoneCopyKnownNames'); + late final _CFTimeZoneCopyKnownNames = + _CFTimeZoneCopyKnownNamesPtr.asFunction(); + + CFDictionaryRef CFTimeZoneCopyAbbreviationDictionary() { + return _CFTimeZoneCopyAbbreviationDictionary(); + } + + late final _CFTimeZoneCopyAbbreviationDictionaryPtr = + _lookup>( + 'CFTimeZoneCopyAbbreviationDictionary'); + late final _CFTimeZoneCopyAbbreviationDictionary = + _CFTimeZoneCopyAbbreviationDictionaryPtr.asFunction< + CFDictionaryRef Function()>(); + + void CFTimeZoneSetAbbreviationDictionary( + CFDictionaryRef dict, + ) { + return _CFTimeZoneSetAbbreviationDictionary( + dict, + ); + } + + late final _CFTimeZoneSetAbbreviationDictionaryPtr = + _lookup>( + 'CFTimeZoneSetAbbreviationDictionary'); + late final _CFTimeZoneSetAbbreviationDictionary = + _CFTimeZoneSetAbbreviationDictionaryPtr.asFunction< + void Function(CFDictionaryRef)>(); + + CFTimeZoneRef CFTimeZoneCreate( + CFAllocatorRef allocator, + CFStringRef name, + CFDataRef data, + ) { + return _CFTimeZoneCreate( + allocator, + name, + data, + ); + } + + late final _CFTimeZoneCreatePtr = _lookup< + ffi.NativeFunction< + CFTimeZoneRef Function( + CFAllocatorRef, CFStringRef, CFDataRef)>>('CFTimeZoneCreate'); + late final _CFTimeZoneCreate = _CFTimeZoneCreatePtr.asFunction< + CFTimeZoneRef Function(CFAllocatorRef, CFStringRef, CFDataRef)>(); + + CFTimeZoneRef CFTimeZoneCreateWithTimeIntervalFromGMT( + CFAllocatorRef allocator, + double ti, + ) { + return _CFTimeZoneCreateWithTimeIntervalFromGMT( + allocator, + ti, + ); + } + + late final _CFTimeZoneCreateWithTimeIntervalFromGMTPtr = _lookup< + ffi.NativeFunction< + CFTimeZoneRef Function(CFAllocatorRef, + CFTimeInterval)>>('CFTimeZoneCreateWithTimeIntervalFromGMT'); + late final _CFTimeZoneCreateWithTimeIntervalFromGMT = + _CFTimeZoneCreateWithTimeIntervalFromGMTPtr.asFunction< + CFTimeZoneRef Function(CFAllocatorRef, double)>(); + + CFTimeZoneRef CFTimeZoneCreateWithName( + CFAllocatorRef allocator, + CFStringRef name, + int tryAbbrev, + ) { + return _CFTimeZoneCreateWithName( + allocator, + name, + tryAbbrev, + ); + } + + late final _CFTimeZoneCreateWithNamePtr = _lookup< + ffi.NativeFunction< + CFTimeZoneRef Function(CFAllocatorRef, CFStringRef, + Boolean)>>('CFTimeZoneCreateWithName'); + late final _CFTimeZoneCreateWithName = _CFTimeZoneCreateWithNamePtr + .asFunction(); + + CFStringRef CFTimeZoneGetName( + CFTimeZoneRef tz, + ) { + return _CFTimeZoneGetName( + tz, + ); + } + + late final _CFTimeZoneGetNamePtr = + _lookup>( + 'CFTimeZoneGetName'); + late final _CFTimeZoneGetName = + _CFTimeZoneGetNamePtr.asFunction(); + + CFDataRef CFTimeZoneGetData( + CFTimeZoneRef tz, + ) { + return _CFTimeZoneGetData( + tz, + ); + } + + late final _CFTimeZoneGetDataPtr = + _lookup>( + 'CFTimeZoneGetData'); + late final _CFTimeZoneGetData = + _CFTimeZoneGetDataPtr.asFunction(); + + double CFTimeZoneGetSecondsFromGMT( + CFTimeZoneRef tz, + double at, + ) { + return _CFTimeZoneGetSecondsFromGMT( + tz, + at, + ); + } + + late final _CFTimeZoneGetSecondsFromGMTPtr = _lookup< + ffi.NativeFunction< + CFTimeInterval Function( + CFTimeZoneRef, CFAbsoluteTime)>>('CFTimeZoneGetSecondsFromGMT'); + late final _CFTimeZoneGetSecondsFromGMT = _CFTimeZoneGetSecondsFromGMTPtr + .asFunction(); + + CFStringRef CFTimeZoneCopyAbbreviation( + CFTimeZoneRef tz, + double at, + ) { + return _CFTimeZoneCopyAbbreviation( + tz, + at, + ); + } + + late final _CFTimeZoneCopyAbbreviationPtr = _lookup< + ffi + .NativeFunction>( + 'CFTimeZoneCopyAbbreviation'); + late final _CFTimeZoneCopyAbbreviation = _CFTimeZoneCopyAbbreviationPtr + .asFunction(); + + int CFTimeZoneIsDaylightSavingTime( + CFTimeZoneRef tz, + double at, + ) { + return _CFTimeZoneIsDaylightSavingTime( + tz, + at, + ); + } + + late final _CFTimeZoneIsDaylightSavingTimePtr = _lookup< + ffi.NativeFunction>( + 'CFTimeZoneIsDaylightSavingTime'); + late final _CFTimeZoneIsDaylightSavingTime = + _CFTimeZoneIsDaylightSavingTimePtr.asFunction< + int Function(CFTimeZoneRef, double)>(); + + double CFTimeZoneGetDaylightSavingTimeOffset( + CFTimeZoneRef tz, + double at, + ) { + return _CFTimeZoneGetDaylightSavingTimeOffset( + tz, + at, + ); + } + + late final _CFTimeZoneGetDaylightSavingTimeOffsetPtr = _lookup< + ffi.NativeFunction< + CFTimeInterval Function(CFTimeZoneRef, + CFAbsoluteTime)>>('CFTimeZoneGetDaylightSavingTimeOffset'); + late final _CFTimeZoneGetDaylightSavingTimeOffset = + _CFTimeZoneGetDaylightSavingTimeOffsetPtr.asFunction< + double Function(CFTimeZoneRef, double)>(); + + double CFTimeZoneGetNextDaylightSavingTimeTransition( + CFTimeZoneRef tz, + double at, + ) { + return _CFTimeZoneGetNextDaylightSavingTimeTransition( + tz, + at, + ); + } + + late final _CFTimeZoneGetNextDaylightSavingTimeTransitionPtr = _lookup< + ffi.NativeFunction< + CFAbsoluteTime Function(CFTimeZoneRef, CFAbsoluteTime)>>( + 'CFTimeZoneGetNextDaylightSavingTimeTransition'); + late final _CFTimeZoneGetNextDaylightSavingTimeTransition = + _CFTimeZoneGetNextDaylightSavingTimeTransitionPtr.asFunction< + double Function(CFTimeZoneRef, double)>(); + + CFStringRef CFTimeZoneCopyLocalizedName( + CFTimeZoneRef tz, + CFTimeZoneNameStyle style, + CFLocaleRef locale, + ) { + return _CFTimeZoneCopyLocalizedName( + tz, + style.value, + locale, + ); + } + + late final _CFTimeZoneCopyLocalizedNamePtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFTimeZoneRef, CFIndex, + CFLocaleRef)>>('CFTimeZoneCopyLocalizedName'); + late final _CFTimeZoneCopyLocalizedName = _CFTimeZoneCopyLocalizedNamePtr + .asFunction(); + + late final ffi.Pointer + _kCFTimeZoneSystemTimeZoneDidChangeNotification = + _lookup( + 'kCFTimeZoneSystemTimeZoneDidChangeNotification'); + + CFNotificationName get kCFTimeZoneSystemTimeZoneDidChangeNotification => + _kCFTimeZoneSystemTimeZoneDidChangeNotification.value; + + int CFCalendarGetTypeID() { + return _CFCalendarGetTypeID(); + } + + late final _CFCalendarGetTypeIDPtr = + _lookup>('CFCalendarGetTypeID'); + late final _CFCalendarGetTypeID = + _CFCalendarGetTypeIDPtr.asFunction(); + + CFCalendarRef CFCalendarCopyCurrent() { + return _CFCalendarCopyCurrent(); + } + + late final _CFCalendarCopyCurrentPtr = + _lookup>( + 'CFCalendarCopyCurrent'); + late final _CFCalendarCopyCurrent = + _CFCalendarCopyCurrentPtr.asFunction(); + + CFCalendarRef CFCalendarCreateWithIdentifier( + CFAllocatorRef allocator, + CFCalendarIdentifier identifier, + ) { + return _CFCalendarCreateWithIdentifier( + allocator, + identifier, + ); + } + + late final _CFCalendarCreateWithIdentifierPtr = _lookup< + ffi.NativeFunction< + CFCalendarRef Function(CFAllocatorRef, + CFCalendarIdentifier)>>('CFCalendarCreateWithIdentifier'); + late final _CFCalendarCreateWithIdentifier = + _CFCalendarCreateWithIdentifierPtr.asFunction< + CFCalendarRef Function(CFAllocatorRef, CFCalendarIdentifier)>(); + + CFCalendarIdentifier CFCalendarGetIdentifier( + CFCalendarRef calendar, + ) { + return _CFCalendarGetIdentifier( + calendar, + ); + } + + late final _CFCalendarGetIdentifierPtr = + _lookup>( + 'CFCalendarGetIdentifier'); + late final _CFCalendarGetIdentifier = _CFCalendarGetIdentifierPtr.asFunction< + CFCalendarIdentifier Function(CFCalendarRef)>(); + + CFLocaleRef CFCalendarCopyLocale( + CFCalendarRef calendar, + ) { + return _CFCalendarCopyLocale( + calendar, + ); + } + + late final _CFCalendarCopyLocalePtr = + _lookup>( + 'CFCalendarCopyLocale'); + late final _CFCalendarCopyLocale = _CFCalendarCopyLocalePtr.asFunction< + CFLocaleRef Function(CFCalendarRef)>(); + + void CFCalendarSetLocale( + CFCalendarRef calendar, + CFLocaleRef locale, + ) { + return _CFCalendarSetLocale( + calendar, + locale, + ); + } + + late final _CFCalendarSetLocalePtr = _lookup< + ffi.NativeFunction>( + 'CFCalendarSetLocale'); + late final _CFCalendarSetLocale = _CFCalendarSetLocalePtr.asFunction< + void Function(CFCalendarRef, CFLocaleRef)>(); + + CFTimeZoneRef CFCalendarCopyTimeZone( + CFCalendarRef calendar, + ) { + return _CFCalendarCopyTimeZone( + calendar, + ); + } + + late final _CFCalendarCopyTimeZonePtr = + _lookup>( + 'CFCalendarCopyTimeZone'); + late final _CFCalendarCopyTimeZone = _CFCalendarCopyTimeZonePtr.asFunction< + CFTimeZoneRef Function(CFCalendarRef)>(); + + void CFCalendarSetTimeZone( + CFCalendarRef calendar, + CFTimeZoneRef tz, + ) { + return _CFCalendarSetTimeZone( + calendar, + tz, + ); + } + + late final _CFCalendarSetTimeZonePtr = _lookup< + ffi.NativeFunction>( + 'CFCalendarSetTimeZone'); + late final _CFCalendarSetTimeZone = _CFCalendarSetTimeZonePtr.asFunction< + void Function(CFCalendarRef, CFTimeZoneRef)>(); + + int CFCalendarGetFirstWeekday( + CFCalendarRef calendar, + ) { + return _CFCalendarGetFirstWeekday( + calendar, + ); + } + + late final _CFCalendarGetFirstWeekdayPtr = + _lookup>( + 'CFCalendarGetFirstWeekday'); + late final _CFCalendarGetFirstWeekday = + _CFCalendarGetFirstWeekdayPtr.asFunction(); + + void CFCalendarSetFirstWeekday( + CFCalendarRef calendar, + int wkdy, + ) { + return _CFCalendarSetFirstWeekday( + calendar, + wkdy, + ); + } + + late final _CFCalendarSetFirstWeekdayPtr = + _lookup>( + 'CFCalendarSetFirstWeekday'); + late final _CFCalendarSetFirstWeekday = _CFCalendarSetFirstWeekdayPtr + .asFunction(); + + int CFCalendarGetMinimumDaysInFirstWeek( + CFCalendarRef calendar, + ) { + return _CFCalendarGetMinimumDaysInFirstWeek( + calendar, + ); + } + + late final _CFCalendarGetMinimumDaysInFirstWeekPtr = + _lookup>( + 'CFCalendarGetMinimumDaysInFirstWeek'); + late final _CFCalendarGetMinimumDaysInFirstWeek = + _CFCalendarGetMinimumDaysInFirstWeekPtr.asFunction< + int Function(CFCalendarRef)>(); + + void CFCalendarSetMinimumDaysInFirstWeek( + CFCalendarRef calendar, + int mwd, + ) { + return _CFCalendarSetMinimumDaysInFirstWeek( + calendar, + mwd, + ); + } + + late final _CFCalendarSetMinimumDaysInFirstWeekPtr = + _lookup>( + 'CFCalendarSetMinimumDaysInFirstWeek'); + late final _CFCalendarSetMinimumDaysInFirstWeek = + _CFCalendarSetMinimumDaysInFirstWeekPtr.asFunction< + void Function(CFCalendarRef, int)>(); + + CFRange CFCalendarGetMinimumRangeOfUnit( + CFCalendarRef calendar, + CFCalendarUnit unit, + ) { + return _CFCalendarGetMinimumRangeOfUnit( + calendar, + unit.value, + ); + } + + late final _CFCalendarGetMinimumRangeOfUnitPtr = _lookup< + ffi.NativeFunction>( + 'CFCalendarGetMinimumRangeOfUnit'); + late final _CFCalendarGetMinimumRangeOfUnit = + _CFCalendarGetMinimumRangeOfUnitPtr.asFunction< + CFRange Function(CFCalendarRef, int)>(); + + CFRange CFCalendarGetMaximumRangeOfUnit( + CFCalendarRef calendar, + CFCalendarUnit unit, + ) { + return _CFCalendarGetMaximumRangeOfUnit( + calendar, + unit.value, + ); + } + + late final _CFCalendarGetMaximumRangeOfUnitPtr = _lookup< + ffi.NativeFunction>( + 'CFCalendarGetMaximumRangeOfUnit'); + late final _CFCalendarGetMaximumRangeOfUnit = + _CFCalendarGetMaximumRangeOfUnitPtr.asFunction< + CFRange Function(CFCalendarRef, int)>(); + + CFRange CFCalendarGetRangeOfUnit( + CFCalendarRef calendar, + CFCalendarUnit smallerUnit, + CFCalendarUnit biggerUnit, + DartCFTimeInterval at, + ) { + return _CFCalendarGetRangeOfUnit( + calendar, + smallerUnit.value, + biggerUnit.value, + at, + ); + } + + late final _CFCalendarGetRangeOfUnitPtr = _lookup< + ffi.NativeFunction< + CFRange Function(CFCalendarRef, CFOptionFlags, CFOptionFlags, + CFAbsoluteTime)>>('CFCalendarGetRangeOfUnit'); + late final _CFCalendarGetRangeOfUnit = _CFCalendarGetRangeOfUnitPtr + .asFunction(); + + DartCFIndex CFCalendarGetOrdinalityOfUnit( + CFCalendarRef calendar, + CFCalendarUnit smallerUnit, + CFCalendarUnit biggerUnit, + DartCFTimeInterval at, + ) { + return _CFCalendarGetOrdinalityOfUnit( + calendar, + smallerUnit.value, + biggerUnit.value, + at, + ); + } + + late final _CFCalendarGetOrdinalityOfUnitPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFCalendarRef, CFOptionFlags, CFOptionFlags, + CFAbsoluteTime)>>('CFCalendarGetOrdinalityOfUnit'); + late final _CFCalendarGetOrdinalityOfUnit = _CFCalendarGetOrdinalityOfUnitPtr + .asFunction(); + + DartBoolean CFCalendarGetTimeRangeOfUnit( + CFCalendarRef calendar, + CFCalendarUnit unit, + DartCFTimeInterval at, + ffi.Pointer startp, + ffi.Pointer tip, + ) { + return _CFCalendarGetTimeRangeOfUnit( + calendar, + unit.value, + at, + startp, + tip, + ); + } + + late final _CFCalendarGetTimeRangeOfUnitPtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFCalendarRef, + CFOptionFlags, + CFAbsoluteTime, + ffi.Pointer, + ffi.Pointer)>>('CFCalendarGetTimeRangeOfUnit'); + late final _CFCalendarGetTimeRangeOfUnit = + _CFCalendarGetTimeRangeOfUnitPtr.asFunction< + int Function(CFCalendarRef, int, double, ffi.Pointer, + ffi.Pointer)>(); + + int CFCalendarComposeAbsoluteTime( + CFCalendarRef calendar, + ffi.Pointer at, + ffi.Pointer componentDesc, + ) { + return _CFCalendarComposeAbsoluteTime( + calendar, + at, + componentDesc, + ); + } + + late final _CFCalendarComposeAbsoluteTimePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFCalendarRef, ffi.Pointer, + ffi.Pointer)>>('CFCalendarComposeAbsoluteTime'); + late final _CFCalendarComposeAbsoluteTime = + _CFCalendarComposeAbsoluteTimePtr.asFunction< + int Function(CFCalendarRef, ffi.Pointer, + ffi.Pointer)>(); + + int CFCalendarDecomposeAbsoluteTime( + CFCalendarRef calendar, + double at, + ffi.Pointer componentDesc, + ) { + return _CFCalendarDecomposeAbsoluteTime( + calendar, + at, + componentDesc, + ); + } + + late final _CFCalendarDecomposeAbsoluteTimePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFCalendarRef, CFAbsoluteTime, + ffi.Pointer)>>('CFCalendarDecomposeAbsoluteTime'); + late final _CFCalendarDecomposeAbsoluteTime = + _CFCalendarDecomposeAbsoluteTimePtr.asFunction< + int Function(CFCalendarRef, double, ffi.Pointer)>(); + + int CFCalendarAddComponents( + CFCalendarRef calendar, + ffi.Pointer at, + int options, + ffi.Pointer componentDesc, + ) { + return _CFCalendarAddComponents( + calendar, + at, + options, + componentDesc, + ); + } + + late final _CFCalendarAddComponentsPtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFCalendarRef, + ffi.Pointer, + CFOptionFlags, + ffi.Pointer)>>('CFCalendarAddComponents'); + late final _CFCalendarAddComponents = _CFCalendarAddComponentsPtr.asFunction< + int Function(CFCalendarRef, ffi.Pointer, int, + ffi.Pointer)>(); + + int CFCalendarGetComponentDifference( + CFCalendarRef calendar, + double startingAT, + double resultAT, + int options, + ffi.Pointer componentDesc, + ) { + return _CFCalendarGetComponentDifference( + calendar, + startingAT, + resultAT, + options, + componentDesc, + ); + } + + late final _CFCalendarGetComponentDifferencePtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFCalendarRef, + CFAbsoluteTime, + CFAbsoluteTime, + CFOptionFlags, + ffi.Pointer)>>('CFCalendarGetComponentDifference'); + late final _CFCalendarGetComponentDifference = + _CFCalendarGetComponentDifferencePtr.asFunction< + int Function( + CFCalendarRef, double, double, int, ffi.Pointer)>(); + + CFStringRef CFDateFormatterCreateDateFormatFromTemplate( + CFAllocatorRef allocator, + CFStringRef tmplate, + int options, + CFLocaleRef locale, + ) { + return _CFDateFormatterCreateDateFormatFromTemplate( + allocator, + tmplate, + options, + locale, + ); + } + + late final _CFDateFormatterCreateDateFormatFromTemplatePtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef, CFOptionFlags, + CFLocaleRef)>>('CFDateFormatterCreateDateFormatFromTemplate'); + late final _CFDateFormatterCreateDateFormatFromTemplate = + _CFDateFormatterCreateDateFormatFromTemplatePtr.asFunction< + CFStringRef Function( + CFAllocatorRef, CFStringRef, int, CFLocaleRef)>(); + + int CFDateFormatterGetTypeID() { + return _CFDateFormatterGetTypeID(); + } + + late final _CFDateFormatterGetTypeIDPtr = + _lookup>( + 'CFDateFormatterGetTypeID'); + late final _CFDateFormatterGetTypeID = + _CFDateFormatterGetTypeIDPtr.asFunction(); + + CFDateFormatterRef CFDateFormatterCreateISO8601Formatter( + CFAllocatorRef allocator, + CFISO8601DateFormatOptions formatOptions, + ) { + return _CFDateFormatterCreateISO8601Formatter( + allocator, + formatOptions.value, + ); + } + + late final _CFDateFormatterCreateISO8601FormatterPtr = _lookup< + ffi.NativeFunction< + CFDateFormatterRef Function(CFAllocatorRef, + CFOptionFlags)>>('CFDateFormatterCreateISO8601Formatter'); + late final _CFDateFormatterCreateISO8601Formatter = + _CFDateFormatterCreateISO8601FormatterPtr.asFunction< + CFDateFormatterRef Function(CFAllocatorRef, int)>(); + + CFDateFormatterRef CFDateFormatterCreate( + CFAllocatorRef allocator, + CFLocaleRef locale, + CFDateFormatterStyle dateStyle, + CFDateFormatterStyle timeStyle, + ) { + return _CFDateFormatterCreate( + allocator, + locale, + dateStyle.value, + timeStyle.value, + ); + } + + late final _CFDateFormatterCreatePtr = _lookup< + ffi.NativeFunction< + CFDateFormatterRef Function(CFAllocatorRef, CFLocaleRef, CFIndex, + CFIndex)>>('CFDateFormatterCreate'); + late final _CFDateFormatterCreate = _CFDateFormatterCreatePtr.asFunction< + CFDateFormatterRef Function(CFAllocatorRef, CFLocaleRef, int, int)>(); + + CFLocaleRef CFDateFormatterGetLocale( + CFDateFormatterRef formatter, + ) { + return _CFDateFormatterGetLocale( + formatter, + ); + } + + late final _CFDateFormatterGetLocalePtr = + _lookup>( + 'CFDateFormatterGetLocale'); + late final _CFDateFormatterGetLocale = _CFDateFormatterGetLocalePtr + .asFunction(); + + CFDateFormatterStyle CFDateFormatterGetDateStyle( + CFDateFormatterRef formatter, + ) { + return CFDateFormatterStyle.fromValue(_CFDateFormatterGetDateStyle( + formatter, + )); + } + + late final _CFDateFormatterGetDateStylePtr = + _lookup>( + 'CFDateFormatterGetDateStyle'); + late final _CFDateFormatterGetDateStyle = _CFDateFormatterGetDateStylePtr + .asFunction(); + + CFDateFormatterStyle CFDateFormatterGetTimeStyle( + CFDateFormatterRef formatter, + ) { + return CFDateFormatterStyle.fromValue(_CFDateFormatterGetTimeStyle( + formatter, + )); + } + + late final _CFDateFormatterGetTimeStylePtr = + _lookup>( + 'CFDateFormatterGetTimeStyle'); + late final _CFDateFormatterGetTimeStyle = _CFDateFormatterGetTimeStylePtr + .asFunction(); + + CFStringRef CFDateFormatterGetFormat( + CFDateFormatterRef formatter, + ) { + return _CFDateFormatterGetFormat( + formatter, + ); + } + + late final _CFDateFormatterGetFormatPtr = + _lookup>( + 'CFDateFormatterGetFormat'); + late final _CFDateFormatterGetFormat = _CFDateFormatterGetFormatPtr + .asFunction(); + + void CFDateFormatterSetFormat( + CFDateFormatterRef formatter, + CFStringRef formatString, + ) { + return _CFDateFormatterSetFormat( + formatter, + formatString, + ); + } + + late final _CFDateFormatterSetFormatPtr = _lookup< + ffi + .NativeFunction>( + 'CFDateFormatterSetFormat'); + late final _CFDateFormatterSetFormat = _CFDateFormatterSetFormatPtr + .asFunction(); + + CFStringRef CFDateFormatterCreateStringWithDate( + CFAllocatorRef allocator, + CFDateFormatterRef formatter, + CFDateRef date, + ) { + return _CFDateFormatterCreateStringWithDate( + allocator, + formatter, + date, + ); + } + + late final _CFDateFormatterCreateStringWithDatePtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFDateFormatterRef, + CFDateRef)>>('CFDateFormatterCreateStringWithDate'); + late final _CFDateFormatterCreateStringWithDate = + _CFDateFormatterCreateStringWithDatePtr.asFunction< + CFStringRef Function( + CFAllocatorRef, CFDateFormatterRef, CFDateRef)>(); + + CFStringRef CFDateFormatterCreateStringWithAbsoluteTime( + CFAllocatorRef allocator, + CFDateFormatterRef formatter, + double at, + ) { + return _CFDateFormatterCreateStringWithAbsoluteTime( + allocator, + formatter, + at, + ); + } + + late final _CFDateFormatterCreateStringWithAbsoluteTimePtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFDateFormatterRef, + CFAbsoluteTime)>>('CFDateFormatterCreateStringWithAbsoluteTime'); + late final _CFDateFormatterCreateStringWithAbsoluteTime = + _CFDateFormatterCreateStringWithAbsoluteTimePtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFDateFormatterRef, double)>(); + + CFDateRef CFDateFormatterCreateDateFromString( + CFAllocatorRef allocator, + CFDateFormatterRef formatter, + CFStringRef string, + ffi.Pointer rangep, + ) { + return _CFDateFormatterCreateDateFromString( + allocator, + formatter, + string, + rangep, + ); + } + + late final _CFDateFormatterCreateDateFromStringPtr = _lookup< + ffi.NativeFunction< + CFDateRef Function(CFAllocatorRef, CFDateFormatterRef, CFStringRef, + ffi.Pointer)>>('CFDateFormatterCreateDateFromString'); + late final _CFDateFormatterCreateDateFromString = + _CFDateFormatterCreateDateFromStringPtr.asFunction< + CFDateRef Function(CFAllocatorRef, CFDateFormatterRef, CFStringRef, + ffi.Pointer)>(); + + int CFDateFormatterGetAbsoluteTimeFromString( + CFDateFormatterRef formatter, + CFStringRef string, + ffi.Pointer rangep, + ffi.Pointer atp, + ) { + return _CFDateFormatterGetAbsoluteTimeFromString( + formatter, + string, + rangep, + atp, + ); + } + + late final _CFDateFormatterGetAbsoluteTimeFromStringPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFDateFormatterRef, CFStringRef, + ffi.Pointer, ffi.Pointer)>>( + 'CFDateFormatterGetAbsoluteTimeFromString'); + late final _CFDateFormatterGetAbsoluteTimeFromString = + _CFDateFormatterGetAbsoluteTimeFromStringPtr.asFunction< + int Function(CFDateFormatterRef, CFStringRef, ffi.Pointer, + ffi.Pointer)>(); + + void CFDateFormatterSetProperty( + CFDateFormatterRef formatter, + CFStringRef key, + CFTypeRef value, + ) { + return _CFDateFormatterSetProperty( + formatter, + key, + value, + ); + } + + late final _CFDateFormatterSetPropertyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFDateFormatterRef, CFStringRef, + CFTypeRef)>>('CFDateFormatterSetProperty'); + late final _CFDateFormatterSetProperty = _CFDateFormatterSetPropertyPtr + .asFunction(); + + CFTypeRef CFDateFormatterCopyProperty( + CFDateFormatterRef formatter, + CFDateFormatterKey key, + ) { + return _CFDateFormatterCopyProperty( + formatter, + key, + ); + } + + late final _CFDateFormatterCopyPropertyPtr = _lookup< + ffi.NativeFunction< + CFTypeRef Function(CFDateFormatterRef, + CFDateFormatterKey)>>('CFDateFormatterCopyProperty'); + late final _CFDateFormatterCopyProperty = _CFDateFormatterCopyPropertyPtr + .asFunction(); + + late final ffi.Pointer _kCFDateFormatterIsLenient = + _lookup('kCFDateFormatterIsLenient'); + + CFDateFormatterKey get kCFDateFormatterIsLenient => + _kCFDateFormatterIsLenient.value; + + late final ffi.Pointer _kCFDateFormatterTimeZone = + _lookup('kCFDateFormatterTimeZone'); + + CFDateFormatterKey get kCFDateFormatterTimeZone => + _kCFDateFormatterTimeZone.value; + + late final ffi.Pointer _kCFDateFormatterCalendarName = + _lookup('kCFDateFormatterCalendarName'); + + CFDateFormatterKey get kCFDateFormatterCalendarName => + _kCFDateFormatterCalendarName.value; + + late final ffi.Pointer _kCFDateFormatterDefaultFormat = + _lookup('kCFDateFormatterDefaultFormat'); + + CFDateFormatterKey get kCFDateFormatterDefaultFormat => + _kCFDateFormatterDefaultFormat.value; + + late final ffi.Pointer + _kCFDateFormatterTwoDigitStartDate = + _lookup('kCFDateFormatterTwoDigitStartDate'); + + CFDateFormatterKey get kCFDateFormatterTwoDigitStartDate => + _kCFDateFormatterTwoDigitStartDate.value; + + late final ffi.Pointer _kCFDateFormatterDefaultDate = + _lookup('kCFDateFormatterDefaultDate'); + + CFDateFormatterKey get kCFDateFormatterDefaultDate => + _kCFDateFormatterDefaultDate.value; + + late final ffi.Pointer _kCFDateFormatterCalendar = + _lookup('kCFDateFormatterCalendar'); + + CFDateFormatterKey get kCFDateFormatterCalendar => + _kCFDateFormatterCalendar.value; + + late final ffi.Pointer _kCFDateFormatterEraSymbols = + _lookup('kCFDateFormatterEraSymbols'); + + CFDateFormatterKey get kCFDateFormatterEraSymbols => + _kCFDateFormatterEraSymbols.value; + + late final ffi.Pointer _kCFDateFormatterMonthSymbols = + _lookup('kCFDateFormatterMonthSymbols'); + + CFDateFormatterKey get kCFDateFormatterMonthSymbols => + _kCFDateFormatterMonthSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterShortMonthSymbols = + _lookup('kCFDateFormatterShortMonthSymbols'); + + CFDateFormatterKey get kCFDateFormatterShortMonthSymbols => + _kCFDateFormatterShortMonthSymbols.value; + + late final ffi.Pointer _kCFDateFormatterWeekdaySymbols = + _lookup('kCFDateFormatterWeekdaySymbols'); + + CFDateFormatterKey get kCFDateFormatterWeekdaySymbols => + _kCFDateFormatterWeekdaySymbols.value; + + late final ffi.Pointer + _kCFDateFormatterShortWeekdaySymbols = + _lookup('kCFDateFormatterShortWeekdaySymbols'); + + CFDateFormatterKey get kCFDateFormatterShortWeekdaySymbols => + _kCFDateFormatterShortWeekdaySymbols.value; + + late final ffi.Pointer _kCFDateFormatterAMSymbol = + _lookup('kCFDateFormatterAMSymbol'); + + CFDateFormatterKey get kCFDateFormatterAMSymbol => + _kCFDateFormatterAMSymbol.value; + + late final ffi.Pointer _kCFDateFormatterPMSymbol = + _lookup('kCFDateFormatterPMSymbol'); + + CFDateFormatterKey get kCFDateFormatterPMSymbol => + _kCFDateFormatterPMSymbol.value; + + late final ffi.Pointer _kCFDateFormatterLongEraSymbols = + _lookup('kCFDateFormatterLongEraSymbols'); + + CFDateFormatterKey get kCFDateFormatterLongEraSymbols => + _kCFDateFormatterLongEraSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterVeryShortMonthSymbols = + _lookup('kCFDateFormatterVeryShortMonthSymbols'); + + CFDateFormatterKey get kCFDateFormatterVeryShortMonthSymbols => + _kCFDateFormatterVeryShortMonthSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterStandaloneMonthSymbols = + _lookup('kCFDateFormatterStandaloneMonthSymbols'); + + CFDateFormatterKey get kCFDateFormatterStandaloneMonthSymbols => + _kCFDateFormatterStandaloneMonthSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterShortStandaloneMonthSymbols = + _lookup( + 'kCFDateFormatterShortStandaloneMonthSymbols'); + + CFDateFormatterKey get kCFDateFormatterShortStandaloneMonthSymbols => + _kCFDateFormatterShortStandaloneMonthSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterVeryShortStandaloneMonthSymbols = + _lookup( + 'kCFDateFormatterVeryShortStandaloneMonthSymbols'); + + CFDateFormatterKey get kCFDateFormatterVeryShortStandaloneMonthSymbols => + _kCFDateFormatterVeryShortStandaloneMonthSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterVeryShortWeekdaySymbols = + _lookup('kCFDateFormatterVeryShortWeekdaySymbols'); + + CFDateFormatterKey get kCFDateFormatterVeryShortWeekdaySymbols => + _kCFDateFormatterVeryShortWeekdaySymbols.value; + + late final ffi.Pointer + _kCFDateFormatterStandaloneWeekdaySymbols = + _lookup('kCFDateFormatterStandaloneWeekdaySymbols'); + + CFDateFormatterKey get kCFDateFormatterStandaloneWeekdaySymbols => + _kCFDateFormatterStandaloneWeekdaySymbols.value; + + late final ffi.Pointer + _kCFDateFormatterShortStandaloneWeekdaySymbols = + _lookup( + 'kCFDateFormatterShortStandaloneWeekdaySymbols'); + + CFDateFormatterKey get kCFDateFormatterShortStandaloneWeekdaySymbols => + _kCFDateFormatterShortStandaloneWeekdaySymbols.value; + + late final ffi.Pointer + _kCFDateFormatterVeryShortStandaloneWeekdaySymbols = + _lookup( + 'kCFDateFormatterVeryShortStandaloneWeekdaySymbols'); + + CFDateFormatterKey get kCFDateFormatterVeryShortStandaloneWeekdaySymbols => + _kCFDateFormatterVeryShortStandaloneWeekdaySymbols.value; + + late final ffi.Pointer _kCFDateFormatterQuarterSymbols = + _lookup('kCFDateFormatterQuarterSymbols'); + + CFDateFormatterKey get kCFDateFormatterQuarterSymbols => + _kCFDateFormatterQuarterSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterShortQuarterSymbols = + _lookup('kCFDateFormatterShortQuarterSymbols'); + + CFDateFormatterKey get kCFDateFormatterShortQuarterSymbols => + _kCFDateFormatterShortQuarterSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterStandaloneQuarterSymbols = + _lookup('kCFDateFormatterStandaloneQuarterSymbols'); + + CFDateFormatterKey get kCFDateFormatterStandaloneQuarterSymbols => + _kCFDateFormatterStandaloneQuarterSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterShortStandaloneQuarterSymbols = + _lookup( + 'kCFDateFormatterShortStandaloneQuarterSymbols'); + + CFDateFormatterKey get kCFDateFormatterShortStandaloneQuarterSymbols => + _kCFDateFormatterShortStandaloneQuarterSymbols.value; + + late final ffi.Pointer + _kCFDateFormatterGregorianStartDate = + _lookup('kCFDateFormatterGregorianStartDate'); + + CFDateFormatterKey get kCFDateFormatterGregorianStartDate => + _kCFDateFormatterGregorianStartDate.value; + + late final ffi.Pointer + _kCFDateFormatterDoesRelativeDateFormattingKey = + _lookup( + 'kCFDateFormatterDoesRelativeDateFormattingKey'); + + CFDateFormatterKey get kCFDateFormatterDoesRelativeDateFormattingKey => + _kCFDateFormatterDoesRelativeDateFormattingKey.value; + + late final ffi.Pointer _kCFBooleanTrue = + _lookup('kCFBooleanTrue'); + + CFBooleanRef get kCFBooleanTrue => _kCFBooleanTrue.value; + + late final ffi.Pointer _kCFBooleanFalse = + _lookup('kCFBooleanFalse'); + + CFBooleanRef get kCFBooleanFalse => _kCFBooleanFalse.value; + + int CFBooleanGetTypeID() { + return _CFBooleanGetTypeID(); + } + + late final _CFBooleanGetTypeIDPtr = + _lookup>('CFBooleanGetTypeID'); + late final _CFBooleanGetTypeID = + _CFBooleanGetTypeIDPtr.asFunction(); + + int CFBooleanGetValue( + CFBooleanRef boolean, + ) { + return _CFBooleanGetValue( + boolean, + ); + } + + late final _CFBooleanGetValuePtr = + _lookup>( + 'CFBooleanGetValue'); + late final _CFBooleanGetValue = + _CFBooleanGetValuePtr.asFunction(); + + late final ffi.Pointer _kCFNumberPositiveInfinity = + _lookup('kCFNumberPositiveInfinity'); + + CFNumberRef get kCFNumberPositiveInfinity => _kCFNumberPositiveInfinity.value; + + late final ffi.Pointer _kCFNumberNegativeInfinity = + _lookup('kCFNumberNegativeInfinity'); + + CFNumberRef get kCFNumberNegativeInfinity => _kCFNumberNegativeInfinity.value; + + late final ffi.Pointer _kCFNumberNaN = + _lookup('kCFNumberNaN'); + + CFNumberRef get kCFNumberNaN => _kCFNumberNaN.value; + + int CFNumberGetTypeID() { + return _CFNumberGetTypeID(); + } + + late final _CFNumberGetTypeIDPtr = + _lookup>('CFNumberGetTypeID'); + late final _CFNumberGetTypeID = + _CFNumberGetTypeIDPtr.asFunction(); + + CFNumberRef CFNumberCreate( + CFAllocatorRef allocator, + CFNumberType theType, + ffi.Pointer valuePtr, + ) { + return _CFNumberCreate( + allocator, + theType.value, + valuePtr, + ); + } + + late final _CFNumberCreatePtr = _lookup< + ffi.NativeFunction< + CFNumberRef Function(CFAllocatorRef, CFIndex, + ffi.Pointer)>>('CFNumberCreate'); + late final _CFNumberCreate = _CFNumberCreatePtr.asFunction< + CFNumberRef Function(CFAllocatorRef, int, ffi.Pointer)>(); + + CFNumberType CFNumberGetType( + CFNumberRef number, + ) { + return CFNumberType.fromValue(_CFNumberGetType( + number, + )); + } + + late final _CFNumberGetTypePtr = + _lookup>( + 'CFNumberGetType'); + late final _CFNumberGetType = + _CFNumberGetTypePtr.asFunction(); + + int CFNumberGetByteSize( + CFNumberRef number, + ) { + return _CFNumberGetByteSize( + number, + ); + } + + late final _CFNumberGetByteSizePtr = + _lookup>( + 'CFNumberGetByteSize'); + late final _CFNumberGetByteSize = + _CFNumberGetByteSizePtr.asFunction(); + + int CFNumberIsFloatType( + CFNumberRef number, + ) { + return _CFNumberIsFloatType( + number, + ); + } + + late final _CFNumberIsFloatTypePtr = + _lookup>( + 'CFNumberIsFloatType'); + late final _CFNumberIsFloatType = + _CFNumberIsFloatTypePtr.asFunction(); + + DartBoolean CFNumberGetValue( + CFNumberRef number, + CFNumberType theType, + ffi.Pointer valuePtr, + ) { + return _CFNumberGetValue( + number, + theType.value, + valuePtr, + ); + } + + late final _CFNumberGetValuePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFNumberRef, CFIndex, + ffi.Pointer)>>('CFNumberGetValue'); + late final _CFNumberGetValue = _CFNumberGetValuePtr.asFunction< + int Function(CFNumberRef, int, ffi.Pointer)>(); + + CFComparisonResult CFNumberCompare( + CFNumberRef number, + CFNumberRef otherNumber, + ffi.Pointer context, + ) { + return CFComparisonResult.fromValue(_CFNumberCompare( + number, + otherNumber, + context, + )); + } + + late final _CFNumberComparePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFNumberRef, CFNumberRef, + ffi.Pointer)>>('CFNumberCompare'); + late final _CFNumberCompare = _CFNumberComparePtr.asFunction< + int Function(CFNumberRef, CFNumberRef, ffi.Pointer)>(); + + int CFNumberFormatterGetTypeID() { + return _CFNumberFormatterGetTypeID(); + } + + late final _CFNumberFormatterGetTypeIDPtr = + _lookup>( + 'CFNumberFormatterGetTypeID'); + late final _CFNumberFormatterGetTypeID = + _CFNumberFormatterGetTypeIDPtr.asFunction(); + + CFNumberFormatterRef CFNumberFormatterCreate( + CFAllocatorRef allocator, + CFLocaleRef locale, + CFNumberFormatterStyle style, + ) { + return _CFNumberFormatterCreate( + allocator, + locale, + style.value, + ); + } + + late final _CFNumberFormatterCreatePtr = _lookup< + ffi.NativeFunction< + CFNumberFormatterRef Function(CFAllocatorRef, CFLocaleRef, + CFIndex)>>('CFNumberFormatterCreate'); + late final _CFNumberFormatterCreate = _CFNumberFormatterCreatePtr.asFunction< + CFNumberFormatterRef Function(CFAllocatorRef, CFLocaleRef, int)>(); + + CFLocaleRef CFNumberFormatterGetLocale( + CFNumberFormatterRef formatter, + ) { + return _CFNumberFormatterGetLocale( + formatter, + ); + } + + late final _CFNumberFormatterGetLocalePtr = + _lookup>( + 'CFNumberFormatterGetLocale'); + late final _CFNumberFormatterGetLocale = _CFNumberFormatterGetLocalePtr + .asFunction(); + + CFNumberFormatterStyle CFNumberFormatterGetStyle( + CFNumberFormatterRef formatter, + ) { + return CFNumberFormatterStyle.fromValue(_CFNumberFormatterGetStyle( + formatter, + )); + } + + late final _CFNumberFormatterGetStylePtr = + _lookup>( + 'CFNumberFormatterGetStyle'); + late final _CFNumberFormatterGetStyle = _CFNumberFormatterGetStylePtr + .asFunction(); + + CFStringRef CFNumberFormatterGetFormat( + CFNumberFormatterRef formatter, + ) { + return _CFNumberFormatterGetFormat( + formatter, + ); + } + + late final _CFNumberFormatterGetFormatPtr = + _lookup>( + 'CFNumberFormatterGetFormat'); + late final _CFNumberFormatterGetFormat = _CFNumberFormatterGetFormatPtr + .asFunction(); + + void CFNumberFormatterSetFormat( + CFNumberFormatterRef formatter, + CFStringRef formatString, + ) { + return _CFNumberFormatterSetFormat( + formatter, + formatString, + ); + } + + late final _CFNumberFormatterSetFormatPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFNumberFormatterRef, + CFStringRef)>>('CFNumberFormatterSetFormat'); + late final _CFNumberFormatterSetFormat = _CFNumberFormatterSetFormatPtr + .asFunction(); + + CFStringRef CFNumberFormatterCreateStringWithNumber( + CFAllocatorRef allocator, + CFNumberFormatterRef formatter, + CFNumberRef number, + ) { + return _CFNumberFormatterCreateStringWithNumber( + allocator, + formatter, + number, + ); + } + + late final _CFNumberFormatterCreateStringWithNumberPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFNumberFormatterRef, + CFNumberRef)>>('CFNumberFormatterCreateStringWithNumber'); + late final _CFNumberFormatterCreateStringWithNumber = + _CFNumberFormatterCreateStringWithNumberPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, CFNumberFormatterRef, CFNumberRef)>(); + + CFStringRef CFNumberFormatterCreateStringWithValue( + CFAllocatorRef allocator, + CFNumberFormatterRef formatter, + CFNumberType numberType, + ffi.Pointer valuePtr, + ) { + return _CFNumberFormatterCreateStringWithValue( + allocator, + formatter, + numberType.value, + valuePtr, + ); + } + + late final _CFNumberFormatterCreateStringWithValuePtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFNumberFormatterRef, + CFIndex, ffi.Pointer)>>( + 'CFNumberFormatterCreateStringWithValue'); + late final _CFNumberFormatterCreateStringWithValue = + _CFNumberFormatterCreateStringWithValuePtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFNumberFormatterRef, int, + ffi.Pointer)>(); + + CFNumberRef CFNumberFormatterCreateNumberFromString( + CFAllocatorRef allocator, + CFNumberFormatterRef formatter, + CFStringRef string, + ffi.Pointer rangep, + int options, + ) { + return _CFNumberFormatterCreateNumberFromString( + allocator, + formatter, + string, + rangep, + options, + ); + } + + late final _CFNumberFormatterCreateNumberFromStringPtr = _lookup< + ffi.NativeFunction< + CFNumberRef Function( + CFAllocatorRef, + CFNumberFormatterRef, + CFStringRef, + ffi.Pointer, + CFOptionFlags)>>('CFNumberFormatterCreateNumberFromString'); + late final _CFNumberFormatterCreateNumberFromString = + _CFNumberFormatterCreateNumberFromStringPtr.asFunction< + CFNumberRef Function(CFAllocatorRef, CFNumberFormatterRef, + CFStringRef, ffi.Pointer, int)>(); + + DartBoolean CFNumberFormatterGetValueFromString( + CFNumberFormatterRef formatter, + CFStringRef string, + ffi.Pointer rangep, + CFNumberType numberType, + ffi.Pointer valuePtr, + ) { + return _CFNumberFormatterGetValueFromString( + formatter, + string, + rangep, + numberType.value, + valuePtr, + ); + } + + late final _CFNumberFormatterGetValueFromStringPtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFNumberFormatterRef, + CFStringRef, + ffi.Pointer, + CFIndex, + ffi.Pointer)>>('CFNumberFormatterGetValueFromString'); + late final _CFNumberFormatterGetValueFromString = + _CFNumberFormatterGetValueFromStringPtr.asFunction< + int Function(CFNumberFormatterRef, CFStringRef, ffi.Pointer, + int, ffi.Pointer)>(); + + void CFNumberFormatterSetProperty( + CFNumberFormatterRef formatter, + CFNumberFormatterKey key, + CFTypeRef value, + ) { + return _CFNumberFormatterSetProperty( + formatter, + key, + value, + ); + } + + late final _CFNumberFormatterSetPropertyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFNumberFormatterRef, CFNumberFormatterKey, + CFTypeRef)>>('CFNumberFormatterSetProperty'); + late final _CFNumberFormatterSetProperty = + _CFNumberFormatterSetPropertyPtr.asFunction< + void Function( + CFNumberFormatterRef, CFNumberFormatterKey, CFTypeRef)>(); + + CFTypeRef CFNumberFormatterCopyProperty( + CFNumberFormatterRef formatter, + CFNumberFormatterKey key, + ) { + return _CFNumberFormatterCopyProperty( + formatter, + key, + ); + } + + late final _CFNumberFormatterCopyPropertyPtr = _lookup< + ffi.NativeFunction< + CFTypeRef Function(CFNumberFormatterRef, + CFNumberFormatterKey)>>('CFNumberFormatterCopyProperty'); + late final _CFNumberFormatterCopyProperty = + _CFNumberFormatterCopyPropertyPtr.asFunction< + CFTypeRef Function(CFNumberFormatterRef, CFNumberFormatterKey)>(); + + late final ffi.Pointer _kCFNumberFormatterCurrencyCode = + _lookup('kCFNumberFormatterCurrencyCode'); + + CFNumberFormatterKey get kCFNumberFormatterCurrencyCode => + _kCFNumberFormatterCurrencyCode.value; + + late final ffi.Pointer + _kCFNumberFormatterDecimalSeparator = + _lookup('kCFNumberFormatterDecimalSeparator'); + + CFNumberFormatterKey get kCFNumberFormatterDecimalSeparator => + _kCFNumberFormatterDecimalSeparator.value; + + late final ffi.Pointer + _kCFNumberFormatterCurrencyDecimalSeparator = + _lookup( + 'kCFNumberFormatterCurrencyDecimalSeparator'); + + CFNumberFormatterKey get kCFNumberFormatterCurrencyDecimalSeparator => + _kCFNumberFormatterCurrencyDecimalSeparator.value; + + late final ffi.Pointer + _kCFNumberFormatterAlwaysShowDecimalSeparator = + _lookup( + 'kCFNumberFormatterAlwaysShowDecimalSeparator'); + + CFNumberFormatterKey get kCFNumberFormatterAlwaysShowDecimalSeparator => + _kCFNumberFormatterAlwaysShowDecimalSeparator.value; + + late final ffi.Pointer + _kCFNumberFormatterGroupingSeparator = + _lookup('kCFNumberFormatterGroupingSeparator'); + + CFNumberFormatterKey get kCFNumberFormatterGroupingSeparator => + _kCFNumberFormatterGroupingSeparator.value; + + late final ffi.Pointer + _kCFNumberFormatterUseGroupingSeparator = + _lookup('kCFNumberFormatterUseGroupingSeparator'); + + CFNumberFormatterKey get kCFNumberFormatterUseGroupingSeparator => + _kCFNumberFormatterUseGroupingSeparator.value; + + late final ffi.Pointer + _kCFNumberFormatterPercentSymbol = + _lookup('kCFNumberFormatterPercentSymbol'); + + CFNumberFormatterKey get kCFNumberFormatterPercentSymbol => + _kCFNumberFormatterPercentSymbol.value; + + late final ffi.Pointer _kCFNumberFormatterZeroSymbol = + _lookup('kCFNumberFormatterZeroSymbol'); + + CFNumberFormatterKey get kCFNumberFormatterZeroSymbol => + _kCFNumberFormatterZeroSymbol.value; + + late final ffi.Pointer _kCFNumberFormatterNaNSymbol = + _lookup('kCFNumberFormatterNaNSymbol'); + + CFNumberFormatterKey get kCFNumberFormatterNaNSymbol => + _kCFNumberFormatterNaNSymbol.value; + + late final ffi.Pointer + _kCFNumberFormatterInfinitySymbol = + _lookup('kCFNumberFormatterInfinitySymbol'); + + CFNumberFormatterKey get kCFNumberFormatterInfinitySymbol => + _kCFNumberFormatterInfinitySymbol.value; + + late final ffi.Pointer _kCFNumberFormatterMinusSign = + _lookup('kCFNumberFormatterMinusSign'); + + CFNumberFormatterKey get kCFNumberFormatterMinusSign => + _kCFNumberFormatterMinusSign.value; + + late final ffi.Pointer _kCFNumberFormatterPlusSign = + _lookup('kCFNumberFormatterPlusSign'); + + CFNumberFormatterKey get kCFNumberFormatterPlusSign => + _kCFNumberFormatterPlusSign.value; + + late final ffi.Pointer + _kCFNumberFormatterCurrencySymbol = + _lookup('kCFNumberFormatterCurrencySymbol'); + + CFNumberFormatterKey get kCFNumberFormatterCurrencySymbol => + _kCFNumberFormatterCurrencySymbol.value; + + late final ffi.Pointer + _kCFNumberFormatterExponentSymbol = + _lookup('kCFNumberFormatterExponentSymbol'); + + CFNumberFormatterKey get kCFNumberFormatterExponentSymbol => + _kCFNumberFormatterExponentSymbol.value; + + late final ffi.Pointer + _kCFNumberFormatterMinIntegerDigits = + _lookup('kCFNumberFormatterMinIntegerDigits'); + + CFNumberFormatterKey get kCFNumberFormatterMinIntegerDigits => + _kCFNumberFormatterMinIntegerDigits.value; + + late final ffi.Pointer + _kCFNumberFormatterMaxIntegerDigits = + _lookup('kCFNumberFormatterMaxIntegerDigits'); + + CFNumberFormatterKey get kCFNumberFormatterMaxIntegerDigits => + _kCFNumberFormatterMaxIntegerDigits.value; + + late final ffi.Pointer + _kCFNumberFormatterMinFractionDigits = + _lookup('kCFNumberFormatterMinFractionDigits'); + + CFNumberFormatterKey get kCFNumberFormatterMinFractionDigits => + _kCFNumberFormatterMinFractionDigits.value; + + late final ffi.Pointer + _kCFNumberFormatterMaxFractionDigits = + _lookup('kCFNumberFormatterMaxFractionDigits'); + + CFNumberFormatterKey get kCFNumberFormatterMaxFractionDigits => + _kCFNumberFormatterMaxFractionDigits.value; + + late final ffi.Pointer _kCFNumberFormatterGroupingSize = + _lookup('kCFNumberFormatterGroupingSize'); + + CFNumberFormatterKey get kCFNumberFormatterGroupingSize => + _kCFNumberFormatterGroupingSize.value; + + late final ffi.Pointer + _kCFNumberFormatterSecondaryGroupingSize = + _lookup('kCFNumberFormatterSecondaryGroupingSize'); + + CFNumberFormatterKey get kCFNumberFormatterSecondaryGroupingSize => + _kCFNumberFormatterSecondaryGroupingSize.value; + + late final ffi.Pointer _kCFNumberFormatterRoundingMode = + _lookup('kCFNumberFormatterRoundingMode'); + + CFNumberFormatterKey get kCFNumberFormatterRoundingMode => + _kCFNumberFormatterRoundingMode.value; + + late final ffi.Pointer + _kCFNumberFormatterRoundingIncrement = + _lookup('kCFNumberFormatterRoundingIncrement'); + + CFNumberFormatterKey get kCFNumberFormatterRoundingIncrement => + _kCFNumberFormatterRoundingIncrement.value; + + late final ffi.Pointer _kCFNumberFormatterFormatWidth = + _lookup('kCFNumberFormatterFormatWidth'); + + CFNumberFormatterKey get kCFNumberFormatterFormatWidth => + _kCFNumberFormatterFormatWidth.value; + + late final ffi.Pointer + _kCFNumberFormatterPaddingPosition = + _lookup('kCFNumberFormatterPaddingPosition'); + + CFNumberFormatterKey get kCFNumberFormatterPaddingPosition => + _kCFNumberFormatterPaddingPosition.value; + + late final ffi.Pointer + _kCFNumberFormatterPaddingCharacter = + _lookup('kCFNumberFormatterPaddingCharacter'); + + CFNumberFormatterKey get kCFNumberFormatterPaddingCharacter => + _kCFNumberFormatterPaddingCharacter.value; + + late final ffi.Pointer + _kCFNumberFormatterDefaultFormat = + _lookup('kCFNumberFormatterDefaultFormat'); + + CFNumberFormatterKey get kCFNumberFormatterDefaultFormat => + _kCFNumberFormatterDefaultFormat.value; + + late final ffi.Pointer _kCFNumberFormatterMultiplier = + _lookup('kCFNumberFormatterMultiplier'); + + CFNumberFormatterKey get kCFNumberFormatterMultiplier => + _kCFNumberFormatterMultiplier.value; + + late final ffi.Pointer + _kCFNumberFormatterPositivePrefix = + _lookup('kCFNumberFormatterPositivePrefix'); + + CFNumberFormatterKey get kCFNumberFormatterPositivePrefix => + _kCFNumberFormatterPositivePrefix.value; + + late final ffi.Pointer + _kCFNumberFormatterPositiveSuffix = + _lookup('kCFNumberFormatterPositiveSuffix'); + + CFNumberFormatterKey get kCFNumberFormatterPositiveSuffix => + _kCFNumberFormatterPositiveSuffix.value; + + late final ffi.Pointer + _kCFNumberFormatterNegativePrefix = + _lookup('kCFNumberFormatterNegativePrefix'); + + CFNumberFormatterKey get kCFNumberFormatterNegativePrefix => + _kCFNumberFormatterNegativePrefix.value; + + late final ffi.Pointer + _kCFNumberFormatterNegativeSuffix = + _lookup('kCFNumberFormatterNegativeSuffix'); + + CFNumberFormatterKey get kCFNumberFormatterNegativeSuffix => + _kCFNumberFormatterNegativeSuffix.value; + + late final ffi.Pointer + _kCFNumberFormatterPerMillSymbol = + _lookup('kCFNumberFormatterPerMillSymbol'); + + CFNumberFormatterKey get kCFNumberFormatterPerMillSymbol => + _kCFNumberFormatterPerMillSymbol.value; + + late final ffi.Pointer + _kCFNumberFormatterInternationalCurrencySymbol = + _lookup( + 'kCFNumberFormatterInternationalCurrencySymbol'); + + CFNumberFormatterKey get kCFNumberFormatterInternationalCurrencySymbol => + _kCFNumberFormatterInternationalCurrencySymbol.value; + + late final ffi.Pointer + _kCFNumberFormatterCurrencyGroupingSeparator = + _lookup( + 'kCFNumberFormatterCurrencyGroupingSeparator'); + + CFNumberFormatterKey get kCFNumberFormatterCurrencyGroupingSeparator => + _kCFNumberFormatterCurrencyGroupingSeparator.value; + + late final ffi.Pointer _kCFNumberFormatterIsLenient = + _lookup('kCFNumberFormatterIsLenient'); + + CFNumberFormatterKey get kCFNumberFormatterIsLenient => + _kCFNumberFormatterIsLenient.value; + + late final ffi.Pointer + _kCFNumberFormatterUseSignificantDigits = + _lookup('kCFNumberFormatterUseSignificantDigits'); + + CFNumberFormatterKey get kCFNumberFormatterUseSignificantDigits => + _kCFNumberFormatterUseSignificantDigits.value; + + late final ffi.Pointer + _kCFNumberFormatterMinSignificantDigits = + _lookup('kCFNumberFormatterMinSignificantDigits'); + + CFNumberFormatterKey get kCFNumberFormatterMinSignificantDigits => + _kCFNumberFormatterMinSignificantDigits.value; + + late final ffi.Pointer + _kCFNumberFormatterMaxSignificantDigits = + _lookup('kCFNumberFormatterMaxSignificantDigits'); + + CFNumberFormatterKey get kCFNumberFormatterMaxSignificantDigits => + _kCFNumberFormatterMaxSignificantDigits.value; + + int CFNumberFormatterGetDecimalInfoForCurrencyCode( + CFStringRef currencyCode, + ffi.Pointer defaultFractionDigits, + ffi.Pointer roundingIncrement, + ) { + return _CFNumberFormatterGetDecimalInfoForCurrencyCode( + currencyCode, + defaultFractionDigits, + roundingIncrement, + ); + } + + late final _CFNumberFormatterGetDecimalInfoForCurrencyCodePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFStringRef, ffi.Pointer, + ffi.Pointer)>>( + 'CFNumberFormatterGetDecimalInfoForCurrencyCode'); + late final _CFNumberFormatterGetDecimalInfoForCurrencyCode = + _CFNumberFormatterGetDecimalInfoForCurrencyCodePtr.asFunction< + int Function( + CFStringRef, ffi.Pointer, ffi.Pointer)>(); + + late final ffi.Pointer _kCFPreferencesAnyApplication = + _lookup('kCFPreferencesAnyApplication'); + + CFStringRef get kCFPreferencesAnyApplication => + _kCFPreferencesAnyApplication.value; + + set kCFPreferencesAnyApplication(CFStringRef value) => + _kCFPreferencesAnyApplication.value = value; + + late final ffi.Pointer _kCFPreferencesCurrentApplication = + _lookup('kCFPreferencesCurrentApplication'); + + CFStringRef get kCFPreferencesCurrentApplication => + _kCFPreferencesCurrentApplication.value; + + set kCFPreferencesCurrentApplication(CFStringRef value) => + _kCFPreferencesCurrentApplication.value = value; + + late final ffi.Pointer _kCFPreferencesAnyHost = + _lookup('kCFPreferencesAnyHost'); + + CFStringRef get kCFPreferencesAnyHost => _kCFPreferencesAnyHost.value; + + set kCFPreferencesAnyHost(CFStringRef value) => + _kCFPreferencesAnyHost.value = value; + + late final ffi.Pointer _kCFPreferencesCurrentHost = + _lookup('kCFPreferencesCurrentHost'); + + CFStringRef get kCFPreferencesCurrentHost => _kCFPreferencesCurrentHost.value; + + set kCFPreferencesCurrentHost(CFStringRef value) => + _kCFPreferencesCurrentHost.value = value; + + late final ffi.Pointer _kCFPreferencesAnyUser = + _lookup('kCFPreferencesAnyUser'); + + CFStringRef get kCFPreferencesAnyUser => _kCFPreferencesAnyUser.value; + + set kCFPreferencesAnyUser(CFStringRef value) => + _kCFPreferencesAnyUser.value = value; + + late final ffi.Pointer _kCFPreferencesCurrentUser = + _lookup('kCFPreferencesCurrentUser'); + + CFStringRef get kCFPreferencesCurrentUser => _kCFPreferencesCurrentUser.value; + + set kCFPreferencesCurrentUser(CFStringRef value) => + _kCFPreferencesCurrentUser.value = value; + + CFPropertyListRef CFPreferencesCopyAppValue( + CFStringRef key, + CFStringRef applicationID, + ) { + return _CFPreferencesCopyAppValue( + key, + applicationID, + ); + } + + late final _CFPreferencesCopyAppValuePtr = _lookup< + ffi.NativeFunction< + CFPropertyListRef Function( + CFStringRef, CFStringRef)>>('CFPreferencesCopyAppValue'); + late final _CFPreferencesCopyAppValue = _CFPreferencesCopyAppValuePtr + .asFunction(); + + int CFPreferencesGetAppBooleanValue( + CFStringRef key, + CFStringRef applicationID, + ffi.Pointer keyExistsAndHasValidFormat, + ) { + return _CFPreferencesGetAppBooleanValue( + key, + applicationID, + keyExistsAndHasValidFormat, + ); + } + + late final _CFPreferencesGetAppBooleanValuePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFStringRef, CFStringRef, + ffi.Pointer)>>('CFPreferencesGetAppBooleanValue'); + late final _CFPreferencesGetAppBooleanValue = + _CFPreferencesGetAppBooleanValuePtr.asFunction< + int Function(CFStringRef, CFStringRef, ffi.Pointer)>(); + + int CFPreferencesGetAppIntegerValue( + CFStringRef key, + CFStringRef applicationID, + ffi.Pointer keyExistsAndHasValidFormat, + ) { + return _CFPreferencesGetAppIntegerValue( + key, + applicationID, + keyExistsAndHasValidFormat, + ); + } + + late final _CFPreferencesGetAppIntegerValuePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFStringRef, CFStringRef, + ffi.Pointer)>>('CFPreferencesGetAppIntegerValue'); + late final _CFPreferencesGetAppIntegerValue = + _CFPreferencesGetAppIntegerValuePtr.asFunction< + int Function(CFStringRef, CFStringRef, ffi.Pointer)>(); + + void CFPreferencesSetAppValue( + CFStringRef key, + CFPropertyListRef value, + CFStringRef applicationID, + ) { + return _CFPreferencesSetAppValue( + key, + value, + applicationID, + ); + } + + late final _CFPreferencesSetAppValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFStringRef, CFPropertyListRef, + CFStringRef)>>('CFPreferencesSetAppValue'); + late final _CFPreferencesSetAppValue = _CFPreferencesSetAppValuePtr + .asFunction(); + + void CFPreferencesAddSuitePreferencesToApp( + CFStringRef applicationID, + CFStringRef suiteID, + ) { + return _CFPreferencesAddSuitePreferencesToApp( + applicationID, + suiteID, + ); + } + + late final _CFPreferencesAddSuitePreferencesToAppPtr = + _lookup>( + 'CFPreferencesAddSuitePreferencesToApp'); + late final _CFPreferencesAddSuitePreferencesToApp = + _CFPreferencesAddSuitePreferencesToAppPtr.asFunction< + void Function(CFStringRef, CFStringRef)>(); + + void CFPreferencesRemoveSuitePreferencesFromApp( + CFStringRef applicationID, + CFStringRef suiteID, + ) { + return _CFPreferencesRemoveSuitePreferencesFromApp( + applicationID, + suiteID, + ); + } + + late final _CFPreferencesRemoveSuitePreferencesFromAppPtr = + _lookup>( + 'CFPreferencesRemoveSuitePreferencesFromApp'); + late final _CFPreferencesRemoveSuitePreferencesFromApp = + _CFPreferencesRemoveSuitePreferencesFromAppPtr.asFunction< + void Function(CFStringRef, CFStringRef)>(); + + int CFPreferencesAppSynchronize( + CFStringRef applicationID, + ) { + return _CFPreferencesAppSynchronize( + applicationID, + ); + } + + late final _CFPreferencesAppSynchronizePtr = + _lookup>( + 'CFPreferencesAppSynchronize'); + late final _CFPreferencesAppSynchronize = + _CFPreferencesAppSynchronizePtr.asFunction(); + + CFPropertyListRef CFPreferencesCopyValue( + CFStringRef key, + CFStringRef applicationID, + CFStringRef userName, + CFStringRef hostName, + ) { + return _CFPreferencesCopyValue( + key, + applicationID, + userName, + hostName, + ); + } + + late final _CFPreferencesCopyValuePtr = _lookup< + ffi.NativeFunction< + CFPropertyListRef Function(CFStringRef, CFStringRef, CFStringRef, + CFStringRef)>>('CFPreferencesCopyValue'); + late final _CFPreferencesCopyValue = _CFPreferencesCopyValuePtr.asFunction< + CFPropertyListRef Function( + CFStringRef, CFStringRef, CFStringRef, CFStringRef)>(); + + CFDictionaryRef CFPreferencesCopyMultiple( + CFArrayRef keysToFetch, + CFStringRef applicationID, + CFStringRef userName, + CFStringRef hostName, + ) { + return _CFPreferencesCopyMultiple( + keysToFetch, + applicationID, + userName, + hostName, + ); + } + + late final _CFPreferencesCopyMultiplePtr = _lookup< + ffi.NativeFunction< + CFDictionaryRef Function(CFArrayRef, CFStringRef, CFStringRef, + CFStringRef)>>('CFPreferencesCopyMultiple'); + late final _CFPreferencesCopyMultiple = + _CFPreferencesCopyMultiplePtr.asFunction< + CFDictionaryRef Function( + CFArrayRef, CFStringRef, CFStringRef, CFStringRef)>(); + + void CFPreferencesSetValue( + CFStringRef key, + CFPropertyListRef value, + CFStringRef applicationID, + CFStringRef userName, + CFStringRef hostName, + ) { + return _CFPreferencesSetValue( + key, + value, + applicationID, + userName, + hostName, + ); + } + + late final _CFPreferencesSetValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFStringRef, CFPropertyListRef, CFStringRef, + CFStringRef, CFStringRef)>>('CFPreferencesSetValue'); + late final _CFPreferencesSetValue = _CFPreferencesSetValuePtr.asFunction< + void Function(CFStringRef, CFPropertyListRef, CFStringRef, CFStringRef, + CFStringRef)>(); + + void CFPreferencesSetMultiple( + CFDictionaryRef keysToSet, + CFArrayRef keysToRemove, + CFStringRef applicationID, + CFStringRef userName, + CFStringRef hostName, + ) { + return _CFPreferencesSetMultiple( + keysToSet, + keysToRemove, + applicationID, + userName, + hostName, + ); + } + + late final _CFPreferencesSetMultiplePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFDictionaryRef, CFArrayRef, CFStringRef, + CFStringRef, CFStringRef)>>('CFPreferencesSetMultiple'); + late final _CFPreferencesSetMultiple = + _CFPreferencesSetMultiplePtr.asFunction< + void Function(CFDictionaryRef, CFArrayRef, CFStringRef, CFStringRef, + CFStringRef)>(); + + int CFPreferencesSynchronize( + CFStringRef applicationID, + CFStringRef userName, + CFStringRef hostName, + ) { + return _CFPreferencesSynchronize( + applicationID, + userName, + hostName, + ); + } + + late final _CFPreferencesSynchronizePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFStringRef, CFStringRef, + CFStringRef)>>('CFPreferencesSynchronize'); + late final _CFPreferencesSynchronize = _CFPreferencesSynchronizePtr + .asFunction(); + + CFArrayRef CFPreferencesCopyApplicationList( + CFStringRef userName, + CFStringRef hostName, + ) { + return _CFPreferencesCopyApplicationList( + userName, + hostName, + ); + } + + late final _CFPreferencesCopyApplicationListPtr = _lookup< + ffi.NativeFunction>( + 'CFPreferencesCopyApplicationList'); + late final _CFPreferencesCopyApplicationList = + _CFPreferencesCopyApplicationListPtr.asFunction< + CFArrayRef Function(CFStringRef, CFStringRef)>(); + + CFArrayRef CFPreferencesCopyKeyList( + CFStringRef applicationID, + CFStringRef userName, + CFStringRef hostName, + ) { + return _CFPreferencesCopyKeyList( + applicationID, + userName, + hostName, + ); + } + + late final _CFPreferencesCopyKeyListPtr = _lookup< + ffi.NativeFunction< + CFArrayRef Function(CFStringRef, CFStringRef, + CFStringRef)>>('CFPreferencesCopyKeyList'); + late final _CFPreferencesCopyKeyList = _CFPreferencesCopyKeyListPtr + .asFunction(); + + int CFPreferencesAppValueIsForced( + CFStringRef key, + CFStringRef applicationID, + ) { + return _CFPreferencesAppValueIsForced( + key, + applicationID, + ); + } + + late final _CFPreferencesAppValueIsForcedPtr = + _lookup>( + 'CFPreferencesAppValueIsForced'); + late final _CFPreferencesAppValueIsForced = _CFPreferencesAppValueIsForcedPtr + .asFunction(); + + int CFURLGetTypeID() { + return _CFURLGetTypeID(); + } + + late final _CFURLGetTypeIDPtr = + _lookup>('CFURLGetTypeID'); + late final _CFURLGetTypeID = _CFURLGetTypeIDPtr.asFunction(); + + CFURLRef CFURLCreateWithBytes( + CFAllocatorRef allocator, + ffi.Pointer URLBytes, + int length, + int encoding, + CFURLRef baseURL, + ) { + return _CFURLCreateWithBytes( + allocator, + URLBytes, + length, + encoding, + baseURL, + ); + } + + late final _CFURLCreateWithBytesPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFAllocatorRef, ffi.Pointer, CFIndex, + CFStringEncoding, CFURLRef)>>('CFURLCreateWithBytes'); + late final _CFURLCreateWithBytes = _CFURLCreateWithBytesPtr.asFunction< + CFURLRef Function( + CFAllocatorRef, ffi.Pointer, int, int, CFURLRef)>(); + + CFDataRef CFURLCreateData( + CFAllocatorRef allocator, + CFURLRef url, + int encoding, + int escapeWhitespace, + ) { + return _CFURLCreateData( + allocator, + url, + encoding, + escapeWhitespace, + ); + } + + late final _CFURLCreateDataPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(CFAllocatorRef, CFURLRef, CFStringEncoding, + Boolean)>>('CFURLCreateData'); + late final _CFURLCreateData = _CFURLCreateDataPtr.asFunction< + CFDataRef Function(CFAllocatorRef, CFURLRef, int, int)>(); + + CFURLRef CFURLCreateWithString( + CFAllocatorRef allocator, + CFStringRef URLString, + CFURLRef baseURL, + ) { + return _CFURLCreateWithString( + allocator, + URLString, + baseURL, + ); + } + + late final _CFURLCreateWithStringPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function( + CFAllocatorRef, CFStringRef, CFURLRef)>>('CFURLCreateWithString'); + late final _CFURLCreateWithString = _CFURLCreateWithStringPtr.asFunction< + CFURLRef Function(CFAllocatorRef, CFStringRef, CFURLRef)>(); + + CFURLRef CFURLCreateAbsoluteURLWithBytes( + CFAllocatorRef alloc, + ffi.Pointer relativeURLBytes, + int length, + int encoding, + CFURLRef baseURL, + int useCompatibilityMode, + ) { + return _CFURLCreateAbsoluteURLWithBytes( + alloc, + relativeURLBytes, + length, + encoding, + baseURL, + useCompatibilityMode, + ); + } + + late final _CFURLCreateAbsoluteURLWithBytesPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function( + CFAllocatorRef, + ffi.Pointer, + CFIndex, + CFStringEncoding, + CFURLRef, + Boolean)>>('CFURLCreateAbsoluteURLWithBytes'); + late final _CFURLCreateAbsoluteURLWithBytes = + _CFURLCreateAbsoluteURLWithBytesPtr.asFunction< + CFURLRef Function( + CFAllocatorRef, ffi.Pointer, int, int, CFURLRef, int)>(); + + CFURLRef CFURLCreateWithFileSystemPath( + CFAllocatorRef allocator, + CFStringRef filePath, + CFURLPathStyle pathStyle, + DartBoolean isDirectory, + ) { + return _CFURLCreateWithFileSystemPath( + allocator, + filePath, + pathStyle.value, + isDirectory, + ); + } + + late final _CFURLCreateWithFileSystemPathPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFAllocatorRef, CFStringRef, CFIndex, + Boolean)>>('CFURLCreateWithFileSystemPath'); + late final _CFURLCreateWithFileSystemPath = _CFURLCreateWithFileSystemPathPtr + .asFunction(); + + CFURLRef CFURLCreateFromFileSystemRepresentation( + CFAllocatorRef allocator, + ffi.Pointer buffer, + int bufLen, + int isDirectory, + ) { + return _CFURLCreateFromFileSystemRepresentation( + allocator, + buffer, + bufLen, + isDirectory, + ); + } + + late final _CFURLCreateFromFileSystemRepresentationPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFAllocatorRef, ffi.Pointer, CFIndex, + Boolean)>>('CFURLCreateFromFileSystemRepresentation'); + late final _CFURLCreateFromFileSystemRepresentation = + _CFURLCreateFromFileSystemRepresentationPtr.asFunction< + CFURLRef Function(CFAllocatorRef, ffi.Pointer, int, int)>(); + + CFURLRef CFURLCreateWithFileSystemPathRelativeToBase( + CFAllocatorRef allocator, + CFStringRef filePath, + CFURLPathStyle pathStyle, + DartBoolean isDirectory, + CFURLRef baseURL, + ) { + return _CFURLCreateWithFileSystemPathRelativeToBase( + allocator, + filePath, + pathStyle.value, + isDirectory, + baseURL, + ); + } + + late final _CFURLCreateWithFileSystemPathRelativeToBasePtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFAllocatorRef, CFStringRef, CFIndex, Boolean, + CFURLRef)>>('CFURLCreateWithFileSystemPathRelativeToBase'); + late final _CFURLCreateWithFileSystemPathRelativeToBase = + _CFURLCreateWithFileSystemPathRelativeToBasePtr.asFunction< + CFURLRef Function(CFAllocatorRef, CFStringRef, int, int, CFURLRef)>(); + + CFURLRef CFURLCreateFromFileSystemRepresentationRelativeToBase( + CFAllocatorRef allocator, + ffi.Pointer buffer, + int bufLen, + int isDirectory, + CFURLRef baseURL, + ) { + return _CFURLCreateFromFileSystemRepresentationRelativeToBase( + allocator, + buffer, + bufLen, + isDirectory, + baseURL, + ); + } + + late final _CFURLCreateFromFileSystemRepresentationRelativeToBasePtr = + _lookup< + ffi.NativeFunction< + CFURLRef Function(CFAllocatorRef, ffi.Pointer, CFIndex, + Boolean, CFURLRef)>>( + 'CFURLCreateFromFileSystemRepresentationRelativeToBase'); + late final _CFURLCreateFromFileSystemRepresentationRelativeToBase = + _CFURLCreateFromFileSystemRepresentationRelativeToBasePtr.asFunction< + CFURLRef Function( + CFAllocatorRef, ffi.Pointer, int, int, CFURLRef)>(); + + int CFURLGetFileSystemRepresentation( + CFURLRef url, + int resolveAgainstBase, + ffi.Pointer buffer, + int maxBufLen, + ) { + return _CFURLGetFileSystemRepresentation( + url, + resolveAgainstBase, + buffer, + maxBufLen, + ); + } + + late final _CFURLGetFileSystemRepresentationPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFURLRef, Boolean, ffi.Pointer, + CFIndex)>>('CFURLGetFileSystemRepresentation'); + late final _CFURLGetFileSystemRepresentation = + _CFURLGetFileSystemRepresentationPtr.asFunction< + int Function(CFURLRef, int, ffi.Pointer, int)>(); + + CFURLRef CFURLCopyAbsoluteURL( + CFURLRef relativeURL, + ) { + return _CFURLCopyAbsoluteURL( + relativeURL, + ); + } + + late final _CFURLCopyAbsoluteURLPtr = + _lookup>( + 'CFURLCopyAbsoluteURL'); + late final _CFURLCopyAbsoluteURL = + _CFURLCopyAbsoluteURLPtr.asFunction(); + + CFStringRef CFURLGetString( + CFURLRef anURL, + ) { + return _CFURLGetString( + anURL, + ); + } + + late final _CFURLGetStringPtr = + _lookup>( + 'CFURLGetString'); + late final _CFURLGetString = + _CFURLGetStringPtr.asFunction(); + + CFURLRef CFURLGetBaseURL( + CFURLRef anURL, + ) { + return _CFURLGetBaseURL( + anURL, + ); + } + + late final _CFURLGetBaseURLPtr = + _lookup>( + 'CFURLGetBaseURL'); + late final _CFURLGetBaseURL = + _CFURLGetBaseURLPtr.asFunction(); + + int CFURLCanBeDecomposed( + CFURLRef anURL, + ) { + return _CFURLCanBeDecomposed( + anURL, + ); + } + + late final _CFURLCanBeDecomposedPtr = + _lookup>( + 'CFURLCanBeDecomposed'); + late final _CFURLCanBeDecomposed = + _CFURLCanBeDecomposedPtr.asFunction(); + + CFStringRef CFURLCopyScheme( + CFURLRef anURL, + ) { + return _CFURLCopyScheme( + anURL, + ); + } + + late final _CFURLCopySchemePtr = + _lookup>( + 'CFURLCopyScheme'); + late final _CFURLCopyScheme = + _CFURLCopySchemePtr.asFunction(); + + CFStringRef CFURLCopyNetLocation( + CFURLRef anURL, + ) { + return _CFURLCopyNetLocation( + anURL, + ); + } + + late final _CFURLCopyNetLocationPtr = + _lookup>( + 'CFURLCopyNetLocation'); + late final _CFURLCopyNetLocation = + _CFURLCopyNetLocationPtr.asFunction(); + + CFStringRef CFURLCopyPath( + CFURLRef anURL, + ) { + return _CFURLCopyPath( + anURL, + ); + } + + late final _CFURLCopyPathPtr = + _lookup>( + 'CFURLCopyPath'); + late final _CFURLCopyPath = + _CFURLCopyPathPtr.asFunction(); + + CFStringRef CFURLCopyStrictPath( + CFURLRef anURL, + ffi.Pointer isAbsolute, + ) { + return _CFURLCopyStrictPath( + anURL, + isAbsolute, + ); + } + + late final _CFURLCopyStrictPathPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function( + CFURLRef, ffi.Pointer)>>('CFURLCopyStrictPath'); + late final _CFURLCopyStrictPath = _CFURLCopyStrictPathPtr.asFunction< + CFStringRef Function(CFURLRef, ffi.Pointer)>(); + + CFStringRef CFURLCopyFileSystemPath( + CFURLRef anURL, + CFURLPathStyle pathStyle, + ) { + return _CFURLCopyFileSystemPath( + anURL, + pathStyle.value, + ); + } + + late final _CFURLCopyFileSystemPathPtr = + _lookup>( + 'CFURLCopyFileSystemPath'); + late final _CFURLCopyFileSystemPath = _CFURLCopyFileSystemPathPtr.asFunction< + CFStringRef Function(CFURLRef, int)>(); + + int CFURLHasDirectoryPath( + CFURLRef anURL, + ) { + return _CFURLHasDirectoryPath( + anURL, + ); + } + + late final _CFURLHasDirectoryPathPtr = + _lookup>( + 'CFURLHasDirectoryPath'); + late final _CFURLHasDirectoryPath = + _CFURLHasDirectoryPathPtr.asFunction(); + + CFStringRef CFURLCopyResourceSpecifier( + CFURLRef anURL, + ) { + return _CFURLCopyResourceSpecifier( + anURL, + ); + } + + late final _CFURLCopyResourceSpecifierPtr = + _lookup>( + 'CFURLCopyResourceSpecifier'); + late final _CFURLCopyResourceSpecifier = _CFURLCopyResourceSpecifierPtr + .asFunction(); + + CFStringRef CFURLCopyHostName( + CFURLRef anURL, + ) { + return _CFURLCopyHostName( + anURL, + ); + } + + late final _CFURLCopyHostNamePtr = + _lookup>( + 'CFURLCopyHostName'); + late final _CFURLCopyHostName = + _CFURLCopyHostNamePtr.asFunction(); + + int CFURLGetPortNumber( + CFURLRef anURL, + ) { + return _CFURLGetPortNumber( + anURL, + ); + } + + late final _CFURLGetPortNumberPtr = + _lookup>( + 'CFURLGetPortNumber'); + late final _CFURLGetPortNumber = + _CFURLGetPortNumberPtr.asFunction(); + + CFStringRef CFURLCopyUserName( + CFURLRef anURL, + ) { + return _CFURLCopyUserName( + anURL, + ); + } + + late final _CFURLCopyUserNamePtr = + _lookup>( + 'CFURLCopyUserName'); + late final _CFURLCopyUserName = + _CFURLCopyUserNamePtr.asFunction(); + + CFStringRef CFURLCopyPassword( + CFURLRef anURL, + ) { + return _CFURLCopyPassword( + anURL, + ); + } + + late final _CFURLCopyPasswordPtr = + _lookup>( + 'CFURLCopyPassword'); + late final _CFURLCopyPassword = + _CFURLCopyPasswordPtr.asFunction(); + + CFStringRef CFURLCopyParameterString( + CFURLRef anURL, + CFStringRef charactersToLeaveEscaped, + ) { + return _CFURLCopyParameterString( + anURL, + charactersToLeaveEscaped, + ); + } + + late final _CFURLCopyParameterStringPtr = + _lookup>( + 'CFURLCopyParameterString'); + late final _CFURLCopyParameterString = _CFURLCopyParameterStringPtr + .asFunction(); + + CFStringRef CFURLCopyQueryString( + CFURLRef anURL, + CFStringRef charactersToLeaveEscaped, + ) { + return _CFURLCopyQueryString( + anURL, + charactersToLeaveEscaped, + ); + } + + late final _CFURLCopyQueryStringPtr = + _lookup>( + 'CFURLCopyQueryString'); + late final _CFURLCopyQueryString = _CFURLCopyQueryStringPtr.asFunction< + CFStringRef Function(CFURLRef, CFStringRef)>(); + + CFStringRef CFURLCopyFragment( + CFURLRef anURL, + CFStringRef charactersToLeaveEscaped, + ) { + return _CFURLCopyFragment( + anURL, + charactersToLeaveEscaped, + ); + } + + late final _CFURLCopyFragmentPtr = + _lookup>( + 'CFURLCopyFragment'); + late final _CFURLCopyFragment = _CFURLCopyFragmentPtr.asFunction< + CFStringRef Function(CFURLRef, CFStringRef)>(); + + CFStringRef CFURLCopyLastPathComponent( + CFURLRef url, + ) { + return _CFURLCopyLastPathComponent( + url, + ); + } + + late final _CFURLCopyLastPathComponentPtr = + _lookup>( + 'CFURLCopyLastPathComponent'); + late final _CFURLCopyLastPathComponent = _CFURLCopyLastPathComponentPtr + .asFunction(); + + CFStringRef CFURLCopyPathExtension( + CFURLRef url, + ) { + return _CFURLCopyPathExtension( + url, + ); + } + + late final _CFURLCopyPathExtensionPtr = + _lookup>( + 'CFURLCopyPathExtension'); + late final _CFURLCopyPathExtension = + _CFURLCopyPathExtensionPtr.asFunction(); + + CFURLRef CFURLCreateCopyAppendingPathComponent( + CFAllocatorRef allocator, + CFURLRef url, + CFStringRef pathComponent, + int isDirectory, + ) { + return _CFURLCreateCopyAppendingPathComponent( + allocator, + url, + pathComponent, + isDirectory, + ); + } + + late final _CFURLCreateCopyAppendingPathComponentPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFAllocatorRef, CFURLRef, CFStringRef, + Boolean)>>('CFURLCreateCopyAppendingPathComponent'); + late final _CFURLCreateCopyAppendingPathComponent = + _CFURLCreateCopyAppendingPathComponentPtr.asFunction< + CFURLRef Function(CFAllocatorRef, CFURLRef, CFStringRef, int)>(); + + CFURLRef CFURLCreateCopyDeletingLastPathComponent( + CFAllocatorRef allocator, + CFURLRef url, + ) { + return _CFURLCreateCopyDeletingLastPathComponent( + allocator, + url, + ); + } + + late final _CFURLCreateCopyDeletingLastPathComponentPtr = + _lookup>( + 'CFURLCreateCopyDeletingLastPathComponent'); + late final _CFURLCreateCopyDeletingLastPathComponent = + _CFURLCreateCopyDeletingLastPathComponentPtr.asFunction< + CFURLRef Function(CFAllocatorRef, CFURLRef)>(); + + CFURLRef CFURLCreateCopyAppendingPathExtension( + CFAllocatorRef allocator, + CFURLRef url, + CFStringRef extension1, + ) { + return _CFURLCreateCopyAppendingPathExtension( + allocator, + url, + extension1, + ); + } + + late final _CFURLCreateCopyAppendingPathExtensionPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFAllocatorRef, CFURLRef, + CFStringRef)>>('CFURLCreateCopyAppendingPathExtension'); + late final _CFURLCreateCopyAppendingPathExtension = + _CFURLCreateCopyAppendingPathExtensionPtr.asFunction< + CFURLRef Function(CFAllocatorRef, CFURLRef, CFStringRef)>(); + + CFURLRef CFURLCreateCopyDeletingPathExtension( + CFAllocatorRef allocator, + CFURLRef url, + ) { + return _CFURLCreateCopyDeletingPathExtension( + allocator, + url, + ); + } + + late final _CFURLCreateCopyDeletingPathExtensionPtr = + _lookup>( + 'CFURLCreateCopyDeletingPathExtension'); + late final _CFURLCreateCopyDeletingPathExtension = + _CFURLCreateCopyDeletingPathExtensionPtr.asFunction< + CFURLRef Function(CFAllocatorRef, CFURLRef)>(); + + int CFURLGetBytes( + CFURLRef url, + ffi.Pointer buffer, + int bufferLength, + ) { + return _CFURLGetBytes( + url, + buffer, + bufferLength, + ); + } + + late final _CFURLGetBytesPtr = _lookup< + ffi.NativeFunction< + CFIndex Function( + CFURLRef, ffi.Pointer, CFIndex)>>('CFURLGetBytes'); + late final _CFURLGetBytes = _CFURLGetBytesPtr.asFunction< + int Function(CFURLRef, ffi.Pointer, int)>(); + + CFRange CFURLGetByteRangeForComponent( + CFURLRef url, + CFURLComponentType component, + ffi.Pointer rangeIncludingSeparators, + ) { + return _CFURLGetByteRangeForComponent( + url, + component.value, + rangeIncludingSeparators, + ); + } + + late final _CFURLGetByteRangeForComponentPtr = _lookup< + ffi.NativeFunction< + CFRange Function(CFURLRef, CFIndex, + ffi.Pointer)>>('CFURLGetByteRangeForComponent'); + late final _CFURLGetByteRangeForComponent = _CFURLGetByteRangeForComponentPtr + .asFunction)>(); + + CFStringRef CFURLCreateStringByReplacingPercentEscapes( + CFAllocatorRef allocator, + CFStringRef originalString, + CFStringRef charactersToLeaveEscaped, + ) { + return _CFURLCreateStringByReplacingPercentEscapes( + allocator, + originalString, + charactersToLeaveEscaped, + ); + } + + late final _CFURLCreateStringByReplacingPercentEscapesPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef, + CFStringRef)>>('CFURLCreateStringByReplacingPercentEscapes'); + late final _CFURLCreateStringByReplacingPercentEscapes = + _CFURLCreateStringByReplacingPercentEscapesPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef, CFStringRef)>(); + + CFStringRef CFURLCreateStringByReplacingPercentEscapesUsingEncoding( + CFAllocatorRef allocator, + CFStringRef origString, + CFStringRef charsToLeaveEscaped, + int encoding, + ) { + return _CFURLCreateStringByReplacingPercentEscapesUsingEncoding( + allocator, + origString, + charsToLeaveEscaped, + encoding, + ); + } + + late final _CFURLCreateStringByReplacingPercentEscapesUsingEncodingPtr = + _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef, CFStringRef, + CFStringEncoding)>>( + 'CFURLCreateStringByReplacingPercentEscapesUsingEncoding'); + late final _CFURLCreateStringByReplacingPercentEscapesUsingEncoding = + _CFURLCreateStringByReplacingPercentEscapesUsingEncodingPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, CFStringRef, CFStringRef, int)>(); + + CFStringRef CFURLCreateStringByAddingPercentEscapes( + CFAllocatorRef allocator, + CFStringRef originalString, + CFStringRef charactersToLeaveUnescaped, + CFStringRef legalURLCharactersToBeEscaped, + int encoding, + ) { + return _CFURLCreateStringByAddingPercentEscapes( + allocator, + originalString, + charactersToLeaveUnescaped, + legalURLCharactersToBeEscaped, + encoding, + ); + } + + late final _CFURLCreateStringByAddingPercentEscapesPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function( + CFAllocatorRef, + CFStringRef, + CFStringRef, + CFStringRef, + CFStringEncoding)>>('CFURLCreateStringByAddingPercentEscapes'); + late final _CFURLCreateStringByAddingPercentEscapes = + _CFURLCreateStringByAddingPercentEscapesPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, CFStringRef, CFStringRef, CFStringRef, int)>(); + + int CFURLIsFileReferenceURL( + CFURLRef url, + ) { + return _CFURLIsFileReferenceURL( + url, + ); + } + + late final _CFURLIsFileReferenceURLPtr = + _lookup>( + 'CFURLIsFileReferenceURL'); + late final _CFURLIsFileReferenceURL = + _CFURLIsFileReferenceURLPtr.asFunction(); + + CFURLRef CFURLCreateFileReferenceURL( + CFAllocatorRef allocator, + CFURLRef url, + ffi.Pointer error, + ) { + return _CFURLCreateFileReferenceURL( + allocator, + url, + error, + ); + } + + late final _CFURLCreateFileReferenceURLPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFAllocatorRef, CFURLRef, + ffi.Pointer)>>('CFURLCreateFileReferenceURL'); + late final _CFURLCreateFileReferenceURL = + _CFURLCreateFileReferenceURLPtr.asFunction< + CFURLRef Function( + CFAllocatorRef, CFURLRef, ffi.Pointer)>(); + + CFURLRef CFURLCreateFilePathURL( + CFAllocatorRef allocator, + CFURLRef url, + ffi.Pointer error, + ) { + return _CFURLCreateFilePathURL( + allocator, + url, + error, + ); + } + + late final _CFURLCreateFilePathURLPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFAllocatorRef, CFURLRef, + ffi.Pointer)>>('CFURLCreateFilePathURL'); + late final _CFURLCreateFilePathURL = _CFURLCreateFilePathURLPtr.asFunction< + CFURLRef Function(CFAllocatorRef, CFURLRef, ffi.Pointer)>(); + + CFURLRef CFURLCreateFromFSRef( + CFAllocatorRef allocator, + ffi.Pointer fsRef, + ) { + return _CFURLCreateFromFSRef( + allocator, + fsRef, + ); + } + + late final _CFURLCreateFromFSRefPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function( + CFAllocatorRef, ffi.Pointer)>>('CFURLCreateFromFSRef'); + late final _CFURLCreateFromFSRef = _CFURLCreateFromFSRefPtr.asFunction< + CFURLRef Function(CFAllocatorRef, ffi.Pointer)>(); + + int CFURLGetFSRef( + CFURLRef url, + ffi.Pointer fsRef, + ) { + return _CFURLGetFSRef( + url, + fsRef, + ); + } + + late final _CFURLGetFSRefPtr = _lookup< + ffi.NativeFunction)>>( + 'CFURLGetFSRef'); + late final _CFURLGetFSRef = _CFURLGetFSRefPtr.asFunction< + int Function(CFURLRef, ffi.Pointer)>(); + + int CFURLCopyResourcePropertyForKey( + CFURLRef url, + CFStringRef key, + ffi.Pointer propertyValueTypeRefPtr, + ffi.Pointer error, + ) { + return _CFURLCopyResourcePropertyForKey( + url, + key, + propertyValueTypeRefPtr, + error, + ); + } + + late final _CFURLCopyResourcePropertyForKeyPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFURLRef, CFStringRef, ffi.Pointer, + ffi.Pointer)>>('CFURLCopyResourcePropertyForKey'); + late final _CFURLCopyResourcePropertyForKey = + _CFURLCopyResourcePropertyForKeyPtr.asFunction< + int Function(CFURLRef, CFStringRef, ffi.Pointer, + ffi.Pointer)>(); + + CFDictionaryRef CFURLCopyResourcePropertiesForKeys( + CFURLRef url, + CFArrayRef keys, + ffi.Pointer error, + ) { + return _CFURLCopyResourcePropertiesForKeys( + url, + keys, + error, + ); + } + + late final _CFURLCopyResourcePropertiesForKeysPtr = _lookup< + ffi.NativeFunction< + CFDictionaryRef Function(CFURLRef, CFArrayRef, + ffi.Pointer)>>('CFURLCopyResourcePropertiesForKeys'); + late final _CFURLCopyResourcePropertiesForKeys = + _CFURLCopyResourcePropertiesForKeysPtr.asFunction< + CFDictionaryRef Function( + CFURLRef, CFArrayRef, ffi.Pointer)>(); + + int CFURLSetResourcePropertyForKey( + CFURLRef url, + CFStringRef key, + CFTypeRef propertyValue, + ffi.Pointer error, + ) { + return _CFURLSetResourcePropertyForKey( + url, + key, + propertyValue, + error, + ); + } + + late final _CFURLSetResourcePropertyForKeyPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFURLRef, CFStringRef, CFTypeRef, + ffi.Pointer)>>('CFURLSetResourcePropertyForKey'); + late final _CFURLSetResourcePropertyForKey = + _CFURLSetResourcePropertyForKeyPtr.asFunction< + int Function( + CFURLRef, CFStringRef, CFTypeRef, ffi.Pointer)>(); + + int CFURLSetResourcePropertiesForKeys( + CFURLRef url, + CFDictionaryRef keyedPropertyValues, + ffi.Pointer error, + ) { + return _CFURLSetResourcePropertiesForKeys( + url, + keyedPropertyValues, + error, + ); + } + + late final _CFURLSetResourcePropertiesForKeysPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFURLRef, CFDictionaryRef, + ffi.Pointer)>>('CFURLSetResourcePropertiesForKeys'); + late final _CFURLSetResourcePropertiesForKeys = + _CFURLSetResourcePropertiesForKeysPtr.asFunction< + int Function(CFURLRef, CFDictionaryRef, ffi.Pointer)>(); + + late final ffi.Pointer _kCFURLKeysOfUnsetValuesKey = + _lookup('kCFURLKeysOfUnsetValuesKey'); + + CFStringRef get kCFURLKeysOfUnsetValuesKey => + _kCFURLKeysOfUnsetValuesKey.value; + + void CFURLClearResourcePropertyCacheForKey( + CFURLRef url, + CFStringRef key, + ) { + return _CFURLClearResourcePropertyCacheForKey( + url, + key, + ); + } + + late final _CFURLClearResourcePropertyCacheForKeyPtr = + _lookup>( + 'CFURLClearResourcePropertyCacheForKey'); + late final _CFURLClearResourcePropertyCacheForKey = + _CFURLClearResourcePropertyCacheForKeyPtr.asFunction< + void Function(CFURLRef, CFStringRef)>(); + + void CFURLClearResourcePropertyCache( + CFURLRef url, + ) { + return _CFURLClearResourcePropertyCache( + url, + ); + } + + late final _CFURLClearResourcePropertyCachePtr = + _lookup>( + 'CFURLClearResourcePropertyCache'); + late final _CFURLClearResourcePropertyCache = + _CFURLClearResourcePropertyCachePtr.asFunction(); + + void CFURLSetTemporaryResourcePropertyForKey( + CFURLRef url, + CFStringRef key, + CFTypeRef propertyValue, + ) { + return _CFURLSetTemporaryResourcePropertyForKey( + url, + key, + propertyValue, + ); + } + + late final _CFURLSetTemporaryResourcePropertyForKeyPtr = _lookup< + ffi + .NativeFunction>( + 'CFURLSetTemporaryResourcePropertyForKey'); + late final _CFURLSetTemporaryResourcePropertyForKey = + _CFURLSetTemporaryResourcePropertyForKeyPtr.asFunction< + void Function(CFURLRef, CFStringRef, CFTypeRef)>(); + + int CFURLResourceIsReachable( + CFURLRef url, + ffi.Pointer error, + ) { + return _CFURLResourceIsReachable( + url, + error, + ); + } + + late final _CFURLResourceIsReachablePtr = _lookup< + ffi + .NativeFunction)>>( + 'CFURLResourceIsReachable'); + late final _CFURLResourceIsReachable = _CFURLResourceIsReachablePtr + .asFunction)>(); + + late final ffi.Pointer _kCFURLNameKey = + _lookup('kCFURLNameKey'); + + CFStringRef get kCFURLNameKey => _kCFURLNameKey.value; + + late final ffi.Pointer _kCFURLLocalizedNameKey = + _lookup('kCFURLLocalizedNameKey'); + + CFStringRef get kCFURLLocalizedNameKey => _kCFURLLocalizedNameKey.value; + + late final ffi.Pointer _kCFURLIsRegularFileKey = + _lookup('kCFURLIsRegularFileKey'); + + CFStringRef get kCFURLIsRegularFileKey => _kCFURLIsRegularFileKey.value; + + late final ffi.Pointer _kCFURLIsDirectoryKey = + _lookup('kCFURLIsDirectoryKey'); + + CFStringRef get kCFURLIsDirectoryKey => _kCFURLIsDirectoryKey.value; + + late final ffi.Pointer _kCFURLIsSymbolicLinkKey = + _lookup('kCFURLIsSymbolicLinkKey'); + + CFStringRef get kCFURLIsSymbolicLinkKey => _kCFURLIsSymbolicLinkKey.value; + + late final ffi.Pointer _kCFURLIsVolumeKey = + _lookup('kCFURLIsVolumeKey'); + + CFStringRef get kCFURLIsVolumeKey => _kCFURLIsVolumeKey.value; + + late final ffi.Pointer _kCFURLIsPackageKey = + _lookup('kCFURLIsPackageKey'); + + CFStringRef get kCFURLIsPackageKey => _kCFURLIsPackageKey.value; + + late final ffi.Pointer _kCFURLIsApplicationKey = + _lookup('kCFURLIsApplicationKey'); + + CFStringRef get kCFURLIsApplicationKey => _kCFURLIsApplicationKey.value; + + late final ffi.Pointer _kCFURLApplicationIsScriptableKey = + _lookup('kCFURLApplicationIsScriptableKey'); + + CFStringRef get kCFURLApplicationIsScriptableKey => + _kCFURLApplicationIsScriptableKey.value; + + late final ffi.Pointer _kCFURLIsSystemImmutableKey = + _lookup('kCFURLIsSystemImmutableKey'); + + CFStringRef get kCFURLIsSystemImmutableKey => + _kCFURLIsSystemImmutableKey.value; + + late final ffi.Pointer _kCFURLIsUserImmutableKey = + _lookup('kCFURLIsUserImmutableKey'); + + CFStringRef get kCFURLIsUserImmutableKey => _kCFURLIsUserImmutableKey.value; + + late final ffi.Pointer _kCFURLIsHiddenKey = + _lookup('kCFURLIsHiddenKey'); + + CFStringRef get kCFURLIsHiddenKey => _kCFURLIsHiddenKey.value; + + late final ffi.Pointer _kCFURLHasHiddenExtensionKey = + _lookup('kCFURLHasHiddenExtensionKey'); + + CFStringRef get kCFURLHasHiddenExtensionKey => + _kCFURLHasHiddenExtensionKey.value; + + late final ffi.Pointer _kCFURLCreationDateKey = + _lookup('kCFURLCreationDateKey'); + + CFStringRef get kCFURLCreationDateKey => _kCFURLCreationDateKey.value; + + late final ffi.Pointer _kCFURLContentAccessDateKey = + _lookup('kCFURLContentAccessDateKey'); + + CFStringRef get kCFURLContentAccessDateKey => + _kCFURLContentAccessDateKey.value; + + late final ffi.Pointer _kCFURLContentModificationDateKey = + _lookup('kCFURLContentModificationDateKey'); + + CFStringRef get kCFURLContentModificationDateKey => + _kCFURLContentModificationDateKey.value; + + late final ffi.Pointer _kCFURLAttributeModificationDateKey = + _lookup('kCFURLAttributeModificationDateKey'); + + CFStringRef get kCFURLAttributeModificationDateKey => + _kCFURLAttributeModificationDateKey.value; + + late final ffi.Pointer _kCFURLFileIdentifierKey = + _lookup('kCFURLFileIdentifierKey'); + + CFStringRef get kCFURLFileIdentifierKey => _kCFURLFileIdentifierKey.value; + + late final ffi.Pointer _kCFURLFileContentIdentifierKey = + _lookup('kCFURLFileContentIdentifierKey'); + + CFStringRef get kCFURLFileContentIdentifierKey => + _kCFURLFileContentIdentifierKey.value; + + late final ffi.Pointer _kCFURLMayShareFileContentKey = + _lookup('kCFURLMayShareFileContentKey'); + + CFStringRef get kCFURLMayShareFileContentKey => + _kCFURLMayShareFileContentKey.value; + + late final ffi.Pointer _kCFURLMayHaveExtendedAttributesKey = + _lookup('kCFURLMayHaveExtendedAttributesKey'); + + CFStringRef get kCFURLMayHaveExtendedAttributesKey => + _kCFURLMayHaveExtendedAttributesKey.value; + + late final ffi.Pointer _kCFURLIsPurgeableKey = + _lookup('kCFURLIsPurgeableKey'); + + CFStringRef get kCFURLIsPurgeableKey => _kCFURLIsPurgeableKey.value; + + late final ffi.Pointer _kCFURLIsSparseKey = + _lookup('kCFURLIsSparseKey'); + + CFStringRef get kCFURLIsSparseKey => _kCFURLIsSparseKey.value; + + late final ffi.Pointer _kCFURLLinkCountKey = + _lookup('kCFURLLinkCountKey'); + + CFStringRef get kCFURLLinkCountKey => _kCFURLLinkCountKey.value; + + late final ffi.Pointer _kCFURLParentDirectoryURLKey = + _lookup('kCFURLParentDirectoryURLKey'); + + CFStringRef get kCFURLParentDirectoryURLKey => + _kCFURLParentDirectoryURLKey.value; + + late final ffi.Pointer _kCFURLVolumeURLKey = + _lookup('kCFURLVolumeURLKey'); + + CFStringRef get kCFURLVolumeURLKey => _kCFURLVolumeURLKey.value; + + late final ffi.Pointer _kCFURLTypeIdentifierKey = + _lookup('kCFURLTypeIdentifierKey'); + + CFStringRef get kCFURLTypeIdentifierKey => _kCFURLTypeIdentifierKey.value; + + late final ffi.Pointer _kCFURLLocalizedTypeDescriptionKey = + _lookup('kCFURLLocalizedTypeDescriptionKey'); + + CFStringRef get kCFURLLocalizedTypeDescriptionKey => + _kCFURLLocalizedTypeDescriptionKey.value; + + late final ffi.Pointer _kCFURLLabelNumberKey = + _lookup('kCFURLLabelNumberKey'); + + CFStringRef get kCFURLLabelNumberKey => _kCFURLLabelNumberKey.value; + + late final ffi.Pointer _kCFURLLabelColorKey = + _lookup('kCFURLLabelColorKey'); + + CFStringRef get kCFURLLabelColorKey => _kCFURLLabelColorKey.value; + + late final ffi.Pointer _kCFURLLocalizedLabelKey = + _lookup('kCFURLLocalizedLabelKey'); + + CFStringRef get kCFURLLocalizedLabelKey => _kCFURLLocalizedLabelKey.value; + + late final ffi.Pointer _kCFURLEffectiveIconKey = + _lookup('kCFURLEffectiveIconKey'); + + CFStringRef get kCFURLEffectiveIconKey => _kCFURLEffectiveIconKey.value; + + late final ffi.Pointer _kCFURLCustomIconKey = + _lookup('kCFURLCustomIconKey'); + + CFStringRef get kCFURLCustomIconKey => _kCFURLCustomIconKey.value; + + late final ffi.Pointer _kCFURLFileResourceIdentifierKey = + _lookup('kCFURLFileResourceIdentifierKey'); + + CFStringRef get kCFURLFileResourceIdentifierKey => + _kCFURLFileResourceIdentifierKey.value; + + late final ffi.Pointer _kCFURLVolumeIdentifierKey = + _lookup('kCFURLVolumeIdentifierKey'); + + CFStringRef get kCFURLVolumeIdentifierKey => _kCFURLVolumeIdentifierKey.value; + + late final ffi.Pointer _kCFURLPreferredIOBlockSizeKey = + _lookup('kCFURLPreferredIOBlockSizeKey'); + + CFStringRef get kCFURLPreferredIOBlockSizeKey => + _kCFURLPreferredIOBlockSizeKey.value; + + late final ffi.Pointer _kCFURLIsReadableKey = + _lookup('kCFURLIsReadableKey'); + + CFStringRef get kCFURLIsReadableKey => _kCFURLIsReadableKey.value; + + late final ffi.Pointer _kCFURLIsWritableKey = + _lookup('kCFURLIsWritableKey'); + + CFStringRef get kCFURLIsWritableKey => _kCFURLIsWritableKey.value; + + late final ffi.Pointer _kCFURLIsExecutableKey = + _lookup('kCFURLIsExecutableKey'); + + CFStringRef get kCFURLIsExecutableKey => _kCFURLIsExecutableKey.value; + + late final ffi.Pointer _kCFURLFileSecurityKey = + _lookup('kCFURLFileSecurityKey'); + + CFStringRef get kCFURLFileSecurityKey => _kCFURLFileSecurityKey.value; + + late final ffi.Pointer _kCFURLIsExcludedFromBackupKey = + _lookup('kCFURLIsExcludedFromBackupKey'); + + CFStringRef get kCFURLIsExcludedFromBackupKey => + _kCFURLIsExcludedFromBackupKey.value; + + late final ffi.Pointer _kCFURLTagNamesKey = + _lookup('kCFURLTagNamesKey'); + + CFStringRef get kCFURLTagNamesKey => _kCFURLTagNamesKey.value; + + late final ffi.Pointer _kCFURLPathKey = + _lookup('kCFURLPathKey'); + + CFStringRef get kCFURLPathKey => _kCFURLPathKey.value; + + late final ffi.Pointer _kCFURLCanonicalPathKey = + _lookup('kCFURLCanonicalPathKey'); + + CFStringRef get kCFURLCanonicalPathKey => _kCFURLCanonicalPathKey.value; + + late final ffi.Pointer _kCFURLIsMountTriggerKey = + _lookup('kCFURLIsMountTriggerKey'); + + CFStringRef get kCFURLIsMountTriggerKey => _kCFURLIsMountTriggerKey.value; + + late final ffi.Pointer _kCFURLGenerationIdentifierKey = + _lookup('kCFURLGenerationIdentifierKey'); + + CFStringRef get kCFURLGenerationIdentifierKey => + _kCFURLGenerationIdentifierKey.value; + + late final ffi.Pointer _kCFURLDocumentIdentifierKey = + _lookup('kCFURLDocumentIdentifierKey'); + + CFStringRef get kCFURLDocumentIdentifierKey => + _kCFURLDocumentIdentifierKey.value; + + late final ffi.Pointer _kCFURLAddedToDirectoryDateKey = + _lookup('kCFURLAddedToDirectoryDateKey'); + + CFStringRef get kCFURLAddedToDirectoryDateKey => + _kCFURLAddedToDirectoryDateKey.value; + + late final ffi.Pointer _kCFURLQuarantinePropertiesKey = + _lookup('kCFURLQuarantinePropertiesKey'); + + CFStringRef get kCFURLQuarantinePropertiesKey => + _kCFURLQuarantinePropertiesKey.value; + + late final ffi.Pointer _kCFURLFileResourceTypeKey = + _lookup('kCFURLFileResourceTypeKey'); + + CFStringRef get kCFURLFileResourceTypeKey => _kCFURLFileResourceTypeKey.value; + + late final ffi.Pointer _kCFURLFileResourceTypeNamedPipe = + _lookup('kCFURLFileResourceTypeNamedPipe'); + + CFStringRef get kCFURLFileResourceTypeNamedPipe => + _kCFURLFileResourceTypeNamedPipe.value; + + late final ffi.Pointer _kCFURLFileResourceTypeCharacterSpecial = + _lookup('kCFURLFileResourceTypeCharacterSpecial'); + + CFStringRef get kCFURLFileResourceTypeCharacterSpecial => + _kCFURLFileResourceTypeCharacterSpecial.value; + + late final ffi.Pointer _kCFURLFileResourceTypeDirectory = + _lookup('kCFURLFileResourceTypeDirectory'); + + CFStringRef get kCFURLFileResourceTypeDirectory => + _kCFURLFileResourceTypeDirectory.value; + + late final ffi.Pointer _kCFURLFileResourceTypeBlockSpecial = + _lookup('kCFURLFileResourceTypeBlockSpecial'); + + CFStringRef get kCFURLFileResourceTypeBlockSpecial => + _kCFURLFileResourceTypeBlockSpecial.value; + + late final ffi.Pointer _kCFURLFileResourceTypeRegular = + _lookup('kCFURLFileResourceTypeRegular'); + + CFStringRef get kCFURLFileResourceTypeRegular => + _kCFURLFileResourceTypeRegular.value; + + late final ffi.Pointer _kCFURLFileResourceTypeSymbolicLink = + _lookup('kCFURLFileResourceTypeSymbolicLink'); + + CFStringRef get kCFURLFileResourceTypeSymbolicLink => + _kCFURLFileResourceTypeSymbolicLink.value; + + late final ffi.Pointer _kCFURLFileResourceTypeSocket = + _lookup('kCFURLFileResourceTypeSocket'); + + CFStringRef get kCFURLFileResourceTypeSocket => + _kCFURLFileResourceTypeSocket.value; + + late final ffi.Pointer _kCFURLFileResourceTypeUnknown = + _lookup('kCFURLFileResourceTypeUnknown'); + + CFStringRef get kCFURLFileResourceTypeUnknown => + _kCFURLFileResourceTypeUnknown.value; + + late final ffi.Pointer _kCFURLFileSizeKey = + _lookup('kCFURLFileSizeKey'); + + CFStringRef get kCFURLFileSizeKey => _kCFURLFileSizeKey.value; + + late final ffi.Pointer _kCFURLFileAllocatedSizeKey = + _lookup('kCFURLFileAllocatedSizeKey'); + + CFStringRef get kCFURLFileAllocatedSizeKey => + _kCFURLFileAllocatedSizeKey.value; + + late final ffi.Pointer _kCFURLTotalFileSizeKey = + _lookup('kCFURLTotalFileSizeKey'); + + CFStringRef get kCFURLTotalFileSizeKey => _kCFURLTotalFileSizeKey.value; + + late final ffi.Pointer _kCFURLTotalFileAllocatedSizeKey = + _lookup('kCFURLTotalFileAllocatedSizeKey'); + + CFStringRef get kCFURLTotalFileAllocatedSizeKey => + _kCFURLTotalFileAllocatedSizeKey.value; + + late final ffi.Pointer _kCFURLIsAliasFileKey = + _lookup('kCFURLIsAliasFileKey'); + + CFStringRef get kCFURLIsAliasFileKey => _kCFURLIsAliasFileKey.value; + + late final ffi.Pointer _kCFURLFileProtectionKey = + _lookup('kCFURLFileProtectionKey'); + + CFStringRef get kCFURLFileProtectionKey => _kCFURLFileProtectionKey.value; + + late final ffi.Pointer _kCFURLFileProtectionNone = + _lookup('kCFURLFileProtectionNone'); + + CFStringRef get kCFURLFileProtectionNone => _kCFURLFileProtectionNone.value; + + late final ffi.Pointer _kCFURLFileProtectionComplete = + _lookup('kCFURLFileProtectionComplete'); + + CFStringRef get kCFURLFileProtectionComplete => + _kCFURLFileProtectionComplete.value; + + late final ffi.Pointer _kCFURLFileProtectionCompleteUnlessOpen = + _lookup('kCFURLFileProtectionCompleteUnlessOpen'); + + CFStringRef get kCFURLFileProtectionCompleteUnlessOpen => + _kCFURLFileProtectionCompleteUnlessOpen.value; + + late final ffi.Pointer + _kCFURLFileProtectionCompleteUntilFirstUserAuthentication = + _lookup( + 'kCFURLFileProtectionCompleteUntilFirstUserAuthentication'); + + CFStringRef get kCFURLFileProtectionCompleteUntilFirstUserAuthentication => + _kCFURLFileProtectionCompleteUntilFirstUserAuthentication.value; + + late final ffi.Pointer + _kCFURLFileProtectionCompleteWhenUserInactive = + _lookup('kCFURLFileProtectionCompleteWhenUserInactive'); + + CFStringRef get kCFURLFileProtectionCompleteWhenUserInactive => + _kCFURLFileProtectionCompleteWhenUserInactive.value; + + late final ffi.Pointer _kCFURLDirectoryEntryCountKey = + _lookup('kCFURLDirectoryEntryCountKey'); + + CFStringRef get kCFURLDirectoryEntryCountKey => + _kCFURLDirectoryEntryCountKey.value; + + late final ffi.Pointer + _kCFURLVolumeLocalizedFormatDescriptionKey = + _lookup('kCFURLVolumeLocalizedFormatDescriptionKey'); + + CFStringRef get kCFURLVolumeLocalizedFormatDescriptionKey => + _kCFURLVolumeLocalizedFormatDescriptionKey.value; + + late final ffi.Pointer _kCFURLVolumeTotalCapacityKey = + _lookup('kCFURLVolumeTotalCapacityKey'); + + CFStringRef get kCFURLVolumeTotalCapacityKey => + _kCFURLVolumeTotalCapacityKey.value; + + late final ffi.Pointer _kCFURLVolumeAvailableCapacityKey = + _lookup('kCFURLVolumeAvailableCapacityKey'); + + CFStringRef get kCFURLVolumeAvailableCapacityKey => + _kCFURLVolumeAvailableCapacityKey.value; + + late final ffi.Pointer + _kCFURLVolumeAvailableCapacityForImportantUsageKey = + _lookup('kCFURLVolumeAvailableCapacityForImportantUsageKey'); + + CFStringRef get kCFURLVolumeAvailableCapacityForImportantUsageKey => + _kCFURLVolumeAvailableCapacityForImportantUsageKey.value; + + late final ffi.Pointer + _kCFURLVolumeAvailableCapacityForOpportunisticUsageKey = + _lookup( + 'kCFURLVolumeAvailableCapacityForOpportunisticUsageKey'); + + CFStringRef get kCFURLVolumeAvailableCapacityForOpportunisticUsageKey => + _kCFURLVolumeAvailableCapacityForOpportunisticUsageKey.value; + + late final ffi.Pointer _kCFURLVolumeResourceCountKey = + _lookup('kCFURLVolumeResourceCountKey'); + + CFStringRef get kCFURLVolumeResourceCountKey => + _kCFURLVolumeResourceCountKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsPersistentIDsKey = + _lookup('kCFURLVolumeSupportsPersistentIDsKey'); + + CFStringRef get kCFURLVolumeSupportsPersistentIDsKey => + _kCFURLVolumeSupportsPersistentIDsKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsSymbolicLinksKey = + _lookup('kCFURLVolumeSupportsSymbolicLinksKey'); + + CFStringRef get kCFURLVolumeSupportsSymbolicLinksKey => + _kCFURLVolumeSupportsSymbolicLinksKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsHardLinksKey = + _lookup('kCFURLVolumeSupportsHardLinksKey'); + + CFStringRef get kCFURLVolumeSupportsHardLinksKey => + _kCFURLVolumeSupportsHardLinksKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsJournalingKey = + _lookup('kCFURLVolumeSupportsJournalingKey'); + + CFStringRef get kCFURLVolumeSupportsJournalingKey => + _kCFURLVolumeSupportsJournalingKey.value; + + late final ffi.Pointer _kCFURLVolumeIsJournalingKey = + _lookup('kCFURLVolumeIsJournalingKey'); + + CFStringRef get kCFURLVolumeIsJournalingKey => + _kCFURLVolumeIsJournalingKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsSparseFilesKey = + _lookup('kCFURLVolumeSupportsSparseFilesKey'); + + CFStringRef get kCFURLVolumeSupportsSparseFilesKey => + _kCFURLVolumeSupportsSparseFilesKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsZeroRunsKey = + _lookup('kCFURLVolumeSupportsZeroRunsKey'); + + CFStringRef get kCFURLVolumeSupportsZeroRunsKey => + _kCFURLVolumeSupportsZeroRunsKey.value; + + late final ffi.Pointer + _kCFURLVolumeSupportsCaseSensitiveNamesKey = + _lookup('kCFURLVolumeSupportsCaseSensitiveNamesKey'); + + CFStringRef get kCFURLVolumeSupportsCaseSensitiveNamesKey => + _kCFURLVolumeSupportsCaseSensitiveNamesKey.value; + + late final ffi.Pointer + _kCFURLVolumeSupportsCasePreservedNamesKey = + _lookup('kCFURLVolumeSupportsCasePreservedNamesKey'); + + CFStringRef get kCFURLVolumeSupportsCasePreservedNamesKey => + _kCFURLVolumeSupportsCasePreservedNamesKey.value; + + late final ffi.Pointer + _kCFURLVolumeSupportsRootDirectoryDatesKey = + _lookup('kCFURLVolumeSupportsRootDirectoryDatesKey'); + + CFStringRef get kCFURLVolumeSupportsRootDirectoryDatesKey => + _kCFURLVolumeSupportsRootDirectoryDatesKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsVolumeSizesKey = + _lookup('kCFURLVolumeSupportsVolumeSizesKey'); + + CFStringRef get kCFURLVolumeSupportsVolumeSizesKey => + _kCFURLVolumeSupportsVolumeSizesKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsRenamingKey = + _lookup('kCFURLVolumeSupportsRenamingKey'); + + CFStringRef get kCFURLVolumeSupportsRenamingKey => + _kCFURLVolumeSupportsRenamingKey.value; + + late final ffi.Pointer + _kCFURLVolumeSupportsAdvisoryFileLockingKey = + _lookup('kCFURLVolumeSupportsAdvisoryFileLockingKey'); + + CFStringRef get kCFURLVolumeSupportsAdvisoryFileLockingKey => + _kCFURLVolumeSupportsAdvisoryFileLockingKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsExtendedSecurityKey = + _lookup('kCFURLVolumeSupportsExtendedSecurityKey'); + + CFStringRef get kCFURLVolumeSupportsExtendedSecurityKey => + _kCFURLVolumeSupportsExtendedSecurityKey.value; + + late final ffi.Pointer _kCFURLVolumeIsBrowsableKey = + _lookup('kCFURLVolumeIsBrowsableKey'); + + CFStringRef get kCFURLVolumeIsBrowsableKey => + _kCFURLVolumeIsBrowsableKey.value; + + late final ffi.Pointer _kCFURLVolumeMaximumFileSizeKey = + _lookup('kCFURLVolumeMaximumFileSizeKey'); + + CFStringRef get kCFURLVolumeMaximumFileSizeKey => + _kCFURLVolumeMaximumFileSizeKey.value; + + late final ffi.Pointer _kCFURLVolumeIsEjectableKey = + _lookup('kCFURLVolumeIsEjectableKey'); + + CFStringRef get kCFURLVolumeIsEjectableKey => + _kCFURLVolumeIsEjectableKey.value; + + late final ffi.Pointer _kCFURLVolumeIsRemovableKey = + _lookup('kCFURLVolumeIsRemovableKey'); + + CFStringRef get kCFURLVolumeIsRemovableKey => + _kCFURLVolumeIsRemovableKey.value; + + late final ffi.Pointer _kCFURLVolumeIsInternalKey = + _lookup('kCFURLVolumeIsInternalKey'); + + CFStringRef get kCFURLVolumeIsInternalKey => _kCFURLVolumeIsInternalKey.value; + + late final ffi.Pointer _kCFURLVolumeIsAutomountedKey = + _lookup('kCFURLVolumeIsAutomountedKey'); + + CFStringRef get kCFURLVolumeIsAutomountedKey => + _kCFURLVolumeIsAutomountedKey.value; + + late final ffi.Pointer _kCFURLVolumeIsLocalKey = + _lookup('kCFURLVolumeIsLocalKey'); + + CFStringRef get kCFURLVolumeIsLocalKey => _kCFURLVolumeIsLocalKey.value; + + late final ffi.Pointer _kCFURLVolumeIsReadOnlyKey = + _lookup('kCFURLVolumeIsReadOnlyKey'); + + CFStringRef get kCFURLVolumeIsReadOnlyKey => _kCFURLVolumeIsReadOnlyKey.value; + + late final ffi.Pointer _kCFURLVolumeCreationDateKey = + _lookup('kCFURLVolumeCreationDateKey'); + + CFStringRef get kCFURLVolumeCreationDateKey => + _kCFURLVolumeCreationDateKey.value; + + late final ffi.Pointer _kCFURLVolumeURLForRemountingKey = + _lookup('kCFURLVolumeURLForRemountingKey'); + + CFStringRef get kCFURLVolumeURLForRemountingKey => + _kCFURLVolumeURLForRemountingKey.value; + + late final ffi.Pointer _kCFURLVolumeUUIDStringKey = + _lookup('kCFURLVolumeUUIDStringKey'); + + CFStringRef get kCFURLVolumeUUIDStringKey => _kCFURLVolumeUUIDStringKey.value; + + late final ffi.Pointer _kCFURLVolumeNameKey = + _lookup('kCFURLVolumeNameKey'); + + CFStringRef get kCFURLVolumeNameKey => _kCFURLVolumeNameKey.value; + + late final ffi.Pointer _kCFURLVolumeLocalizedNameKey = + _lookup('kCFURLVolumeLocalizedNameKey'); + + CFStringRef get kCFURLVolumeLocalizedNameKey => + _kCFURLVolumeLocalizedNameKey.value; + + late final ffi.Pointer _kCFURLVolumeIsEncryptedKey = + _lookup('kCFURLVolumeIsEncryptedKey'); + + CFStringRef get kCFURLVolumeIsEncryptedKey => + _kCFURLVolumeIsEncryptedKey.value; + + late final ffi.Pointer _kCFURLVolumeIsRootFileSystemKey = + _lookup('kCFURLVolumeIsRootFileSystemKey'); + + CFStringRef get kCFURLVolumeIsRootFileSystemKey => + _kCFURLVolumeIsRootFileSystemKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsCompressionKey = + _lookup('kCFURLVolumeSupportsCompressionKey'); + + CFStringRef get kCFURLVolumeSupportsCompressionKey => + _kCFURLVolumeSupportsCompressionKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsFileCloningKey = + _lookup('kCFURLVolumeSupportsFileCloningKey'); + + CFStringRef get kCFURLVolumeSupportsFileCloningKey => + _kCFURLVolumeSupportsFileCloningKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsSwapRenamingKey = + _lookup('kCFURLVolumeSupportsSwapRenamingKey'); + + CFStringRef get kCFURLVolumeSupportsSwapRenamingKey => + _kCFURLVolumeSupportsSwapRenamingKey.value; + + late final ffi.Pointer + _kCFURLVolumeSupportsExclusiveRenamingKey = + _lookup('kCFURLVolumeSupportsExclusiveRenamingKey'); + + CFStringRef get kCFURLVolumeSupportsExclusiveRenamingKey => + _kCFURLVolumeSupportsExclusiveRenamingKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsImmutableFilesKey = + _lookup('kCFURLVolumeSupportsImmutableFilesKey'); + + CFStringRef get kCFURLVolumeSupportsImmutableFilesKey => + _kCFURLVolumeSupportsImmutableFilesKey.value; + + late final ffi.Pointer + _kCFURLVolumeSupportsAccessPermissionsKey = + _lookup('kCFURLVolumeSupportsAccessPermissionsKey'); + + CFStringRef get kCFURLVolumeSupportsAccessPermissionsKey => + _kCFURLVolumeSupportsAccessPermissionsKey.value; + + late final ffi.Pointer _kCFURLVolumeSupportsFileProtectionKey = + _lookup('kCFURLVolumeSupportsFileProtectionKey'); + + CFStringRef get kCFURLVolumeSupportsFileProtectionKey => + _kCFURLVolumeSupportsFileProtectionKey.value; + + late final ffi.Pointer _kCFURLVolumeTypeNameKey = + _lookup('kCFURLVolumeTypeNameKey'); + + CFStringRef get kCFURLVolumeTypeNameKey => _kCFURLVolumeTypeNameKey.value; + + late final ffi.Pointer _kCFURLVolumeSubtypeKey = + _lookup('kCFURLVolumeSubtypeKey'); + + CFStringRef get kCFURLVolumeSubtypeKey => _kCFURLVolumeSubtypeKey.value; + + late final ffi.Pointer _kCFURLVolumeMountFromLocationKey = + _lookup('kCFURLVolumeMountFromLocationKey'); + + CFStringRef get kCFURLVolumeMountFromLocationKey => + _kCFURLVolumeMountFromLocationKey.value; + + late final ffi.Pointer _kCFURLIsUbiquitousItemKey = + _lookup('kCFURLIsUbiquitousItemKey'); + + CFStringRef get kCFURLIsUbiquitousItemKey => _kCFURLIsUbiquitousItemKey.value; + + late final ffi.Pointer + _kCFURLUbiquitousItemHasUnresolvedConflictsKey = + _lookup('kCFURLUbiquitousItemHasUnresolvedConflictsKey'); + + CFStringRef get kCFURLUbiquitousItemHasUnresolvedConflictsKey => + _kCFURLUbiquitousItemHasUnresolvedConflictsKey.value; + + late final ffi.Pointer _kCFURLUbiquitousItemIsDownloadedKey = + _lookup('kCFURLUbiquitousItemIsDownloadedKey'); + + CFStringRef get kCFURLUbiquitousItemIsDownloadedKey => + _kCFURLUbiquitousItemIsDownloadedKey.value; + + late final ffi.Pointer _kCFURLUbiquitousItemIsDownloadingKey = + _lookup('kCFURLUbiquitousItemIsDownloadingKey'); + + CFStringRef get kCFURLUbiquitousItemIsDownloadingKey => + _kCFURLUbiquitousItemIsDownloadingKey.value; + + late final ffi.Pointer _kCFURLUbiquitousItemIsUploadedKey = + _lookup('kCFURLUbiquitousItemIsUploadedKey'); + + CFStringRef get kCFURLUbiquitousItemIsUploadedKey => + _kCFURLUbiquitousItemIsUploadedKey.value; + + late final ffi.Pointer _kCFURLUbiquitousItemIsUploadingKey = + _lookup('kCFURLUbiquitousItemIsUploadingKey'); + + CFStringRef get kCFURLUbiquitousItemIsUploadingKey => + _kCFURLUbiquitousItemIsUploadingKey.value; + + late final ffi.Pointer + _kCFURLUbiquitousItemPercentDownloadedKey = + _lookup('kCFURLUbiquitousItemPercentDownloadedKey'); + + CFStringRef get kCFURLUbiquitousItemPercentDownloadedKey => + _kCFURLUbiquitousItemPercentDownloadedKey.value; + + late final ffi.Pointer _kCFURLUbiquitousItemPercentUploadedKey = + _lookup('kCFURLUbiquitousItemPercentUploadedKey'); + + CFStringRef get kCFURLUbiquitousItemPercentUploadedKey => + _kCFURLUbiquitousItemPercentUploadedKey.value; + + late final ffi.Pointer + _kCFURLUbiquitousItemDownloadingStatusKey = + _lookup('kCFURLUbiquitousItemDownloadingStatusKey'); + + CFStringRef get kCFURLUbiquitousItemDownloadingStatusKey => + _kCFURLUbiquitousItemDownloadingStatusKey.value; + + late final ffi.Pointer _kCFURLUbiquitousItemDownloadingErrorKey = + _lookup('kCFURLUbiquitousItemDownloadingErrorKey'); + + CFStringRef get kCFURLUbiquitousItemDownloadingErrorKey => + _kCFURLUbiquitousItemDownloadingErrorKey.value; + + late final ffi.Pointer _kCFURLUbiquitousItemUploadingErrorKey = + _lookup('kCFURLUbiquitousItemUploadingErrorKey'); + + CFStringRef get kCFURLUbiquitousItemUploadingErrorKey => + _kCFURLUbiquitousItemUploadingErrorKey.value; + + late final ffi.Pointer + _kCFURLUbiquitousItemIsExcludedFromSyncKey = + _lookup('kCFURLUbiquitousItemIsExcludedFromSyncKey'); + + CFStringRef get kCFURLUbiquitousItemIsExcludedFromSyncKey => + _kCFURLUbiquitousItemIsExcludedFromSyncKey.value; + + late final ffi.Pointer + _kCFURLUbiquitousItemDownloadingStatusNotDownloaded = + _lookup( + 'kCFURLUbiquitousItemDownloadingStatusNotDownloaded'); + + CFStringRef get kCFURLUbiquitousItemDownloadingStatusNotDownloaded => + _kCFURLUbiquitousItemDownloadingStatusNotDownloaded.value; + + late final ffi.Pointer + _kCFURLUbiquitousItemDownloadingStatusDownloaded = + _lookup('kCFURLUbiquitousItemDownloadingStatusDownloaded'); + + CFStringRef get kCFURLUbiquitousItemDownloadingStatusDownloaded => + _kCFURLUbiquitousItemDownloadingStatusDownloaded.value; + + late final ffi.Pointer + _kCFURLUbiquitousItemDownloadingStatusCurrent = + _lookup('kCFURLUbiquitousItemDownloadingStatusCurrent'); + + CFStringRef get kCFURLUbiquitousItemDownloadingStatusCurrent => + _kCFURLUbiquitousItemDownloadingStatusCurrent.value; + + CFDataRef CFURLCreateBookmarkData( + CFAllocatorRef allocator, + CFURLRef url, + CFURLBookmarkCreationOptions options, + CFArrayRef resourcePropertiesToInclude, + CFURLRef relativeToURL, + ffi.Pointer error, + ) { + return _CFURLCreateBookmarkData( + allocator, + url, + options.value, + resourcePropertiesToInclude, + relativeToURL, + error, + ); + } + + late final _CFURLCreateBookmarkDataPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function( + CFAllocatorRef, + CFURLRef, + CFOptionFlags, + CFArrayRef, + CFURLRef, + ffi.Pointer)>>('CFURLCreateBookmarkData'); + late final _CFURLCreateBookmarkData = _CFURLCreateBookmarkDataPtr.asFunction< + CFDataRef Function(CFAllocatorRef, CFURLRef, int, CFArrayRef, CFURLRef, + ffi.Pointer)>(); + + CFURLRef CFURLCreateByResolvingBookmarkData( + CFAllocatorRef allocator, + CFDataRef bookmark, + CFURLBookmarkResolutionOptions options, + CFURLRef relativeToURL, + CFArrayRef resourcePropertiesToInclude, + ffi.Pointer isStale, + ffi.Pointer error, + ) { + return _CFURLCreateByResolvingBookmarkData( + allocator, + bookmark, + options.value, + relativeToURL, + resourcePropertiesToInclude, + isStale, + error, + ); + } + + late final _CFURLCreateByResolvingBookmarkDataPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function( + CFAllocatorRef, + CFDataRef, + CFOptionFlags, + CFURLRef, + CFArrayRef, + ffi.Pointer, + ffi.Pointer)>>('CFURLCreateByResolvingBookmarkData'); + late final _CFURLCreateByResolvingBookmarkData = + _CFURLCreateByResolvingBookmarkDataPtr.asFunction< + CFURLRef Function(CFAllocatorRef, CFDataRef, int, CFURLRef, + CFArrayRef, ffi.Pointer, ffi.Pointer)>(); + + CFDictionaryRef CFURLCreateResourcePropertiesForKeysFromBookmarkData( + CFAllocatorRef allocator, + CFArrayRef resourcePropertiesToReturn, + CFDataRef bookmark, + ) { + return _CFURLCreateResourcePropertiesForKeysFromBookmarkData( + allocator, + resourcePropertiesToReturn, + bookmark, + ); + } + + late final _CFURLCreateResourcePropertiesForKeysFromBookmarkDataPtr = _lookup< + ffi.NativeFunction< + CFDictionaryRef Function(CFAllocatorRef, CFArrayRef, CFDataRef)>>( + 'CFURLCreateResourcePropertiesForKeysFromBookmarkData'); + late final _CFURLCreateResourcePropertiesForKeysFromBookmarkData = + _CFURLCreateResourcePropertiesForKeysFromBookmarkDataPtr.asFunction< + CFDictionaryRef Function(CFAllocatorRef, CFArrayRef, CFDataRef)>(); + + CFTypeRef CFURLCreateResourcePropertyForKeyFromBookmarkData( + CFAllocatorRef allocator, + CFStringRef resourcePropertyKey, + CFDataRef bookmark, + ) { + return _CFURLCreateResourcePropertyForKeyFromBookmarkData( + allocator, + resourcePropertyKey, + bookmark, + ); + } + + late final _CFURLCreateResourcePropertyForKeyFromBookmarkDataPtr = _lookup< + ffi.NativeFunction< + CFTypeRef Function(CFAllocatorRef, CFStringRef, + CFDataRef)>>('CFURLCreateResourcePropertyForKeyFromBookmarkData'); + late final _CFURLCreateResourcePropertyForKeyFromBookmarkData = + _CFURLCreateResourcePropertyForKeyFromBookmarkDataPtr.asFunction< + CFTypeRef Function(CFAllocatorRef, CFStringRef, CFDataRef)>(); + + CFDataRef CFURLCreateBookmarkDataFromFile( + CFAllocatorRef allocator, + CFURLRef fileURL, + ffi.Pointer errorRef, + ) { + return _CFURLCreateBookmarkDataFromFile( + allocator, + fileURL, + errorRef, + ); + } + + late final _CFURLCreateBookmarkDataFromFilePtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(CFAllocatorRef, CFURLRef, + ffi.Pointer)>>('CFURLCreateBookmarkDataFromFile'); + late final _CFURLCreateBookmarkDataFromFile = + _CFURLCreateBookmarkDataFromFilePtr.asFunction< + CFDataRef Function( + CFAllocatorRef, CFURLRef, ffi.Pointer)>(); + + int CFURLWriteBookmarkDataToFile( + CFDataRef bookmarkRef, + CFURLRef fileURL, + int options, + ffi.Pointer errorRef, + ) { + return _CFURLWriteBookmarkDataToFile( + bookmarkRef, + fileURL, + options, + errorRef, + ); + } + + late final _CFURLWriteBookmarkDataToFilePtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFDataRef, + CFURLRef, + CFURLBookmarkFileCreationOptions, + ffi.Pointer)>>('CFURLWriteBookmarkDataToFile'); + late final _CFURLWriteBookmarkDataToFile = + _CFURLWriteBookmarkDataToFilePtr.asFunction< + int Function(CFDataRef, CFURLRef, int, ffi.Pointer)>(); + + CFDataRef CFURLCreateBookmarkDataFromAliasRecord( + CFAllocatorRef allocatorRef, + CFDataRef aliasRecordDataRef, + ) { + return _CFURLCreateBookmarkDataFromAliasRecord( + allocatorRef, + aliasRecordDataRef, + ); + } + + late final _CFURLCreateBookmarkDataFromAliasRecordPtr = _lookup< + ffi.NativeFunction>( + 'CFURLCreateBookmarkDataFromAliasRecord'); + late final _CFURLCreateBookmarkDataFromAliasRecord = + _CFURLCreateBookmarkDataFromAliasRecordPtr.asFunction< + CFDataRef Function(CFAllocatorRef, CFDataRef)>(); + + int CFURLStartAccessingSecurityScopedResource( + CFURLRef url, + ) { + return _CFURLStartAccessingSecurityScopedResource( + url, + ); + } + + late final _CFURLStartAccessingSecurityScopedResourcePtr = + _lookup>( + 'CFURLStartAccessingSecurityScopedResource'); + late final _CFURLStartAccessingSecurityScopedResource = + _CFURLStartAccessingSecurityScopedResourcePtr.asFunction< + int Function(CFURLRef)>(); + + void CFURLStopAccessingSecurityScopedResource( + CFURLRef url, + ) { + return _CFURLStopAccessingSecurityScopedResource( + url, + ); + } + + late final _CFURLStopAccessingSecurityScopedResourcePtr = + _lookup>( + 'CFURLStopAccessingSecurityScopedResource'); + late final _CFURLStopAccessingSecurityScopedResource = + _CFURLStopAccessingSecurityScopedResourcePtr.asFunction< + void Function(CFURLRef)>(); + + late final ffi.Pointer _kCFRunLoopDefaultMode = + _lookup('kCFRunLoopDefaultMode'); + + CFRunLoopMode get kCFRunLoopDefaultMode => _kCFRunLoopDefaultMode.value; + + late final ffi.Pointer _kCFRunLoopCommonModes = + _lookup('kCFRunLoopCommonModes'); + + CFRunLoopMode get kCFRunLoopCommonModes => _kCFRunLoopCommonModes.value; + + int CFRunLoopGetTypeID() { + return _CFRunLoopGetTypeID(); + } + + late final _CFRunLoopGetTypeIDPtr = + _lookup>('CFRunLoopGetTypeID'); + late final _CFRunLoopGetTypeID = + _CFRunLoopGetTypeIDPtr.asFunction(); + + CFRunLoopRef CFRunLoopGetCurrent() { + return _CFRunLoopGetCurrent(); + } + + late final _CFRunLoopGetCurrentPtr = + _lookup>( + 'CFRunLoopGetCurrent'); + late final _CFRunLoopGetCurrent = + _CFRunLoopGetCurrentPtr.asFunction(); + + CFRunLoopRef CFRunLoopGetMain() { + return _CFRunLoopGetMain(); + } + + late final _CFRunLoopGetMainPtr = + _lookup>('CFRunLoopGetMain'); + late final _CFRunLoopGetMain = + _CFRunLoopGetMainPtr.asFunction(); + + CFRunLoopMode CFRunLoopCopyCurrentMode( + CFRunLoopRef rl, + ) { + return _CFRunLoopCopyCurrentMode( + rl, + ); + } + + late final _CFRunLoopCopyCurrentModePtr = + _lookup>( + 'CFRunLoopCopyCurrentMode'); + late final _CFRunLoopCopyCurrentMode = _CFRunLoopCopyCurrentModePtr + .asFunction(); + + CFArrayRef CFRunLoopCopyAllModes( + CFRunLoopRef rl, + ) { + return _CFRunLoopCopyAllModes( + rl, + ); + } + + late final _CFRunLoopCopyAllModesPtr = + _lookup>( + 'CFRunLoopCopyAllModes'); + late final _CFRunLoopCopyAllModes = + _CFRunLoopCopyAllModesPtr.asFunction(); + + void CFRunLoopAddCommonMode( + CFRunLoopRef rl, + CFRunLoopMode mode, + ) { + return _CFRunLoopAddCommonMode( + rl, + mode, + ); + } + + late final _CFRunLoopAddCommonModePtr = _lookup< + ffi.NativeFunction>( + 'CFRunLoopAddCommonMode'); + late final _CFRunLoopAddCommonMode = _CFRunLoopAddCommonModePtr.asFunction< + void Function(CFRunLoopRef, CFRunLoopMode)>(); + + double CFRunLoopGetNextTimerFireDate( + CFRunLoopRef rl, + CFRunLoopMode mode, + ) { + return _CFRunLoopGetNextTimerFireDate( + rl, + mode, + ); + } + + late final _CFRunLoopGetNextTimerFireDatePtr = _lookup< + ffi.NativeFunction< + CFAbsoluteTime Function( + CFRunLoopRef, CFRunLoopMode)>>('CFRunLoopGetNextTimerFireDate'); + late final _CFRunLoopGetNextTimerFireDate = _CFRunLoopGetNextTimerFireDatePtr + .asFunction(); + + void CFRunLoopRun() { + return _CFRunLoopRun(); + } + + late final _CFRunLoopRunPtr = + _lookup>('CFRunLoopRun'); + late final _CFRunLoopRun = _CFRunLoopRunPtr.asFunction(); + + CFRunLoopRunResult CFRunLoopRunInMode( + CFRunLoopMode mode, + DartCFTimeInterval seconds, + DartBoolean returnAfterSourceHandled, + ) { + return CFRunLoopRunResult.fromValue(_CFRunLoopRunInMode( + mode, + seconds, + returnAfterSourceHandled, + )); + } + + late final _CFRunLoopRunInModePtr = _lookup< + ffi.NativeFunction< + SInt32 Function( + CFRunLoopMode, CFTimeInterval, Boolean)>>('CFRunLoopRunInMode'); + late final _CFRunLoopRunInMode = _CFRunLoopRunInModePtr.asFunction< + int Function(CFRunLoopMode, double, int)>(); + + int CFRunLoopIsWaiting( + CFRunLoopRef rl, + ) { + return _CFRunLoopIsWaiting( + rl, + ); + } + + late final _CFRunLoopIsWaitingPtr = + _lookup>( + 'CFRunLoopIsWaiting'); + late final _CFRunLoopIsWaiting = + _CFRunLoopIsWaitingPtr.asFunction(); + + void CFRunLoopWakeUp( + CFRunLoopRef rl, + ) { + return _CFRunLoopWakeUp( + rl, + ); + } + + late final _CFRunLoopWakeUpPtr = + _lookup>( + 'CFRunLoopWakeUp'); + late final _CFRunLoopWakeUp = + _CFRunLoopWakeUpPtr.asFunction(); + + void CFRunLoopStop( + CFRunLoopRef rl, + ) { + return _CFRunLoopStop( + rl, + ); + } + + late final _CFRunLoopStopPtr = + _lookup>( + 'CFRunLoopStop'); + late final _CFRunLoopStop = + _CFRunLoopStopPtr.asFunction(); + + void CFRunLoopPerformBlock( + CFRunLoopRef rl, + CFTypeRef mode, + objc.ObjCBlock block, + ) { + return _CFRunLoopPerformBlock( + rl, + mode, + block.ref.pointer, + ); + } + + late final _CFRunLoopPerformBlockPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopRef, CFTypeRef, + ffi.Pointer)>>('CFRunLoopPerformBlock'); + late final _CFRunLoopPerformBlock = _CFRunLoopPerformBlockPtr.asFunction< + void Function( + CFRunLoopRef, CFTypeRef, ffi.Pointer)>(); + + int CFRunLoopContainsSource( + CFRunLoopRef rl, + CFRunLoopSourceRef source, + CFRunLoopMode mode, + ) { + return _CFRunLoopContainsSource( + rl, + source, + mode, + ); + } + + late final _CFRunLoopContainsSourcePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFRunLoopRef, CFRunLoopSourceRef, + CFRunLoopMode)>>('CFRunLoopContainsSource'); + late final _CFRunLoopContainsSource = _CFRunLoopContainsSourcePtr.asFunction< + int Function(CFRunLoopRef, CFRunLoopSourceRef, CFRunLoopMode)>(); + + void CFRunLoopAddSource( + CFRunLoopRef rl, + CFRunLoopSourceRef source, + CFRunLoopMode mode, + ) { + return _CFRunLoopAddSource( + rl, + source, + mode, + ); + } + + late final _CFRunLoopAddSourcePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopRef, CFRunLoopSourceRef, + CFRunLoopMode)>>('CFRunLoopAddSource'); + late final _CFRunLoopAddSource = _CFRunLoopAddSourcePtr.asFunction< + void Function(CFRunLoopRef, CFRunLoopSourceRef, CFRunLoopMode)>(); + + void CFRunLoopRemoveSource( + CFRunLoopRef rl, + CFRunLoopSourceRef source, + CFRunLoopMode mode, + ) { + return _CFRunLoopRemoveSource( + rl, + source, + mode, + ); + } + + late final _CFRunLoopRemoveSourcePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopRef, CFRunLoopSourceRef, + CFRunLoopMode)>>('CFRunLoopRemoveSource'); + late final _CFRunLoopRemoveSource = _CFRunLoopRemoveSourcePtr.asFunction< + void Function(CFRunLoopRef, CFRunLoopSourceRef, CFRunLoopMode)>(); + + int CFRunLoopContainsObserver( + CFRunLoopRef rl, + CFRunLoopObserverRef observer, + CFRunLoopMode mode, + ) { + return _CFRunLoopContainsObserver( + rl, + observer, + mode, + ); + } + + late final _CFRunLoopContainsObserverPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFRunLoopRef, CFRunLoopObserverRef, + CFRunLoopMode)>>('CFRunLoopContainsObserver'); + late final _CFRunLoopContainsObserver = + _CFRunLoopContainsObserverPtr.asFunction< + int Function(CFRunLoopRef, CFRunLoopObserverRef, CFRunLoopMode)>(); + + void CFRunLoopAddObserver( + CFRunLoopRef rl, + CFRunLoopObserverRef observer, + CFRunLoopMode mode, + ) { + return _CFRunLoopAddObserver( + rl, + observer, + mode, + ); + } + + late final _CFRunLoopAddObserverPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopRef, CFRunLoopObserverRef, + CFRunLoopMode)>>('CFRunLoopAddObserver'); + late final _CFRunLoopAddObserver = _CFRunLoopAddObserverPtr.asFunction< + void Function(CFRunLoopRef, CFRunLoopObserverRef, CFRunLoopMode)>(); + + void CFRunLoopRemoveObserver( + CFRunLoopRef rl, + CFRunLoopObserverRef observer, + CFRunLoopMode mode, + ) { + return _CFRunLoopRemoveObserver( + rl, + observer, + mode, + ); + } + + late final _CFRunLoopRemoveObserverPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopRef, CFRunLoopObserverRef, + CFRunLoopMode)>>('CFRunLoopRemoveObserver'); + late final _CFRunLoopRemoveObserver = _CFRunLoopRemoveObserverPtr.asFunction< + void Function(CFRunLoopRef, CFRunLoopObserverRef, CFRunLoopMode)>(); + + int CFRunLoopContainsTimer( + CFRunLoopRef rl, + CFRunLoopTimerRef timer, + CFRunLoopMode mode, + ) { + return _CFRunLoopContainsTimer( + rl, + timer, + mode, + ); + } + + late final _CFRunLoopContainsTimerPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFRunLoopRef, CFRunLoopTimerRef, + CFRunLoopMode)>>('CFRunLoopContainsTimer'); + late final _CFRunLoopContainsTimer = _CFRunLoopContainsTimerPtr.asFunction< + int Function(CFRunLoopRef, CFRunLoopTimerRef, CFRunLoopMode)>(); + + void CFRunLoopAddTimer( + CFRunLoopRef rl, + CFRunLoopTimerRef timer, + CFRunLoopMode mode, + ) { + return _CFRunLoopAddTimer( + rl, + timer, + mode, + ); + } + + late final _CFRunLoopAddTimerPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopRef, CFRunLoopTimerRef, + CFRunLoopMode)>>('CFRunLoopAddTimer'); + late final _CFRunLoopAddTimer = _CFRunLoopAddTimerPtr.asFunction< + void Function(CFRunLoopRef, CFRunLoopTimerRef, CFRunLoopMode)>(); + + void CFRunLoopRemoveTimer( + CFRunLoopRef rl, + CFRunLoopTimerRef timer, + CFRunLoopMode mode, + ) { + return _CFRunLoopRemoveTimer( + rl, + timer, + mode, + ); + } + + late final _CFRunLoopRemoveTimerPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopRef, CFRunLoopTimerRef, + CFRunLoopMode)>>('CFRunLoopRemoveTimer'); + late final _CFRunLoopRemoveTimer = _CFRunLoopRemoveTimerPtr.asFunction< + void Function(CFRunLoopRef, CFRunLoopTimerRef, CFRunLoopMode)>(); + + int CFRunLoopSourceGetTypeID() { + return _CFRunLoopSourceGetTypeID(); + } + + late final _CFRunLoopSourceGetTypeIDPtr = + _lookup>( + 'CFRunLoopSourceGetTypeID'); + late final _CFRunLoopSourceGetTypeID = + _CFRunLoopSourceGetTypeIDPtr.asFunction(); + + CFRunLoopSourceRef CFRunLoopSourceCreate( + CFAllocatorRef allocator, + int order, + ffi.Pointer context, + ) { + return _CFRunLoopSourceCreate( + allocator, + order, + context, + ); + } + + late final _CFRunLoopSourceCreatePtr = _lookup< + ffi.NativeFunction< + CFRunLoopSourceRef Function(CFAllocatorRef, CFIndex, + ffi.Pointer)>>('CFRunLoopSourceCreate'); + late final _CFRunLoopSourceCreate = _CFRunLoopSourceCreatePtr.asFunction< + CFRunLoopSourceRef Function( + CFAllocatorRef, int, ffi.Pointer)>(); + + int CFRunLoopSourceGetOrder( + CFRunLoopSourceRef source, + ) { + return _CFRunLoopSourceGetOrder( + source, + ); + } + + late final _CFRunLoopSourceGetOrderPtr = + _lookup>( + 'CFRunLoopSourceGetOrder'); + late final _CFRunLoopSourceGetOrder = _CFRunLoopSourceGetOrderPtr.asFunction< + int Function(CFRunLoopSourceRef)>(); + + void CFRunLoopSourceInvalidate( + CFRunLoopSourceRef source, + ) { + return _CFRunLoopSourceInvalidate( + source, + ); + } + + late final _CFRunLoopSourceInvalidatePtr = + _lookup>( + 'CFRunLoopSourceInvalidate'); + late final _CFRunLoopSourceInvalidate = _CFRunLoopSourceInvalidatePtr + .asFunction(); + + int CFRunLoopSourceIsValid( + CFRunLoopSourceRef source, + ) { + return _CFRunLoopSourceIsValid( + source, + ); + } + + late final _CFRunLoopSourceIsValidPtr = + _lookup>( + 'CFRunLoopSourceIsValid'); + late final _CFRunLoopSourceIsValid = + _CFRunLoopSourceIsValidPtr.asFunction(); + + void CFRunLoopSourceGetContext( + CFRunLoopSourceRef source, + ffi.Pointer context, + ) { + return _CFRunLoopSourceGetContext( + source, + context, + ); + } + + late final _CFRunLoopSourceGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFRunLoopSourceRef, ffi.Pointer)>>( + 'CFRunLoopSourceGetContext'); + late final _CFRunLoopSourceGetContext = + _CFRunLoopSourceGetContextPtr.asFunction< + void Function( + CFRunLoopSourceRef, ffi.Pointer)>(); + + void CFRunLoopSourceSignal( + CFRunLoopSourceRef source, + ) { + return _CFRunLoopSourceSignal( + source, + ); + } + + late final _CFRunLoopSourceSignalPtr = + _lookup>( + 'CFRunLoopSourceSignal'); + late final _CFRunLoopSourceSignal = + _CFRunLoopSourceSignalPtr.asFunction(); + + int CFRunLoopObserverGetTypeID() { + return _CFRunLoopObserverGetTypeID(); + } + + late final _CFRunLoopObserverGetTypeIDPtr = + _lookup>( + 'CFRunLoopObserverGetTypeID'); + late final _CFRunLoopObserverGetTypeID = + _CFRunLoopObserverGetTypeIDPtr.asFunction(); + + CFRunLoopObserverRef CFRunLoopObserverCreate( + CFAllocatorRef allocator, + int activities, + int repeats, + int order, + CFRunLoopObserverCallBack callout, + ffi.Pointer context, + ) { + return _CFRunLoopObserverCreate( + allocator, + activities, + repeats, + order, + callout, + context, + ); + } + + late final _CFRunLoopObserverCreatePtr = _lookup< + ffi.NativeFunction< + CFRunLoopObserverRef Function( + CFAllocatorRef, + CFOptionFlags, + Boolean, + CFIndex, + CFRunLoopObserverCallBack, + ffi.Pointer)>>( + 'CFRunLoopObserverCreate'); + late final _CFRunLoopObserverCreate = _CFRunLoopObserverCreatePtr.asFunction< + CFRunLoopObserverRef Function(CFAllocatorRef, int, int, int, + CFRunLoopObserverCallBack, ffi.Pointer)>(); + + CFRunLoopObserverRef CFRunLoopObserverCreateWithHandler( + CFAllocatorRef allocator, + DartCFOptionFlags activities, + DartBoolean repeats, + DartCFIndex order, + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__CFRunLoopObserver>, CFOptionFlags)> + block, + ) { + return _CFRunLoopObserverCreateWithHandler( + allocator, + activities, + repeats, + order, + block.ref.pointer, + ); + } + + late final _CFRunLoopObserverCreateWithHandlerPtr = _lookup< + ffi.NativeFunction< + CFRunLoopObserverRef Function(CFAllocatorRef, CFOptionFlags, + Boolean, CFIndex, ffi.Pointer)>>( + 'CFRunLoopObserverCreateWithHandler'); + late final _CFRunLoopObserverCreateWithHandler = + _CFRunLoopObserverCreateWithHandlerPtr.asFunction< + CFRunLoopObserverRef Function(CFAllocatorRef, int, int, int, + ffi.Pointer)>(); + + int CFRunLoopObserverGetActivities( + CFRunLoopObserverRef observer, + ) { + return _CFRunLoopObserverGetActivities( + observer, + ); + } + + late final _CFRunLoopObserverGetActivitiesPtr = + _lookup>( + 'CFRunLoopObserverGetActivities'); + late final _CFRunLoopObserverGetActivities = + _CFRunLoopObserverGetActivitiesPtr.asFunction< + int Function(CFRunLoopObserverRef)>(); + + int CFRunLoopObserverDoesRepeat( + CFRunLoopObserverRef observer, + ) { + return _CFRunLoopObserverDoesRepeat( + observer, + ); + } + + late final _CFRunLoopObserverDoesRepeatPtr = + _lookup>( + 'CFRunLoopObserverDoesRepeat'); + late final _CFRunLoopObserverDoesRepeat = _CFRunLoopObserverDoesRepeatPtr + .asFunction(); + + int CFRunLoopObserverGetOrder( + CFRunLoopObserverRef observer, + ) { + return _CFRunLoopObserverGetOrder( + observer, + ); + } + + late final _CFRunLoopObserverGetOrderPtr = + _lookup>( + 'CFRunLoopObserverGetOrder'); + late final _CFRunLoopObserverGetOrder = _CFRunLoopObserverGetOrderPtr + .asFunction(); + + void CFRunLoopObserverInvalidate( + CFRunLoopObserverRef observer, + ) { + return _CFRunLoopObserverInvalidate( + observer, + ); + } + + late final _CFRunLoopObserverInvalidatePtr = + _lookup>( + 'CFRunLoopObserverInvalidate'); + late final _CFRunLoopObserverInvalidate = _CFRunLoopObserverInvalidatePtr + .asFunction(); + + int CFRunLoopObserverIsValid( + CFRunLoopObserverRef observer, + ) { + return _CFRunLoopObserverIsValid( + observer, + ); + } + + late final _CFRunLoopObserverIsValidPtr = + _lookup>( + 'CFRunLoopObserverIsValid'); + late final _CFRunLoopObserverIsValid = _CFRunLoopObserverIsValidPtr + .asFunction(); + + void CFRunLoopObserverGetContext( + CFRunLoopObserverRef observer, + ffi.Pointer context, + ) { + return _CFRunLoopObserverGetContext( + observer, + context, + ); + } + + late final _CFRunLoopObserverGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopObserverRef, + ffi.Pointer)>>( + 'CFRunLoopObserverGetContext'); + late final _CFRunLoopObserverGetContext = + _CFRunLoopObserverGetContextPtr.asFunction< + void Function( + CFRunLoopObserverRef, ffi.Pointer)>(); + + int CFRunLoopTimerGetTypeID() { + return _CFRunLoopTimerGetTypeID(); + } + + late final _CFRunLoopTimerGetTypeIDPtr = + _lookup>( + 'CFRunLoopTimerGetTypeID'); + late final _CFRunLoopTimerGetTypeID = + _CFRunLoopTimerGetTypeIDPtr.asFunction(); + + CFRunLoopTimerRef CFRunLoopTimerCreate( + CFAllocatorRef allocator, + double fireDate, + double interval, + int flags, + int order, + CFRunLoopTimerCallBack callout, + ffi.Pointer context, + ) { + return _CFRunLoopTimerCreate( + allocator, + fireDate, + interval, + flags, + order, + callout, + context, + ); + } + + late final _CFRunLoopTimerCreatePtr = _lookup< + ffi.NativeFunction< + CFRunLoopTimerRef Function( + CFAllocatorRef, + CFAbsoluteTime, + CFTimeInterval, + CFOptionFlags, + CFIndex, + CFRunLoopTimerCallBack, + ffi.Pointer)>>('CFRunLoopTimerCreate'); + late final _CFRunLoopTimerCreate = _CFRunLoopTimerCreatePtr.asFunction< + CFRunLoopTimerRef Function(CFAllocatorRef, double, double, int, int, + CFRunLoopTimerCallBack, ffi.Pointer)>(); + + CFRunLoopTimerRef CFRunLoopTimerCreateWithHandler( + CFAllocatorRef allocator, + DartCFTimeInterval fireDate, + DartCFTimeInterval interval, + DartCFOptionFlags flags, + DartCFIndex order, + objc.ObjCBlock)> block, + ) { + return _CFRunLoopTimerCreateWithHandler( + allocator, + fireDate, + interval, + flags, + order, + block.ref.pointer, + ); + } + + late final _CFRunLoopTimerCreateWithHandlerPtr = _lookup< + ffi.NativeFunction< + CFRunLoopTimerRef Function( + CFAllocatorRef, + CFAbsoluteTime, + CFTimeInterval, + CFOptionFlags, + CFIndex, + ffi.Pointer)>>( + 'CFRunLoopTimerCreateWithHandler'); + late final _CFRunLoopTimerCreateWithHandler = + _CFRunLoopTimerCreateWithHandlerPtr.asFunction< + CFRunLoopTimerRef Function(CFAllocatorRef, double, double, int, int, + ffi.Pointer)>(); + + double CFRunLoopTimerGetNextFireDate( + CFRunLoopTimerRef timer, + ) { + return _CFRunLoopTimerGetNextFireDate( + timer, + ); + } + + late final _CFRunLoopTimerGetNextFireDatePtr = + _lookup>( + 'CFRunLoopTimerGetNextFireDate'); + late final _CFRunLoopTimerGetNextFireDate = _CFRunLoopTimerGetNextFireDatePtr + .asFunction(); + + void CFRunLoopTimerSetNextFireDate( + CFRunLoopTimerRef timer, + double fireDate, + ) { + return _CFRunLoopTimerSetNextFireDate( + timer, + fireDate, + ); + } + + late final _CFRunLoopTimerSetNextFireDatePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopTimerRef, + CFAbsoluteTime)>>('CFRunLoopTimerSetNextFireDate'); + late final _CFRunLoopTimerSetNextFireDate = _CFRunLoopTimerSetNextFireDatePtr + .asFunction(); + + double CFRunLoopTimerGetInterval( + CFRunLoopTimerRef timer, + ) { + return _CFRunLoopTimerGetInterval( + timer, + ); + } + + late final _CFRunLoopTimerGetIntervalPtr = + _lookup>( + 'CFRunLoopTimerGetInterval'); + late final _CFRunLoopTimerGetInterval = _CFRunLoopTimerGetIntervalPtr + .asFunction(); + + int CFRunLoopTimerDoesRepeat( + CFRunLoopTimerRef timer, + ) { + return _CFRunLoopTimerDoesRepeat( + timer, + ); + } + + late final _CFRunLoopTimerDoesRepeatPtr = + _lookup>( + 'CFRunLoopTimerDoesRepeat'); + late final _CFRunLoopTimerDoesRepeat = _CFRunLoopTimerDoesRepeatPtr + .asFunction(); + + int CFRunLoopTimerGetOrder( + CFRunLoopTimerRef timer, + ) { + return _CFRunLoopTimerGetOrder( + timer, + ); + } + + late final _CFRunLoopTimerGetOrderPtr = + _lookup>( + 'CFRunLoopTimerGetOrder'); + late final _CFRunLoopTimerGetOrder = + _CFRunLoopTimerGetOrderPtr.asFunction(); + + void CFRunLoopTimerInvalidate( + CFRunLoopTimerRef timer, + ) { + return _CFRunLoopTimerInvalidate( + timer, + ); + } + + late final _CFRunLoopTimerInvalidatePtr = + _lookup>( + 'CFRunLoopTimerInvalidate'); + late final _CFRunLoopTimerInvalidate = _CFRunLoopTimerInvalidatePtr + .asFunction(); + + int CFRunLoopTimerIsValid( + CFRunLoopTimerRef timer, + ) { + return _CFRunLoopTimerIsValid( + timer, + ); + } + + late final _CFRunLoopTimerIsValidPtr = + _lookup>( + 'CFRunLoopTimerIsValid'); + late final _CFRunLoopTimerIsValid = + _CFRunLoopTimerIsValidPtr.asFunction(); + + void CFRunLoopTimerGetContext( + CFRunLoopTimerRef timer, + ffi.Pointer context, + ) { + return _CFRunLoopTimerGetContext( + timer, + context, + ); + } + + late final _CFRunLoopTimerGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopTimerRef, + ffi.Pointer)>>('CFRunLoopTimerGetContext'); + late final _CFRunLoopTimerGetContext = + _CFRunLoopTimerGetContextPtr.asFunction< + void Function( + CFRunLoopTimerRef, ffi.Pointer)>(); + + double CFRunLoopTimerGetTolerance( + CFRunLoopTimerRef timer, + ) { + return _CFRunLoopTimerGetTolerance( + timer, + ); + } + + late final _CFRunLoopTimerGetTolerancePtr = + _lookup>( + 'CFRunLoopTimerGetTolerance'); + late final _CFRunLoopTimerGetTolerance = _CFRunLoopTimerGetTolerancePtr + .asFunction(); + + void CFRunLoopTimerSetTolerance( + CFRunLoopTimerRef timer, + double tolerance, + ) { + return _CFRunLoopTimerSetTolerance( + timer, + tolerance, + ); + } + + late final _CFRunLoopTimerSetTolerancePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFRunLoopTimerRef, + CFTimeInterval)>>('CFRunLoopTimerSetTolerance'); + late final _CFRunLoopTimerSetTolerance = _CFRunLoopTimerSetTolerancePtr + .asFunction(); + + int CFSocketGetTypeID() { + return _CFSocketGetTypeID(); + } + + late final _CFSocketGetTypeIDPtr = + _lookup>('CFSocketGetTypeID'); + late final _CFSocketGetTypeID = + _CFSocketGetTypeIDPtr.asFunction(); + + CFSocketRef CFSocketCreate( + CFAllocatorRef allocator, + int protocolFamily, + int socketType, + int protocol, + int callBackTypes, + CFSocketCallBack callout, + ffi.Pointer context, + ) { + return _CFSocketCreate( + allocator, + protocolFamily, + socketType, + protocol, + callBackTypes, + callout, + context, + ); + } + + late final _CFSocketCreatePtr = _lookup< + ffi.NativeFunction< + CFSocketRef Function( + CFAllocatorRef, + SInt32, + SInt32, + SInt32, + CFOptionFlags, + CFSocketCallBack, + ffi.Pointer)>>('CFSocketCreate'); + late final _CFSocketCreate = _CFSocketCreatePtr.asFunction< + CFSocketRef Function(CFAllocatorRef, int, int, int, int, CFSocketCallBack, + ffi.Pointer)>(); + + CFSocketRef CFSocketCreateWithNative( + CFAllocatorRef allocator, + int sock, + int callBackTypes, + CFSocketCallBack callout, + ffi.Pointer context, + ) { + return _CFSocketCreateWithNative( + allocator, + sock, + callBackTypes, + callout, + context, + ); + } + + late final _CFSocketCreateWithNativePtr = _lookup< + ffi.NativeFunction< + CFSocketRef Function( + CFAllocatorRef, + CFSocketNativeHandle, + CFOptionFlags, + CFSocketCallBack, + ffi.Pointer)>>('CFSocketCreateWithNative'); + late final _CFSocketCreateWithNative = + _CFSocketCreateWithNativePtr.asFunction< + CFSocketRef Function(CFAllocatorRef, int, int, CFSocketCallBack, + ffi.Pointer)>(); + + CFSocketRef CFSocketCreateWithSocketSignature( + CFAllocatorRef allocator, + ffi.Pointer signature, + int callBackTypes, + CFSocketCallBack callout, + ffi.Pointer context, + ) { + return _CFSocketCreateWithSocketSignature( + allocator, + signature, + callBackTypes, + callout, + context, + ); + } + + late final _CFSocketCreateWithSocketSignaturePtr = _lookup< + ffi.NativeFunction< + CFSocketRef Function( + CFAllocatorRef, + ffi.Pointer, + CFOptionFlags, + CFSocketCallBack, + ffi.Pointer)>>( + 'CFSocketCreateWithSocketSignature'); + late final _CFSocketCreateWithSocketSignature = + _CFSocketCreateWithSocketSignaturePtr.asFunction< + CFSocketRef Function(CFAllocatorRef, ffi.Pointer, + int, CFSocketCallBack, ffi.Pointer)>(); + + CFSocketRef CFSocketCreateConnectedToSocketSignature( + CFAllocatorRef allocator, + ffi.Pointer signature, + int callBackTypes, + CFSocketCallBack callout, + ffi.Pointer context, + double timeout, + ) { + return _CFSocketCreateConnectedToSocketSignature( + allocator, + signature, + callBackTypes, + callout, + context, + timeout, + ); + } + + late final _CFSocketCreateConnectedToSocketSignaturePtr = _lookup< + ffi.NativeFunction< + CFSocketRef Function( + CFAllocatorRef, + ffi.Pointer, + CFOptionFlags, + CFSocketCallBack, + ffi.Pointer, + CFTimeInterval)>>('CFSocketCreateConnectedToSocketSignature'); + late final _CFSocketCreateConnectedToSocketSignature = + _CFSocketCreateConnectedToSocketSignaturePtr.asFunction< + CFSocketRef Function(CFAllocatorRef, ffi.Pointer, + int, CFSocketCallBack, ffi.Pointer, double)>(); + + CFSocketError CFSocketSetAddress( + CFSocketRef s, + CFDataRef address, + ) { + return CFSocketError.fromValue(_CFSocketSetAddress( + s, + address, + )); + } + + late final _CFSocketSetAddressPtr = + _lookup>( + 'CFSocketSetAddress'); + late final _CFSocketSetAddress = + _CFSocketSetAddressPtr.asFunction(); + + CFSocketError CFSocketConnectToAddress( + CFSocketRef s, + CFDataRef address, + DartCFTimeInterval timeout, + ) { + return CFSocketError.fromValue(_CFSocketConnectToAddress( + s, + address, + timeout, + )); + } + + late final _CFSocketConnectToAddressPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFSocketRef, CFDataRef, + CFTimeInterval)>>('CFSocketConnectToAddress'); + late final _CFSocketConnectToAddress = _CFSocketConnectToAddressPtr + .asFunction(); + + void CFSocketInvalidate( + CFSocketRef s, + ) { + return _CFSocketInvalidate( + s, + ); + } + + late final _CFSocketInvalidatePtr = + _lookup>( + 'CFSocketInvalidate'); + late final _CFSocketInvalidate = + _CFSocketInvalidatePtr.asFunction(); + + int CFSocketIsValid( + CFSocketRef s, + ) { + return _CFSocketIsValid( + s, + ); + } + + late final _CFSocketIsValidPtr = + _lookup>( + 'CFSocketIsValid'); + late final _CFSocketIsValid = + _CFSocketIsValidPtr.asFunction(); + + CFDataRef CFSocketCopyAddress( + CFSocketRef s, + ) { + return _CFSocketCopyAddress( + s, + ); + } + + late final _CFSocketCopyAddressPtr = + _lookup>( + 'CFSocketCopyAddress'); + late final _CFSocketCopyAddress = + _CFSocketCopyAddressPtr.asFunction(); + + CFDataRef CFSocketCopyPeerAddress( + CFSocketRef s, + ) { + return _CFSocketCopyPeerAddress( + s, + ); + } + + late final _CFSocketCopyPeerAddressPtr = + _lookup>( + 'CFSocketCopyPeerAddress'); + late final _CFSocketCopyPeerAddress = + _CFSocketCopyPeerAddressPtr.asFunction(); + + void CFSocketGetContext( + CFSocketRef s, + ffi.Pointer context, + ) { + return _CFSocketGetContext( + s, + context, + ); + } + + late final _CFSocketGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFSocketRef, + ffi.Pointer)>>('CFSocketGetContext'); + late final _CFSocketGetContext = _CFSocketGetContextPtr.asFunction< + void Function(CFSocketRef, ffi.Pointer)>(); + + int CFSocketGetNative( + CFSocketRef s, + ) { + return _CFSocketGetNative( + s, + ); + } + + late final _CFSocketGetNativePtr = + _lookup>( + 'CFSocketGetNative'); + late final _CFSocketGetNative = + _CFSocketGetNativePtr.asFunction(); + + CFRunLoopSourceRef CFSocketCreateRunLoopSource( + CFAllocatorRef allocator, + CFSocketRef s, + int order, + ) { + return _CFSocketCreateRunLoopSource( + allocator, + s, + order, + ); + } + + late final _CFSocketCreateRunLoopSourcePtr = _lookup< + ffi.NativeFunction< + CFRunLoopSourceRef Function(CFAllocatorRef, CFSocketRef, + CFIndex)>>('CFSocketCreateRunLoopSource'); + late final _CFSocketCreateRunLoopSource = + _CFSocketCreateRunLoopSourcePtr.asFunction< + CFRunLoopSourceRef Function(CFAllocatorRef, CFSocketRef, int)>(); + + int CFSocketGetSocketFlags( + CFSocketRef s, + ) { + return _CFSocketGetSocketFlags( + s, + ); + } + + late final _CFSocketGetSocketFlagsPtr = + _lookup>( + 'CFSocketGetSocketFlags'); + late final _CFSocketGetSocketFlags = + _CFSocketGetSocketFlagsPtr.asFunction(); + + void CFSocketSetSocketFlags( + CFSocketRef s, + int flags, + ) { + return _CFSocketSetSocketFlags( + s, + flags, + ); + } + + late final _CFSocketSetSocketFlagsPtr = _lookup< + ffi.NativeFunction>( + 'CFSocketSetSocketFlags'); + late final _CFSocketSetSocketFlags = + _CFSocketSetSocketFlagsPtr.asFunction(); + + void CFSocketDisableCallBacks( + CFSocketRef s, + int callBackTypes, + ) { + return _CFSocketDisableCallBacks( + s, + callBackTypes, + ); + } + + late final _CFSocketDisableCallBacksPtr = _lookup< + ffi.NativeFunction>( + 'CFSocketDisableCallBacks'); + late final _CFSocketDisableCallBacks = _CFSocketDisableCallBacksPtr + .asFunction(); + + void CFSocketEnableCallBacks( + CFSocketRef s, + int callBackTypes, + ) { + return _CFSocketEnableCallBacks( + s, + callBackTypes, + ); + } + + late final _CFSocketEnableCallBacksPtr = _lookup< + ffi.NativeFunction>( + 'CFSocketEnableCallBacks'); + late final _CFSocketEnableCallBacks = + _CFSocketEnableCallBacksPtr.asFunction(); + + CFSocketError CFSocketSendData( + CFSocketRef s, + CFDataRef address, + CFDataRef data, + DartCFTimeInterval timeout, + ) { + return CFSocketError.fromValue(_CFSocketSendData( + s, + address, + data, + timeout, + )); + } + + late final _CFSocketSendDataPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFSocketRef, CFDataRef, CFDataRef, + CFTimeInterval)>>('CFSocketSendData'); + late final _CFSocketSendData = _CFSocketSendDataPtr.asFunction< + int Function(CFSocketRef, CFDataRef, CFDataRef, double)>(); + + CFSocketError CFSocketRegisterValue( + ffi.Pointer nameServerSignature, + DartCFTimeInterval timeout, + CFStringRef name, + CFPropertyListRef value, + ) { + return CFSocketError.fromValue(_CFSocketRegisterValue( + nameServerSignature, + timeout, + name, + value, + )); + } + + late final _CFSocketRegisterValuePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(ffi.Pointer, CFTimeInterval, + CFStringRef, CFPropertyListRef)>>('CFSocketRegisterValue'); + late final _CFSocketRegisterValue = _CFSocketRegisterValuePtr.asFunction< + int Function(ffi.Pointer, double, CFStringRef, + CFPropertyListRef)>(); + + CFSocketError CFSocketCopyRegisteredValue( + ffi.Pointer nameServerSignature, + DartCFTimeInterval timeout, + CFStringRef name, + ffi.Pointer value, + ffi.Pointer nameServerAddress, + ) { + return CFSocketError.fromValue(_CFSocketCopyRegisteredValue( + nameServerSignature, + timeout, + name, + value, + nameServerAddress, + )); + } + + late final _CFSocketCopyRegisteredValuePtr = _lookup< + ffi.NativeFunction< + CFIndex Function( + ffi.Pointer, + CFTimeInterval, + CFStringRef, + ffi.Pointer, + ffi.Pointer)>>('CFSocketCopyRegisteredValue'); + late final _CFSocketCopyRegisteredValue = + _CFSocketCopyRegisteredValuePtr.asFunction< + int Function(ffi.Pointer, double, CFStringRef, + ffi.Pointer, ffi.Pointer)>(); + + CFSocketError CFSocketRegisterSocketSignature( + ffi.Pointer nameServerSignature, + DartCFTimeInterval timeout, + CFStringRef name, + ffi.Pointer signature, + ) { + return CFSocketError.fromValue(_CFSocketRegisterSocketSignature( + nameServerSignature, + timeout, + name, + signature, + )); + } + + late final _CFSocketRegisterSocketSignaturePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(ffi.Pointer, CFTimeInterval, + CFStringRef, ffi.Pointer)>>( + 'CFSocketRegisterSocketSignature'); + late final _CFSocketRegisterSocketSignature = + _CFSocketRegisterSocketSignaturePtr.asFunction< + int Function(ffi.Pointer, double, CFStringRef, + ffi.Pointer)>(); + + CFSocketError CFSocketCopyRegisteredSocketSignature( + ffi.Pointer nameServerSignature, + DartCFTimeInterval timeout, + CFStringRef name, + ffi.Pointer signature, + ffi.Pointer nameServerAddress, + ) { + return CFSocketError.fromValue(_CFSocketCopyRegisteredSocketSignature( + nameServerSignature, + timeout, + name, + signature, + nameServerAddress, + )); + } + + late final _CFSocketCopyRegisteredSocketSignaturePtr = _lookup< + ffi.NativeFunction< + CFIndex Function( + ffi.Pointer, + CFTimeInterval, + CFStringRef, + ffi.Pointer, + ffi.Pointer)>>( + 'CFSocketCopyRegisteredSocketSignature'); + late final _CFSocketCopyRegisteredSocketSignature = + _CFSocketCopyRegisteredSocketSignaturePtr.asFunction< + int Function(ffi.Pointer, double, CFStringRef, + ffi.Pointer, ffi.Pointer)>(); + + CFSocketError CFSocketUnregister( + ffi.Pointer nameServerSignature, + DartCFTimeInterval timeout, + CFStringRef name, + ) { + return CFSocketError.fromValue(_CFSocketUnregister( + nameServerSignature, + timeout, + name, + )); + } + + late final _CFSocketUnregisterPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(ffi.Pointer, CFTimeInterval, + CFStringRef)>>('CFSocketUnregister'); + late final _CFSocketUnregister = _CFSocketUnregisterPtr.asFunction< + int Function(ffi.Pointer, double, CFStringRef)>(); + + void CFSocketSetDefaultNameRegistryPortNumber( + int port, + ) { + return _CFSocketSetDefaultNameRegistryPortNumber( + port, + ); + } + + late final _CFSocketSetDefaultNameRegistryPortNumberPtr = + _lookup>( + 'CFSocketSetDefaultNameRegistryPortNumber'); + late final _CFSocketSetDefaultNameRegistryPortNumber = + _CFSocketSetDefaultNameRegistryPortNumberPtr.asFunction< + void Function(int)>(); + + int CFSocketGetDefaultNameRegistryPortNumber() { + return _CFSocketGetDefaultNameRegistryPortNumber(); + } + + late final _CFSocketGetDefaultNameRegistryPortNumberPtr = + _lookup>( + 'CFSocketGetDefaultNameRegistryPortNumber'); + late final _CFSocketGetDefaultNameRegistryPortNumber = + _CFSocketGetDefaultNameRegistryPortNumberPtr.asFunction(); + + late final ffi.Pointer _kCFSocketCommandKey = + _lookup('kCFSocketCommandKey'); + + CFStringRef get kCFSocketCommandKey => _kCFSocketCommandKey.value; + + late final ffi.Pointer _kCFSocketNameKey = + _lookup('kCFSocketNameKey'); + + CFStringRef get kCFSocketNameKey => _kCFSocketNameKey.value; + + late final ffi.Pointer _kCFSocketValueKey = + _lookup('kCFSocketValueKey'); + + CFStringRef get kCFSocketValueKey => _kCFSocketValueKey.value; + + late final ffi.Pointer _kCFSocketResultKey = + _lookup('kCFSocketResultKey'); + + CFStringRef get kCFSocketResultKey => _kCFSocketResultKey.value; + + late final ffi.Pointer _kCFSocketErrorKey = + _lookup('kCFSocketErrorKey'); + + CFStringRef get kCFSocketErrorKey => _kCFSocketErrorKey.value; + + late final ffi.Pointer _kCFSocketRegisterCommand = + _lookup('kCFSocketRegisterCommand'); + + CFStringRef get kCFSocketRegisterCommand => _kCFSocketRegisterCommand.value; + + late final ffi.Pointer _kCFSocketRetrieveCommand = + _lookup('kCFSocketRetrieveCommand'); + + CFStringRef get kCFSocketRetrieveCommand => _kCFSocketRetrieveCommand.value; + + int getattrlistbulk( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + ) { + return _getattrlistbulk( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _getattrlistbulkPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, + ffi.Pointer, ffi.Size, ffi.Uint64)>>('getattrlistbulk'); + late final _getattrlistbulk = _getattrlistbulkPtr.asFunction< + int Function( + int, ffi.Pointer, ffi.Pointer, int, int)>(); + + int getattrlistat( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + int arg4, + int arg5, + ) { + return _getattrlistat( + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + ); + } + + late final _getattrlistatPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.UnsignedLong)>>('getattrlistat'); + late final _getattrlistat = _getattrlistatPtr.asFunction< + int Function(int, ffi.Pointer, ffi.Pointer, + ffi.Pointer, int, int)>(); + + int setattrlistat( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + int arg4, + int arg5, + ) { + return _setattrlistat( + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + ); + } + + late final _setattrlistatPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Uint32)>>('setattrlistat'); + late final _setattrlistat = _setattrlistatPtr.asFunction< + int Function(int, ffi.Pointer, ffi.Pointer, + ffi.Pointer, int, int)>(); + + int freadlink( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _freadlink( + arg0, + arg1, + arg2, + ); + } + + late final _freadlinkPtr = _lookup< + ffi.NativeFunction< + ssize_t Function( + ffi.Int, ffi.Pointer, ffi.Size)>>('freadlink'); + late final _freadlink = + _freadlinkPtr.asFunction, int)>(); + + int faccessat( + int arg0, + ffi.Pointer arg1, + int arg2, + int arg3, + ) { + return _faccessat( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _faccessatPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Int, ffi.Int)>>('faccessat'); + late final _faccessat = _faccessatPtr + .asFunction, int, int)>(); + + int fchownat( + int arg0, + ffi.Pointer arg1, + int arg2, + int arg3, + int arg4, + ) { + return _fchownat( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _fchownatPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, uid_t, gid_t, + ffi.Int)>>('fchownat'); + late final _fchownat = _fchownatPtr + .asFunction, int, int, int)>(); + + int linkat( + int arg0, + ffi.Pointer arg1, + int arg2, + ffi.Pointer arg3, + int arg4, + ) { + return _linkat( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _linkatPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, ffi.Int, + ffi.Pointer, ffi.Int)>>('linkat'); + late final _linkat = _linkatPtr.asFunction< + int Function( + int, ffi.Pointer, int, ffi.Pointer, int)>(); + + int readlinkat( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ) { + return _readlinkat( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _readlinkatPtr = _lookup< + ffi.NativeFunction< + ssize_t Function(ffi.Int, ffi.Pointer, + ffi.Pointer, ffi.Size)>>('readlinkat'); + late final _readlinkat = _readlinkatPtr.asFunction< + int Function(int, ffi.Pointer, ffi.Pointer, int)>(); + + int symlinkat( + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2, + ) { + return _symlinkat( + arg0, + arg1, + arg2, + ); + } + + late final _symlinkatPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('symlinkat'); + late final _symlinkat = _symlinkatPtr.asFunction< + int Function(ffi.Pointer, int, ffi.Pointer)>(); + + int unlinkat( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _unlinkat( + arg0, + arg1, + arg2, + ); + } + + late final _unlinkatPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Int)>>('unlinkat'); + late final _unlinkat = + _unlinkatPtr.asFunction, int)>(); + + void _exit( + int arg0, + ) { + return __exit( + arg0, + ); + } + + late final __exitPtr = + _lookup>('_exit'); + late final __exit = __exitPtr.asFunction(); + + int access( + ffi.Pointer arg0, + int arg1, + ) { + return _access( + arg0, + arg1, + ); + } + + late final _accessPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'access'); + late final _access = + _accessPtr.asFunction, int)>(); + + int alarm( + int arg0, + ) { + return _alarm( + arg0, + ); + } + + late final _alarmPtr = + _lookup>( + 'alarm'); + late final _alarm = _alarmPtr.asFunction(); + + int chdir( + ffi.Pointer arg0, + ) { + return _chdir( + arg0, + ); + } + + late final _chdirPtr = + _lookup)>>( + 'chdir'); + late final _chdir = + _chdirPtr.asFunction)>(); + + int chown( + ffi.Pointer arg0, + int arg1, + int arg2, + ) { + return _chown( + arg0, + arg1, + arg2, + ); + } + + late final _chownPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, uid_t, gid_t)>>('chown'); + late final _chown = + _chownPtr.asFunction, int, int)>(); + + int close( + int arg0, + ) { + return _close( + arg0, + ); + } + + late final _closePtr = + _lookup>('close'); + late final _close = _closePtr.asFunction(); + + int dup( + int arg0, + ) { + return _dup( + arg0, + ); + } + + late final _dupPtr = + _lookup>('dup'); + late final _dup = _dupPtr.asFunction(); + + int dup2( + int arg0, + int arg1, + ) { + return _dup2( + arg0, + arg1, + ); + } + + late final _dup2Ptr = + _lookup>('dup2'); + late final _dup2 = _dup2Ptr.asFunction(); + + int execl( + ffi.Pointer __path, + ffi.Pointer __arg0, + ) { + return _execl( + __path, + __arg0, + ); + } + + late final _execlPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('execl'); + late final _execl = _execlPtr + .asFunction, ffi.Pointer)>(); + + int execle( + ffi.Pointer __path, + ffi.Pointer __arg0, + ) { + return _execle( + __path, + __arg0, + ); + } + + late final _execlePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('execle'); + late final _execle = _execlePtr + .asFunction, ffi.Pointer)>(); + + int execlp( + ffi.Pointer __file, + ffi.Pointer __arg0, + ) { + return _execlp( + __file, + __arg0, + ); + } + + late final _execlpPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('execlp'); + late final _execlp = _execlpPtr + .asFunction, ffi.Pointer)>(); + + int execv( + ffi.Pointer __path, + ffi.Pointer> __argv, + ) { + return _execv( + __path, + __argv, + ); + } + + late final _execvPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer>)>>('execv'); + late final _execv = _execvPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>)>(); + + int execve( + ffi.Pointer __file, + ffi.Pointer> __argv, + ffi.Pointer> __envp, + ) { + return _execve( + __file, + __argv, + __envp, + ); + } + + late final _execvePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer>)>>('execve'); + late final _execve = _execvePtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + ffi.Pointer>)>(); + + int execvp( + ffi.Pointer __file, + ffi.Pointer> __argv, + ) { + return _execvp( + __file, + __argv, + ); + } + + late final _execvpPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer>)>>('execvp'); + late final _execvp = _execvpPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>)>(); + + int fork() { + return _fork(); + } + + late final _forkPtr = _lookup>('fork'); + late final _fork = _forkPtr.asFunction(); + + int fpathconf( + int arg0, + int arg1, + ) { + return _fpathconf( + arg0, + arg1, + ); + } + + late final _fpathconfPtr = + _lookup>( + 'fpathconf'); + late final _fpathconf = _fpathconfPtr.asFunction(); + + ffi.Pointer getcwd( + ffi.Pointer arg0, + int arg1, + ) { + return _getcwd( + arg0, + arg1, + ); + } + + late final _getcwdPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size)>>('getcwd'); + late final _getcwd = _getcwdPtr + .asFunction Function(ffi.Pointer, int)>(); + + int getegid() { + return _getegid(); + } + + late final _getegidPtr = + _lookup>('getegid'); + late final _getegid = _getegidPtr.asFunction(); + + int geteuid() { + return _geteuid(); + } + + late final _geteuidPtr = + _lookup>('geteuid'); + late final _geteuid = _geteuidPtr.asFunction(); + + int getgid() { + return _getgid(); + } + + late final _getgidPtr = + _lookup>('getgid'); + late final _getgid = _getgidPtr.asFunction(); + + int getgroups( + int arg0, + ffi.Pointer arg1, + ) { + return _getgroups( + arg0, + arg1, + ); + } + + late final _getgroupsPtr = _lookup< + ffi.NativeFunction)>>( + 'getgroups'); + late final _getgroups = + _getgroupsPtr.asFunction)>(); + + ffi.Pointer getlogin() { + return _getlogin(); + } + + late final _getloginPtr = + _lookup Function()>>('getlogin'); + late final _getlogin = + _getloginPtr.asFunction Function()>(); + + int getpgrp() { + return _getpgrp(); + } + + late final _getpgrpPtr = + _lookup>('getpgrp'); + late final _getpgrp = _getpgrpPtr.asFunction(); + + int getpid() { + return _getpid(); + } + + late final _getpidPtr = + _lookup>('getpid'); + late final _getpid = _getpidPtr.asFunction(); + + int getppid() { + return _getppid(); + } + + late final _getppidPtr = + _lookup>('getppid'); + late final _getppid = _getppidPtr.asFunction(); + + int getuid() { + return _getuid(); + } + + late final _getuidPtr = + _lookup>('getuid'); + late final _getuid = _getuidPtr.asFunction(); + + int isatty( + int arg0, + ) { + return _isatty( + arg0, + ); + } + + late final _isattyPtr = + _lookup>('isatty'); + late final _isatty = _isattyPtr.asFunction(); + + int link( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _link( + arg0, + arg1, + ); + } + + late final _linkPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('link'); + late final _link = _linkPtr + .asFunction, ffi.Pointer)>(); + + int lseek( + int arg0, + int arg1, + int arg2, + ) { + return _lseek( + arg0, + arg1, + arg2, + ); + } + + late final _lseekPtr = + _lookup>( + 'lseek'); + late final _lseek = _lseekPtr.asFunction(); + + int pathconf( + ffi.Pointer arg0, + int arg1, + ) { + return _pathconf( + arg0, + arg1, + ); + } + + late final _pathconfPtr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, ffi.Int)>>('pathconf'); + late final _pathconf = + _pathconfPtr.asFunction, int)>(); + + int pause() { + return _pause(); + } + + late final _pausePtr = + _lookup>('pause'); + late final _pause = _pausePtr.asFunction(); + + int pipe( + ffi.Pointer arg0, + ) { + return _pipe( + arg0, + ); + } + + late final _pipePtr = + _lookup)>>( + 'pipe'); + late final _pipe = _pipePtr.asFunction)>(); + + int read( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _read( + arg0, + arg1, + arg2, + ); + } + + late final _readPtr = _lookup< + ffi.NativeFunction< + ssize_t Function(ffi.Int, ffi.Pointer, ffi.Size)>>('read'); + late final _read = + _readPtr.asFunction, int)>(); + + int rmdir( + ffi.Pointer arg0, + ) { + return _rmdir( + arg0, + ); + } + + late final _rmdirPtr = + _lookup)>>( + 'rmdir'); + late final _rmdir = + _rmdirPtr.asFunction)>(); + + int setgid( + int arg0, + ) { + return _setgid( + arg0, + ); + } + + late final _setgidPtr = + _lookup>('setgid'); + late final _setgid = _setgidPtr.asFunction(); + + int setpgid( + int arg0, + int arg1, + ) { + return _setpgid( + arg0, + arg1, + ); + } + + late final _setpgidPtr = + _lookup>('setpgid'); + late final _setpgid = _setpgidPtr.asFunction(); + + int setsid() { + return _setsid(); + } + + late final _setsidPtr = + _lookup>('setsid'); + late final _setsid = _setsidPtr.asFunction(); + + int setuid( + int arg0, + ) { + return _setuid( + arg0, + ); + } + + late final _setuidPtr = + _lookup>('setuid'); + late final _setuid = _setuidPtr.asFunction(); + + int sleep( + int arg0, + ) { + return _sleep( + arg0, + ); + } + + late final _sleepPtr = + _lookup>( + 'sleep'); + late final _sleep = _sleepPtr.asFunction(); + + int sysconf( + int arg0, + ) { + return _sysconf( + arg0, + ); + } + + late final _sysconfPtr = + _lookup>('sysconf'); + late final _sysconf = _sysconfPtr.asFunction(); + + int tcgetpgrp( + int arg0, + ) { + return _tcgetpgrp( + arg0, + ); + } + + late final _tcgetpgrpPtr = + _lookup>('tcgetpgrp'); + late final _tcgetpgrp = _tcgetpgrpPtr.asFunction(); + + int tcsetpgrp( + int arg0, + int arg1, + ) { + return _tcsetpgrp( + arg0, + arg1, + ); + } + + late final _tcsetpgrpPtr = + _lookup>( + 'tcsetpgrp'); + late final _tcsetpgrp = _tcsetpgrpPtr.asFunction(); + + ffi.Pointer ttyname( + int arg0, + ) { + return _ttyname( + arg0, + ); + } + + late final _ttynamePtr = + _lookup Function(ffi.Int)>>( + 'ttyname'); + late final _ttyname = + _ttynamePtr.asFunction Function(int)>(); + + int ttyname_r( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _ttyname_r( + arg0, + arg1, + arg2, + ); + } + + late final _ttyname_rPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Size)>>('ttyname_r'); + late final _ttyname_r = + _ttyname_rPtr.asFunction, int)>(); + + int unlink( + ffi.Pointer arg0, + ) { + return _unlink( + arg0, + ); + } + + late final _unlinkPtr = + _lookup)>>( + 'unlink'); + late final _unlink = + _unlinkPtr.asFunction)>(); + + int write( + int __fd, + ffi.Pointer __buf, + int __nbyte, + ) { + return _write( + __fd, + __buf, + __nbyte, + ); + } + + late final _writePtr = _lookup< + ffi.NativeFunction< + ssize_t Function(ffi.Int, ffi.Pointer, ffi.Size)>>('write'); + late final _write = + _writePtr.asFunction, int)>(); + + int confstr( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _confstr( + arg0, + arg1, + arg2, + ); + } + + late final _confstrPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function( + ffi.Int, ffi.Pointer, ffi.Size)>>('confstr'); + late final _confstr = + _confstrPtr.asFunction, int)>(); + + int getopt( + int arg0, + ffi.Pointer> arg1, + ffi.Pointer arg2, + ) { + return _getopt( + arg0, + arg1, + arg2, + ); + } + + late final _getoptPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer>, + ffi.Pointer)>>('getopt'); + late final _getopt = _getoptPtr.asFunction< + int Function( + int, ffi.Pointer>, ffi.Pointer)>(); + + late final ffi.Pointer> _optarg = + _lookup>('optarg'); + + ffi.Pointer get optarg => _optarg.value; + + set optarg(ffi.Pointer value) => _optarg.value = value; + + late final ffi.Pointer _optind = _lookup('optind'); + + int get optind => _optind.value; + + set optind(int value) => _optind.value = value; + + late final ffi.Pointer _opterr = _lookup('opterr'); + + int get opterr => _opterr.value; + + set opterr(int value) => _opterr.value = value; + + late final ffi.Pointer _optopt = _lookup('optopt'); + + int get optopt => _optopt.value; + + set optopt(int value) => _optopt.value = value; + + ffi.Pointer brk( + ffi.Pointer arg0, + ) { + return _brk( + arg0, + ); + } + + late final _brkPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('brk'); + late final _brk = _brkPtr + .asFunction Function(ffi.Pointer)>(); + + int chroot( + ffi.Pointer arg0, + ) { + return _chroot( + arg0, + ); + } + + late final _chrootPtr = + _lookup)>>( + 'chroot'); + late final _chroot = + _chrootPtr.asFunction)>(); + + ffi.Pointer crypt( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _crypt( + arg0, + arg1, + ); + } + + late final _cryptPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('crypt'); + late final _crypt = _cryptPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + void encrypt( + ffi.Pointer arg0, + int arg1, + ) { + return _encrypt( + arg0, + arg1, + ); + } + + late final _encryptPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Int)>>('encrypt'); + late final _encrypt = + _encryptPtr.asFunction, int)>(); + + int fchdir( + int arg0, + ) { + return _fchdir( + arg0, + ); + } + + late final _fchdirPtr = + _lookup>('fchdir'); + late final _fchdir = _fchdirPtr.asFunction(); + + int gethostid() { + return _gethostid(); + } + + late final _gethostidPtr = + _lookup>('gethostid'); + late final _gethostid = _gethostidPtr.asFunction(); + + int getpgid( + int arg0, + ) { + return _getpgid( + arg0, + ); + } + + late final _getpgidPtr = + _lookup>('getpgid'); + late final _getpgid = _getpgidPtr.asFunction(); + + int getsid( + int arg0, + ) { + return _getsid( + arg0, + ); + } + + late final _getsidPtr = + _lookup>('getsid'); + late final _getsid = _getsidPtr.asFunction(); + + int getdtablesize() { + return _getdtablesize(); + } + + late final _getdtablesizePtr = + _lookup>('getdtablesize'); + late final _getdtablesize = _getdtablesizePtr.asFunction(); + + int getpagesize() { + return _getpagesize(); + } + + late final _getpagesizePtr = + _lookup>('getpagesize'); + late final _getpagesize = _getpagesizePtr.asFunction(); + + ffi.Pointer getpass( + ffi.Pointer arg0, + ) { + return _getpass( + arg0, + ); + } + + late final _getpassPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('getpass'); + late final _getpass = _getpassPtr + .asFunction Function(ffi.Pointer)>(); + + ffi.Pointer getwd( + ffi.Pointer arg0, + ) { + return _getwd( + arg0, + ); + } + + late final _getwdPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('getwd'); + late final _getwd = _getwdPtr + .asFunction Function(ffi.Pointer)>(); + + int lchown( + ffi.Pointer arg0, + int arg1, + int arg2, + ) { + return _lchown( + arg0, + arg1, + arg2, + ); + } + + late final _lchownPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, uid_t, gid_t)>>('lchown'); + late final _lchown = + _lchownPtr.asFunction, int, int)>(); + + int lockf( + int arg0, + int arg1, + int arg2, + ) { + return _lockf( + arg0, + arg1, + arg2, + ); + } + + late final _lockfPtr = + _lookup>( + 'lockf'); + late final _lockf = _lockfPtr.asFunction(); + + int nice( + int arg0, + ) { + return _nice( + arg0, + ); + } + + late final _nicePtr = + _lookup>('nice'); + late final _nice = _nicePtr.asFunction(); + + int pread( + int __fd, + ffi.Pointer __buf, + int __nbyte, + int __offset, + ) { + return _pread( + __fd, + __buf, + __nbyte, + __offset, + ); + } + + late final _preadPtr = _lookup< + ffi.NativeFunction< + ssize_t Function( + ffi.Int, ffi.Pointer, ffi.Size, off_t)>>('pread'); + late final _pread = _preadPtr + .asFunction, int, int)>(); + + int pwrite( + int __fd, + ffi.Pointer __buf, + int __nbyte, + int __offset, + ) { + return _pwrite( + __fd, + __buf, + __nbyte, + __offset, + ); + } + + late final _pwritePtr = _lookup< + ffi.NativeFunction< + ssize_t Function( + ffi.Int, ffi.Pointer, ffi.Size, off_t)>>('pwrite'); + late final _pwrite = _pwritePtr + .asFunction, int, int)>(); + + ffi.Pointer sbrk( + int arg0, + ) { + return _sbrk( + arg0, + ); + } + + late final _sbrkPtr = + _lookup Function(ffi.Int)>>( + 'sbrk'); + late final _sbrk = _sbrkPtr.asFunction Function(int)>(); + + int setpgrp() { + return _setpgrp(); + } + + late final _setpgrpPtr = + _lookup>('setpgrp'); + late final _setpgrp = _setpgrpPtr.asFunction(); + + int setregid( + int arg0, + int arg1, + ) { + return _setregid( + arg0, + arg1, + ); + } + + late final _setregidPtr = + _lookup>('setregid'); + late final _setregid = _setregidPtr.asFunction(); + + int setreuid( + int arg0, + int arg1, + ) { + return _setreuid( + arg0, + arg1, + ); + } + + late final _setreuidPtr = + _lookup>('setreuid'); + late final _setreuid = _setreuidPtr.asFunction(); + + void sync1() { + return _sync1(); + } + + late final _sync1Ptr = + _lookup>('sync'); + late final _sync1 = _sync1Ptr.asFunction(); + + int truncate( + ffi.Pointer arg0, + int arg1, + ) { + return _truncate( + arg0, + arg1, + ); + } + + late final _truncatePtr = _lookup< + ffi.NativeFunction, off_t)>>( + 'truncate'); + late final _truncate = + _truncatePtr.asFunction, int)>(); + + int ualarm( + int arg0, + int arg1, + ) { + return _ualarm( + arg0, + arg1, + ); + } + + late final _ualarmPtr = + _lookup>( + 'ualarm'); + late final _ualarm = _ualarmPtr.asFunction(); + + int usleep( + int arg0, + ) { + return _usleep( + arg0, + ); + } + + late final _usleepPtr = + _lookup>('usleep'); + late final _usleep = _usleepPtr.asFunction(); + + int vfork() { + return _vfork(); + } + + late final _vforkPtr = + _lookup>('vfork'); + late final _vfork = _vforkPtr.asFunction(); + + int fsync( + int arg0, + ) { + return _fsync( + arg0, + ); + } + + late final _fsyncPtr = + _lookup>('fsync'); + late final _fsync = _fsyncPtr.asFunction(); + + int ftruncate( + int arg0, + int arg1, + ) { + return _ftruncate( + arg0, + arg1, + ); + } + + late final _ftruncatePtr = + _lookup>( + 'ftruncate'); + late final _ftruncate = _ftruncatePtr.asFunction(); + + int getlogin_r( + ffi.Pointer arg0, + int arg1, + ) { + return _getlogin_r( + arg0, + arg1, + ); + } + + late final _getlogin_rPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size)>>('getlogin_r'); + late final _getlogin_r = + _getlogin_rPtr.asFunction, int)>(); + + int fchown( + int arg0, + int arg1, + int arg2, + ) { + return _fchown( + arg0, + arg1, + arg2, + ); + } + + late final _fchownPtr = + _lookup>( + 'fchown'); + late final _fchown = _fchownPtr.asFunction(); + + int gethostname( + ffi.Pointer arg0, + int arg1, + ) { + return _gethostname( + arg0, + arg1, + ); + } + + late final _gethostnamePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size)>>('gethostname'); + late final _gethostname = + _gethostnamePtr.asFunction, int)>(); + + int readlink( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _readlink( + arg0, + arg1, + arg2, + ); + } + + late final _readlinkPtr = _lookup< + ffi.NativeFunction< + ssize_t Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('readlink'); + late final _readlink = _readlinkPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int setegid( + int arg0, + ) { + return _setegid( + arg0, + ); + } + + late final _setegidPtr = + _lookup>('setegid'); + late final _setegid = _setegidPtr.asFunction(); + + int seteuid( + int arg0, + ) { + return _seteuid( + arg0, + ); + } + + late final _seteuidPtr = + _lookup>('seteuid'); + late final _seteuid = _seteuidPtr.asFunction(); + + int symlink( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _symlink( + arg0, + arg1, + ); + } + + late final _symlinkPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('symlink'); + late final _symlink = _symlinkPtr + .asFunction, ffi.Pointer)>(); + + int pselect( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ffi.Pointer arg5, + ) { + return _pselect( + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + ); + } + + late final _pselectPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('pselect'); + late final _pselect = _pselectPtr.asFunction< + int Function(int, ffi.Pointer, ffi.Pointer, + ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); + + int select( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ) { + return _select( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _selectPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>('select'); + late final _select = _selectPtr.asFunction< + int Function(int, ffi.Pointer, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + int accessx_np( + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2, + int arg3, + ) { + return _accessx_np( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _accessx_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size, + ffi.Pointer, uid_t)>>('accessx_np'); + late final _accessx_np = _accessx_npPtr.asFunction< + int Function( + ffi.Pointer, int, ffi.Pointer, int)>(); + + int acct( + ffi.Pointer arg0, + ) { + return _acct( + arg0, + ); + } + + late final _acctPtr = + _lookup)>>( + 'acct'); + late final _acct = _acctPtr.asFunction)>(); + + int add_profil( + ffi.Pointer arg0, + int arg1, + int arg2, + int arg3, + ) { + return _add_profil( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _add_profilPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size, ffi.UnsignedLong, + ffi.UnsignedInt)>>('add_profil'); + late final _add_profil = _add_profilPtr + .asFunction, int, int, int)>(); + + void endusershell() { + return _endusershell(); + } + + late final _endusershellPtr = + _lookup>('endusershell'); + late final _endusershell = _endusershellPtr.asFunction(); + + int execvP( + ffi.Pointer __file, + ffi.Pointer __searchpath, + ffi.Pointer> __argv, + ) { + return _execvP( + __file, + __searchpath, + __argv, + ); + } + + late final _execvPPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>>('execvP'); + late final _execvP = _execvPPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>(); + + ffi.Pointer fflagstostr( + int arg0, + ) { + return _fflagstostr( + arg0, + ); + } + + late final _fflagstostrPtr = _lookup< + ffi.NativeFunction Function(ffi.UnsignedLong)>>( + 'fflagstostr'); + late final _fflagstostr = + _fflagstostrPtr.asFunction Function(int)>(); + + int getdomainname( + ffi.Pointer arg0, + int arg1, + ) { + return _getdomainname( + arg0, + arg1, + ); + } + + late final _getdomainnamePtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'getdomainname'); + late final _getdomainname = + _getdomainnamePtr.asFunction, int)>(); + + int getgrouplist( + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ) { + return _getgrouplist( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _getgrouplistPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int, ffi.Pointer, + ffi.Pointer)>>('getgrouplist'); + late final _getgrouplist = _getgrouplistPtr.asFunction< + int Function(ffi.Pointer, int, ffi.Pointer, + ffi.Pointer)>(); + + int gethostuuid( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _gethostuuid( + arg0, + arg1, + ); + } + + late final _gethostuuidPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>('gethostuuid'); + late final _gethostuuid = _gethostuuidPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer)>(); + + int getmode( + ffi.Pointer arg0, + int arg1, + ) { + return _getmode( + arg0, + arg1, + ); + } + + late final _getmodePtr = _lookup< + ffi.NativeFunction, mode_t)>>( + 'getmode'); + late final _getmode = + _getmodePtr.asFunction, int)>(); + + int getpeereid( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _getpeereid( + arg0, + arg1, + arg2, + ); + } + + late final _getpeereidPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Pointer)>>('getpeereid'); + late final _getpeereid = _getpeereidPtr + .asFunction, ffi.Pointer)>(); + + int getsgroups_np( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _getsgroups_np( + arg0, + arg1, + ); + } + + late final _getsgroups_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>('getsgroups_np'); + late final _getsgroups_np = _getsgroups_npPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer getusershell() { + return _getusershell(); + } + + late final _getusershellPtr = + _lookup Function()>>( + 'getusershell'); + late final _getusershell = + _getusershellPtr.asFunction Function()>(); + + int getwgroups_np( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _getwgroups_np( + arg0, + arg1, + ); + } + + late final _getwgroups_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>('getwgroups_np'); + late final _getwgroups_np = _getwgroups_npPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer)>(); + + int initgroups( + ffi.Pointer arg0, + int arg1, + ) { + return _initgroups( + arg0, + arg1, + ); + } + + late final _initgroupsPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'initgroups'); + late final _initgroups = + _initgroupsPtr.asFunction, int)>(); + + int issetugid() { + return _issetugid(); + } + + late final _issetugidPtr = + _lookup>('issetugid'); + late final _issetugid = _issetugidPtr.asFunction(); + + ffi.Pointer mkdtemp( + ffi.Pointer arg0, + ) { + return _mkdtemp( + arg0, + ); + } + + late final _mkdtempPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('mkdtemp'); + late final _mkdtemp = _mkdtempPtr + .asFunction Function(ffi.Pointer)>(); + + int mknod( + ffi.Pointer arg0, + int arg1, + int arg2, + ) { + return _mknod( + arg0, + arg1, + arg2, + ); + } + + late final _mknodPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, mode_t, dev_t)>>('mknod'); + late final _mknod = + _mknodPtr.asFunction, int, int)>(); + + int mkpath_np( + ffi.Pointer path, + int omode, + ) { + return _mkpath_np( + path, + omode, + ); + } + + late final _mkpath_npPtr = _lookup< + ffi.NativeFunction, mode_t)>>( + 'mkpath_np'); + late final _mkpath_np = + _mkpath_npPtr.asFunction, int)>(); + + int mkpathat_np( + int dfd, + ffi.Pointer path, + int omode, + ) { + return _mkpathat_np( + dfd, + path, + omode, + ); + } + + late final _mkpathat_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, mode_t)>>('mkpathat_np'); + late final _mkpathat_np = _mkpathat_npPtr + .asFunction, int)>(); + + int mkstemps( + ffi.Pointer arg0, + int arg1, + ) { + return _mkstemps( + arg0, + arg1, + ); + } + + late final _mkstempsPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'mkstemps'); + late final _mkstemps = + _mkstempsPtr.asFunction, int)>(); + + int mkostemp( + ffi.Pointer path, + int oflags, + ) { + return _mkostemp( + path, + oflags, + ); + } + + late final _mkostempPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'mkostemp'); + late final _mkostemp = + _mkostempPtr.asFunction, int)>(); + + int mkostemps( + ffi.Pointer path, + int slen, + int oflags, + ) { + return _mkostemps( + path, + slen, + oflags, + ); + } + + late final _mkostempsPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Int, ffi.Int)>>('mkostemps'); + late final _mkostemps = + _mkostempsPtr.asFunction, int, int)>(); + + int mkstemp_dprotected_np( + ffi.Pointer path, + int dpclass, + int dpflags, + ) { + return _mkstemp_dprotected_np( + path, + dpclass, + dpflags, + ); + } + + late final _mkstemp_dprotected_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int, + ffi.Int)>>('mkstemp_dprotected_np'); + late final _mkstemp_dprotected_np = _mkstemp_dprotected_npPtr + .asFunction, int, int)>(); + + ffi.Pointer mkdtempat_np( + int dfd, + ffi.Pointer path, + ) { + return _mkdtempat_np( + dfd, + path, + ); + } + + late final _mkdtempat_npPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Pointer)>>('mkdtempat_np'); + late final _mkdtempat_np = _mkdtempat_npPtr + .asFunction Function(int, ffi.Pointer)>(); + + int mkstempsat_np( + int dfd, + ffi.Pointer path, + int slen, + ) { + return _mkstempsat_np( + dfd, + path, + slen, + ); + } + + late final _mkstempsat_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Int)>>('mkstempsat_np'); + late final _mkstempsat_np = _mkstempsat_npPtr + .asFunction, int)>(); + + int mkostempsat_np( + int dfd, + ffi.Pointer path, + int slen, + int oflags, + ) { + return _mkostempsat_np( + dfd, + path, + slen, + oflags, + ); + } + + late final _mkostempsat_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, ffi.Int, + ffi.Int)>>('mkostempsat_np'); + late final _mkostempsat_np = _mkostempsat_npPtr + .asFunction, int, int)>(); + + int nfssvc( + int arg0, + ffi.Pointer arg1, + ) { + return _nfssvc( + arg0, + arg1, + ); + } + + late final _nfssvcPtr = _lookup< + ffi.NativeFunction)>>( + 'nfssvc'); + late final _nfssvc = + _nfssvcPtr.asFunction)>(); + + int profil( + ffi.Pointer arg0, + int arg1, + int arg2, + int arg3, + ) { + return _profil( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _profilPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size, ffi.UnsignedLong, + ffi.UnsignedInt)>>('profil'); + late final _profil = _profilPtr + .asFunction, int, int, int)>(); + + int pthread_setugid_np( + int arg0, + int arg1, + ) { + return _pthread_setugid_np( + arg0, + arg1, + ); + } + + late final _pthread_setugid_npPtr = + _lookup>( + 'pthread_setugid_np'); + late final _pthread_setugid_np = + _pthread_setugid_npPtr.asFunction(); + + int pthread_getugid_np( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _pthread_getugid_np( + arg0, + arg1, + ); + } + + late final _pthread_getugid_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('pthread_getugid_np'); + late final _pthread_getugid_np = _pthread_getugid_npPtr + .asFunction, ffi.Pointer)>(); + + int reboot( + int arg0, + ) { + return _reboot( + arg0, + ); + } + + late final _rebootPtr = + _lookup>('reboot'); + late final _reboot = _rebootPtr.asFunction(); + + int revoke( + ffi.Pointer arg0, + ) { + return _revoke( + arg0, + ); + } + + late final _revokePtr = + _lookup)>>( + 'revoke'); + late final _revoke = + _revokePtr.asFunction)>(); + + int rcmd( + ffi.Pointer> arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ffi.Pointer arg5, + ) { + return _rcmd( + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + ); + } + + late final _rcmdPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('rcmd'); + late final _rcmd = _rcmdPtr.asFunction< + int Function( + ffi.Pointer>, + int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + int rcmd_af( + ffi.Pointer> arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ffi.Pointer arg5, + int arg6, + ) { + return _rcmd_af( + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + ); + } + + late final _rcmd_afPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int)>>('rcmd_af'); + late final _rcmd_af = _rcmd_afPtr.asFunction< + int Function( + ffi.Pointer>, + int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); + + int rresvport( + ffi.Pointer arg0, + ) { + return _rresvport( + arg0, + ); + } + + late final _rresvportPtr = + _lookup)>>( + 'rresvport'); + late final _rresvport = + _rresvportPtr.asFunction)>(); + + int rresvport_af( + ffi.Pointer arg0, + int arg1, + ) { + return _rresvport_af( + arg0, + arg1, + ); + } + + late final _rresvport_afPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'rresvport_af'); + late final _rresvport_af = + _rresvport_afPtr.asFunction, int)>(); + + int iruserok( + int arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ) { + return _iruserok( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _iruserokPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.UnsignedLong, ffi.Int, ffi.Pointer, + ffi.Pointer)>>('iruserok'); + late final _iruserok = _iruserokPtr.asFunction< + int Function(int, int, ffi.Pointer, ffi.Pointer)>(); + + int iruserok_sa( + ffi.Pointer arg0, + int arg1, + int arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ) { + return _iruserok_sa( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _iruserok_saPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('iruserok_sa'); + late final _iruserok_sa = _iruserok_saPtr.asFunction< + int Function(ffi.Pointer, int, int, ffi.Pointer, + ffi.Pointer)>(); + + int ruserok( + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ) { + return _ruserok( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _ruserokPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('ruserok'); + late final _ruserok = _ruserokPtr.asFunction< + int Function(ffi.Pointer, int, ffi.Pointer, + ffi.Pointer)>(); + + int setdomainname( + ffi.Pointer arg0, + int arg1, + ) { + return _setdomainname( + arg0, + arg1, + ); + } + + late final _setdomainnamePtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'setdomainname'); + late final _setdomainname = + _setdomainnamePtr.asFunction, int)>(); + + int setgroups( + int arg0, + ffi.Pointer arg1, + ) { + return _setgroups( + arg0, + arg1, + ); + } + + late final _setgroupsPtr = _lookup< + ffi.NativeFunction)>>( + 'setgroups'); + late final _setgroups = + _setgroupsPtr.asFunction)>(); + + void sethostid( + int arg0, + ) { + return _sethostid( + arg0, + ); + } + + late final _sethostidPtr = + _lookup>('sethostid'); + late final _sethostid = _sethostidPtr.asFunction(); + + int sethostname( + ffi.Pointer arg0, + int arg1, + ) { + return _sethostname( + arg0, + arg1, + ); + } + + late final _sethostnamePtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'sethostname'); + late final _sethostname = + _sethostnamePtr.asFunction, int)>(); + + int setlogin( + ffi.Pointer arg0, + ) { + return _setlogin( + arg0, + ); + } + + late final _setloginPtr = + _lookup)>>( + 'setlogin'); + late final _setlogin = + _setloginPtr.asFunction)>(); + + ffi.Pointer setmode( + ffi.Pointer arg0, + ) { + return _setmode( + arg0, + ); + } + + late final _setmodePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('setmode'); + late final _setmode = _setmodePtr + .asFunction Function(ffi.Pointer)>(); + + int setrgid( + int arg0, + ) { + return _setrgid( + arg0, + ); + } + + late final _setrgidPtr = + _lookup>('setrgid'); + late final _setrgid = _setrgidPtr.asFunction(); + + int setruid( + int arg0, + ) { + return _setruid( + arg0, + ); + } + + late final _setruidPtr = + _lookup>('setruid'); + late final _setruid = _setruidPtr.asFunction(); + + int setsgroups_np( + int arg0, + ffi.Pointer arg1, + ) { + return _setsgroups_np( + arg0, + arg1, + ); + } + + late final _setsgroups_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer)>>('setsgroups_np'); + late final _setsgroups_np = _setsgroups_npPtr + .asFunction)>(); + + void setusershell() { + return _setusershell(); + } + + late final _setusershellPtr = + _lookup>('setusershell'); + late final _setusershell = _setusershellPtr.asFunction(); + + int setwgroups_np( + int arg0, + ffi.Pointer arg1, + ) { + return _setwgroups_np( + arg0, + arg1, + ); + } + + late final _setwgroups_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer)>>('setwgroups_np'); + late final _setwgroups_np = _setwgroups_npPtr + .asFunction)>(); + + int strtofflags( + ffi.Pointer> arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _strtofflags( + arg0, + arg1, + arg2, + ); + } + + late final _strtofflagsPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Pointer, + ffi.Pointer)>>('strtofflags'); + late final _strtofflags = _strtofflagsPtr.asFunction< + int Function(ffi.Pointer>, + ffi.Pointer, ffi.Pointer)>(); + + int swapon( + ffi.Pointer arg0, + ) { + return _swapon( + arg0, + ); + } + + late final _swaponPtr = + _lookup)>>( + 'swapon'); + late final _swapon = + _swaponPtr.asFunction)>(); + + int ttyslot() { + return _ttyslot(); + } + + late final _ttyslotPtr = + _lookup>('ttyslot'); + late final _ttyslot = _ttyslotPtr.asFunction(); + + int undelete( + ffi.Pointer arg0, + ) { + return _undelete( + arg0, + ); + } + + late final _undeletePtr = + _lookup)>>( + 'undelete'); + late final _undelete = + _undeletePtr.asFunction)>(); + + int unwhiteout( + ffi.Pointer arg0, + ) { + return _unwhiteout( + arg0, + ); + } + + late final _unwhiteoutPtr = + _lookup)>>( + 'unwhiteout'); + late final _unwhiteout = + _unwhiteoutPtr.asFunction)>(); + + int syscall( + int arg0, + ) { + return _syscall( + arg0, + ); + } + + late final _syscallPtr = + _lookup>('syscall'); + late final _syscall = _syscallPtr.asFunction(); + + int fgetattrlist( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + ) { + return _fgetattrlist( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _fgetattrlistPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.UnsignedInt)>>('fgetattrlist'); + late final _fgetattrlist = _fgetattrlistPtr.asFunction< + int Function( + int, ffi.Pointer, ffi.Pointer, int, int)>(); + + int fsetattrlist( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + ) { + return _fsetattrlist( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _fsetattrlistPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.UnsignedInt)>>('fsetattrlist'); + late final _fsetattrlist = _fsetattrlistPtr.asFunction< + int Function( + int, ffi.Pointer, ffi.Pointer, int, int)>(); + + int getattrlist( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + ) { + return _getattrlist( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _getattrlistPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.UnsignedInt)>>('getattrlist'); + late final _getattrlist = _getattrlistPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, int, int)>(); + + int setattrlist( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + ) { + return _setattrlist( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _setattrlistPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.UnsignedInt)>>('setattrlist'); + late final _setattrlist = _setattrlistPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, int, int)>(); + + int exchangedata( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _exchangedata( + arg0, + arg1, + arg2, + ); + } + + late final _exchangedataPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.UnsignedInt)>>('exchangedata'); + late final _exchangedata = _exchangedataPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int getdirentriesattr( + int arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4, + ffi.Pointer arg5, + ffi.Pointer arg6, + int arg7, + ) { + return _getdirentriesattr( + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + ); + } + + late final _getdirentriesattrPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedInt)>>('getdirentriesattr'); + late final _getdirentriesattr = _getdirentriesattrPtr.asFunction< + int Function( + int, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); + + int searchfs( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + ffi.Pointer arg5, + ) { + return _searchfs( + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + ); + } + + late final _searchfsPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedInt, + ffi.UnsignedInt, + ffi.Pointer)>>('searchfs'); + late final _searchfs = _searchfsPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, int, int, ffi.Pointer)>(); + + int fsctl( + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2, + int arg3, + ) { + return _fsctl( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _fsctlPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer, ffi.UnsignedInt)>>('fsctl'); + late final _fsctl = _fsctlPtr.asFunction< + int Function(ffi.Pointer, int, ffi.Pointer, int)>(); + + int ffsctl( + int arg0, + int arg1, + ffi.Pointer arg2, + int arg3, + ) { + return _ffsctl( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _ffsctlPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.UnsignedLong, ffi.Pointer, + ffi.UnsignedInt)>>('ffsctl'); + late final _ffsctl = _ffsctlPtr + .asFunction, int)>(); + + int fsync_volume_np( + int arg0, + int arg1, + ) { + return _fsync_volume_np( + arg0, + arg1, + ); + } + + late final _fsync_volume_npPtr = + _lookup>( + 'fsync_volume_np'); + late final _fsync_volume_np = + _fsync_volume_npPtr.asFunction(); + + int sync_volume_np( + ffi.Pointer arg0, + int arg1, + ) { + return _sync_volume_np( + arg0, + arg1, + ); + } + + late final _sync_volume_npPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'sync_volume_np'); + late final _sync_volume_np = + _sync_volume_npPtr.asFunction, int)>(); + + late final ffi.Pointer _optreset = _lookup('optreset'); + + int get optreset => _optreset.value; + + set optreset(int value) => _optreset.value = value; + + int open( + ffi.Pointer arg0, + int arg1, + ) { + return _open( + arg0, + arg1, + ); + } + + late final _openPtr = _lookup< + ffi.NativeFunction, ffi.Int)>>( + 'open'); + late final _open = + _openPtr.asFunction, int)>(); + + int openat( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _openat( + arg0, + arg1, + arg2, + ); + } + + late final _openatPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, ffi.Int)>>('openat'); + late final _openat = + _openatPtr.asFunction, int)>(); + + int creat( + ffi.Pointer arg0, + int arg1, + ) { + return _creat( + arg0, + arg1, + ); + } + + late final _creatPtr = _lookup< + ffi.NativeFunction, mode_t)>>( + 'creat'); + late final _creat = + _creatPtr.asFunction, int)>(); + + int fcntl( + int arg0, + int arg1, + ) { + return _fcntl( + arg0, + arg1, + ); + } + + late final _fcntlPtr = + _lookup>('fcntl'); + late final _fcntl = _fcntlPtr.asFunction(); + + int openx_np( + ffi.Pointer arg0, + int arg1, + filesec_t arg2, + ) { + return _openx_np( + arg0, + arg1, + arg2, + ); + } + + late final _openx_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Int, filesec_t)>>('openx_np'); + late final _openx_np = _openx_npPtr + .asFunction, int, filesec_t)>(); + + int open_dprotected_np( + ffi.Pointer arg0, + int arg1, + int arg2, + int arg3, + ) { + return _open_dprotected_np( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _open_dprotected_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int, ffi.Int, + ffi.Int)>>('open_dprotected_np'); + late final _open_dprotected_np = _open_dprotected_npPtr + .asFunction, int, int, int)>(); + + int openat_dprotected_np( + int arg0, + ffi.Pointer arg1, + int arg2, + int arg3, + int arg4, + ) { + return _openat_dprotected_np( + arg0, + arg1, + arg2, + arg3, + arg4, + ); + } + + late final _openat_dprotected_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, ffi.Int, ffi.Int, + ffi.Int)>>('openat_dprotected_np'); + late final _openat_dprotected_np = _openat_dprotected_npPtr + .asFunction, int, int, int)>(); + + int openat_authenticated_np( + int arg0, + ffi.Pointer arg1, + int arg2, + int arg3, + ) { + return _openat_authenticated_np( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _openat_authenticated_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, ffi.Int, + ffi.Int)>>('openat_authenticated_np'); + late final _openat_authenticated_np = _openat_authenticated_npPtr + .asFunction, int, int)>(); + + int flock1( + int arg0, + int arg1, + ) { + return _flock1( + arg0, + arg1, + ); + } + + late final _flock1Ptr = + _lookup>('flock'); + late final _flock1 = _flock1Ptr.asFunction(); + + filesec_t filesec_init() { + return _filesec_init(); + } + + late final _filesec_initPtr = + _lookup>('filesec_init'); + late final _filesec_init = + _filesec_initPtr.asFunction(); + + filesec_t filesec_dup( + filesec_t arg0, + ) { + return _filesec_dup( + arg0, + ); + } + + late final _filesec_dupPtr = + _lookup>('filesec_dup'); + late final _filesec_dup = + _filesec_dupPtr.asFunction(); + + void filesec_free( + filesec_t arg0, + ) { + return _filesec_free( + arg0, + ); + } + + late final _filesec_freePtr = + _lookup>('filesec_free'); + late final _filesec_free = + _filesec_freePtr.asFunction(); + + int filesec_get_property( + filesec_t arg0, + filesec_property_t arg1, + ffi.Pointer arg2, + ) { + return _filesec_get_property( + arg0, + arg1.value, + arg2, + ); + } + + late final _filesec_get_propertyPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(filesec_t, ffi.UnsignedInt, + ffi.Pointer)>>('filesec_get_property'); + late final _filesec_get_property = _filesec_get_propertyPtr + .asFunction)>(); + + int filesec_query_property( + filesec_t arg0, + filesec_property_t arg1, + ffi.Pointer arg2, + ) { + return _filesec_query_property( + arg0, + arg1.value, + arg2, + ); + } + + late final _filesec_query_propertyPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(filesec_t, ffi.UnsignedInt, + ffi.Pointer)>>('filesec_query_property'); + late final _filesec_query_property = _filesec_query_propertyPtr + .asFunction)>(); + + int filesec_set_property( + filesec_t arg0, + filesec_property_t arg1, + ffi.Pointer arg2, + ) { + return _filesec_set_property( + arg0, + arg1.value, + arg2, + ); + } + + late final _filesec_set_propertyPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(filesec_t, ffi.UnsignedInt, + ffi.Pointer)>>('filesec_set_property'); + late final _filesec_set_property = _filesec_set_propertyPtr + .asFunction)>(); + + int filesec_unset_property( + filesec_t arg0, + filesec_property_t arg1, + ) { + return _filesec_unset_property( + arg0, + arg1.value, + ); + } + + late final _filesec_unset_propertyPtr = + _lookup>( + 'filesec_unset_property'); + late final _filesec_unset_property = + _filesec_unset_propertyPtr.asFunction(); + + int os_workgroup_copy_port( + Dartos_workgroup_t wg, + ffi.Pointer mach_port_out, + ) { + return _os_workgroup_copy_port( + wg.ref.pointer, + mach_port_out, + ); + } + + late final _os_workgroup_copy_portPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(os_workgroup_t, + ffi.Pointer)>>('os_workgroup_copy_port'); + late final _os_workgroup_copy_port = _os_workgroup_copy_portPtr + .asFunction)>(); + + Dartos_workgroup_t? os_workgroup_create_with_port( + ffi.Pointer name, + Dart__darwin_natural_t mach_port, + ) { + return _os_workgroup_create_with_port( + name, + mach_port, + ).address == + 0 + ? null + : OS_os_workgroup.castFromPointer( + _os_workgroup_create_with_port( + name, + mach_port, + ), + retain: false, + release: true); + } + + late final _os_workgroup_create_with_portPtr = _lookup< + ffi.NativeFunction< + os_workgroup_t Function(ffi.Pointer, + mach_port_t)>>('os_workgroup_create_with_port'); + late final _os_workgroup_create_with_port = _os_workgroup_create_with_portPtr + .asFunction, int)>(); + + Dartos_workgroup_t? os_workgroup_create_with_workgroup( + ffi.Pointer name, + Dartos_workgroup_t wg, + ) { + return _os_workgroup_create_with_workgroup( + name, + wg.ref.pointer, + ).address == + 0 + ? null + : OS_os_workgroup.castFromPointer( + _os_workgroup_create_with_workgroup( + name, + wg.ref.pointer, + ), + retain: false, + release: true); + } + + late final _os_workgroup_create_with_workgroupPtr = _lookup< + ffi.NativeFunction< + os_workgroup_t Function(ffi.Pointer, + os_workgroup_t)>>('os_workgroup_create_with_workgroup'); + late final _os_workgroup_create_with_workgroup = + _os_workgroup_create_with_workgroupPtr.asFunction< + os_workgroup_t Function(ffi.Pointer, os_workgroup_t)>(); + + int os_workgroup_join( + Dartos_workgroup_t wg, + os_workgroup_join_token_t token_out, + ) { + return _os_workgroup_join( + wg.ref.pointer, + token_out, + ); + } + + late final _os_workgroup_joinPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + os_workgroup_t, os_workgroup_join_token_t)>>('os_workgroup_join'); + late final _os_workgroup_join = _os_workgroup_joinPtr + .asFunction(); + + void os_workgroup_leave( + Dartos_workgroup_t wg, + os_workgroup_join_token_t token, + ) { + return _os_workgroup_leave( + wg.ref.pointer, + token, + ); + } + + late final _os_workgroup_leavePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(os_workgroup_t, + os_workgroup_join_token_t)>>('os_workgroup_leave'); + late final _os_workgroup_leave = _os_workgroup_leavePtr + .asFunction(); + + int os_workgroup_set_working_arena( + Dartos_workgroup_t wg, + ffi.Pointer arena, + int max_workers, + os_workgroup_working_arena_destructor_t destructor, + ) { + return _os_workgroup_set_working_arena( + wg.ref.pointer, + arena, + max_workers, + destructor, + ); + } + + late final _os_workgroup_set_working_arenaPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(os_workgroup_t, ffi.Pointer, + ffi.Uint32, os_workgroup_working_arena_destructor_t)>>( + 'os_workgroup_set_working_arena'); + late final _os_workgroup_set_working_arena = + _os_workgroup_set_working_arenaPtr.asFunction< + int Function(os_workgroup_t, ffi.Pointer, int, + os_workgroup_working_arena_destructor_t)>(); + + ffi.Pointer os_workgroup_get_working_arena( + Dartos_workgroup_t wg, + ffi.Pointer index_out, + ) { + return _os_workgroup_get_working_arena( + wg.ref.pointer, + index_out, + ); + } + + late final _os_workgroup_get_working_arenaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + os_workgroup_t, ffi.Pointer)>>( + 'os_workgroup_get_working_arena'); + late final _os_workgroup_get_working_arena = + _os_workgroup_get_working_arenaPtr.asFunction< + ffi.Pointer Function( + os_workgroup_t, ffi.Pointer)>(); + + void os_workgroup_cancel( + Dartos_workgroup_t wg, + ) { + return _os_workgroup_cancel( + wg.ref.pointer, + ); + } + + late final _os_workgroup_cancelPtr = + _lookup>( + 'os_workgroup_cancel'); + late final _os_workgroup_cancel = + _os_workgroup_cancelPtr.asFunction(); + + bool os_workgroup_testcancel( + Dartos_workgroup_t wg, + ) { + return _os_workgroup_testcancel( + wg.ref.pointer, + ); + } + + late final _os_workgroup_testcancelPtr = + _lookup>( + 'os_workgroup_testcancel'); + late final _os_workgroup_testcancel = + _os_workgroup_testcancelPtr.asFunction(); + + int os_workgroup_max_parallel_threads( + Dartos_workgroup_t wg, + os_workgroup_mpt_attr_t attr, + ) { + return _os_workgroup_max_parallel_threads( + wg.ref.pointer, + attr, + ); + } + + late final _os_workgroup_max_parallel_threadsPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(os_workgroup_t, + os_workgroup_mpt_attr_t)>>('os_workgroup_max_parallel_threads'); + late final _os_workgroup_max_parallel_threads = + _os_workgroup_max_parallel_threadsPtr + .asFunction(); + + int os_workgroup_interval_start( + Dartos_workgroup_interval_t wg, + int start, + int deadline, + os_workgroup_interval_data_t data, + ) { + return _os_workgroup_interval_start( + wg.ref.pointer, + start, + deadline, + data, + ); + } + + late final _os_workgroup_interval_startPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(os_workgroup_interval_t, ffi.Uint64, ffi.Uint64, + os_workgroup_interval_data_t)>>('os_workgroup_interval_start'); + late final _os_workgroup_interval_start = + _os_workgroup_interval_startPtr.asFunction< + int Function(os_workgroup_interval_t, int, int, + os_workgroup_interval_data_t)>(); + + int os_workgroup_interval_update( + Dartos_workgroup_interval_t wg, + int deadline, + os_workgroup_interval_data_t data, + ) { + return _os_workgroup_interval_update( + wg.ref.pointer, + deadline, + data, + ); + } + + late final _os_workgroup_interval_updatePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(os_workgroup_interval_t, ffi.Uint64, + os_workgroup_interval_data_t)>>('os_workgroup_interval_update'); + late final _os_workgroup_interval_update = + _os_workgroup_interval_updatePtr.asFunction< + int Function( + os_workgroup_interval_t, int, os_workgroup_interval_data_t)>(); + + int os_workgroup_interval_finish( + Dartos_workgroup_interval_t wg, + os_workgroup_interval_data_t data, + ) { + return _os_workgroup_interval_finish( + wg.ref.pointer, + data, + ); + } + + late final _os_workgroup_interval_finishPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(os_workgroup_interval_t, + os_workgroup_interval_data_t)>>('os_workgroup_interval_finish'); + late final _os_workgroup_interval_finish = + _os_workgroup_interval_finishPtr.asFunction< + int Function( + os_workgroup_interval_t, os_workgroup_interval_data_t)>(); + + Dartos_workgroup_parallel_t? os_workgroup_parallel_create( + ffi.Pointer name, + os_workgroup_attr_t attr, + ) { + return _os_workgroup_parallel_create( + name, + attr, + ).address == + 0 + ? null + : OS_os_workgroup.castFromPointer( + _os_workgroup_parallel_create( + name, + attr, + ), + retain: false, + release: true); + } + + late final _os_workgroup_parallel_createPtr = _lookup< + ffi.NativeFunction< + os_workgroup_parallel_t Function(ffi.Pointer, + os_workgroup_attr_t)>>('os_workgroup_parallel_create'); + late final _os_workgroup_parallel_create = + _os_workgroup_parallel_createPtr.asFunction< + os_workgroup_parallel_t Function( + ffi.Pointer, os_workgroup_attr_t)>(); + + int dispatch_time( + int when, + int delta, + ) { + return _dispatch_time( + when, + delta, + ); + } + + late final _dispatch_timePtr = _lookup< + ffi.NativeFunction< + dispatch_time_t Function( + dispatch_time_t, ffi.Int64)>>('dispatch_time'); + late final _dispatch_time = + _dispatch_timePtr.asFunction(); + + int dispatch_walltime( + ffi.Pointer when, + int delta, + ) { + return _dispatch_walltime( + when, + delta, + ); + } + + late final _dispatch_walltimePtr = _lookup< + ffi.NativeFunction< + dispatch_time_t Function( + ffi.Pointer, ffi.Int64)>>('dispatch_walltime'); + late final _dispatch_walltime = _dispatch_walltimePtr + .asFunction, int)>(); + + qos_class_t qos_class_self() { + return qos_class_t.fromValue(_qos_class_self()); + } + + late final _qos_class_selfPtr = + _lookup>('qos_class_self'); + late final _qos_class_self = _qos_class_selfPtr.asFunction(); + + qos_class_t qos_class_main() { + return qos_class_t.fromValue(_qos_class_main()); + } + + late final _qos_class_mainPtr = + _lookup>('qos_class_main'); + late final _qos_class_main = _qos_class_mainPtr.asFunction(); + + void dispatch_retain( + Dartdispatch_object_t object, + ) { + return _dispatch_retain( + object.ref.pointer, + ); + } + + late final _dispatch_retainPtr = + _lookup>( + 'dispatch_retain'); + late final _dispatch_retain = + _dispatch_retainPtr.asFunction(); + + void dispatch_release( + Dartdispatch_object_t object, + ) { + return _dispatch_release( + object.ref.pointer, + ); + } + + late final _dispatch_releasePtr = + _lookup>( + 'dispatch_release'); + late final _dispatch_release = + _dispatch_releasePtr.asFunction(); + + ffi.Pointer dispatch_get_context( + Dartdispatch_object_t object, + ) { + return _dispatch_get_context( + object.ref.pointer, + ); + } + + late final _dispatch_get_contextPtr = _lookup< + ffi + .NativeFunction Function(dispatch_object_t)>>( + 'dispatch_get_context'); + late final _dispatch_get_context = _dispatch_get_contextPtr + .asFunction Function(dispatch_object_t)>(); + + void dispatch_set_context( + Dartdispatch_object_t object, + ffi.Pointer context, + ) { + return _dispatch_set_context( + object.ref.pointer, + context, + ); + } + + late final _dispatch_set_contextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_object_t, + ffi.Pointer)>>('dispatch_set_context'); + late final _dispatch_set_context = _dispatch_set_contextPtr + .asFunction)>(); + + void dispatch_set_finalizer_f( + Dartdispatch_object_t object, + dispatch_function_t finalizer, + ) { + return _dispatch_set_finalizer_f( + object.ref.pointer, + finalizer, + ); + } + + late final _dispatch_set_finalizer_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_object_t, + dispatch_function_t)>>('dispatch_set_finalizer_f'); + late final _dispatch_set_finalizer_f = _dispatch_set_finalizer_fPtr + .asFunction(); + + void dispatch_activate( + Dartdispatch_object_t object, + ) { + return _dispatch_activate( + object.ref.pointer, + ); + } + + late final _dispatch_activatePtr = + _lookup>( + 'dispatch_activate'); + late final _dispatch_activate = + _dispatch_activatePtr.asFunction(); + + void dispatch_suspend( + Dartdispatch_object_t object, + ) { + return _dispatch_suspend( + object.ref.pointer, + ); + } + + late final _dispatch_suspendPtr = + _lookup>( + 'dispatch_suspend'); + late final _dispatch_suspend = + _dispatch_suspendPtr.asFunction(); + + void dispatch_resume( + Dartdispatch_object_t object, + ) { + return _dispatch_resume( + object.ref.pointer, + ); + } + + late final _dispatch_resumePtr = + _lookup>( + 'dispatch_resume'); + late final _dispatch_resume = + _dispatch_resumePtr.asFunction(); + + void dispatch_set_qos_class_floor( + Dartdispatch_object_t object, + qos_class_t qos_class, + int relative_priority, + ) { + return _dispatch_set_qos_class_floor( + object.ref.pointer, + qos_class.value, + relative_priority, + ); + } + + late final _dispatch_set_qos_class_floorPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_object_t, ffi.UnsignedInt, + ffi.Int)>>('dispatch_set_qos_class_floor'); + late final _dispatch_set_qos_class_floor = _dispatch_set_qos_class_floorPtr + .asFunction(); + + int dispatch_wait( + ffi.Pointer object, + int timeout, + ) { + return _dispatch_wait( + object, + timeout, + ); + } + + late final _dispatch_waitPtr = _lookup< + ffi.NativeFunction< + ffi.IntPtr Function( + ffi.Pointer, dispatch_time_t)>>('dispatch_wait'); + late final _dispatch_wait = + _dispatch_waitPtr.asFunction, int)>(); + + void dispatch_notify( + ffi.Pointer object, + Dartdispatch_object_t queue, + Dartdispatch_block_t notification_block, + ) { + return _dispatch_notify( + object, + queue.ref.pointer, + notification_block.ref.pointer, + ); + } + + late final _dispatch_notifyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, dispatch_object_t, + dispatch_block_t)>>('dispatch_notify'); + late final _dispatch_notify = _dispatch_notifyPtr.asFunction< + void Function( + ffi.Pointer, dispatch_object_t, dispatch_block_t)>(); + + void dispatch_cancel( + ffi.Pointer object, + ) { + return _dispatch_cancel( + object, + ); + } + + late final _dispatch_cancelPtr = + _lookup)>>( + 'dispatch_cancel'); + late final _dispatch_cancel = + _dispatch_cancelPtr.asFunction)>(); + + int dispatch_testcancel( + ffi.Pointer object, + ) { + return _dispatch_testcancel( + object, + ); + } + + late final _dispatch_testcancelPtr = + _lookup)>>( + 'dispatch_testcancel'); + late final _dispatch_testcancel = + _dispatch_testcancelPtr.asFunction)>(); + + void dispatch_debug( + Dartdispatch_object_t object, + ffi.Pointer message, + ) { + return _dispatch_debug( + object.ref.pointer, + message, + ); + } + + late final _dispatch_debugPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_object_t, ffi.Pointer)>>('dispatch_debug'); + late final _dispatch_debug = _dispatch_debugPtr + .asFunction)>(); + + void dispatch_debugv( + Dartdispatch_object_t object, + ffi.Pointer message, + va_list ap, + ) { + return _dispatch_debugv( + object.ref.pointer, + message, + ap, + ); + } + + late final _dispatch_debugvPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_object_t, ffi.Pointer, + va_list)>>('dispatch_debugv'); + late final _dispatch_debugv = _dispatch_debugvPtr.asFunction< + void Function(dispatch_object_t, ffi.Pointer, va_list)>(); + + void dispatch_async( + Dartdispatch_queue_t queue, + Dartdispatch_block_t block, + ) { + return _dispatch_async( + queue.ref.pointer, + block.ref.pointer, + ); + } + + late final _dispatch_asyncPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_queue_t, dispatch_block_t)>>('dispatch_async'); + late final _dispatch_async = _dispatch_asyncPtr + .asFunction(); + + void dispatch_async_f( + Dartdispatch_queue_t queue, + ffi.Pointer context, + dispatch_function_t work, + ) { + return _dispatch_async_f( + queue.ref.pointer, + context, + work, + ); + } + + late final _dispatch_async_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_queue_t, ffi.Pointer, + dispatch_function_t)>>('dispatch_async_f'); + late final _dispatch_async_f = _dispatch_async_fPtr.asFunction< + void Function( + dispatch_queue_t, ffi.Pointer, dispatch_function_t)>(); + + void dispatch_sync( + Dartdispatch_queue_t queue, + Dartdispatch_block_t block, + ) { + return _dispatch_sync( + queue.ref.pointer, + block.ref.pointer, + ); + } + + late final _dispatch_syncPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_queue_t, dispatch_block_t)>>('dispatch_sync'); + late final _dispatch_sync = _dispatch_syncPtr + .asFunction(); + + void dispatch_sync_f( + Dartdispatch_queue_t queue, + ffi.Pointer context, + dispatch_function_t work, + ) { + return _dispatch_sync_f( + queue.ref.pointer, + context, + work, + ); + } + + late final _dispatch_sync_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_queue_t, ffi.Pointer, + dispatch_function_t)>>('dispatch_sync_f'); + late final _dispatch_sync_f = _dispatch_sync_fPtr.asFunction< + void Function( + dispatch_queue_t, ffi.Pointer, dispatch_function_t)>(); + + void dispatch_async_and_wait( + Dartdispatch_queue_t queue, + Dartdispatch_block_t block, + ) { + return _dispatch_async_and_wait( + queue.ref.pointer, + block.ref.pointer, + ); + } + + late final _dispatch_async_and_waitPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_queue_t, dispatch_block_t)>>('dispatch_async_and_wait'); + late final _dispatch_async_and_wait = _dispatch_async_and_waitPtr + .asFunction(); + + void dispatch_async_and_wait_f( + Dartdispatch_queue_t queue, + ffi.Pointer context, + dispatch_function_t work, + ) { + return _dispatch_async_and_wait_f( + queue.ref.pointer, + context, + work, + ); + } + + late final _dispatch_async_and_wait_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_queue_t, ffi.Pointer, + dispatch_function_t)>>('dispatch_async_and_wait_f'); + late final _dispatch_async_and_wait_f = + _dispatch_async_and_wait_fPtr.asFunction< + void Function( + dispatch_queue_t, ffi.Pointer, dispatch_function_t)>(); + + void dispatch_apply( + int iterations, + Dartdispatch_queue_t? queue, + objc.ObjCBlock block, + ) { + return _dispatch_apply( + iterations, + queue?.ref.pointer ?? ffi.nullptr, + block.ref.pointer, + ); + } + + late final _dispatch_applyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Size, dispatch_queue_t, + ffi.Pointer)>>('dispatch_apply'); + late final _dispatch_apply = _dispatch_applyPtr.asFunction< + void Function(int, dispatch_queue_t, ffi.Pointer)>(); + + void dispatch_apply_f( + int iterations, + Dartdispatch_queue_t? queue, + ffi.Pointer context, + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer context, ffi.Size iteration)>> + work, + ) { + return _dispatch_apply_f( + iterations, + queue?.ref.pointer ?? ffi.nullptr, + context, + work, + ); + } + + late final _dispatch_apply_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Size, + dispatch_queue_t, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer context, + ffi.Size iteration)>>)>>('dispatch_apply_f'); + late final _dispatch_apply_f = _dispatch_apply_fPtr.asFunction< + void Function( + int, + dispatch_queue_t, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer context, ffi.Size iteration)>>)>(); + + Dartdispatch_queue_t dispatch_get_current_queue() { + return objc.NSObject.castFromPointer(_dispatch_get_current_queue(), + retain: true, release: true); + } + + late final _dispatch_get_current_queuePtr = + _lookup>( + 'dispatch_get_current_queue'); + late final _dispatch_get_current_queue = + _dispatch_get_current_queuePtr.asFunction(); + + late final ffi.Pointer __dispatch_main_q = + _lookup('_dispatch_main_q'); + + ffi.Pointer get _dispatch_main_q => __dispatch_main_q; + + Dartdispatch_queue_global_t dispatch_get_global_queue( + int identifier, + int flags, + ) { + return objc.NSObject.castFromPointer( + _dispatch_get_global_queue( + identifier, + flags, + ), + retain: true, + release: true); + } + + late final _dispatch_get_global_queuePtr = _lookup< + ffi.NativeFunction< + dispatch_queue_global_t Function( + ffi.IntPtr, ffi.UintPtr)>>('dispatch_get_global_queue'); + late final _dispatch_get_global_queue = _dispatch_get_global_queuePtr + .asFunction(); + + late final ffi.Pointer + __dispatch_queue_attr_concurrent = + _lookup('_dispatch_queue_attr_concurrent'); + + ffi.Pointer get _dispatch_queue_attr_concurrent => + __dispatch_queue_attr_concurrent; + + Dartdispatch_queue_attr_t dispatch_queue_attr_make_initially_inactive( + Dartdispatch_queue_attr_t? attr, + ) { + return objc.NSObject.castFromPointer( + _dispatch_queue_attr_make_initially_inactive( + attr?.ref.pointer ?? ffi.nullptr, + ), + retain: true, + release: true); + } + + late final _dispatch_queue_attr_make_initially_inactivePtr = _lookup< + ffi.NativeFunction< + dispatch_queue_attr_t Function(dispatch_queue_attr_t)>>( + 'dispatch_queue_attr_make_initially_inactive'); + late final _dispatch_queue_attr_make_initially_inactive = + _dispatch_queue_attr_make_initially_inactivePtr + .asFunction(); + + Dartdispatch_queue_attr_t dispatch_queue_attr_make_with_autorelease_frequency( + Dartdispatch_queue_attr_t? attr, + dispatch_autorelease_frequency_t frequency, + ) { + return objc.NSObject.castFromPointer( + _dispatch_queue_attr_make_with_autorelease_frequency( + attr?.ref.pointer ?? ffi.nullptr, + frequency.value, + ), + retain: true, + release: true); + } + + late final _dispatch_queue_attr_make_with_autorelease_frequencyPtr = _lookup< + ffi.NativeFunction< + dispatch_queue_attr_t Function( + dispatch_queue_attr_t, ffi.UnsignedLong)>>( + 'dispatch_queue_attr_make_with_autorelease_frequency'); + late final _dispatch_queue_attr_make_with_autorelease_frequency = + _dispatch_queue_attr_make_with_autorelease_frequencyPtr.asFunction< + dispatch_queue_attr_t Function(dispatch_queue_attr_t, int)>(); + + Dartdispatch_queue_attr_t dispatch_queue_attr_make_with_qos_class( + Dartdispatch_queue_attr_t? attr, + qos_class_t qos_class, + int relative_priority, + ) { + return objc.NSObject.castFromPointer( + _dispatch_queue_attr_make_with_qos_class( + attr?.ref.pointer ?? ffi.nullptr, + qos_class.value, + relative_priority, + ), + retain: true, + release: true); + } + + late final _dispatch_queue_attr_make_with_qos_classPtr = _lookup< + ffi.NativeFunction< + dispatch_queue_attr_t Function(dispatch_queue_attr_t, ffi.UnsignedInt, + ffi.Int)>>('dispatch_queue_attr_make_with_qos_class'); + late final _dispatch_queue_attr_make_with_qos_class = + _dispatch_queue_attr_make_with_qos_classPtr.asFunction< + dispatch_queue_attr_t Function(dispatch_queue_attr_t, int, int)>(); + + Dartdispatch_queue_t dispatch_queue_create_with_target( + ffi.Pointer label, + Dartdispatch_queue_attr_t? attr, + Dartdispatch_queue_t? target, + ) { + return objc.NSObject.castFromPointer( + _dispatch_queue_create_with_target( + label, + attr?.ref.pointer ?? ffi.nullptr, + target?.ref.pointer ?? ffi.nullptr, + ), + retain: false, + release: true); + } + + late final _dispatch_queue_create_with_targetPtr = _lookup< + ffi.NativeFunction< + dispatch_queue_t Function( + ffi.Pointer, + dispatch_queue_attr_t, + dispatch_queue_t)>>('dispatch_queue_create_with_target'); + late final _dispatch_queue_create_with_target = + _dispatch_queue_create_with_targetPtr.asFunction< + dispatch_queue_t Function(ffi.Pointer, + dispatch_queue_attr_t, dispatch_queue_t)>(); + + Dartdispatch_queue_t dispatch_queue_create( + ffi.Pointer label, + Dartdispatch_queue_attr_t? attr, + ) { + return objc.NSObject.castFromPointer( + _dispatch_queue_create( + label, + attr?.ref.pointer ?? ffi.nullptr, + ), + retain: false, + release: true); + } + + late final _dispatch_queue_createPtr = _lookup< + ffi.NativeFunction< + dispatch_queue_t Function(ffi.Pointer, + dispatch_queue_attr_t)>>('dispatch_queue_create'); + late final _dispatch_queue_create = _dispatch_queue_createPtr.asFunction< + dispatch_queue_t Function( + ffi.Pointer, dispatch_queue_attr_t)>(); + + ffi.Pointer dispatch_queue_get_label( + Dartdispatch_queue_t? queue, + ) { + return _dispatch_queue_get_label( + queue?.ref.pointer ?? ffi.nullptr, + ); + } + + late final _dispatch_queue_get_labelPtr = _lookup< + ffi.NativeFunction Function(dispatch_queue_t)>>( + 'dispatch_queue_get_label'); + late final _dispatch_queue_get_label = _dispatch_queue_get_labelPtr + .asFunction Function(dispatch_queue_t)>(); + + qos_class_t dispatch_queue_get_qos_class( + Dartdispatch_queue_t queue, + ffi.Pointer relative_priority_ptr, + ) { + return qos_class_t.fromValue(_dispatch_queue_get_qos_class( + queue.ref.pointer, + relative_priority_ptr, + )); + } + + late final _dispatch_queue_get_qos_classPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedInt Function(dispatch_queue_t, + ffi.Pointer)>>('dispatch_queue_get_qos_class'); + late final _dispatch_queue_get_qos_class = _dispatch_queue_get_qos_classPtr + .asFunction)>(); + + void dispatch_set_target_queue( + Dartdispatch_object_t object, + Dartdispatch_queue_t? queue, + ) { + return _dispatch_set_target_queue( + object.ref.pointer, + queue?.ref.pointer ?? ffi.nullptr, + ); + } + + late final _dispatch_set_target_queuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_object_t, + dispatch_queue_t)>>('dispatch_set_target_queue'); + late final _dispatch_set_target_queue = _dispatch_set_target_queuePtr + .asFunction(); + + void dispatch_main() { + return _dispatch_main(); + } + + late final _dispatch_mainPtr = + _lookup>('dispatch_main'); + late final _dispatch_main = _dispatch_mainPtr.asFunction(); + + void dispatch_after( + Dartdispatch_time_t when, + Dartdispatch_queue_t queue, + Dartdispatch_block_t block, + ) { + return _dispatch_after( + when, + queue.ref.pointer, + block.ref.pointer, + ); + } + + late final _dispatch_afterPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_time_t, dispatch_queue_t, + dispatch_block_t)>>('dispatch_after'); + late final _dispatch_after = _dispatch_afterPtr + .asFunction(); + + void dispatch_after_f( + Dartdispatch_time_t when, + Dartdispatch_queue_t queue, + ffi.Pointer context, + dispatch_function_t work, + ) { + return _dispatch_after_f( + when, + queue.ref.pointer, + context, + work, + ); + } + + late final _dispatch_after_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_time_t, dispatch_queue_t, + ffi.Pointer, dispatch_function_t)>>('dispatch_after_f'); + late final _dispatch_after_f = _dispatch_after_fPtr.asFunction< + void Function( + int, dispatch_queue_t, ffi.Pointer, dispatch_function_t)>(); + + void dispatch_barrier_async( + Dartdispatch_queue_t queue, + Dartdispatch_block_t block, + ) { + return _dispatch_barrier_async( + queue.ref.pointer, + block.ref.pointer, + ); + } + + late final _dispatch_barrier_asyncPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_queue_t, dispatch_block_t)>>('dispatch_barrier_async'); + late final _dispatch_barrier_async = _dispatch_barrier_asyncPtr + .asFunction(); + + void dispatch_barrier_async_f( + Dartdispatch_queue_t queue, + ffi.Pointer context, + dispatch_function_t work, + ) { + return _dispatch_barrier_async_f( + queue.ref.pointer, + context, + work, + ); + } + + late final _dispatch_barrier_async_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_queue_t, ffi.Pointer, + dispatch_function_t)>>('dispatch_barrier_async_f'); + late final _dispatch_barrier_async_f = + _dispatch_barrier_async_fPtr.asFunction< + void Function( + dispatch_queue_t, ffi.Pointer, dispatch_function_t)>(); + + void dispatch_barrier_sync( + Dartdispatch_queue_t queue, + Dartdispatch_block_t block, + ) { + return _dispatch_barrier_sync( + queue.ref.pointer, + block.ref.pointer, + ); + } + + late final _dispatch_barrier_syncPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_queue_t, dispatch_block_t)>>('dispatch_barrier_sync'); + late final _dispatch_barrier_sync = _dispatch_barrier_syncPtr + .asFunction(); + + void dispatch_barrier_sync_f( + Dartdispatch_queue_t queue, + ffi.Pointer context, + dispatch_function_t work, + ) { + return _dispatch_barrier_sync_f( + queue.ref.pointer, + context, + work, + ); + } + + late final _dispatch_barrier_sync_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_queue_t, ffi.Pointer, + dispatch_function_t)>>('dispatch_barrier_sync_f'); + late final _dispatch_barrier_sync_f = _dispatch_barrier_sync_fPtr.asFunction< + void Function( + dispatch_queue_t, ffi.Pointer, dispatch_function_t)>(); + + void dispatch_barrier_async_and_wait( + Dartdispatch_queue_t queue, + Dartdispatch_block_t block, + ) { + return _dispatch_barrier_async_and_wait( + queue.ref.pointer, + block.ref.pointer, + ); + } + + late final _dispatch_barrier_async_and_waitPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_queue_t, + dispatch_block_t)>>('dispatch_barrier_async_and_wait'); + late final _dispatch_barrier_async_and_wait = + _dispatch_barrier_async_and_waitPtr + .asFunction(); + + void dispatch_barrier_async_and_wait_f( + Dartdispatch_queue_t queue, + ffi.Pointer context, + dispatch_function_t work, + ) { + return _dispatch_barrier_async_and_wait_f( + queue.ref.pointer, + context, + work, + ); + } + + late final _dispatch_barrier_async_and_wait_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_queue_t, ffi.Pointer, + dispatch_function_t)>>('dispatch_barrier_async_and_wait_f'); + late final _dispatch_barrier_async_and_wait_f = + _dispatch_barrier_async_and_wait_fPtr.asFunction< + void Function( + dispatch_queue_t, ffi.Pointer, dispatch_function_t)>(); + + void dispatch_queue_set_specific( + Dartdispatch_queue_t queue, + ffi.Pointer key, + ffi.Pointer context, + dispatch_function_t destructor, + ) { + return _dispatch_queue_set_specific( + queue.ref.pointer, + key, + context, + destructor, + ); + } + + late final _dispatch_queue_set_specificPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_queue_t, + ffi.Pointer, + ffi.Pointer, + dispatch_function_t)>>('dispatch_queue_set_specific'); + late final _dispatch_queue_set_specific = + _dispatch_queue_set_specificPtr.asFunction< + void Function(dispatch_queue_t, ffi.Pointer, + ffi.Pointer, dispatch_function_t)>(); + + ffi.Pointer dispatch_queue_get_specific( + Dartdispatch_queue_t queue, + ffi.Pointer key, + ) { + return _dispatch_queue_get_specific( + queue.ref.pointer, + key, + ); + } + + late final _dispatch_queue_get_specificPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(dispatch_queue_t, + ffi.Pointer)>>('dispatch_queue_get_specific'); + late final _dispatch_queue_get_specific = + _dispatch_queue_get_specificPtr.asFunction< + ffi.Pointer Function( + dispatch_queue_t, ffi.Pointer)>(); + + ffi.Pointer dispatch_get_specific( + ffi.Pointer key, + ) { + return _dispatch_get_specific( + key, + ); + } + + late final _dispatch_get_specificPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('dispatch_get_specific'); + late final _dispatch_get_specific = _dispatch_get_specificPtr + .asFunction Function(ffi.Pointer)>(); + + void dispatch_assert_queue( + Dartdispatch_queue_t queue, + ) { + return _dispatch_assert_queue( + queue.ref.pointer, + ); + } + + late final _dispatch_assert_queuePtr = + _lookup>( + 'dispatch_assert_queue'); + late final _dispatch_assert_queue = + _dispatch_assert_queuePtr.asFunction(); + + void dispatch_assert_queue_barrier( + Dartdispatch_queue_t queue, + ) { + return _dispatch_assert_queue_barrier( + queue.ref.pointer, + ); + } + + late final _dispatch_assert_queue_barrierPtr = + _lookup>( + 'dispatch_assert_queue_barrier'); + late final _dispatch_assert_queue_barrier = _dispatch_assert_queue_barrierPtr + .asFunction(); + + void dispatch_assert_queue_not( + Dartdispatch_queue_t queue, + ) { + return _dispatch_assert_queue_not( + queue.ref.pointer, + ); + } + + late final _dispatch_assert_queue_notPtr = + _lookup>( + 'dispatch_assert_queue_not'); + late final _dispatch_assert_queue_not = _dispatch_assert_queue_notPtr + .asFunction(); + + int dispatch_allow_send_signals( + int preserve_signum, + ) { + return _dispatch_allow_send_signals( + preserve_signum, + ); + } + + late final _dispatch_allow_send_signalsPtr = + _lookup>( + 'dispatch_allow_send_signals'); + late final _dispatch_allow_send_signals = + _dispatch_allow_send_signalsPtr.asFunction(); + + Dartdispatch_block_t dispatch_block_create( + dispatch_block_flags_t flags, + Dartdispatch_block_t block, + ) { + return ObjCBlock_ffiVoid.castFromPointer( + _dispatch_block_create( + flags.value, + block.ref.pointer, + ), + retain: false, + release: true); + } + + late final _dispatch_block_createPtr = _lookup< + ffi.NativeFunction< + dispatch_block_t Function( + ffi.UnsignedLong, dispatch_block_t)>>('dispatch_block_create'); + late final _dispatch_block_create = _dispatch_block_createPtr + .asFunction(); + + Dartdispatch_block_t dispatch_block_create_with_qos_class( + dispatch_block_flags_t flags, + qos_class_t qos_class, + int relative_priority, + Dartdispatch_block_t block, + ) { + return ObjCBlock_ffiVoid.castFromPointer( + _dispatch_block_create_with_qos_class( + flags.value, + qos_class.value, + relative_priority, + block.ref.pointer, + ), + retain: false, + release: true); + } + + late final _dispatch_block_create_with_qos_classPtr = _lookup< + ffi.NativeFunction< + dispatch_block_t Function(ffi.UnsignedLong, ffi.UnsignedInt, ffi.Int, + dispatch_block_t)>>('dispatch_block_create_with_qos_class'); + late final _dispatch_block_create_with_qos_class = + _dispatch_block_create_with_qos_classPtr.asFunction< + dispatch_block_t Function(int, int, int, dispatch_block_t)>(); + + void dispatch_block_perform( + dispatch_block_flags_t flags, + Dartdispatch_block_t block, + ) { + return _dispatch_block_perform( + flags.value, + block.ref.pointer, + ); + } + + late final _dispatch_block_performPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.UnsignedLong, dispatch_block_t)>>('dispatch_block_perform'); + late final _dispatch_block_perform = _dispatch_block_performPtr + .asFunction(); + + int dispatch_block_wait( + Dartdispatch_block_t block, + Dartdispatch_time_t timeout, + ) { + return _dispatch_block_wait( + block.ref.pointer, + timeout, + ); + } + + late final _dispatch_block_waitPtr = _lookup< + ffi.NativeFunction< + ffi.IntPtr Function( + dispatch_block_t, dispatch_time_t)>>('dispatch_block_wait'); + late final _dispatch_block_wait = + _dispatch_block_waitPtr.asFunction(); + + void dispatch_block_notify( + Dartdispatch_block_t block, + Dartdispatch_queue_t queue, + Dartdispatch_block_t notification_block, + ) { + return _dispatch_block_notify( + block.ref.pointer, + queue.ref.pointer, + notification_block.ref.pointer, + ); + } + + late final _dispatch_block_notifyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_block_t, dispatch_queue_t, + dispatch_block_t)>>('dispatch_block_notify'); + late final _dispatch_block_notify = _dispatch_block_notifyPtr.asFunction< + void Function(dispatch_block_t, dispatch_queue_t, dispatch_block_t)>(); + + void dispatch_block_cancel( + Dartdispatch_block_t block, + ) { + return _dispatch_block_cancel( + block.ref.pointer, + ); + } + + late final _dispatch_block_cancelPtr = + _lookup>( + 'dispatch_block_cancel'); + late final _dispatch_block_cancel = + _dispatch_block_cancelPtr.asFunction(); + + int dispatch_block_testcancel( + Dartdispatch_block_t block, + ) { + return _dispatch_block_testcancel( + block.ref.pointer, + ); + } + + late final _dispatch_block_testcancelPtr = + _lookup>( + 'dispatch_block_testcancel'); + late final _dispatch_block_testcancel = _dispatch_block_testcancelPtr + .asFunction(); + + late final ffi.Pointer _KERNEL_SECURITY_TOKEN = + _lookup('KERNEL_SECURITY_TOKEN'); + + security_token_t get KERNEL_SECURITY_TOKEN => _KERNEL_SECURITY_TOKEN.ref; + + late final ffi.Pointer _KERNEL_AUDIT_TOKEN = + _lookup('KERNEL_AUDIT_TOKEN'); + + audit_token_t get KERNEL_AUDIT_TOKEN => _KERNEL_AUDIT_TOKEN.ref; + + int mach_msg_overwrite( + ffi.Pointer msg, + int option, + int send_size, + int rcv_size, + int rcv_name, + int timeout, + int notify, + ffi.Pointer rcv_msg, + int rcv_limit, + ) { + return _mach_msg_overwrite( + msg, + option, + send_size, + rcv_size, + rcv_name, + timeout, + notify, + rcv_msg, + rcv_limit, + ); + } + + late final _mach_msg_overwritePtr = _lookup< + ffi.NativeFunction< + mach_msg_return_t Function( + ffi.Pointer, + mach_msg_option_t, + mach_msg_size_t, + mach_msg_size_t, + mach_port_name_t, + mach_msg_timeout_t, + mach_port_name_t, + ffi.Pointer, + mach_msg_size_t)>>('mach_msg_overwrite'); + late final _mach_msg_overwrite = _mach_msg_overwritePtr.asFunction< + int Function(ffi.Pointer, int, int, int, int, int, int, + ffi.Pointer, int)>(); + + int mach_msg( + ffi.Pointer msg, + int option, + int send_size, + int rcv_size, + int rcv_name, + int timeout, + int notify, + ) { + return _mach_msg( + msg, + option, + send_size, + rcv_size, + rcv_name, + timeout, + notify, + ); + } + + late final _mach_msgPtr = _lookup< + ffi.NativeFunction< + mach_msg_return_t Function( + ffi.Pointer, + mach_msg_option_t, + mach_msg_size_t, + mach_msg_size_t, + mach_port_name_t, + mach_msg_timeout_t, + mach_port_name_t)>>('mach_msg'); + late final _mach_msg = _mach_msgPtr.asFunction< + int Function( + ffi.Pointer, int, int, int, int, int, int)>(); + + int mach_voucher_deallocate( + int voucher, + ) { + return _mach_voucher_deallocate( + voucher, + ); + } + + late final _mach_voucher_deallocatePtr = + _lookup>( + 'mach_voucher_deallocate'); + late final _mach_voucher_deallocate = + _mach_voucher_deallocatePtr.asFunction(); + + late final ffi.Pointer + __dispatch_source_type_data_add = + _lookup('_dispatch_source_type_data_add'); + + ffi.Pointer get _dispatch_source_type_data_add => + __dispatch_source_type_data_add; + + late final ffi.Pointer + __dispatch_source_type_data_or = + _lookup('_dispatch_source_type_data_or'); + + ffi.Pointer get _dispatch_source_type_data_or => + __dispatch_source_type_data_or; + + late final ffi.Pointer + __dispatch_source_type_data_replace = + _lookup('_dispatch_source_type_data_replace'); + + ffi.Pointer get _dispatch_source_type_data_replace => + __dispatch_source_type_data_replace; + + late final ffi.Pointer + __dispatch_source_type_mach_send = + _lookup('_dispatch_source_type_mach_send'); + + ffi.Pointer get _dispatch_source_type_mach_send => + __dispatch_source_type_mach_send; + + late final ffi.Pointer + __dispatch_source_type_mach_recv = + _lookup('_dispatch_source_type_mach_recv'); + + ffi.Pointer get _dispatch_source_type_mach_recv => + __dispatch_source_type_mach_recv; + + late final ffi.Pointer + __dispatch_source_type_memorypressure = + _lookup('_dispatch_source_type_memorypressure'); + + ffi.Pointer + get _dispatch_source_type_memorypressure => + __dispatch_source_type_memorypressure; + + late final ffi.Pointer __dispatch_source_type_proc = + _lookup('_dispatch_source_type_proc'); + + ffi.Pointer get _dispatch_source_type_proc => + __dispatch_source_type_proc; + + late final ffi.Pointer __dispatch_source_type_read = + _lookup('_dispatch_source_type_read'); + + ffi.Pointer get _dispatch_source_type_read => + __dispatch_source_type_read; + + late final ffi.Pointer __dispatch_source_type_signal = + _lookup('_dispatch_source_type_signal'); + + ffi.Pointer get _dispatch_source_type_signal => + __dispatch_source_type_signal; + + late final ffi.Pointer __dispatch_source_type_timer = + _lookup('_dispatch_source_type_timer'); + + ffi.Pointer get _dispatch_source_type_timer => + __dispatch_source_type_timer; + + late final ffi.Pointer __dispatch_source_type_vnode = + _lookup('_dispatch_source_type_vnode'); + + ffi.Pointer get _dispatch_source_type_vnode => + __dispatch_source_type_vnode; + + late final ffi.Pointer __dispatch_source_type_write = + _lookup('_dispatch_source_type_write'); + + ffi.Pointer get _dispatch_source_type_write => + __dispatch_source_type_write; + + Dartdispatch_source_t dispatch_source_create( + dispatch_source_type_t type, + int handle, + int mask, + Dartdispatch_queue_t? queue, + ) { + return objc.NSObject.castFromPointer( + _dispatch_source_create( + type, + handle, + mask, + queue?.ref.pointer ?? ffi.nullptr, + ), + retain: false, + release: true); + } + + late final _dispatch_source_createPtr = _lookup< + ffi.NativeFunction< + dispatch_source_t Function(dispatch_source_type_t, ffi.UintPtr, + ffi.UintPtr, dispatch_queue_t)>>('dispatch_source_create'); + late final _dispatch_source_create = _dispatch_source_createPtr.asFunction< + dispatch_source_t Function( + dispatch_source_type_t, int, int, dispatch_queue_t)>(); + + void dispatch_source_set_event_handler( + Dartdispatch_source_t source, + Dartdispatch_block_t? handler, + ) { + return _dispatch_source_set_event_handler( + source.ref.pointer, + handler?.ref.pointer ?? ffi.nullptr, + ); + } + + late final _dispatch_source_set_event_handlerPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_source_t, + dispatch_block_t)>>('dispatch_source_set_event_handler'); + late final _dispatch_source_set_event_handler = + _dispatch_source_set_event_handlerPtr + .asFunction(); + + void dispatch_source_set_event_handler_f( + Dartdispatch_source_t source, + dispatch_function_t handler, + ) { + return _dispatch_source_set_event_handler_f( + source.ref.pointer, + handler, + ); + } + + late final _dispatch_source_set_event_handler_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_source_t, + dispatch_function_t)>>('dispatch_source_set_event_handler_f'); + late final _dispatch_source_set_event_handler_f = + _dispatch_source_set_event_handler_fPtr + .asFunction(); + + void dispatch_source_set_cancel_handler( + Dartdispatch_source_t source, + Dartdispatch_block_t? handler, + ) { + return _dispatch_source_set_cancel_handler( + source.ref.pointer, + handler?.ref.pointer ?? ffi.nullptr, + ); + } + + late final _dispatch_source_set_cancel_handlerPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_source_t, + dispatch_block_t)>>('dispatch_source_set_cancel_handler'); + late final _dispatch_source_set_cancel_handler = + _dispatch_source_set_cancel_handlerPtr + .asFunction(); + + void dispatch_source_set_cancel_handler_f( + Dartdispatch_source_t source, + dispatch_function_t handler, + ) { + return _dispatch_source_set_cancel_handler_f( + source.ref.pointer, + handler, + ); + } + + late final _dispatch_source_set_cancel_handler_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_source_t, + dispatch_function_t)>>('dispatch_source_set_cancel_handler_f'); + late final _dispatch_source_set_cancel_handler_f = + _dispatch_source_set_cancel_handler_fPtr + .asFunction(); + + void dispatch_source_cancel( + Dartdispatch_source_t source, + ) { + return _dispatch_source_cancel( + source.ref.pointer, + ); + } + + late final _dispatch_source_cancelPtr = + _lookup>( + 'dispatch_source_cancel'); + late final _dispatch_source_cancel = + _dispatch_source_cancelPtr.asFunction(); + + int dispatch_source_testcancel( + Dartdispatch_source_t source, + ) { + return _dispatch_source_testcancel( + source.ref.pointer, + ); + } + + late final _dispatch_source_testcancelPtr = + _lookup>( + 'dispatch_source_testcancel'); + late final _dispatch_source_testcancel = _dispatch_source_testcancelPtr + .asFunction(); + + int dispatch_source_get_handle( + Dartdispatch_source_t source, + ) { + return _dispatch_source_get_handle( + source.ref.pointer, + ); + } + + late final _dispatch_source_get_handlePtr = + _lookup>( + 'dispatch_source_get_handle'); + late final _dispatch_source_get_handle = _dispatch_source_get_handlePtr + .asFunction(); + + int dispatch_source_get_mask( + Dartdispatch_source_t source, + ) { + return _dispatch_source_get_mask( + source.ref.pointer, + ); + } + + late final _dispatch_source_get_maskPtr = + _lookup>( + 'dispatch_source_get_mask'); + late final _dispatch_source_get_mask = _dispatch_source_get_maskPtr + .asFunction(); + + int dispatch_source_get_data( + Dartdispatch_source_t source, + ) { + return _dispatch_source_get_data( + source.ref.pointer, + ); + } + + late final _dispatch_source_get_dataPtr = + _lookup>( + 'dispatch_source_get_data'); + late final _dispatch_source_get_data = _dispatch_source_get_dataPtr + .asFunction(); + + void dispatch_source_merge_data( + Dartdispatch_source_t source, + int value, + ) { + return _dispatch_source_merge_data( + source.ref.pointer, + value, + ); + } + + late final _dispatch_source_merge_dataPtr = _lookup< + ffi + .NativeFunction>( + 'dispatch_source_merge_data'); + late final _dispatch_source_merge_data = _dispatch_source_merge_dataPtr + .asFunction(); + + void dispatch_source_set_timer( + Dartdispatch_source_t source, + Dartdispatch_time_t start, + int interval, + int leeway, + ) { + return _dispatch_source_set_timer( + source.ref.pointer, + start, + interval, + leeway, + ); + } + + late final _dispatch_source_set_timerPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_source_t, dispatch_time_t, ffi.Uint64, + ffi.Uint64)>>('dispatch_source_set_timer'); + late final _dispatch_source_set_timer = _dispatch_source_set_timerPtr + .asFunction(); + + void dispatch_source_set_registration_handler( + Dartdispatch_source_t source, + Dartdispatch_block_t? handler, + ) { + return _dispatch_source_set_registration_handler( + source.ref.pointer, + handler?.ref.pointer ?? ffi.nullptr, + ); + } + + late final _dispatch_source_set_registration_handlerPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_source_t, + dispatch_block_t)>>('dispatch_source_set_registration_handler'); + late final _dispatch_source_set_registration_handler = + _dispatch_source_set_registration_handlerPtr + .asFunction(); + + void dispatch_source_set_registration_handler_f( + Dartdispatch_source_t source, + dispatch_function_t handler, + ) { + return _dispatch_source_set_registration_handler_f( + source.ref.pointer, + handler, + ); + } + + late final _dispatch_source_set_registration_handler_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_source_t, dispatch_function_t)>>( + 'dispatch_source_set_registration_handler_f'); + late final _dispatch_source_set_registration_handler_f = + _dispatch_source_set_registration_handler_fPtr + .asFunction(); + + Dartdispatch_group_t dispatch_group_create() { + return objc.NSObject.castFromPointer(_dispatch_group_create(), + retain: false, release: true); + } + + late final _dispatch_group_createPtr = + _lookup>( + 'dispatch_group_create'); + late final _dispatch_group_create = + _dispatch_group_createPtr.asFunction(); + + void dispatch_group_async( + Dartdispatch_group_t group, + Dartdispatch_queue_t queue, + Dartdispatch_block_t block, + ) { + return _dispatch_group_async( + group.ref.pointer, + queue.ref.pointer, + block.ref.pointer, + ); + } + + late final _dispatch_group_asyncPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_group_t, dispatch_queue_t, + dispatch_block_t)>>('dispatch_group_async'); + late final _dispatch_group_async = _dispatch_group_asyncPtr.asFunction< + void Function(dispatch_group_t, dispatch_queue_t, dispatch_block_t)>(); + + void dispatch_group_async_f( + Dartdispatch_group_t group, + Dartdispatch_queue_t queue, + ffi.Pointer context, + dispatch_function_t work, + ) { + return _dispatch_group_async_f( + group.ref.pointer, + queue.ref.pointer, + context, + work, + ); + } + + late final _dispatch_group_async_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_group_t, + dispatch_queue_t, + ffi.Pointer, + dispatch_function_t)>>('dispatch_group_async_f'); + late final _dispatch_group_async_f = _dispatch_group_async_fPtr.asFunction< + void Function(dispatch_group_t, dispatch_queue_t, ffi.Pointer, + dispatch_function_t)>(); + + int dispatch_group_wait( + Dartdispatch_group_t group, + Dartdispatch_time_t timeout, + ) { + return _dispatch_group_wait( + group.ref.pointer, + timeout, + ); + } + + late final _dispatch_group_waitPtr = _lookup< + ffi.NativeFunction< + ffi.IntPtr Function( + dispatch_group_t, dispatch_time_t)>>('dispatch_group_wait'); + late final _dispatch_group_wait = + _dispatch_group_waitPtr.asFunction(); + + void dispatch_group_notify( + Dartdispatch_group_t group, + Dartdispatch_queue_t queue, + Dartdispatch_block_t block, + ) { + return _dispatch_group_notify( + group.ref.pointer, + queue.ref.pointer, + block.ref.pointer, + ); + } + + late final _dispatch_group_notifyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_group_t, dispatch_queue_t, + dispatch_block_t)>>('dispatch_group_notify'); + late final _dispatch_group_notify = _dispatch_group_notifyPtr.asFunction< + void Function(dispatch_group_t, dispatch_queue_t, dispatch_block_t)>(); + + void dispatch_group_notify_f( + Dartdispatch_group_t group, + Dartdispatch_queue_t queue, + ffi.Pointer context, + dispatch_function_t work, + ) { + return _dispatch_group_notify_f( + group.ref.pointer, + queue.ref.pointer, + context, + work, + ); + } + + late final _dispatch_group_notify_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_group_t, + dispatch_queue_t, + ffi.Pointer, + dispatch_function_t)>>('dispatch_group_notify_f'); + late final _dispatch_group_notify_f = _dispatch_group_notify_fPtr.asFunction< + void Function(dispatch_group_t, dispatch_queue_t, ffi.Pointer, + dispatch_function_t)>(); + + void dispatch_group_enter( + Dartdispatch_group_t group, + ) { + return _dispatch_group_enter( + group.ref.pointer, + ); + } + + late final _dispatch_group_enterPtr = + _lookup>( + 'dispatch_group_enter'); + late final _dispatch_group_enter = + _dispatch_group_enterPtr.asFunction(); + + void dispatch_group_leave( + Dartdispatch_group_t group, + ) { + return _dispatch_group_leave( + group.ref.pointer, + ); + } + + late final _dispatch_group_leavePtr = + _lookup>( + 'dispatch_group_leave'); + late final _dispatch_group_leave = + _dispatch_group_leavePtr.asFunction(); + + Dartdispatch_semaphore_t dispatch_semaphore_create( + int value, + ) { + return objc.NSObject.castFromPointer( + _dispatch_semaphore_create( + value, + ), + retain: false, + release: true); + } + + late final _dispatch_semaphore_createPtr = + _lookup>( + 'dispatch_semaphore_create'); + late final _dispatch_semaphore_create = _dispatch_semaphore_createPtr + .asFunction(); + + int dispatch_semaphore_wait( + Dartdispatch_semaphore_t dsema, + Dartdispatch_time_t timeout, + ) { + return _dispatch_semaphore_wait( + dsema.ref.pointer, + timeout, + ); + } + + late final _dispatch_semaphore_waitPtr = _lookup< + ffi.NativeFunction< + ffi.IntPtr Function(dispatch_semaphore_t, + dispatch_time_t)>>('dispatch_semaphore_wait'); + late final _dispatch_semaphore_wait = _dispatch_semaphore_waitPtr + .asFunction(); + + int dispatch_semaphore_signal( + Dartdispatch_semaphore_t dsema, + ) { + return _dispatch_semaphore_signal( + dsema.ref.pointer, + ); + } + + late final _dispatch_semaphore_signalPtr = + _lookup>( + 'dispatch_semaphore_signal'); + late final _dispatch_semaphore_signal = _dispatch_semaphore_signalPtr + .asFunction(); + + void dispatch_once( + ffi.Pointer predicate, + Dartdispatch_block_t block, + ) { + return _dispatch_once( + predicate, + block.ref.pointer, + ); + } + + late final _dispatch_oncePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + dispatch_block_t)>>('dispatch_once'); + late final _dispatch_once = _dispatch_oncePtr.asFunction< + void Function(ffi.Pointer, dispatch_block_t)>(); + + void dispatch_once_f( + ffi.Pointer predicate, + ffi.Pointer context, + dispatch_function_t function, + ) { + return _dispatch_once_f( + predicate, + context, + function, + ); + } + + late final _dispatch_once_fPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + dispatch_function_t)>>('dispatch_once_f'); + late final _dispatch_once_f = _dispatch_once_fPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, + dispatch_function_t)>(); + + late final ffi.Pointer __dispatch_data_empty = + _lookup('_dispatch_data_empty'); + + ffi.Pointer get _dispatch_data_empty => + __dispatch_data_empty; + + late final ffi.Pointer __dispatch_data_destructor_free = + _lookup('_dispatch_data_destructor_free'); + + Dartdispatch_block_t get _dispatch_data_destructor_free => + ObjCBlock_ffiVoid.castFromPointer(__dispatch_data_destructor_free.value, + retain: true, release: true); + + set _dispatch_data_destructor_free(Dartdispatch_block_t value) { + ObjCBlock_ffiVoid.castFromPointer(__dispatch_data_destructor_free.value, + retain: false, release: true) + .ref + .release(); + __dispatch_data_destructor_free.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer __dispatch_data_destructor_munmap = + _lookup('_dispatch_data_destructor_munmap'); + + Dartdispatch_block_t get _dispatch_data_destructor_munmap => + ObjCBlock_ffiVoid.castFromPointer(__dispatch_data_destructor_munmap.value, + retain: true, release: true); + + set _dispatch_data_destructor_munmap(Dartdispatch_block_t value) { + ObjCBlock_ffiVoid.castFromPointer(__dispatch_data_destructor_munmap.value, + retain: false, release: true) + .ref + .release(); + __dispatch_data_destructor_munmap.value = + value.ref.retainAndReturnPointer(); + } + + Dartdispatch_data_t dispatch_data_create( + ffi.Pointer buffer, + int size, + Dartdispatch_queue_t? queue, + Dartdispatch_block_t? destructor, + ) { + return objc.NSObject.castFromPointer( + _dispatch_data_create( + buffer, + size, + queue?.ref.pointer ?? ffi.nullptr, + destructor?.ref.pointer ?? ffi.nullptr, + ), + retain: false, + release: true); + } + + late final _dispatch_data_createPtr = _lookup< + ffi.NativeFunction< + dispatch_data_t Function(ffi.Pointer, ffi.Size, + dispatch_queue_t, dispatch_block_t)>>('dispatch_data_create'); + late final _dispatch_data_create = _dispatch_data_createPtr.asFunction< + dispatch_data_t Function( + ffi.Pointer, int, dispatch_queue_t, dispatch_block_t)>(); + + int dispatch_data_get_size( + Dartdispatch_data_t data, + ) { + return _dispatch_data_get_size( + data.ref.pointer, + ); + } + + late final _dispatch_data_get_sizePtr = + _lookup>( + 'dispatch_data_get_size'); + late final _dispatch_data_get_size = + _dispatch_data_get_sizePtr.asFunction(); + + Dartdispatch_data_t dispatch_data_create_map( + Dartdispatch_data_t data, + ffi.Pointer> buffer_ptr, + ffi.Pointer size_ptr, + ) { + return objc.NSObject.castFromPointer( + _dispatch_data_create_map( + data.ref.pointer, + buffer_ptr, + size_ptr, + ), + retain: false, + release: true); + } + + late final _dispatch_data_create_mapPtr = _lookup< + ffi.NativeFunction< + dispatch_data_t Function( + dispatch_data_t, + ffi.Pointer>, + ffi.Pointer)>>('dispatch_data_create_map'); + late final _dispatch_data_create_map = + _dispatch_data_create_mapPtr.asFunction< + dispatch_data_t Function(dispatch_data_t, + ffi.Pointer>, ffi.Pointer)>(); + + Dartdispatch_data_t dispatch_data_create_concat( + Dartdispatch_data_t data1, + Dartdispatch_data_t data2, + ) { + return objc.NSObject.castFromPointer( + _dispatch_data_create_concat( + data1.ref.pointer, + data2.ref.pointer, + ), + retain: false, + release: true); + } + + late final _dispatch_data_create_concatPtr = _lookup< + ffi.NativeFunction< + dispatch_data_t Function(dispatch_data_t, + dispatch_data_t)>>('dispatch_data_create_concat'); + late final _dispatch_data_create_concat = _dispatch_data_create_concatPtr + .asFunction(); + + Dartdispatch_data_t dispatch_data_create_subrange( + Dartdispatch_data_t data, + int offset, + int length, + ) { + return objc.NSObject.castFromPointer( + _dispatch_data_create_subrange( + data.ref.pointer, + offset, + length, + ), + retain: false, + release: true); + } + + late final _dispatch_data_create_subrangePtr = _lookup< + ffi.NativeFunction< + dispatch_data_t Function(dispatch_data_t, ffi.Size, + ffi.Size)>>('dispatch_data_create_subrange'); + late final _dispatch_data_create_subrange = _dispatch_data_create_subrangePtr + .asFunction(); + + bool dispatch_data_apply( + Dartdispatch_data_t data, + Dartdispatch_data_applier_t applier, + ) { + return _dispatch_data_apply( + data.ref.pointer, + applier.ref.pointer, + ); + } + + late final _dispatch_data_applyPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function(dispatch_data_t, + dispatch_data_applier_t)>>('dispatch_data_apply'); + late final _dispatch_data_apply = _dispatch_data_applyPtr + .asFunction(); + + Dartdispatch_data_t dispatch_data_copy_region( + Dartdispatch_data_t data, + int location, + ffi.Pointer offset_ptr, + ) { + return objc.NSObject.castFromPointer( + _dispatch_data_copy_region( + data.ref.pointer, + location, + offset_ptr, + ), + retain: false, + release: true); + } + + late final _dispatch_data_copy_regionPtr = _lookup< + ffi.NativeFunction< + dispatch_data_t Function(dispatch_data_t, ffi.Size, + ffi.Pointer)>>('dispatch_data_copy_region'); + late final _dispatch_data_copy_region = + _dispatch_data_copy_regionPtr.asFunction< + dispatch_data_t Function( + dispatch_data_t, int, ffi.Pointer)>(); + + void dispatch_read( + Dartdispatch_fd_t fd, + int length, + Dartdispatch_queue_t queue, + objc.ObjCBlock handler, + ) { + return _dispatch_read( + fd, + length, + queue.ref.pointer, + handler.ref.pointer, + ); + } + + late final _dispatch_readPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_fd_t, ffi.Size, dispatch_queue_t, + ffi.Pointer)>>('dispatch_read'); + late final _dispatch_read = _dispatch_readPtr.asFunction< + void Function( + int, int, dispatch_queue_t, ffi.Pointer)>(); + + void dispatch_write( + Dartdispatch_fd_t fd, + Dartdispatch_data_t data, + Dartdispatch_queue_t queue, + objc.ObjCBlock handler, + ) { + return _dispatch_write( + fd, + data.ref.pointer, + queue.ref.pointer, + handler.ref.pointer, + ); + } + + late final _dispatch_writePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_fd_t, dispatch_data_t, dispatch_queue_t, + ffi.Pointer)>>('dispatch_write'); + late final _dispatch_write = _dispatch_writePtr.asFunction< + void Function(int, dispatch_data_t, dispatch_queue_t, + ffi.Pointer)>(); + + Dartdispatch_io_t dispatch_io_create( + Dartdispatch_io_type_t type, + Dartdispatch_fd_t fd, + Dartdispatch_queue_t queue, + objc.ObjCBlock cleanup_handler, + ) { + return objc.NSObject.castFromPointer( + _dispatch_io_create( + type, + fd, + queue.ref.pointer, + cleanup_handler.ref.pointer, + ), + retain: false, + release: true); + } + + late final _dispatch_io_createPtr = _lookup< + ffi.NativeFunction< + dispatch_io_t Function( + dispatch_io_type_t, + dispatch_fd_t, + dispatch_queue_t, + ffi.Pointer)>>('dispatch_io_create'); + late final _dispatch_io_create = _dispatch_io_createPtr.asFunction< + dispatch_io_t Function( + int, int, dispatch_queue_t, ffi.Pointer)>(); + + Dartdispatch_io_t dispatch_io_create_with_path( + Dartdispatch_io_type_t type, + ffi.Pointer path, + int oflag, + Dart__uint16_t mode, + Dartdispatch_queue_t queue, + objc.ObjCBlock cleanup_handler, + ) { + return objc.NSObject.castFromPointer( + _dispatch_io_create_with_path( + type, + path, + oflag, + mode, + queue.ref.pointer, + cleanup_handler.ref.pointer, + ), + retain: false, + release: true); + } + + late final _dispatch_io_create_with_pathPtr = _lookup< + ffi.NativeFunction< + dispatch_io_t Function( + dispatch_io_type_t, + ffi.Pointer, + ffi.Int, + mode_t, + dispatch_queue_t, + ffi.Pointer)>>( + 'dispatch_io_create_with_path'); + late final _dispatch_io_create_with_path = + _dispatch_io_create_with_pathPtr.asFunction< + dispatch_io_t Function(int, ffi.Pointer, int, int, + dispatch_queue_t, ffi.Pointer)>(); + + Dartdispatch_io_t dispatch_io_create_with_io( + Dartdispatch_io_type_t type, + Dartdispatch_io_t io, + Dartdispatch_queue_t queue, + objc.ObjCBlock cleanup_handler, + ) { + return objc.NSObject.castFromPointer( + _dispatch_io_create_with_io( + type, + io.ref.pointer, + queue.ref.pointer, + cleanup_handler.ref.pointer, + ), + retain: false, + release: true); + } + + late final _dispatch_io_create_with_ioPtr = _lookup< + ffi.NativeFunction< + dispatch_io_t Function( + dispatch_io_type_t, + dispatch_io_t, + dispatch_queue_t, + ffi.Pointer)>>('dispatch_io_create_with_io'); + late final _dispatch_io_create_with_io = + _dispatch_io_create_with_ioPtr.asFunction< + dispatch_io_t Function(int, dispatch_io_t, dispatch_queue_t, + ffi.Pointer)>(); + + void dispatch_io_read( + Dartdispatch_io_t channel, + Dart__int64_t offset, + int length, + Dartdispatch_queue_t queue, + Dartdispatch_io_handler_t io_handler, + ) { + return _dispatch_io_read( + channel.ref.pointer, + offset, + length, + queue.ref.pointer, + io_handler.ref.pointer, + ); + } + + late final _dispatch_io_readPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_io_t, off_t, ffi.Size, dispatch_queue_t, + dispatch_io_handler_t)>>('dispatch_io_read'); + late final _dispatch_io_read = _dispatch_io_readPtr.asFunction< + void Function( + dispatch_io_t, int, int, dispatch_queue_t, dispatch_io_handler_t)>(); + + void dispatch_io_write( + Dartdispatch_io_t channel, + Dart__int64_t offset, + Dartdispatch_data_t data, + Dartdispatch_queue_t queue, + Dartdispatch_io_handler_t io_handler, + ) { + return _dispatch_io_write( + channel.ref.pointer, + offset, + data.ref.pointer, + queue.ref.pointer, + io_handler.ref.pointer, + ); + } + + late final _dispatch_io_writePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_io_t, off_t, dispatch_data_t, + dispatch_queue_t, dispatch_io_handler_t)>>('dispatch_io_write'); + late final _dispatch_io_write = _dispatch_io_writePtr.asFunction< + void Function(dispatch_io_t, int, dispatch_data_t, dispatch_queue_t, + dispatch_io_handler_t)>(); + + void dispatch_io_close( + Dartdispatch_io_t channel, + Dartdispatch_io_close_flags_t flags, + ) { + return _dispatch_io_close( + channel.ref.pointer, + flags, + ); + } + + late final _dispatch_io_closePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + dispatch_io_t, dispatch_io_close_flags_t)>>('dispatch_io_close'); + late final _dispatch_io_close = + _dispatch_io_closePtr.asFunction(); + + void dispatch_io_barrier( + Dartdispatch_io_t channel, + Dartdispatch_block_t barrier, + ) { + return _dispatch_io_barrier( + channel.ref.pointer, + barrier.ref.pointer, + ); + } + + late final _dispatch_io_barrierPtr = _lookup< + ffi + .NativeFunction>( + 'dispatch_io_barrier'); + late final _dispatch_io_barrier = _dispatch_io_barrierPtr + .asFunction(); + + Dartdispatch_fd_t dispatch_io_get_descriptor( + Dartdispatch_io_t channel, + ) { + return _dispatch_io_get_descriptor( + channel.ref.pointer, + ); + } + + late final _dispatch_io_get_descriptorPtr = + _lookup>( + 'dispatch_io_get_descriptor'); + late final _dispatch_io_get_descriptor = + _dispatch_io_get_descriptorPtr.asFunction(); + + void dispatch_io_set_high_water( + Dartdispatch_io_t channel, + int high_water, + ) { + return _dispatch_io_set_high_water( + channel.ref.pointer, + high_water, + ); + } + + late final _dispatch_io_set_high_waterPtr = + _lookup>( + 'dispatch_io_set_high_water'); + late final _dispatch_io_set_high_water = _dispatch_io_set_high_waterPtr + .asFunction(); + + void dispatch_io_set_low_water( + Dartdispatch_io_t channel, + int low_water, + ) { + return _dispatch_io_set_low_water( + channel.ref.pointer, + low_water, + ); + } + + late final _dispatch_io_set_low_waterPtr = + _lookup>( + 'dispatch_io_set_low_water'); + late final _dispatch_io_set_low_water = _dispatch_io_set_low_waterPtr + .asFunction(); + + void dispatch_io_set_interval( + Dartdispatch_io_t channel, + int interval, + Dartdispatch_io_interval_flags_t flags, + ) { + return _dispatch_io_set_interval( + channel.ref.pointer, + interval, + flags, + ); + } + + late final _dispatch_io_set_intervalPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_io_t, ffi.Uint64, + dispatch_io_interval_flags_t)>>('dispatch_io_set_interval'); + late final _dispatch_io_set_interval = _dispatch_io_set_intervalPtr + .asFunction(); + + Dartdispatch_workloop_t dispatch_workloop_create( + ffi.Pointer label, + ) { + return objc.NSObject.castFromPointer( + _dispatch_workloop_create( + label, + ), + retain: false, + release: true); + } + + late final _dispatch_workloop_createPtr = _lookup< + ffi + .NativeFunction)>>( + 'dispatch_workloop_create'); + late final _dispatch_workloop_create = _dispatch_workloop_createPtr + .asFunction)>(); + + Dartdispatch_workloop_t dispatch_workloop_create_inactive( + ffi.Pointer label, + ) { + return objc.NSObject.castFromPointer( + _dispatch_workloop_create_inactive( + label, + ), + retain: false, + release: true); + } + + late final _dispatch_workloop_create_inactivePtr = _lookup< + ffi + .NativeFunction)>>( + 'dispatch_workloop_create_inactive'); + late final _dispatch_workloop_create_inactive = + _dispatch_workloop_create_inactivePtr + .asFunction)>(); + + void dispatch_workloop_set_autorelease_frequency( + Dartdispatch_workloop_t workloop, + dispatch_autorelease_frequency_t frequency, + ) { + return _dispatch_workloop_set_autorelease_frequency( + workloop.ref.pointer, + frequency.value, + ); + } + + late final _dispatch_workloop_set_autorelease_frequencyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_workloop_t, ffi.UnsignedLong)>>( + 'dispatch_workloop_set_autorelease_frequency'); + late final _dispatch_workloop_set_autorelease_frequency = + _dispatch_workloop_set_autorelease_frequencyPtr + .asFunction(); + + void dispatch_workloop_set_os_workgroup( + Dartdispatch_workloop_t workloop, + Dartos_workgroup_t workgroup, + ) { + return _dispatch_workloop_set_os_workgroup( + workloop.ref.pointer, + workgroup.ref.pointer, + ); + } + + late final _dispatch_workloop_set_os_workgroupPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(dispatch_workloop_t, + os_workgroup_t)>>('dispatch_workloop_set_os_workgroup'); + late final _dispatch_workloop_set_os_workgroup = + _dispatch_workloop_set_os_workgroupPtr + .asFunction(); + + int CFReadStreamGetTypeID() { + return _CFReadStreamGetTypeID(); + } + + late final _CFReadStreamGetTypeIDPtr = + _lookup>('CFReadStreamGetTypeID'); + late final _CFReadStreamGetTypeID = + _CFReadStreamGetTypeIDPtr.asFunction(); + + int CFWriteStreamGetTypeID() { + return _CFWriteStreamGetTypeID(); + } + + late final _CFWriteStreamGetTypeIDPtr = + _lookup>( + 'CFWriteStreamGetTypeID'); + late final _CFWriteStreamGetTypeID = + _CFWriteStreamGetTypeIDPtr.asFunction(); + + late final ffi.Pointer _kCFStreamPropertyDataWritten = + _lookup('kCFStreamPropertyDataWritten'); + + CFStreamPropertyKey get kCFStreamPropertyDataWritten => + _kCFStreamPropertyDataWritten.value; + + CFReadStreamRef CFReadStreamCreateWithBytesNoCopy( + CFAllocatorRef alloc, + ffi.Pointer bytes, + int length, + CFAllocatorRef bytesDeallocator, + ) { + return _CFReadStreamCreateWithBytesNoCopy( + alloc, + bytes, + length, + bytesDeallocator, + ); + } + + late final _CFReadStreamCreateWithBytesNoCopyPtr = _lookup< + ffi.NativeFunction< + CFReadStreamRef Function(CFAllocatorRef, ffi.Pointer, CFIndex, + CFAllocatorRef)>>('CFReadStreamCreateWithBytesNoCopy'); + late final _CFReadStreamCreateWithBytesNoCopy = + _CFReadStreamCreateWithBytesNoCopyPtr.asFunction< + CFReadStreamRef Function( + CFAllocatorRef, ffi.Pointer, int, CFAllocatorRef)>(); + + CFWriteStreamRef CFWriteStreamCreateWithBuffer( + CFAllocatorRef alloc, + ffi.Pointer buffer, + int bufferCapacity, + ) { + return _CFWriteStreamCreateWithBuffer( + alloc, + buffer, + bufferCapacity, + ); + } + + late final _CFWriteStreamCreateWithBufferPtr = _lookup< + ffi.NativeFunction< + CFWriteStreamRef Function(CFAllocatorRef, ffi.Pointer, + CFIndex)>>('CFWriteStreamCreateWithBuffer'); + late final _CFWriteStreamCreateWithBuffer = + _CFWriteStreamCreateWithBufferPtr.asFunction< + CFWriteStreamRef Function(CFAllocatorRef, ffi.Pointer, int)>(); + + CFWriteStreamRef CFWriteStreamCreateWithAllocatedBuffers( + CFAllocatorRef alloc, + CFAllocatorRef bufferAllocator, + ) { + return _CFWriteStreamCreateWithAllocatedBuffers( + alloc, + bufferAllocator, + ); + } + + late final _CFWriteStreamCreateWithAllocatedBuffersPtr = _lookup< + ffi.NativeFunction< + CFWriteStreamRef Function(CFAllocatorRef, + CFAllocatorRef)>>('CFWriteStreamCreateWithAllocatedBuffers'); + late final _CFWriteStreamCreateWithAllocatedBuffers = + _CFWriteStreamCreateWithAllocatedBuffersPtr.asFunction< + CFWriteStreamRef Function(CFAllocatorRef, CFAllocatorRef)>(); + + CFReadStreamRef CFReadStreamCreateWithFile( + CFAllocatorRef alloc, + CFURLRef fileURL, + ) { + return _CFReadStreamCreateWithFile( + alloc, + fileURL, + ); + } + + late final _CFReadStreamCreateWithFilePtr = _lookup< + ffi + .NativeFunction>( + 'CFReadStreamCreateWithFile'); + late final _CFReadStreamCreateWithFile = _CFReadStreamCreateWithFilePtr + .asFunction(); + + CFWriteStreamRef CFWriteStreamCreateWithFile( + CFAllocatorRef alloc, + CFURLRef fileURL, + ) { + return _CFWriteStreamCreateWithFile( + alloc, + fileURL, + ); + } + + late final _CFWriteStreamCreateWithFilePtr = _lookup< + ffi + .NativeFunction>( + 'CFWriteStreamCreateWithFile'); + late final _CFWriteStreamCreateWithFile = _CFWriteStreamCreateWithFilePtr + .asFunction(); + + void CFStreamCreateBoundPair( + CFAllocatorRef alloc, + ffi.Pointer readStream, + ffi.Pointer writeStream, + int transferBufferSize, + ) { + return _CFStreamCreateBoundPair( + alloc, + readStream, + writeStream, + transferBufferSize, + ); + } + + late final _CFStreamCreateBoundPairPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFAllocatorRef, + ffi.Pointer, + ffi.Pointer, + CFIndex)>>('CFStreamCreateBoundPair'); + late final _CFStreamCreateBoundPair = _CFStreamCreateBoundPairPtr.asFunction< + void Function(CFAllocatorRef, ffi.Pointer, + ffi.Pointer, int)>(); + + late final ffi.Pointer _kCFStreamPropertyAppendToFile = + _lookup('kCFStreamPropertyAppendToFile'); + + CFStreamPropertyKey get kCFStreamPropertyAppendToFile => + _kCFStreamPropertyAppendToFile.value; + + late final ffi.Pointer + _kCFStreamPropertyFileCurrentOffset = + _lookup('kCFStreamPropertyFileCurrentOffset'); + + CFStreamPropertyKey get kCFStreamPropertyFileCurrentOffset => + _kCFStreamPropertyFileCurrentOffset.value; + + late final ffi.Pointer + _kCFStreamPropertySocketNativeHandle = + _lookup('kCFStreamPropertySocketNativeHandle'); + + CFStreamPropertyKey get kCFStreamPropertySocketNativeHandle => + _kCFStreamPropertySocketNativeHandle.value; + + late final ffi.Pointer + _kCFStreamPropertySocketRemoteHostName = + _lookup('kCFStreamPropertySocketRemoteHostName'); + + CFStreamPropertyKey get kCFStreamPropertySocketRemoteHostName => + _kCFStreamPropertySocketRemoteHostName.value; + + late final ffi.Pointer + _kCFStreamPropertySocketRemotePortNumber = + _lookup('kCFStreamPropertySocketRemotePortNumber'); + + CFStreamPropertyKey get kCFStreamPropertySocketRemotePortNumber => + _kCFStreamPropertySocketRemotePortNumber.value; + + late final ffi.Pointer _kCFStreamErrorDomainSOCKS = + _lookup('kCFStreamErrorDomainSOCKS'); + + int get kCFStreamErrorDomainSOCKS => _kCFStreamErrorDomainSOCKS.value; + + late final ffi.Pointer _kCFStreamPropertySOCKSProxy = + _lookup('kCFStreamPropertySOCKSProxy'); + + CFStringRef get kCFStreamPropertySOCKSProxy => + _kCFStreamPropertySOCKSProxy.value; + + set kCFStreamPropertySOCKSProxy(CFStringRef value) => + _kCFStreamPropertySOCKSProxy.value = value; + + late final ffi.Pointer _kCFStreamPropertySOCKSProxyHost = + _lookup('kCFStreamPropertySOCKSProxyHost'); + + CFStringRef get kCFStreamPropertySOCKSProxyHost => + _kCFStreamPropertySOCKSProxyHost.value; + + set kCFStreamPropertySOCKSProxyHost(CFStringRef value) => + _kCFStreamPropertySOCKSProxyHost.value = value; + + late final ffi.Pointer _kCFStreamPropertySOCKSProxyPort = + _lookup('kCFStreamPropertySOCKSProxyPort'); + + CFStringRef get kCFStreamPropertySOCKSProxyPort => + _kCFStreamPropertySOCKSProxyPort.value; + + set kCFStreamPropertySOCKSProxyPort(CFStringRef value) => + _kCFStreamPropertySOCKSProxyPort.value = value; + + late final ffi.Pointer _kCFStreamPropertySOCKSVersion = + _lookup('kCFStreamPropertySOCKSVersion'); + + CFStringRef get kCFStreamPropertySOCKSVersion => + _kCFStreamPropertySOCKSVersion.value; + + set kCFStreamPropertySOCKSVersion(CFStringRef value) => + _kCFStreamPropertySOCKSVersion.value = value; + + late final ffi.Pointer _kCFStreamSocketSOCKSVersion4 = + _lookup('kCFStreamSocketSOCKSVersion4'); + + CFStringRef get kCFStreamSocketSOCKSVersion4 => + _kCFStreamSocketSOCKSVersion4.value; + + set kCFStreamSocketSOCKSVersion4(CFStringRef value) => + _kCFStreamSocketSOCKSVersion4.value = value; + + late final ffi.Pointer _kCFStreamSocketSOCKSVersion5 = + _lookup('kCFStreamSocketSOCKSVersion5'); + + CFStringRef get kCFStreamSocketSOCKSVersion5 => + _kCFStreamSocketSOCKSVersion5.value; + + set kCFStreamSocketSOCKSVersion5(CFStringRef value) => + _kCFStreamSocketSOCKSVersion5.value = value; + + late final ffi.Pointer _kCFStreamPropertySOCKSUser = + _lookup('kCFStreamPropertySOCKSUser'); + + CFStringRef get kCFStreamPropertySOCKSUser => + _kCFStreamPropertySOCKSUser.value; + + set kCFStreamPropertySOCKSUser(CFStringRef value) => + _kCFStreamPropertySOCKSUser.value = value; + + late final ffi.Pointer _kCFStreamPropertySOCKSPassword = + _lookup('kCFStreamPropertySOCKSPassword'); + + CFStringRef get kCFStreamPropertySOCKSPassword => + _kCFStreamPropertySOCKSPassword.value; + + set kCFStreamPropertySOCKSPassword(CFStringRef value) => + _kCFStreamPropertySOCKSPassword.value = value; + + late final ffi.Pointer _kCFStreamErrorDomainSSL = + _lookup('kCFStreamErrorDomainSSL'); + + int get kCFStreamErrorDomainSSL => _kCFStreamErrorDomainSSL.value; + + late final ffi.Pointer _kCFStreamPropertySocketSecurityLevel = + _lookup('kCFStreamPropertySocketSecurityLevel'); + + CFStringRef get kCFStreamPropertySocketSecurityLevel => + _kCFStreamPropertySocketSecurityLevel.value; + + set kCFStreamPropertySocketSecurityLevel(CFStringRef value) => + _kCFStreamPropertySocketSecurityLevel.value = value; + + late final ffi.Pointer _kCFStreamSocketSecurityLevelNone = + _lookup('kCFStreamSocketSecurityLevelNone'); + + CFStringRef get kCFStreamSocketSecurityLevelNone => + _kCFStreamSocketSecurityLevelNone.value; + + set kCFStreamSocketSecurityLevelNone(CFStringRef value) => + _kCFStreamSocketSecurityLevelNone.value = value; + + late final ffi.Pointer _kCFStreamSocketSecurityLevelSSLv2 = + _lookup('kCFStreamSocketSecurityLevelSSLv2'); + + CFStringRef get kCFStreamSocketSecurityLevelSSLv2 => + _kCFStreamSocketSecurityLevelSSLv2.value; + + set kCFStreamSocketSecurityLevelSSLv2(CFStringRef value) => + _kCFStreamSocketSecurityLevelSSLv2.value = value; + + late final ffi.Pointer _kCFStreamSocketSecurityLevelSSLv3 = + _lookup('kCFStreamSocketSecurityLevelSSLv3'); + + CFStringRef get kCFStreamSocketSecurityLevelSSLv3 => + _kCFStreamSocketSecurityLevelSSLv3.value; + + set kCFStreamSocketSecurityLevelSSLv3(CFStringRef value) => + _kCFStreamSocketSecurityLevelSSLv3.value = value; + + late final ffi.Pointer _kCFStreamSocketSecurityLevelTLSv1 = + _lookup('kCFStreamSocketSecurityLevelTLSv1'); + + CFStringRef get kCFStreamSocketSecurityLevelTLSv1 => + _kCFStreamSocketSecurityLevelTLSv1.value; + + set kCFStreamSocketSecurityLevelTLSv1(CFStringRef value) => + _kCFStreamSocketSecurityLevelTLSv1.value = value; + + late final ffi.Pointer + _kCFStreamSocketSecurityLevelNegotiatedSSL = + _lookup('kCFStreamSocketSecurityLevelNegotiatedSSL'); + + CFStringRef get kCFStreamSocketSecurityLevelNegotiatedSSL => + _kCFStreamSocketSecurityLevelNegotiatedSSL.value; + + set kCFStreamSocketSecurityLevelNegotiatedSSL(CFStringRef value) => + _kCFStreamSocketSecurityLevelNegotiatedSSL.value = value; + + late final ffi.Pointer + _kCFStreamPropertyShouldCloseNativeSocket = + _lookup('kCFStreamPropertyShouldCloseNativeSocket'); + + CFStringRef get kCFStreamPropertyShouldCloseNativeSocket => + _kCFStreamPropertyShouldCloseNativeSocket.value; + + set kCFStreamPropertyShouldCloseNativeSocket(CFStringRef value) => + _kCFStreamPropertyShouldCloseNativeSocket.value = value; + + void CFStreamCreatePairWithSocket( + CFAllocatorRef alloc, + int sock, + ffi.Pointer readStream, + ffi.Pointer writeStream, + ) { + return _CFStreamCreatePairWithSocket( + alloc, + sock, + readStream, + writeStream, + ); + } + + late final _CFStreamCreatePairWithSocketPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFAllocatorRef, + CFSocketNativeHandle, + ffi.Pointer, + ffi.Pointer)>>('CFStreamCreatePairWithSocket'); + late final _CFStreamCreatePairWithSocket = + _CFStreamCreatePairWithSocketPtr.asFunction< + void Function(CFAllocatorRef, int, ffi.Pointer, + ffi.Pointer)>(); + + void CFStreamCreatePairWithSocketToHost( + CFAllocatorRef alloc, + CFStringRef host, + int port, + ffi.Pointer readStream, + ffi.Pointer writeStream, + ) { + return _CFStreamCreatePairWithSocketToHost( + alloc, + host, + port, + readStream, + writeStream, + ); + } + + late final _CFStreamCreatePairWithSocketToHostPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFAllocatorRef, + CFStringRef, + UInt32, + ffi.Pointer, + ffi.Pointer)>>( + 'CFStreamCreatePairWithSocketToHost'); + late final _CFStreamCreatePairWithSocketToHost = + _CFStreamCreatePairWithSocketToHostPtr.asFunction< + void Function(CFAllocatorRef, CFStringRef, int, + ffi.Pointer, ffi.Pointer)>(); + + void CFStreamCreatePairWithPeerSocketSignature( + CFAllocatorRef alloc, + ffi.Pointer signature, + ffi.Pointer readStream, + ffi.Pointer writeStream, + ) { + return _CFStreamCreatePairWithPeerSocketSignature( + alloc, + signature, + readStream, + writeStream, + ); + } + + late final _CFStreamCreatePairWithPeerSocketSignaturePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFAllocatorRef, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>( + 'CFStreamCreatePairWithPeerSocketSignature'); + late final _CFStreamCreatePairWithPeerSocketSignature = + _CFStreamCreatePairWithPeerSocketSignaturePtr.asFunction< + void Function(CFAllocatorRef, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + CFStreamStatus CFReadStreamGetStatus( + CFReadStreamRef stream, + ) { + return CFStreamStatus.fromValue(_CFReadStreamGetStatus( + stream, + )); + } + + late final _CFReadStreamGetStatusPtr = + _lookup>( + 'CFReadStreamGetStatus'); + late final _CFReadStreamGetStatus = + _CFReadStreamGetStatusPtr.asFunction(); + + CFStreamStatus CFWriteStreamGetStatus( + CFWriteStreamRef stream, + ) { + return CFStreamStatus.fromValue(_CFWriteStreamGetStatus( + stream, + )); + } + + late final _CFWriteStreamGetStatusPtr = + _lookup>( + 'CFWriteStreamGetStatus'); + late final _CFWriteStreamGetStatus = + _CFWriteStreamGetStatusPtr.asFunction(); + + CFErrorRef CFReadStreamCopyError( + CFReadStreamRef stream, + ) { + return _CFReadStreamCopyError( + stream, + ); + } + + late final _CFReadStreamCopyErrorPtr = + _lookup>( + 'CFReadStreamCopyError'); + late final _CFReadStreamCopyError = _CFReadStreamCopyErrorPtr.asFunction< + CFErrorRef Function(CFReadStreamRef)>(); + + CFErrorRef CFWriteStreamCopyError( + CFWriteStreamRef stream, + ) { + return _CFWriteStreamCopyError( + stream, + ); + } + + late final _CFWriteStreamCopyErrorPtr = + _lookup>( + 'CFWriteStreamCopyError'); + late final _CFWriteStreamCopyError = _CFWriteStreamCopyErrorPtr.asFunction< + CFErrorRef Function(CFWriteStreamRef)>(); + + int CFReadStreamOpen( + CFReadStreamRef stream, + ) { + return _CFReadStreamOpen( + stream, + ); + } + + late final _CFReadStreamOpenPtr = + _lookup>( + 'CFReadStreamOpen'); + late final _CFReadStreamOpen = + _CFReadStreamOpenPtr.asFunction(); + + int CFWriteStreamOpen( + CFWriteStreamRef stream, + ) { + return _CFWriteStreamOpen( + stream, + ); + } + + late final _CFWriteStreamOpenPtr = + _lookup>( + 'CFWriteStreamOpen'); + late final _CFWriteStreamOpen = + _CFWriteStreamOpenPtr.asFunction(); + + void CFReadStreamClose( + CFReadStreamRef stream, + ) { + return _CFReadStreamClose( + stream, + ); + } + + late final _CFReadStreamClosePtr = + _lookup>( + 'CFReadStreamClose'); + late final _CFReadStreamClose = + _CFReadStreamClosePtr.asFunction(); + + void CFWriteStreamClose( + CFWriteStreamRef stream, + ) { + return _CFWriteStreamClose( + stream, + ); + } + + late final _CFWriteStreamClosePtr = + _lookup>( + 'CFWriteStreamClose'); + late final _CFWriteStreamClose = + _CFWriteStreamClosePtr.asFunction(); + + int CFReadStreamHasBytesAvailable( + CFReadStreamRef stream, + ) { + return _CFReadStreamHasBytesAvailable( + stream, + ); + } + + late final _CFReadStreamHasBytesAvailablePtr = + _lookup>( + 'CFReadStreamHasBytesAvailable'); + late final _CFReadStreamHasBytesAvailable = _CFReadStreamHasBytesAvailablePtr + .asFunction(); + + int CFReadStreamRead( + CFReadStreamRef stream, + ffi.Pointer buffer, + int bufferLength, + ) { + return _CFReadStreamRead( + stream, + buffer, + bufferLength, + ); + } + + late final _CFReadStreamReadPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFReadStreamRef, ffi.Pointer, + CFIndex)>>('CFReadStreamRead'); + late final _CFReadStreamRead = _CFReadStreamReadPtr.asFunction< + int Function(CFReadStreamRef, ffi.Pointer, int)>(); + + ffi.Pointer CFReadStreamGetBuffer( + CFReadStreamRef stream, + int maxBytesToRead, + ffi.Pointer numBytesRead, + ) { + return _CFReadStreamGetBuffer( + stream, + maxBytesToRead, + numBytesRead, + ); + } + + late final _CFReadStreamGetBufferPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(CFReadStreamRef, CFIndex, + ffi.Pointer)>>('CFReadStreamGetBuffer'); + late final _CFReadStreamGetBuffer = _CFReadStreamGetBufferPtr.asFunction< + ffi.Pointer Function( + CFReadStreamRef, int, ffi.Pointer)>(); + + int CFWriteStreamCanAcceptBytes( + CFWriteStreamRef stream, + ) { + return _CFWriteStreamCanAcceptBytes( + stream, + ); + } + + late final _CFWriteStreamCanAcceptBytesPtr = + _lookup>( + 'CFWriteStreamCanAcceptBytes'); + late final _CFWriteStreamCanAcceptBytes = _CFWriteStreamCanAcceptBytesPtr + .asFunction(); + + int CFWriteStreamWrite( + CFWriteStreamRef stream, + ffi.Pointer buffer, + int bufferLength, + ) { + return _CFWriteStreamWrite( + stream, + buffer, + bufferLength, + ); + } + + late final _CFWriteStreamWritePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFWriteStreamRef, ffi.Pointer, + CFIndex)>>('CFWriteStreamWrite'); + late final _CFWriteStreamWrite = _CFWriteStreamWritePtr.asFunction< + int Function(CFWriteStreamRef, ffi.Pointer, int)>(); + + CFTypeRef CFReadStreamCopyProperty( + CFReadStreamRef stream, + CFStreamPropertyKey propertyName, + ) { + return _CFReadStreamCopyProperty( + stream, + propertyName, + ); + } + + late final _CFReadStreamCopyPropertyPtr = _lookup< + ffi.NativeFunction< + CFTypeRef Function(CFReadStreamRef, + CFStreamPropertyKey)>>('CFReadStreamCopyProperty'); + late final _CFReadStreamCopyProperty = _CFReadStreamCopyPropertyPtr + .asFunction(); + + CFTypeRef CFWriteStreamCopyProperty( + CFWriteStreamRef stream, + CFStreamPropertyKey propertyName, + ) { + return _CFWriteStreamCopyProperty( + stream, + propertyName, + ); + } + + late final _CFWriteStreamCopyPropertyPtr = _lookup< + ffi.NativeFunction< + CFTypeRef Function(CFWriteStreamRef, + CFStreamPropertyKey)>>('CFWriteStreamCopyProperty'); + late final _CFWriteStreamCopyProperty = _CFWriteStreamCopyPropertyPtr + .asFunction(); + + int CFReadStreamSetProperty( + CFReadStreamRef stream, + CFStreamPropertyKey propertyName, + CFTypeRef propertyValue, + ) { + return _CFReadStreamSetProperty( + stream, + propertyName, + propertyValue, + ); + } + + late final _CFReadStreamSetPropertyPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFReadStreamRef, CFStreamPropertyKey, + CFTypeRef)>>('CFReadStreamSetProperty'); + late final _CFReadStreamSetProperty = _CFReadStreamSetPropertyPtr.asFunction< + int Function(CFReadStreamRef, CFStreamPropertyKey, CFTypeRef)>(); + + int CFWriteStreamSetProperty( + CFWriteStreamRef stream, + CFStreamPropertyKey propertyName, + CFTypeRef propertyValue, + ) { + return _CFWriteStreamSetProperty( + stream, + propertyName, + propertyValue, + ); + } + + late final _CFWriteStreamSetPropertyPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFWriteStreamRef, CFStreamPropertyKey, + CFTypeRef)>>('CFWriteStreamSetProperty'); + late final _CFWriteStreamSetProperty = + _CFWriteStreamSetPropertyPtr.asFunction< + int Function(CFWriteStreamRef, CFStreamPropertyKey, CFTypeRef)>(); + + int CFReadStreamSetClient( + CFReadStreamRef stream, + int streamEvents, + CFReadStreamClientCallBack clientCB, + ffi.Pointer clientContext, + ) { + return _CFReadStreamSetClient( + stream, + streamEvents, + clientCB, + clientContext, + ); + } + + late final _CFReadStreamSetClientPtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFReadStreamRef, + CFOptionFlags, + CFReadStreamClientCallBack, + ffi.Pointer)>>('CFReadStreamSetClient'); + late final _CFReadStreamSetClient = _CFReadStreamSetClientPtr.asFunction< + int Function(CFReadStreamRef, int, CFReadStreamClientCallBack, + ffi.Pointer)>(); + + int CFWriteStreamSetClient( + CFWriteStreamRef stream, + int streamEvents, + CFWriteStreamClientCallBack clientCB, + ffi.Pointer clientContext, + ) { + return _CFWriteStreamSetClient( + stream, + streamEvents, + clientCB, + clientContext, + ); + } + + late final _CFWriteStreamSetClientPtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFWriteStreamRef, + CFOptionFlags, + CFWriteStreamClientCallBack, + ffi.Pointer)>>('CFWriteStreamSetClient'); + late final _CFWriteStreamSetClient = _CFWriteStreamSetClientPtr.asFunction< + int Function(CFWriteStreamRef, int, CFWriteStreamClientCallBack, + ffi.Pointer)>(); + + void CFReadStreamScheduleWithRunLoop( + CFReadStreamRef stream, + CFRunLoopRef runLoop, + CFRunLoopMode runLoopMode, + ) { + return _CFReadStreamScheduleWithRunLoop( + stream, + runLoop, + runLoopMode, + ); + } + + late final _CFReadStreamScheduleWithRunLoopPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFReadStreamRef, CFRunLoopRef, + CFRunLoopMode)>>('CFReadStreamScheduleWithRunLoop'); + late final _CFReadStreamScheduleWithRunLoop = + _CFReadStreamScheduleWithRunLoopPtr.asFunction< + void Function(CFReadStreamRef, CFRunLoopRef, CFRunLoopMode)>(); + + void CFWriteStreamScheduleWithRunLoop( + CFWriteStreamRef stream, + CFRunLoopRef runLoop, + CFRunLoopMode runLoopMode, + ) { + return _CFWriteStreamScheduleWithRunLoop( + stream, + runLoop, + runLoopMode, + ); + } + + late final _CFWriteStreamScheduleWithRunLoopPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFWriteStreamRef, CFRunLoopRef, + CFRunLoopMode)>>('CFWriteStreamScheduleWithRunLoop'); + late final _CFWriteStreamScheduleWithRunLoop = + _CFWriteStreamScheduleWithRunLoopPtr.asFunction< + void Function(CFWriteStreamRef, CFRunLoopRef, CFRunLoopMode)>(); + + void CFReadStreamUnscheduleFromRunLoop( + CFReadStreamRef stream, + CFRunLoopRef runLoop, + CFRunLoopMode runLoopMode, + ) { + return _CFReadStreamUnscheduleFromRunLoop( + stream, + runLoop, + runLoopMode, + ); + } + + late final _CFReadStreamUnscheduleFromRunLoopPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFReadStreamRef, CFRunLoopRef, + CFRunLoopMode)>>('CFReadStreamUnscheduleFromRunLoop'); + late final _CFReadStreamUnscheduleFromRunLoop = + _CFReadStreamUnscheduleFromRunLoopPtr.asFunction< + void Function(CFReadStreamRef, CFRunLoopRef, CFRunLoopMode)>(); + + void CFWriteStreamUnscheduleFromRunLoop( + CFWriteStreamRef stream, + CFRunLoopRef runLoop, + CFRunLoopMode runLoopMode, + ) { + return _CFWriteStreamUnscheduleFromRunLoop( + stream, + runLoop, + runLoopMode, + ); + } + + late final _CFWriteStreamUnscheduleFromRunLoopPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFWriteStreamRef, CFRunLoopRef, + CFRunLoopMode)>>('CFWriteStreamUnscheduleFromRunLoop'); + late final _CFWriteStreamUnscheduleFromRunLoop = + _CFWriteStreamUnscheduleFromRunLoopPtr.asFunction< + void Function(CFWriteStreamRef, CFRunLoopRef, CFRunLoopMode)>(); + + void CFReadStreamSetDispatchQueue( + CFReadStreamRef stream, + Dartdispatch_queue_t q, + ) { + return _CFReadStreamSetDispatchQueue( + stream, + q.ref.pointer, + ); + } + + late final _CFReadStreamSetDispatchQueuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFReadStreamRef, + dispatch_queue_t)>>('CFReadStreamSetDispatchQueue'); + late final _CFReadStreamSetDispatchQueue = _CFReadStreamSetDispatchQueuePtr + .asFunction(); + + void CFWriteStreamSetDispatchQueue( + CFWriteStreamRef stream, + Dartdispatch_queue_t q, + ) { + return _CFWriteStreamSetDispatchQueue( + stream, + q.ref.pointer, + ); + } + + late final _CFWriteStreamSetDispatchQueuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFWriteStreamRef, + dispatch_queue_t)>>('CFWriteStreamSetDispatchQueue'); + late final _CFWriteStreamSetDispatchQueue = _CFWriteStreamSetDispatchQueuePtr + .asFunction(); + + Dartdispatch_queue_t CFReadStreamCopyDispatchQueue( + CFReadStreamRef stream, + ) { + return objc.NSObject.castFromPointer( + _CFReadStreamCopyDispatchQueue( + stream, + ), + retain: true, + release: true); + } + + late final _CFReadStreamCopyDispatchQueuePtr = + _lookup>( + 'CFReadStreamCopyDispatchQueue'); + late final _CFReadStreamCopyDispatchQueue = _CFReadStreamCopyDispatchQueuePtr + .asFunction(); + + Dartdispatch_queue_t CFWriteStreamCopyDispatchQueue( + CFWriteStreamRef stream, + ) { + return objc.NSObject.castFromPointer( + _CFWriteStreamCopyDispatchQueue( + stream, + ), + retain: true, + release: true); + } + + late final _CFWriteStreamCopyDispatchQueuePtr = + _lookup>( + 'CFWriteStreamCopyDispatchQueue'); + late final _CFWriteStreamCopyDispatchQueue = + _CFWriteStreamCopyDispatchQueuePtr.asFunction< + dispatch_queue_t Function(CFWriteStreamRef)>(); + + CFStreamError CFReadStreamGetError( + CFReadStreamRef stream, + ) { + return _CFReadStreamGetError( + stream, + ); + } + + late final _CFReadStreamGetErrorPtr = + _lookup>( + 'CFReadStreamGetError'); + late final _CFReadStreamGetError = _CFReadStreamGetErrorPtr.asFunction< + CFStreamError Function(CFReadStreamRef)>(); + + CFStreamError CFWriteStreamGetError( + CFWriteStreamRef stream, + ) { + return _CFWriteStreamGetError( + stream, + ); + } + + late final _CFWriteStreamGetErrorPtr = + _lookup>( + 'CFWriteStreamGetError'); + late final _CFWriteStreamGetError = _CFWriteStreamGetErrorPtr.asFunction< + CFStreamError Function(CFWriteStreamRef)>(); + + CFPropertyListRef CFPropertyListCreateFromXMLData( + CFAllocatorRef allocator, + CFDataRef xmlData, + int mutabilityOption, + ffi.Pointer errorString, + ) { + return _CFPropertyListCreateFromXMLData( + allocator, + xmlData, + mutabilityOption, + errorString, + ); + } + + late final _CFPropertyListCreateFromXMLDataPtr = _lookup< + ffi.NativeFunction< + CFPropertyListRef Function(CFAllocatorRef, CFDataRef, CFOptionFlags, + ffi.Pointer)>>('CFPropertyListCreateFromXMLData'); + late final _CFPropertyListCreateFromXMLData = + _CFPropertyListCreateFromXMLDataPtr.asFunction< + CFPropertyListRef Function( + CFAllocatorRef, CFDataRef, int, ffi.Pointer)>(); + + CFDataRef CFPropertyListCreateXMLData( + CFAllocatorRef allocator, + CFPropertyListRef propertyList, + ) { + return _CFPropertyListCreateXMLData( + allocator, + propertyList, + ); + } + + late final _CFPropertyListCreateXMLDataPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(CFAllocatorRef, + CFPropertyListRef)>>('CFPropertyListCreateXMLData'); + late final _CFPropertyListCreateXMLData = _CFPropertyListCreateXMLDataPtr + .asFunction(); + + CFPropertyListRef CFPropertyListCreateDeepCopy( + CFAllocatorRef allocator, + CFPropertyListRef propertyList, + int mutabilityOption, + ) { + return _CFPropertyListCreateDeepCopy( + allocator, + propertyList, + mutabilityOption, + ); + } + + late final _CFPropertyListCreateDeepCopyPtr = _lookup< + ffi.NativeFunction< + CFPropertyListRef Function(CFAllocatorRef, CFPropertyListRef, + CFOptionFlags)>>('CFPropertyListCreateDeepCopy'); + late final _CFPropertyListCreateDeepCopy = + _CFPropertyListCreateDeepCopyPtr.asFunction< + CFPropertyListRef Function(CFAllocatorRef, CFPropertyListRef, int)>(); + + DartBoolean CFPropertyListIsValid( + CFPropertyListRef plist, + CFPropertyListFormat format, + ) { + return _CFPropertyListIsValid( + plist, + format.value, + ); + } + + late final _CFPropertyListIsValidPtr = + _lookup>( + 'CFPropertyListIsValid'); + late final _CFPropertyListIsValid = _CFPropertyListIsValidPtr.asFunction< + int Function(CFPropertyListRef, int)>(); + + DartCFIndex CFPropertyListWriteToStream( + CFPropertyListRef propertyList, + CFWriteStreamRef stream, + CFPropertyListFormat format, + ffi.Pointer errorString, + ) { + return _CFPropertyListWriteToStream( + propertyList, + stream, + format.value, + errorString, + ); + } + + late final _CFPropertyListWriteToStreamPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFPropertyListRef, CFWriteStreamRef, CFIndex, + ffi.Pointer)>>('CFPropertyListWriteToStream'); + late final _CFPropertyListWriteToStream = + _CFPropertyListWriteToStreamPtr.asFunction< + int Function(CFPropertyListRef, CFWriteStreamRef, int, + ffi.Pointer)>(); + + CFPropertyListRef CFPropertyListCreateFromStream( + CFAllocatorRef allocator, + CFReadStreamRef stream, + int streamLength, + int mutabilityOption, + ffi.Pointer format, + ffi.Pointer errorString, + ) { + return _CFPropertyListCreateFromStream( + allocator, + stream, + streamLength, + mutabilityOption, + format, + errorString, + ); + } + + late final _CFPropertyListCreateFromStreamPtr = _lookup< + ffi.NativeFunction< + CFPropertyListRef Function( + CFAllocatorRef, + CFReadStreamRef, + CFIndex, + CFOptionFlags, + ffi.Pointer, + ffi.Pointer)>>('CFPropertyListCreateFromStream'); + late final _CFPropertyListCreateFromStream = + _CFPropertyListCreateFromStreamPtr.asFunction< + CFPropertyListRef Function(CFAllocatorRef, CFReadStreamRef, int, int, + ffi.Pointer, ffi.Pointer)>(); + + CFPropertyListRef CFPropertyListCreateWithData( + CFAllocatorRef allocator, + CFDataRef data, + int options, + ffi.Pointer format, + ffi.Pointer error, + ) { + return _CFPropertyListCreateWithData( + allocator, + data, + options, + format, + error, + ); + } + + late final _CFPropertyListCreateWithDataPtr = _lookup< + ffi.NativeFunction< + CFPropertyListRef Function( + CFAllocatorRef, + CFDataRef, + CFOptionFlags, + ffi.Pointer, + ffi.Pointer)>>('CFPropertyListCreateWithData'); + late final _CFPropertyListCreateWithData = + _CFPropertyListCreateWithDataPtr.asFunction< + CFPropertyListRef Function(CFAllocatorRef, CFDataRef, int, + ffi.Pointer, ffi.Pointer)>(); + + CFPropertyListRef CFPropertyListCreateWithStream( + CFAllocatorRef allocator, + CFReadStreamRef stream, + int streamLength, + int options, + ffi.Pointer format, + ffi.Pointer error, + ) { + return _CFPropertyListCreateWithStream( + allocator, + stream, + streamLength, + options, + format, + error, + ); + } + + late final _CFPropertyListCreateWithStreamPtr = _lookup< + ffi.NativeFunction< + CFPropertyListRef Function( + CFAllocatorRef, + CFReadStreamRef, + CFIndex, + CFOptionFlags, + ffi.Pointer, + ffi.Pointer)>>('CFPropertyListCreateWithStream'); + late final _CFPropertyListCreateWithStream = + _CFPropertyListCreateWithStreamPtr.asFunction< + CFPropertyListRef Function(CFAllocatorRef, CFReadStreamRef, int, int, + ffi.Pointer, ffi.Pointer)>(); + + DartCFIndex CFPropertyListWrite( + CFPropertyListRef propertyList, + CFWriteStreamRef stream, + CFPropertyListFormat format, + DartCFOptionFlags options, + ffi.Pointer error, + ) { + return _CFPropertyListWrite( + propertyList, + stream, + format.value, + options, + error, + ); + } + + late final _CFPropertyListWritePtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFPropertyListRef, CFWriteStreamRef, CFIndex, + CFOptionFlags, ffi.Pointer)>>('CFPropertyListWrite'); + late final _CFPropertyListWrite = _CFPropertyListWritePtr.asFunction< + int Function(CFPropertyListRef, CFWriteStreamRef, int, int, + ffi.Pointer)>(); + + CFDataRef CFPropertyListCreateData( + CFAllocatorRef allocator, + CFPropertyListRef propertyList, + CFPropertyListFormat format, + DartCFOptionFlags options, + ffi.Pointer error, + ) { + return _CFPropertyListCreateData( + allocator, + propertyList, + format.value, + options, + error, + ); + } + + late final _CFPropertyListCreateDataPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function( + CFAllocatorRef, + CFPropertyListRef, + CFIndex, + CFOptionFlags, + ffi.Pointer)>>('CFPropertyListCreateData'); + late final _CFPropertyListCreateData = + _CFPropertyListCreateDataPtr.asFunction< + CFDataRef Function(CFAllocatorRef, CFPropertyListRef, int, int, + ffi.Pointer)>(); + + late final ffi.Pointer _kCFTypeSetCallBacks = + _lookup('kCFTypeSetCallBacks'); + + CFSetCallBacks get kCFTypeSetCallBacks => _kCFTypeSetCallBacks.ref; + + late final ffi.Pointer _kCFCopyStringSetCallBacks = + _lookup('kCFCopyStringSetCallBacks'); + + CFSetCallBacks get kCFCopyStringSetCallBacks => + _kCFCopyStringSetCallBacks.ref; + + int CFSetGetTypeID() { + return _CFSetGetTypeID(); + } + + late final _CFSetGetTypeIDPtr = + _lookup>('CFSetGetTypeID'); + late final _CFSetGetTypeID = _CFSetGetTypeIDPtr.asFunction(); + + CFSetRef CFSetCreate( + CFAllocatorRef allocator, + ffi.Pointer> values, + int numValues, + ffi.Pointer callBacks, + ) { + return _CFSetCreate( + allocator, + values, + numValues, + callBacks, + ); + } + + late final _CFSetCreatePtr = _lookup< + ffi.NativeFunction< + CFSetRef Function(CFAllocatorRef, ffi.Pointer>, + CFIndex, ffi.Pointer)>>('CFSetCreate'); + late final _CFSetCreate = _CFSetCreatePtr.asFunction< + CFSetRef Function(CFAllocatorRef, ffi.Pointer>, int, + ffi.Pointer)>(); + + CFSetRef CFSetCreateCopy( + CFAllocatorRef allocator, + CFSetRef theSet, + ) { + return _CFSetCreateCopy( + allocator, + theSet, + ); + } + + late final _CFSetCreateCopyPtr = + _lookup>( + 'CFSetCreateCopy'); + late final _CFSetCreateCopy = _CFSetCreateCopyPtr.asFunction< + CFSetRef Function(CFAllocatorRef, CFSetRef)>(); + + CFMutableSetRef CFSetCreateMutable( + CFAllocatorRef allocator, + int capacity, + ffi.Pointer callBacks, + ) { + return _CFSetCreateMutable( + allocator, + capacity, + callBacks, + ); + } + + late final _CFSetCreateMutablePtr = _lookup< + ffi.NativeFunction< + CFMutableSetRef Function(CFAllocatorRef, CFIndex, + ffi.Pointer)>>('CFSetCreateMutable'); + late final _CFSetCreateMutable = _CFSetCreateMutablePtr.asFunction< + CFMutableSetRef Function( + CFAllocatorRef, int, ffi.Pointer)>(); + + CFMutableSetRef CFSetCreateMutableCopy( + CFAllocatorRef allocator, + int capacity, + CFSetRef theSet, + ) { + return _CFSetCreateMutableCopy( + allocator, + capacity, + theSet, + ); + } + + late final _CFSetCreateMutableCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableSetRef Function( + CFAllocatorRef, CFIndex, CFSetRef)>>('CFSetCreateMutableCopy'); + late final _CFSetCreateMutableCopy = _CFSetCreateMutableCopyPtr.asFunction< + CFMutableSetRef Function(CFAllocatorRef, int, CFSetRef)>(); + + int CFSetGetCount( + CFSetRef theSet, + ) { + return _CFSetGetCount( + theSet, + ); + } + + late final _CFSetGetCountPtr = + _lookup>('CFSetGetCount'); + late final _CFSetGetCount = + _CFSetGetCountPtr.asFunction(); + + int CFSetGetCountOfValue( + CFSetRef theSet, + ffi.Pointer value, + ) { + return _CFSetGetCountOfValue( + theSet, + value, + ); + } + + late final _CFSetGetCountOfValuePtr = _lookup< + ffi + .NativeFunction)>>( + 'CFSetGetCountOfValue'); + late final _CFSetGetCountOfValue = _CFSetGetCountOfValuePtr.asFunction< + int Function(CFSetRef, ffi.Pointer)>(); + + int CFSetContainsValue( + CFSetRef theSet, + ffi.Pointer value, + ) { + return _CFSetContainsValue( + theSet, + value, + ); + } + + late final _CFSetContainsValuePtr = _lookup< + ffi + .NativeFunction)>>( + 'CFSetContainsValue'); + late final _CFSetContainsValue = _CFSetContainsValuePtr.asFunction< + int Function(CFSetRef, ffi.Pointer)>(); + + ffi.Pointer CFSetGetValue( + CFSetRef theSet, + ffi.Pointer value, + ) { + return _CFSetGetValue( + theSet, + value, + ); + } + + late final _CFSetGetValuePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CFSetRef, ffi.Pointer)>>('CFSetGetValue'); + late final _CFSetGetValue = _CFSetGetValuePtr.asFunction< + ffi.Pointer Function(CFSetRef, ffi.Pointer)>(); + + int CFSetGetValueIfPresent( + CFSetRef theSet, + ffi.Pointer candidate, + ffi.Pointer> value, + ) { + return _CFSetGetValueIfPresent( + theSet, + candidate, + value, + ); + } + + late final _CFSetGetValueIfPresentPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFSetRef, ffi.Pointer, + ffi.Pointer>)>>('CFSetGetValueIfPresent'); + late final _CFSetGetValueIfPresent = _CFSetGetValueIfPresentPtr.asFunction< + int Function(CFSetRef, ffi.Pointer, + ffi.Pointer>)>(); + + void CFSetGetValues( + CFSetRef theSet, + ffi.Pointer> values, + ) { + return _CFSetGetValues( + theSet, + values, + ); + } + + late final _CFSetGetValuesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFSetRef, ffi.Pointer>)>>('CFSetGetValues'); + late final _CFSetGetValues = _CFSetGetValuesPtr.asFunction< + void Function(CFSetRef, ffi.Pointer>)>(); + + void CFSetApplyFunction( + CFSetRef theSet, + CFSetApplierFunction applier, + ffi.Pointer context, + ) { + return _CFSetApplyFunction( + theSet, + applier, + context, + ); + } + + late final _CFSetApplyFunctionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFSetRef, CFSetApplierFunction, + ffi.Pointer)>>('CFSetApplyFunction'); + late final _CFSetApplyFunction = _CFSetApplyFunctionPtr.asFunction< + void Function(CFSetRef, CFSetApplierFunction, ffi.Pointer)>(); + + void CFSetAddValue( + CFMutableSetRef theSet, + ffi.Pointer value, + ) { + return _CFSetAddValue( + theSet, + value, + ); + } + + late final _CFSetAddValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableSetRef, ffi.Pointer)>>('CFSetAddValue'); + late final _CFSetAddValue = _CFSetAddValuePtr.asFunction< + void Function(CFMutableSetRef, ffi.Pointer)>(); + + void CFSetReplaceValue( + CFMutableSetRef theSet, + ffi.Pointer value, + ) { + return _CFSetReplaceValue( + theSet, + value, + ); + } + + late final _CFSetReplaceValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableSetRef, ffi.Pointer)>>('CFSetReplaceValue'); + late final _CFSetReplaceValue = _CFSetReplaceValuePtr.asFunction< + void Function(CFMutableSetRef, ffi.Pointer)>(); + + void CFSetSetValue( + CFMutableSetRef theSet, + ffi.Pointer value, + ) { + return _CFSetSetValue( + theSet, + value, + ); + } + + late final _CFSetSetValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableSetRef, ffi.Pointer)>>('CFSetSetValue'); + late final _CFSetSetValue = _CFSetSetValuePtr.asFunction< + void Function(CFMutableSetRef, ffi.Pointer)>(); + + void CFSetRemoveValue( + CFMutableSetRef theSet, + ffi.Pointer value, + ) { + return _CFSetRemoveValue( + theSet, + value, + ); + } + + late final _CFSetRemoveValuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMutableSetRef, ffi.Pointer)>>('CFSetRemoveValue'); + late final _CFSetRemoveValue = _CFSetRemoveValuePtr.asFunction< + void Function(CFMutableSetRef, ffi.Pointer)>(); + + void CFSetRemoveAllValues( + CFMutableSetRef theSet, + ) { + return _CFSetRemoveAllValues( + theSet, + ); + } + + late final _CFSetRemoveAllValuesPtr = + _lookup>( + 'CFSetRemoveAllValues'); + late final _CFSetRemoveAllValues = + _CFSetRemoveAllValuesPtr.asFunction(); + + int CFTreeGetTypeID() { + return _CFTreeGetTypeID(); + } + + late final _CFTreeGetTypeIDPtr = + _lookup>('CFTreeGetTypeID'); + late final _CFTreeGetTypeID = + _CFTreeGetTypeIDPtr.asFunction(); + + CFTreeRef CFTreeCreate( + CFAllocatorRef allocator, + ffi.Pointer context, + ) { + return _CFTreeCreate( + allocator, + context, + ); + } + + late final _CFTreeCreatePtr = _lookup< + ffi.NativeFunction< + CFTreeRef Function( + CFAllocatorRef, ffi.Pointer)>>('CFTreeCreate'); + late final _CFTreeCreate = _CFTreeCreatePtr.asFunction< + CFTreeRef Function(CFAllocatorRef, ffi.Pointer)>(); + + CFTreeRef CFTreeGetParent( + CFTreeRef tree, + ) { + return _CFTreeGetParent( + tree, + ); + } + + late final _CFTreeGetParentPtr = + _lookup>( + 'CFTreeGetParent'); + late final _CFTreeGetParent = + _CFTreeGetParentPtr.asFunction(); + + CFTreeRef CFTreeGetNextSibling( + CFTreeRef tree, + ) { + return _CFTreeGetNextSibling( + tree, + ); + } + + late final _CFTreeGetNextSiblingPtr = + _lookup>( + 'CFTreeGetNextSibling'); + late final _CFTreeGetNextSibling = + _CFTreeGetNextSiblingPtr.asFunction(); + + CFTreeRef CFTreeGetFirstChild( + CFTreeRef tree, + ) { + return _CFTreeGetFirstChild( + tree, + ); + } + + late final _CFTreeGetFirstChildPtr = + _lookup>( + 'CFTreeGetFirstChild'); + late final _CFTreeGetFirstChild = + _CFTreeGetFirstChildPtr.asFunction(); + + void CFTreeGetContext( + CFTreeRef tree, + ffi.Pointer context, + ) { + return _CFTreeGetContext( + tree, + context, + ); + } + + late final _CFTreeGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFTreeRef, ffi.Pointer)>>('CFTreeGetContext'); + late final _CFTreeGetContext = _CFTreeGetContextPtr.asFunction< + void Function(CFTreeRef, ffi.Pointer)>(); + + int CFTreeGetChildCount( + CFTreeRef tree, + ) { + return _CFTreeGetChildCount( + tree, + ); + } + + late final _CFTreeGetChildCountPtr = + _lookup>( + 'CFTreeGetChildCount'); + late final _CFTreeGetChildCount = + _CFTreeGetChildCountPtr.asFunction(); + + CFTreeRef CFTreeGetChildAtIndex( + CFTreeRef tree, + int idx, + ) { + return _CFTreeGetChildAtIndex( + tree, + idx, + ); + } + + late final _CFTreeGetChildAtIndexPtr = + _lookup>( + 'CFTreeGetChildAtIndex'); + late final _CFTreeGetChildAtIndex = _CFTreeGetChildAtIndexPtr.asFunction< + CFTreeRef Function(CFTreeRef, int)>(); + + void CFTreeGetChildren( + CFTreeRef tree, + ffi.Pointer children, + ) { + return _CFTreeGetChildren( + tree, + children, + ); + } + + late final _CFTreeGetChildrenPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFTreeRef, ffi.Pointer)>>('CFTreeGetChildren'); + late final _CFTreeGetChildren = _CFTreeGetChildrenPtr.asFunction< + void Function(CFTreeRef, ffi.Pointer)>(); + + void CFTreeApplyFunctionToChildren( + CFTreeRef tree, + CFTreeApplierFunction applier, + ffi.Pointer context, + ) { + return _CFTreeApplyFunctionToChildren( + tree, + applier, + context, + ); + } + + late final _CFTreeApplyFunctionToChildrenPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFTreeRef, CFTreeApplierFunction, + ffi.Pointer)>>('CFTreeApplyFunctionToChildren'); + late final _CFTreeApplyFunctionToChildren = + _CFTreeApplyFunctionToChildrenPtr.asFunction< + void Function( + CFTreeRef, CFTreeApplierFunction, ffi.Pointer)>(); + + CFTreeRef CFTreeFindRoot( + CFTreeRef tree, + ) { + return _CFTreeFindRoot( + tree, + ); + } + + late final _CFTreeFindRootPtr = + _lookup>( + 'CFTreeFindRoot'); + late final _CFTreeFindRoot = + _CFTreeFindRootPtr.asFunction(); + + void CFTreeSetContext( + CFTreeRef tree, + ffi.Pointer context, + ) { + return _CFTreeSetContext( + tree, + context, + ); + } + + late final _CFTreeSetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFTreeRef, ffi.Pointer)>>('CFTreeSetContext'); + late final _CFTreeSetContext = _CFTreeSetContextPtr.asFunction< + void Function(CFTreeRef, ffi.Pointer)>(); + + void CFTreePrependChild( + CFTreeRef tree, + CFTreeRef newChild, + ) { + return _CFTreePrependChild( + tree, + newChild, + ); + } + + late final _CFTreePrependChildPtr = + _lookup>( + 'CFTreePrependChild'); + late final _CFTreePrependChild = + _CFTreePrependChildPtr.asFunction(); + + void CFTreeAppendChild( + CFTreeRef tree, + CFTreeRef newChild, + ) { + return _CFTreeAppendChild( + tree, + newChild, + ); + } + + late final _CFTreeAppendChildPtr = + _lookup>( + 'CFTreeAppendChild'); + late final _CFTreeAppendChild = + _CFTreeAppendChildPtr.asFunction(); + + void CFTreeInsertSibling( + CFTreeRef tree, + CFTreeRef newSibling, + ) { + return _CFTreeInsertSibling( + tree, + newSibling, + ); + } + + late final _CFTreeInsertSiblingPtr = + _lookup>( + 'CFTreeInsertSibling'); + late final _CFTreeInsertSibling = + _CFTreeInsertSiblingPtr.asFunction(); + + void CFTreeRemove( + CFTreeRef tree, + ) { + return _CFTreeRemove( + tree, + ); + } + + late final _CFTreeRemovePtr = + _lookup>('CFTreeRemove'); + late final _CFTreeRemove = + _CFTreeRemovePtr.asFunction(); + + void CFTreeRemoveAllChildren( + CFTreeRef tree, + ) { + return _CFTreeRemoveAllChildren( + tree, + ); + } + + late final _CFTreeRemoveAllChildrenPtr = + _lookup>( + 'CFTreeRemoveAllChildren'); + late final _CFTreeRemoveAllChildren = + _CFTreeRemoveAllChildrenPtr.asFunction(); + + void CFTreeSortChildren( + CFTreeRef tree, + CFComparatorFunction comparator, + ffi.Pointer context, + ) { + return _CFTreeSortChildren( + tree, + comparator, + context, + ); + } + + late final _CFTreeSortChildrenPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFTreeRef, CFComparatorFunction, + ffi.Pointer)>>('CFTreeSortChildren'); + late final _CFTreeSortChildren = _CFTreeSortChildrenPtr.asFunction< + void Function(CFTreeRef, CFComparatorFunction, ffi.Pointer)>(); + + int CFURLCreateDataAndPropertiesFromResource( + CFAllocatorRef alloc, + CFURLRef url, + ffi.Pointer resourceData, + ffi.Pointer properties, + CFArrayRef desiredProperties, + ffi.Pointer errorCode, + ) { + return _CFURLCreateDataAndPropertiesFromResource( + alloc, + url, + resourceData, + properties, + desiredProperties, + errorCode, + ); + } + + late final _CFURLCreateDataAndPropertiesFromResourcePtr = _lookup< + ffi.NativeFunction< + Boolean Function( + CFAllocatorRef, + CFURLRef, + ffi.Pointer, + ffi.Pointer, + CFArrayRef, + ffi.Pointer)>>( + 'CFURLCreateDataAndPropertiesFromResource'); + late final _CFURLCreateDataAndPropertiesFromResource = + _CFURLCreateDataAndPropertiesFromResourcePtr.asFunction< + int Function(CFAllocatorRef, CFURLRef, ffi.Pointer, + ffi.Pointer, CFArrayRef, ffi.Pointer)>(); + + int CFURLWriteDataAndPropertiesToResource( + CFURLRef url, + CFDataRef dataToWrite, + CFDictionaryRef propertiesToWrite, + ffi.Pointer errorCode, + ) { + return _CFURLWriteDataAndPropertiesToResource( + url, + dataToWrite, + propertiesToWrite, + errorCode, + ); + } + + late final _CFURLWriteDataAndPropertiesToResourcePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFURLRef, CFDataRef, CFDictionaryRef, + ffi.Pointer)>>('CFURLWriteDataAndPropertiesToResource'); + late final _CFURLWriteDataAndPropertiesToResource = + _CFURLWriteDataAndPropertiesToResourcePtr.asFunction< + int Function( + CFURLRef, CFDataRef, CFDictionaryRef, ffi.Pointer)>(); + + int CFURLDestroyResource( + CFURLRef url, + ffi.Pointer errorCode, + ) { + return _CFURLDestroyResource( + url, + errorCode, + ); + } + + late final _CFURLDestroyResourcePtr = _lookup< + ffi.NativeFunction)>>( + 'CFURLDestroyResource'); + late final _CFURLDestroyResource = _CFURLDestroyResourcePtr.asFunction< + int Function(CFURLRef, ffi.Pointer)>(); + + CFTypeRef CFURLCreatePropertyFromResource( + CFAllocatorRef alloc, + CFURLRef url, + CFStringRef property, + ffi.Pointer errorCode, + ) { + return _CFURLCreatePropertyFromResource( + alloc, + url, + property, + errorCode, + ); + } + + late final _CFURLCreatePropertyFromResourcePtr = _lookup< + ffi.NativeFunction< + CFTypeRef Function(CFAllocatorRef, CFURLRef, CFStringRef, + ffi.Pointer)>>('CFURLCreatePropertyFromResource'); + late final _CFURLCreatePropertyFromResource = + _CFURLCreatePropertyFromResourcePtr.asFunction< + CFTypeRef Function( + CFAllocatorRef, CFURLRef, CFStringRef, ffi.Pointer)>(); + + late final ffi.Pointer _kCFURLFileExists = + _lookup('kCFURLFileExists'); + + CFStringRef get kCFURLFileExists => _kCFURLFileExists.value; + + late final ffi.Pointer _kCFURLFileDirectoryContents = + _lookup('kCFURLFileDirectoryContents'); + + CFStringRef get kCFURLFileDirectoryContents => + _kCFURLFileDirectoryContents.value; + + late final ffi.Pointer _kCFURLFileLength = + _lookup('kCFURLFileLength'); + + CFStringRef get kCFURLFileLength => _kCFURLFileLength.value; + + late final ffi.Pointer _kCFURLFileLastModificationTime = + _lookup('kCFURLFileLastModificationTime'); + + CFStringRef get kCFURLFileLastModificationTime => + _kCFURLFileLastModificationTime.value; + + late final ffi.Pointer _kCFURLFilePOSIXMode = + _lookup('kCFURLFilePOSIXMode'); + + CFStringRef get kCFURLFilePOSIXMode => _kCFURLFilePOSIXMode.value; + + late final ffi.Pointer _kCFURLFileOwnerID = + _lookup('kCFURLFileOwnerID'); + + CFStringRef get kCFURLFileOwnerID => _kCFURLFileOwnerID.value; + + late final ffi.Pointer _kCFURLHTTPStatusCode = + _lookup('kCFURLHTTPStatusCode'); + + CFStringRef get kCFURLHTTPStatusCode => _kCFURLHTTPStatusCode.value; + + late final ffi.Pointer _kCFURLHTTPStatusLine = + _lookup('kCFURLHTTPStatusLine'); + + CFStringRef get kCFURLHTTPStatusLine => _kCFURLHTTPStatusLine.value; + + int CFUUIDGetTypeID() { + return _CFUUIDGetTypeID(); + } + + late final _CFUUIDGetTypeIDPtr = + _lookup>('CFUUIDGetTypeID'); + late final _CFUUIDGetTypeID = + _CFUUIDGetTypeIDPtr.asFunction(); + + CFUUIDRef CFUUIDCreate( + CFAllocatorRef alloc, + ) { + return _CFUUIDCreate( + alloc, + ); + } + + late final _CFUUIDCreatePtr = + _lookup>( + 'CFUUIDCreate'); + late final _CFUUIDCreate = + _CFUUIDCreatePtr.asFunction(); + + CFUUIDRef CFUUIDCreateWithBytes( + CFAllocatorRef alloc, + int byte0, + int byte1, + int byte2, + int byte3, + int byte4, + int byte5, + int byte6, + int byte7, + int byte8, + int byte9, + int byte10, + int byte11, + int byte12, + int byte13, + int byte14, + int byte15, + ) { + return _CFUUIDCreateWithBytes( + alloc, + byte0, + byte1, + byte2, + byte3, + byte4, + byte5, + byte6, + byte7, + byte8, + byte9, + byte10, + byte11, + byte12, + byte13, + byte14, + byte15, + ); + } + + late final _CFUUIDCreateWithBytesPtr = _lookup< + ffi.NativeFunction< + CFUUIDRef Function( + CFAllocatorRef, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8)>>('CFUUIDCreateWithBytes'); + late final _CFUUIDCreateWithBytes = _CFUUIDCreateWithBytesPtr.asFunction< + CFUUIDRef Function(CFAllocatorRef, int, int, int, int, int, int, int, int, + int, int, int, int, int, int, int, int)>(); + + CFUUIDRef CFUUIDCreateFromString( + CFAllocatorRef alloc, + CFStringRef uuidStr, + ) { + return _CFUUIDCreateFromString( + alloc, + uuidStr, + ); + } + + late final _CFUUIDCreateFromStringPtr = _lookup< + ffi.NativeFunction>( + 'CFUUIDCreateFromString'); + late final _CFUUIDCreateFromString = _CFUUIDCreateFromStringPtr.asFunction< + CFUUIDRef Function(CFAllocatorRef, CFStringRef)>(); + + CFStringRef CFUUIDCreateString( + CFAllocatorRef alloc, + CFUUIDRef uuid, + ) { + return _CFUUIDCreateString( + alloc, + uuid, + ); + } + + late final _CFUUIDCreateStringPtr = _lookup< + ffi.NativeFunction>( + 'CFUUIDCreateString'); + late final _CFUUIDCreateString = _CFUUIDCreateStringPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFUUIDRef)>(); + + CFUUIDRef CFUUIDGetConstantUUIDWithBytes( + CFAllocatorRef alloc, + int byte0, + int byte1, + int byte2, + int byte3, + int byte4, + int byte5, + int byte6, + int byte7, + int byte8, + int byte9, + int byte10, + int byte11, + int byte12, + int byte13, + int byte14, + int byte15, + ) { + return _CFUUIDGetConstantUUIDWithBytes( + alloc, + byte0, + byte1, + byte2, + byte3, + byte4, + byte5, + byte6, + byte7, + byte8, + byte9, + byte10, + byte11, + byte12, + byte13, + byte14, + byte15, + ); + } + + late final _CFUUIDGetConstantUUIDWithBytesPtr = _lookup< + ffi.NativeFunction< + CFUUIDRef Function( + CFAllocatorRef, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8, + UInt8)>>('CFUUIDGetConstantUUIDWithBytes'); + late final _CFUUIDGetConstantUUIDWithBytes = + _CFUUIDGetConstantUUIDWithBytesPtr.asFunction< + CFUUIDRef Function(CFAllocatorRef, int, int, int, int, int, int, int, + int, int, int, int, int, int, int, int, int)>(); + + CFUUIDBytes CFUUIDGetUUIDBytes( + CFUUIDRef uuid, + ) { + return _CFUUIDGetUUIDBytes( + uuid, + ); + } + + late final _CFUUIDGetUUIDBytesPtr = + _lookup>( + 'CFUUIDGetUUIDBytes'); + late final _CFUUIDGetUUIDBytes = + _CFUUIDGetUUIDBytesPtr.asFunction(); + + CFUUIDRef CFUUIDCreateFromUUIDBytes( + CFAllocatorRef alloc, + CFUUIDBytes bytes, + ) { + return _CFUUIDCreateFromUUIDBytes( + alloc, + bytes, + ); + } + + late final _CFUUIDCreateFromUUIDBytesPtr = _lookup< + ffi.NativeFunction>( + 'CFUUIDCreateFromUUIDBytes'); + late final _CFUUIDCreateFromUUIDBytes = _CFUUIDCreateFromUUIDBytesPtr + .asFunction(); + + CFURLRef CFCopyHomeDirectoryURL() { + return _CFCopyHomeDirectoryURL(); + } + + late final _CFCopyHomeDirectoryURLPtr = + _lookup>( + 'CFCopyHomeDirectoryURL'); + late final _CFCopyHomeDirectoryURL = + _CFCopyHomeDirectoryURLPtr.asFunction(); + + late final ffi.Pointer _kCFBundleInfoDictionaryVersionKey = + _lookup('kCFBundleInfoDictionaryVersionKey'); + + CFStringRef get kCFBundleInfoDictionaryVersionKey => + _kCFBundleInfoDictionaryVersionKey.value; + + late final ffi.Pointer _kCFBundleExecutableKey = + _lookup('kCFBundleExecutableKey'); + + CFStringRef get kCFBundleExecutableKey => _kCFBundleExecutableKey.value; + + late final ffi.Pointer _kCFBundleIdentifierKey = + _lookup('kCFBundleIdentifierKey'); + + CFStringRef get kCFBundleIdentifierKey => _kCFBundleIdentifierKey.value; + + late final ffi.Pointer _kCFBundleVersionKey = + _lookup('kCFBundleVersionKey'); + + CFStringRef get kCFBundleVersionKey => _kCFBundleVersionKey.value; + + late final ffi.Pointer _kCFBundleDevelopmentRegionKey = + _lookup('kCFBundleDevelopmentRegionKey'); + + CFStringRef get kCFBundleDevelopmentRegionKey => + _kCFBundleDevelopmentRegionKey.value; + + late final ffi.Pointer _kCFBundleNameKey = + _lookup('kCFBundleNameKey'); + + CFStringRef get kCFBundleNameKey => _kCFBundleNameKey.value; + + late final ffi.Pointer _kCFBundleLocalizationsKey = + _lookup('kCFBundleLocalizationsKey'); + + CFStringRef get kCFBundleLocalizationsKey => _kCFBundleLocalizationsKey.value; + + CFBundleRef CFBundleGetMainBundle() { + return _CFBundleGetMainBundle(); + } + + late final _CFBundleGetMainBundlePtr = + _lookup>( + 'CFBundleGetMainBundle'); + late final _CFBundleGetMainBundle = + _CFBundleGetMainBundlePtr.asFunction(); + + CFBundleRef CFBundleGetBundleWithIdentifier( + CFStringRef bundleID, + ) { + return _CFBundleGetBundleWithIdentifier( + bundleID, + ); + } + + late final _CFBundleGetBundleWithIdentifierPtr = + _lookup>( + 'CFBundleGetBundleWithIdentifier'); + late final _CFBundleGetBundleWithIdentifier = + _CFBundleGetBundleWithIdentifierPtr.asFunction< + CFBundleRef Function(CFStringRef)>(); + + CFArrayRef CFBundleGetAllBundles() { + return _CFBundleGetAllBundles(); + } + + late final _CFBundleGetAllBundlesPtr = + _lookup>( + 'CFBundleGetAllBundles'); + late final _CFBundleGetAllBundles = + _CFBundleGetAllBundlesPtr.asFunction(); + + int CFBundleGetTypeID() { + return _CFBundleGetTypeID(); + } + + late final _CFBundleGetTypeIDPtr = + _lookup>('CFBundleGetTypeID'); + late final _CFBundleGetTypeID = + _CFBundleGetTypeIDPtr.asFunction(); + + CFBundleRef CFBundleCreate( + CFAllocatorRef allocator, + CFURLRef bundleURL, + ) { + return _CFBundleCreate( + allocator, + bundleURL, + ); + } + + late final _CFBundleCreatePtr = _lookup< + ffi.NativeFunction>( + 'CFBundleCreate'); + late final _CFBundleCreate = _CFBundleCreatePtr.asFunction< + CFBundleRef Function(CFAllocatorRef, CFURLRef)>(); + + CFArrayRef CFBundleCreateBundlesFromDirectory( + CFAllocatorRef allocator, + CFURLRef directoryURL, + CFStringRef bundleType, + ) { + return _CFBundleCreateBundlesFromDirectory( + allocator, + directoryURL, + bundleType, + ); + } + + late final _CFBundleCreateBundlesFromDirectoryPtr = _lookup< + ffi.NativeFunction< + CFArrayRef Function(CFAllocatorRef, CFURLRef, + CFStringRef)>>('CFBundleCreateBundlesFromDirectory'); + late final _CFBundleCreateBundlesFromDirectory = + _CFBundleCreateBundlesFromDirectoryPtr.asFunction< + CFArrayRef Function(CFAllocatorRef, CFURLRef, CFStringRef)>(); + + CFURLRef CFBundleCopyBundleURL( + CFBundleRef bundle, + ) { + return _CFBundleCopyBundleURL( + bundle, + ); + } + + late final _CFBundleCopyBundleURLPtr = + _lookup>( + 'CFBundleCopyBundleURL'); + late final _CFBundleCopyBundleURL = + _CFBundleCopyBundleURLPtr.asFunction(); + + CFTypeRef CFBundleGetValueForInfoDictionaryKey( + CFBundleRef bundle, + CFStringRef key, + ) { + return _CFBundleGetValueForInfoDictionaryKey( + bundle, + key, + ); + } + + late final _CFBundleGetValueForInfoDictionaryKeyPtr = + _lookup>( + 'CFBundleGetValueForInfoDictionaryKey'); + late final _CFBundleGetValueForInfoDictionaryKey = + _CFBundleGetValueForInfoDictionaryKeyPtr.asFunction< + CFTypeRef Function(CFBundleRef, CFStringRef)>(); + + CFDictionaryRef CFBundleGetInfoDictionary( + CFBundleRef bundle, + ) { + return _CFBundleGetInfoDictionary( + bundle, + ); + } + + late final _CFBundleGetInfoDictionaryPtr = + _lookup>( + 'CFBundleGetInfoDictionary'); + late final _CFBundleGetInfoDictionary = _CFBundleGetInfoDictionaryPtr + .asFunction(); + + CFDictionaryRef CFBundleGetLocalInfoDictionary( + CFBundleRef bundle, + ) { + return _CFBundleGetLocalInfoDictionary( + bundle, + ); + } + + late final _CFBundleGetLocalInfoDictionaryPtr = + _lookup>( + 'CFBundleGetLocalInfoDictionary'); + late final _CFBundleGetLocalInfoDictionary = + _CFBundleGetLocalInfoDictionaryPtr.asFunction< + CFDictionaryRef Function(CFBundleRef)>(); + + void CFBundleGetPackageInfo( + CFBundleRef bundle, + ffi.Pointer packageType, + ffi.Pointer packageCreator, + ) { + return _CFBundleGetPackageInfo( + bundle, + packageType, + packageCreator, + ); + } + + late final _CFBundleGetPackageInfoPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFBundleRef, ffi.Pointer, + ffi.Pointer)>>('CFBundleGetPackageInfo'); + late final _CFBundleGetPackageInfo = _CFBundleGetPackageInfoPtr.asFunction< + void Function(CFBundleRef, ffi.Pointer, ffi.Pointer)>(); + + CFStringRef CFBundleGetIdentifier( + CFBundleRef bundle, + ) { + return _CFBundleGetIdentifier( + bundle, + ); + } + + late final _CFBundleGetIdentifierPtr = + _lookup>( + 'CFBundleGetIdentifier'); + late final _CFBundleGetIdentifier = + _CFBundleGetIdentifierPtr.asFunction(); + + int CFBundleGetVersionNumber( + CFBundleRef bundle, + ) { + return _CFBundleGetVersionNumber( + bundle, + ); + } + + late final _CFBundleGetVersionNumberPtr = + _lookup>( + 'CFBundleGetVersionNumber'); + late final _CFBundleGetVersionNumber = + _CFBundleGetVersionNumberPtr.asFunction(); + + CFStringRef CFBundleGetDevelopmentRegion( + CFBundleRef bundle, + ) { + return _CFBundleGetDevelopmentRegion( + bundle, + ); + } + + late final _CFBundleGetDevelopmentRegionPtr = + _lookup>( + 'CFBundleGetDevelopmentRegion'); + late final _CFBundleGetDevelopmentRegion = _CFBundleGetDevelopmentRegionPtr + .asFunction(); + + CFURLRef CFBundleCopySupportFilesDirectoryURL( + CFBundleRef bundle, + ) { + return _CFBundleCopySupportFilesDirectoryURL( + bundle, + ); + } + + late final _CFBundleCopySupportFilesDirectoryURLPtr = + _lookup>( + 'CFBundleCopySupportFilesDirectoryURL'); + late final _CFBundleCopySupportFilesDirectoryURL = + _CFBundleCopySupportFilesDirectoryURLPtr.asFunction< + CFURLRef Function(CFBundleRef)>(); + + CFURLRef CFBundleCopyResourcesDirectoryURL( + CFBundleRef bundle, + ) { + return _CFBundleCopyResourcesDirectoryURL( + bundle, + ); + } + + late final _CFBundleCopyResourcesDirectoryURLPtr = + _lookup>( + 'CFBundleCopyResourcesDirectoryURL'); + late final _CFBundleCopyResourcesDirectoryURL = + _CFBundleCopyResourcesDirectoryURLPtr.asFunction< + CFURLRef Function(CFBundleRef)>(); + + CFURLRef CFBundleCopyPrivateFrameworksURL( + CFBundleRef bundle, + ) { + return _CFBundleCopyPrivateFrameworksURL( + bundle, + ); + } + + late final _CFBundleCopyPrivateFrameworksURLPtr = + _lookup>( + 'CFBundleCopyPrivateFrameworksURL'); + late final _CFBundleCopyPrivateFrameworksURL = + _CFBundleCopyPrivateFrameworksURLPtr.asFunction< + CFURLRef Function(CFBundleRef)>(); + + CFURLRef CFBundleCopySharedFrameworksURL( + CFBundleRef bundle, + ) { + return _CFBundleCopySharedFrameworksURL( + bundle, + ); + } + + late final _CFBundleCopySharedFrameworksURLPtr = + _lookup>( + 'CFBundleCopySharedFrameworksURL'); + late final _CFBundleCopySharedFrameworksURL = + _CFBundleCopySharedFrameworksURLPtr.asFunction< + CFURLRef Function(CFBundleRef)>(); + + CFURLRef CFBundleCopySharedSupportURL( + CFBundleRef bundle, + ) { + return _CFBundleCopySharedSupportURL( + bundle, + ); + } + + late final _CFBundleCopySharedSupportURLPtr = + _lookup>( + 'CFBundleCopySharedSupportURL'); + late final _CFBundleCopySharedSupportURL = _CFBundleCopySharedSupportURLPtr + .asFunction(); + + CFURLRef CFBundleCopyBuiltInPlugInsURL( + CFBundleRef bundle, + ) { + return _CFBundleCopyBuiltInPlugInsURL( + bundle, + ); + } + + late final _CFBundleCopyBuiltInPlugInsURLPtr = + _lookup>( + 'CFBundleCopyBuiltInPlugInsURL'); + late final _CFBundleCopyBuiltInPlugInsURL = _CFBundleCopyBuiltInPlugInsURLPtr + .asFunction(); + + CFDictionaryRef CFBundleCopyInfoDictionaryInDirectory( + CFURLRef bundleURL, + ) { + return _CFBundleCopyInfoDictionaryInDirectory( + bundleURL, + ); + } + + late final _CFBundleCopyInfoDictionaryInDirectoryPtr = + _lookup>( + 'CFBundleCopyInfoDictionaryInDirectory'); + late final _CFBundleCopyInfoDictionaryInDirectory = + _CFBundleCopyInfoDictionaryInDirectoryPtr.asFunction< + CFDictionaryRef Function(CFURLRef)>(); + + int CFBundleGetPackageInfoInDirectory( + CFURLRef url, + ffi.Pointer packageType, + ffi.Pointer packageCreator, + ) { + return _CFBundleGetPackageInfoInDirectory( + url, + packageType, + packageCreator, + ); + } + + late final _CFBundleGetPackageInfoInDirectoryPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFURLRef, ffi.Pointer, + ffi.Pointer)>>('CFBundleGetPackageInfoInDirectory'); + late final _CFBundleGetPackageInfoInDirectory = + _CFBundleGetPackageInfoInDirectoryPtr.asFunction< + int Function(CFURLRef, ffi.Pointer, ffi.Pointer)>(); + + CFURLRef CFBundleCopyResourceURL( + CFBundleRef bundle, + CFStringRef resourceName, + CFStringRef resourceType, + CFStringRef subDirName, + ) { + return _CFBundleCopyResourceURL( + bundle, + resourceName, + resourceType, + subDirName, + ); + } + + late final _CFBundleCopyResourceURLPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFBundleRef, CFStringRef, CFStringRef, + CFStringRef)>>('CFBundleCopyResourceURL'); + late final _CFBundleCopyResourceURL = _CFBundleCopyResourceURLPtr.asFunction< + CFURLRef Function(CFBundleRef, CFStringRef, CFStringRef, CFStringRef)>(); + + CFArrayRef CFBundleCopyResourceURLsOfType( + CFBundleRef bundle, + CFStringRef resourceType, + CFStringRef subDirName, + ) { + return _CFBundleCopyResourceURLsOfType( + bundle, + resourceType, + subDirName, + ); + } + + late final _CFBundleCopyResourceURLsOfTypePtr = _lookup< + ffi.NativeFunction< + CFArrayRef Function(CFBundleRef, CFStringRef, + CFStringRef)>>('CFBundleCopyResourceURLsOfType'); + late final _CFBundleCopyResourceURLsOfType = + _CFBundleCopyResourceURLsOfTypePtr.asFunction< + CFArrayRef Function(CFBundleRef, CFStringRef, CFStringRef)>(); + + CFStringRef CFBundleCopyLocalizedString( + CFBundleRef bundle, + CFStringRef key, + CFStringRef value, + CFStringRef tableName, + ) { + return _CFBundleCopyLocalizedString( + bundle, + key, + value, + tableName, + ); + } + + late final _CFBundleCopyLocalizedStringPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFBundleRef, CFStringRef, CFStringRef, + CFStringRef)>>('CFBundleCopyLocalizedString'); + late final _CFBundleCopyLocalizedString = + _CFBundleCopyLocalizedStringPtr.asFunction< + CFStringRef Function( + CFBundleRef, CFStringRef, CFStringRef, CFStringRef)>(); + + CFURLRef CFBundleCopyResourceURLInDirectory( + CFURLRef bundleURL, + CFStringRef resourceName, + CFStringRef resourceType, + CFStringRef subDirName, + ) { + return _CFBundleCopyResourceURLInDirectory( + bundleURL, + resourceName, + resourceType, + subDirName, + ); + } + + late final _CFBundleCopyResourceURLInDirectoryPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFURLRef, CFStringRef, CFStringRef, + CFStringRef)>>('CFBundleCopyResourceURLInDirectory'); + late final _CFBundleCopyResourceURLInDirectory = + _CFBundleCopyResourceURLInDirectoryPtr.asFunction< + CFURLRef Function(CFURLRef, CFStringRef, CFStringRef, CFStringRef)>(); + + CFArrayRef CFBundleCopyResourceURLsOfTypeInDirectory( + CFURLRef bundleURL, + CFStringRef resourceType, + CFStringRef subDirName, + ) { + return _CFBundleCopyResourceURLsOfTypeInDirectory( + bundleURL, + resourceType, + subDirName, + ); + } + + late final _CFBundleCopyResourceURLsOfTypeInDirectoryPtr = _lookup< + ffi.NativeFunction< + CFArrayRef Function(CFURLRef, CFStringRef, + CFStringRef)>>('CFBundleCopyResourceURLsOfTypeInDirectory'); + late final _CFBundleCopyResourceURLsOfTypeInDirectory = + _CFBundleCopyResourceURLsOfTypeInDirectoryPtr.asFunction< + CFArrayRef Function(CFURLRef, CFStringRef, CFStringRef)>(); + + CFArrayRef CFBundleCopyBundleLocalizations( + CFBundleRef bundle, + ) { + return _CFBundleCopyBundleLocalizations( + bundle, + ); + } + + late final _CFBundleCopyBundleLocalizationsPtr = + _lookup>( + 'CFBundleCopyBundleLocalizations'); + late final _CFBundleCopyBundleLocalizations = + _CFBundleCopyBundleLocalizationsPtr.asFunction< + CFArrayRef Function(CFBundleRef)>(); + + CFArrayRef CFBundleCopyPreferredLocalizationsFromArray( + CFArrayRef locArray, + ) { + return _CFBundleCopyPreferredLocalizationsFromArray( + locArray, + ); + } + + late final _CFBundleCopyPreferredLocalizationsFromArrayPtr = + _lookup>( + 'CFBundleCopyPreferredLocalizationsFromArray'); + late final _CFBundleCopyPreferredLocalizationsFromArray = + _CFBundleCopyPreferredLocalizationsFromArrayPtr.asFunction< + CFArrayRef Function(CFArrayRef)>(); + + CFArrayRef CFBundleCopyLocalizationsForPreferences( + CFArrayRef locArray, + CFArrayRef prefArray, + ) { + return _CFBundleCopyLocalizationsForPreferences( + locArray, + prefArray, + ); + } + + late final _CFBundleCopyLocalizationsForPreferencesPtr = + _lookup>( + 'CFBundleCopyLocalizationsForPreferences'); + late final _CFBundleCopyLocalizationsForPreferences = + _CFBundleCopyLocalizationsForPreferencesPtr.asFunction< + CFArrayRef Function(CFArrayRef, CFArrayRef)>(); + + CFURLRef CFBundleCopyResourceURLForLocalization( + CFBundleRef bundle, + CFStringRef resourceName, + CFStringRef resourceType, + CFStringRef subDirName, + CFStringRef localizationName, + ) { + return _CFBundleCopyResourceURLForLocalization( + bundle, + resourceName, + resourceType, + subDirName, + localizationName, + ); + } + + late final _CFBundleCopyResourceURLForLocalizationPtr = _lookup< + ffi.NativeFunction< + CFURLRef Function(CFBundleRef, CFStringRef, CFStringRef, CFStringRef, + CFStringRef)>>('CFBundleCopyResourceURLForLocalization'); + late final _CFBundleCopyResourceURLForLocalization = + _CFBundleCopyResourceURLForLocalizationPtr.asFunction< + CFURLRef Function(CFBundleRef, CFStringRef, CFStringRef, CFStringRef, + CFStringRef)>(); + + CFArrayRef CFBundleCopyResourceURLsOfTypeForLocalization( + CFBundleRef bundle, + CFStringRef resourceType, + CFStringRef subDirName, + CFStringRef localizationName, + ) { + return _CFBundleCopyResourceURLsOfTypeForLocalization( + bundle, + resourceType, + subDirName, + localizationName, + ); + } + + late final _CFBundleCopyResourceURLsOfTypeForLocalizationPtr = _lookup< + ffi.NativeFunction< + CFArrayRef Function(CFBundleRef, CFStringRef, CFStringRef, + CFStringRef)>>('CFBundleCopyResourceURLsOfTypeForLocalization'); + late final _CFBundleCopyResourceURLsOfTypeForLocalization = + _CFBundleCopyResourceURLsOfTypeForLocalizationPtr.asFunction< + CFArrayRef Function( + CFBundleRef, CFStringRef, CFStringRef, CFStringRef)>(); + + CFDictionaryRef CFBundleCopyInfoDictionaryForURL( + CFURLRef url, + ) { + return _CFBundleCopyInfoDictionaryForURL( + url, + ); + } + + late final _CFBundleCopyInfoDictionaryForURLPtr = + _lookup>( + 'CFBundleCopyInfoDictionaryForURL'); + late final _CFBundleCopyInfoDictionaryForURL = + _CFBundleCopyInfoDictionaryForURLPtr.asFunction< + CFDictionaryRef Function(CFURLRef)>(); + + CFArrayRef CFBundleCopyLocalizationsForURL( + CFURLRef url, + ) { + return _CFBundleCopyLocalizationsForURL( + url, + ); + } + + late final _CFBundleCopyLocalizationsForURLPtr = + _lookup>( + 'CFBundleCopyLocalizationsForURL'); + late final _CFBundleCopyLocalizationsForURL = + _CFBundleCopyLocalizationsForURLPtr.asFunction< + CFArrayRef Function(CFURLRef)>(); + + CFArrayRef CFBundleCopyExecutableArchitecturesForURL( + CFURLRef url, + ) { + return _CFBundleCopyExecutableArchitecturesForURL( + url, + ); + } + + late final _CFBundleCopyExecutableArchitecturesForURLPtr = + _lookup>( + 'CFBundleCopyExecutableArchitecturesForURL'); + late final _CFBundleCopyExecutableArchitecturesForURL = + _CFBundleCopyExecutableArchitecturesForURLPtr.asFunction< + CFArrayRef Function(CFURLRef)>(); + + CFURLRef CFBundleCopyExecutableURL( + CFBundleRef bundle, + ) { + return _CFBundleCopyExecutableURL( + bundle, + ); + } + + late final _CFBundleCopyExecutableURLPtr = + _lookup>( + 'CFBundleCopyExecutableURL'); + late final _CFBundleCopyExecutableURL = _CFBundleCopyExecutableURLPtr + .asFunction(); + + CFArrayRef CFBundleCopyExecutableArchitectures( + CFBundleRef bundle, + ) { + return _CFBundleCopyExecutableArchitectures( + bundle, + ); + } + + late final _CFBundleCopyExecutableArchitecturesPtr = + _lookup>( + 'CFBundleCopyExecutableArchitectures'); + late final _CFBundleCopyExecutableArchitectures = + _CFBundleCopyExecutableArchitecturesPtr.asFunction< + CFArrayRef Function(CFBundleRef)>(); + + int CFBundlePreflightExecutable( + CFBundleRef bundle, + ffi.Pointer error, + ) { + return _CFBundlePreflightExecutable( + bundle, + error, + ); + } + + late final _CFBundlePreflightExecutablePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFBundleRef, + ffi.Pointer)>>('CFBundlePreflightExecutable'); + late final _CFBundlePreflightExecutable = _CFBundlePreflightExecutablePtr + .asFunction)>(); + + int CFBundleLoadExecutableAndReturnError( + CFBundleRef bundle, + ffi.Pointer error, + ) { + return _CFBundleLoadExecutableAndReturnError( + bundle, + error, + ); + } + + late final _CFBundleLoadExecutableAndReturnErrorPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFBundleRef, ffi.Pointer)>>( + 'CFBundleLoadExecutableAndReturnError'); + late final _CFBundleLoadExecutableAndReturnError = + _CFBundleLoadExecutableAndReturnErrorPtr.asFunction< + int Function(CFBundleRef, ffi.Pointer)>(); + + int CFBundleLoadExecutable( + CFBundleRef bundle, + ) { + return _CFBundleLoadExecutable( + bundle, + ); + } + + late final _CFBundleLoadExecutablePtr = + _lookup>( + 'CFBundleLoadExecutable'); + late final _CFBundleLoadExecutable = + _CFBundleLoadExecutablePtr.asFunction(); + + int CFBundleIsExecutableLoaded( + CFBundleRef bundle, + ) { + return _CFBundleIsExecutableLoaded( + bundle, + ); + } + + late final _CFBundleIsExecutableLoadedPtr = + _lookup>( + 'CFBundleIsExecutableLoaded'); + late final _CFBundleIsExecutableLoaded = + _CFBundleIsExecutableLoadedPtr.asFunction(); + + void CFBundleUnloadExecutable( + CFBundleRef bundle, + ) { + return _CFBundleUnloadExecutable( + bundle, + ); + } + + late final _CFBundleUnloadExecutablePtr = + _lookup>( + 'CFBundleUnloadExecutable'); + late final _CFBundleUnloadExecutable = + _CFBundleUnloadExecutablePtr.asFunction(); + + ffi.Pointer CFBundleGetFunctionPointerForName( + CFBundleRef bundle, + CFStringRef functionName, + ) { + return _CFBundleGetFunctionPointerForName( + bundle, + functionName, + ); + } + + late final _CFBundleGetFunctionPointerForNamePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CFBundleRef, CFStringRef)>>('CFBundleGetFunctionPointerForName'); + late final _CFBundleGetFunctionPointerForName = + _CFBundleGetFunctionPointerForNamePtr.asFunction< + ffi.Pointer Function(CFBundleRef, CFStringRef)>(); + + void CFBundleGetFunctionPointersForNames( + CFBundleRef bundle, + CFArrayRef functionNames, + ffi.Pointer> ftbl, + ) { + return _CFBundleGetFunctionPointersForNames( + bundle, + functionNames, + ftbl, + ); + } + + late final _CFBundleGetFunctionPointersForNamesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFBundleRef, CFArrayRef, + ffi.Pointer>)>>( + 'CFBundleGetFunctionPointersForNames'); + late final _CFBundleGetFunctionPointersForNames = + _CFBundleGetFunctionPointersForNamesPtr.asFunction< + void Function( + CFBundleRef, CFArrayRef, ffi.Pointer>)>(); + + ffi.Pointer CFBundleGetDataPointerForName( + CFBundleRef bundle, + CFStringRef symbolName, + ) { + return _CFBundleGetDataPointerForName( + bundle, + symbolName, + ); + } + + late final _CFBundleGetDataPointerForNamePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CFBundleRef, CFStringRef)>>('CFBundleGetDataPointerForName'); + late final _CFBundleGetDataPointerForName = _CFBundleGetDataPointerForNamePtr + .asFunction Function(CFBundleRef, CFStringRef)>(); + + void CFBundleGetDataPointersForNames( + CFBundleRef bundle, + CFArrayRef symbolNames, + ffi.Pointer> stbl, + ) { + return _CFBundleGetDataPointersForNames( + bundle, + symbolNames, + stbl, + ); + } + + late final _CFBundleGetDataPointersForNamesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFBundleRef, CFArrayRef, + ffi.Pointer>)>>( + 'CFBundleGetDataPointersForNames'); + late final _CFBundleGetDataPointersForNames = + _CFBundleGetDataPointersForNamesPtr.asFunction< + void Function( + CFBundleRef, CFArrayRef, ffi.Pointer>)>(); + + CFURLRef CFBundleCopyAuxiliaryExecutableURL( + CFBundleRef bundle, + CFStringRef executableName, + ) { + return _CFBundleCopyAuxiliaryExecutableURL( + bundle, + executableName, + ); + } + + late final _CFBundleCopyAuxiliaryExecutableURLPtr = + _lookup>( + 'CFBundleCopyAuxiliaryExecutableURL'); + late final _CFBundleCopyAuxiliaryExecutableURL = + _CFBundleCopyAuxiliaryExecutableURLPtr.asFunction< + CFURLRef Function(CFBundleRef, CFStringRef)>(); + + int CFBundleIsExecutableLoadable( + CFBundleRef bundle, + ) { + return _CFBundleIsExecutableLoadable( + bundle, + ); + } + + late final _CFBundleIsExecutableLoadablePtr = + _lookup>( + 'CFBundleIsExecutableLoadable'); + late final _CFBundleIsExecutableLoadable = + _CFBundleIsExecutableLoadablePtr.asFunction(); + + int CFBundleIsExecutableLoadableForURL( + CFURLRef url, + ) { + return _CFBundleIsExecutableLoadableForURL( + url, + ); + } + + late final _CFBundleIsExecutableLoadableForURLPtr = + _lookup>( + 'CFBundleIsExecutableLoadableForURL'); + late final _CFBundleIsExecutableLoadableForURL = + _CFBundleIsExecutableLoadableForURLPtr.asFunction< + int Function(CFURLRef)>(); + + int CFBundleIsArchitectureLoadable( + int arch, + ) { + return _CFBundleIsArchitectureLoadable( + arch, + ); + } + + late final _CFBundleIsArchitectureLoadablePtr = + _lookup>( + 'CFBundleIsArchitectureLoadable'); + late final _CFBundleIsArchitectureLoadable = + _CFBundleIsArchitectureLoadablePtr.asFunction(); + + CFPlugInRef CFBundleGetPlugIn( + CFBundleRef bundle, + ) { + return _CFBundleGetPlugIn( + bundle, + ); + } + + late final _CFBundleGetPlugInPtr = + _lookup>( + 'CFBundleGetPlugIn'); + late final _CFBundleGetPlugIn = + _CFBundleGetPlugInPtr.asFunction(); + + int CFBundleOpenBundleResourceMap( + CFBundleRef bundle, + ) { + return _CFBundleOpenBundleResourceMap( + bundle, + ); + } + + late final _CFBundleOpenBundleResourceMapPtr = + _lookup>( + 'CFBundleOpenBundleResourceMap'); + late final _CFBundleOpenBundleResourceMap = + _CFBundleOpenBundleResourceMapPtr.asFunction(); + + int CFBundleOpenBundleResourceFiles( + CFBundleRef bundle, + ffi.Pointer refNum, + ffi.Pointer localizedRefNum, + ) { + return _CFBundleOpenBundleResourceFiles( + bundle, + refNum, + localizedRefNum, + ); + } + + late final _CFBundleOpenBundleResourceFilesPtr = _lookup< + ffi.NativeFunction< + SInt32 Function(CFBundleRef, ffi.Pointer, + ffi.Pointer)>>('CFBundleOpenBundleResourceFiles'); + late final _CFBundleOpenBundleResourceFiles = + _CFBundleOpenBundleResourceFilesPtr.asFunction< + int Function(CFBundleRef, ffi.Pointer, + ffi.Pointer)>(); + + void CFBundleCloseBundleResourceMap( + CFBundleRef bundle, + int refNum, + ) { + return _CFBundleCloseBundleResourceMap( + bundle, + refNum, + ); + } + + late final _CFBundleCloseBundleResourceMapPtr = _lookup< + ffi.NativeFunction>( + 'CFBundleCloseBundleResourceMap'); + late final _CFBundleCloseBundleResourceMap = + _CFBundleCloseBundleResourceMapPtr.asFunction< + void Function(CFBundleRef, int)>(); + + int CFMessagePortGetTypeID() { + return _CFMessagePortGetTypeID(); + } + + late final _CFMessagePortGetTypeIDPtr = + _lookup>( + 'CFMessagePortGetTypeID'); + late final _CFMessagePortGetTypeID = + _CFMessagePortGetTypeIDPtr.asFunction(); + + CFMessagePortRef CFMessagePortCreateLocal( + CFAllocatorRef allocator, + CFStringRef name, + CFMessagePortCallBack callout, + ffi.Pointer context, + ffi.Pointer shouldFreeInfo, + ) { + return _CFMessagePortCreateLocal( + allocator, + name, + callout, + context, + shouldFreeInfo, + ); + } + + late final _CFMessagePortCreateLocalPtr = _lookup< + ffi.NativeFunction< + CFMessagePortRef Function( + CFAllocatorRef, + CFStringRef, + CFMessagePortCallBack, + ffi.Pointer, + ffi.Pointer)>>('CFMessagePortCreateLocal'); + late final _CFMessagePortCreateLocal = + _CFMessagePortCreateLocalPtr.asFunction< + CFMessagePortRef Function( + CFAllocatorRef, + CFStringRef, + CFMessagePortCallBack, + ffi.Pointer, + ffi.Pointer)>(); + + CFMessagePortRef CFMessagePortCreateRemote( + CFAllocatorRef allocator, + CFStringRef name, + ) { + return _CFMessagePortCreateRemote( + allocator, + name, + ); + } + + late final _CFMessagePortCreateRemotePtr = _lookup< + ffi.NativeFunction< + CFMessagePortRef Function( + CFAllocatorRef, CFStringRef)>>('CFMessagePortCreateRemote'); + late final _CFMessagePortCreateRemote = _CFMessagePortCreateRemotePtr + .asFunction(); + + int CFMessagePortIsRemote( + CFMessagePortRef ms, + ) { + return _CFMessagePortIsRemote( + ms, + ); + } + + late final _CFMessagePortIsRemotePtr = + _lookup>( + 'CFMessagePortIsRemote'); + late final _CFMessagePortIsRemote = + _CFMessagePortIsRemotePtr.asFunction(); + + CFStringRef CFMessagePortGetName( + CFMessagePortRef ms, + ) { + return _CFMessagePortGetName( + ms, + ); + } + + late final _CFMessagePortGetNamePtr = + _lookup>( + 'CFMessagePortGetName'); + late final _CFMessagePortGetName = _CFMessagePortGetNamePtr.asFunction< + CFStringRef Function(CFMessagePortRef)>(); + + int CFMessagePortSetName( + CFMessagePortRef ms, + CFStringRef newName, + ) { + return _CFMessagePortSetName( + ms, + newName, + ); + } + + late final _CFMessagePortSetNamePtr = _lookup< + ffi.NativeFunction>( + 'CFMessagePortSetName'); + late final _CFMessagePortSetName = _CFMessagePortSetNamePtr.asFunction< + int Function(CFMessagePortRef, CFStringRef)>(); + + void CFMessagePortGetContext( + CFMessagePortRef ms, + ffi.Pointer context, + ) { + return _CFMessagePortGetContext( + ms, + context, + ); + } + + late final _CFMessagePortGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMessagePortRef, + ffi.Pointer)>>('CFMessagePortGetContext'); + late final _CFMessagePortGetContext = _CFMessagePortGetContextPtr.asFunction< + void Function(CFMessagePortRef, ffi.Pointer)>(); + + void CFMessagePortInvalidate( + CFMessagePortRef ms, + ) { + return _CFMessagePortInvalidate( + ms, + ); + } + + late final _CFMessagePortInvalidatePtr = + _lookup>( + 'CFMessagePortInvalidate'); + late final _CFMessagePortInvalidate = + _CFMessagePortInvalidatePtr.asFunction(); + + int CFMessagePortIsValid( + CFMessagePortRef ms, + ) { + return _CFMessagePortIsValid( + ms, + ); + } + + late final _CFMessagePortIsValidPtr = + _lookup>( + 'CFMessagePortIsValid'); + late final _CFMessagePortIsValid = + _CFMessagePortIsValidPtr.asFunction(); + + CFMessagePortInvalidationCallBack CFMessagePortGetInvalidationCallBack( + CFMessagePortRef ms, + ) { + return _CFMessagePortGetInvalidationCallBack( + ms, + ); + } + + late final _CFMessagePortGetInvalidationCallBackPtr = _lookup< + ffi.NativeFunction< + CFMessagePortInvalidationCallBack Function( + CFMessagePortRef)>>('CFMessagePortGetInvalidationCallBack'); + late final _CFMessagePortGetInvalidationCallBack = + _CFMessagePortGetInvalidationCallBackPtr.asFunction< + CFMessagePortInvalidationCallBack Function(CFMessagePortRef)>(); + + void CFMessagePortSetInvalidationCallBack( + CFMessagePortRef ms, + CFMessagePortInvalidationCallBack callout, + ) { + return _CFMessagePortSetInvalidationCallBack( + ms, + callout, + ); + } + + late final _CFMessagePortSetInvalidationCallBackPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMessagePortRef, CFMessagePortInvalidationCallBack)>>( + 'CFMessagePortSetInvalidationCallBack'); + late final _CFMessagePortSetInvalidationCallBack = + _CFMessagePortSetInvalidationCallBackPtr.asFunction< + void Function(CFMessagePortRef, CFMessagePortInvalidationCallBack)>(); + + int CFMessagePortSendRequest( + CFMessagePortRef remote, + int msgid, + CFDataRef data, + double sendTimeout, + double rcvTimeout, + CFStringRef replyMode, + ffi.Pointer returnData, + ) { + return _CFMessagePortSendRequest( + remote, + msgid, + data, + sendTimeout, + rcvTimeout, + replyMode, + returnData, + ); + } + + late final _CFMessagePortSendRequestPtr = _lookup< + ffi.NativeFunction< + SInt32 Function( + CFMessagePortRef, + SInt32, + CFDataRef, + CFTimeInterval, + CFTimeInterval, + CFStringRef, + ffi.Pointer)>>('CFMessagePortSendRequest'); + late final _CFMessagePortSendRequest = + _CFMessagePortSendRequestPtr.asFunction< + int Function(CFMessagePortRef, int, CFDataRef, double, double, + CFStringRef, ffi.Pointer)>(); + + CFRunLoopSourceRef CFMessagePortCreateRunLoopSource( + CFAllocatorRef allocator, + CFMessagePortRef local, + int order, + ) { + return _CFMessagePortCreateRunLoopSource( + allocator, + local, + order, + ); + } + + late final _CFMessagePortCreateRunLoopSourcePtr = _lookup< + ffi.NativeFunction< + CFRunLoopSourceRef Function(CFAllocatorRef, CFMessagePortRef, + CFIndex)>>('CFMessagePortCreateRunLoopSource'); + late final _CFMessagePortCreateRunLoopSource = + _CFMessagePortCreateRunLoopSourcePtr.asFunction< + CFRunLoopSourceRef Function(CFAllocatorRef, CFMessagePortRef, int)>(); + + void CFMessagePortSetDispatchQueue( + CFMessagePortRef ms, + Dartdispatch_queue_t queue, + ) { + return _CFMessagePortSetDispatchQueue( + ms, + queue.ref.pointer, + ); + } + + late final _CFMessagePortSetDispatchQueuePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMessagePortRef, + dispatch_queue_t)>>('CFMessagePortSetDispatchQueue'); + late final _CFMessagePortSetDispatchQueue = _CFMessagePortSetDispatchQueuePtr + .asFunction(); + + late final ffi.Pointer _kCFPlugInDynamicRegistrationKey = + _lookup('kCFPlugInDynamicRegistrationKey'); + + CFStringRef get kCFPlugInDynamicRegistrationKey => + _kCFPlugInDynamicRegistrationKey.value; + + late final ffi.Pointer _kCFPlugInDynamicRegisterFunctionKey = + _lookup('kCFPlugInDynamicRegisterFunctionKey'); + + CFStringRef get kCFPlugInDynamicRegisterFunctionKey => + _kCFPlugInDynamicRegisterFunctionKey.value; + + late final ffi.Pointer _kCFPlugInUnloadFunctionKey = + _lookup('kCFPlugInUnloadFunctionKey'); + + CFStringRef get kCFPlugInUnloadFunctionKey => + _kCFPlugInUnloadFunctionKey.value; + + late final ffi.Pointer _kCFPlugInFactoriesKey = + _lookup('kCFPlugInFactoriesKey'); + + CFStringRef get kCFPlugInFactoriesKey => _kCFPlugInFactoriesKey.value; + + late final ffi.Pointer _kCFPlugInTypesKey = + _lookup('kCFPlugInTypesKey'); + + CFStringRef get kCFPlugInTypesKey => _kCFPlugInTypesKey.value; + + int CFPlugInGetTypeID() { + return _CFPlugInGetTypeID(); + } + + late final _CFPlugInGetTypeIDPtr = + _lookup>('CFPlugInGetTypeID'); + late final _CFPlugInGetTypeID = + _CFPlugInGetTypeIDPtr.asFunction(); + + CFPlugInRef CFPlugInCreate( + CFAllocatorRef allocator, + CFURLRef plugInURL, + ) { + return _CFPlugInCreate( + allocator, + plugInURL, + ); + } + + late final _CFPlugInCreatePtr = _lookup< + ffi.NativeFunction>( + 'CFPlugInCreate'); + late final _CFPlugInCreate = _CFPlugInCreatePtr.asFunction< + CFPlugInRef Function(CFAllocatorRef, CFURLRef)>(); + + CFBundleRef CFPlugInGetBundle( + CFPlugInRef plugIn, + ) { + return _CFPlugInGetBundle( + plugIn, + ); + } + + late final _CFPlugInGetBundlePtr = + _lookup>( + 'CFPlugInGetBundle'); + late final _CFPlugInGetBundle = + _CFPlugInGetBundlePtr.asFunction(); + + void CFPlugInSetLoadOnDemand( + CFPlugInRef plugIn, + int flag, + ) { + return _CFPlugInSetLoadOnDemand( + plugIn, + flag, + ); + } + + late final _CFPlugInSetLoadOnDemandPtr = + _lookup>( + 'CFPlugInSetLoadOnDemand'); + late final _CFPlugInSetLoadOnDemand = + _CFPlugInSetLoadOnDemandPtr.asFunction(); + + int CFPlugInIsLoadOnDemand( + CFPlugInRef plugIn, + ) { + return _CFPlugInIsLoadOnDemand( + plugIn, + ); + } + + late final _CFPlugInIsLoadOnDemandPtr = + _lookup>( + 'CFPlugInIsLoadOnDemand'); + late final _CFPlugInIsLoadOnDemand = + _CFPlugInIsLoadOnDemandPtr.asFunction(); + + CFArrayRef CFPlugInFindFactoriesForPlugInType( + CFUUIDRef typeUUID, + ) { + return _CFPlugInFindFactoriesForPlugInType( + typeUUID, + ); + } + + late final _CFPlugInFindFactoriesForPlugInTypePtr = + _lookup>( + 'CFPlugInFindFactoriesForPlugInType'); + late final _CFPlugInFindFactoriesForPlugInType = + _CFPlugInFindFactoriesForPlugInTypePtr.asFunction< + CFArrayRef Function(CFUUIDRef)>(); + + CFArrayRef CFPlugInFindFactoriesForPlugInTypeInPlugIn( + CFUUIDRef typeUUID, + CFPlugInRef plugIn, + ) { + return _CFPlugInFindFactoriesForPlugInTypeInPlugIn( + typeUUID, + plugIn, + ); + } + + late final _CFPlugInFindFactoriesForPlugInTypeInPlugInPtr = + _lookup>( + 'CFPlugInFindFactoriesForPlugInTypeInPlugIn'); + late final _CFPlugInFindFactoriesForPlugInTypeInPlugIn = + _CFPlugInFindFactoriesForPlugInTypeInPlugInPtr.asFunction< + CFArrayRef Function(CFUUIDRef, CFPlugInRef)>(); + + ffi.Pointer CFPlugInInstanceCreate( + CFAllocatorRef allocator, + CFUUIDRef factoryUUID, + CFUUIDRef typeUUID, + ) { + return _CFPlugInInstanceCreate( + allocator, + factoryUUID, + typeUUID, + ); + } + + late final _CFPlugInInstanceCreatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CFAllocatorRef, CFUUIDRef, CFUUIDRef)>>('CFPlugInInstanceCreate'); + late final _CFPlugInInstanceCreate = _CFPlugInInstanceCreatePtr.asFunction< + ffi.Pointer Function(CFAllocatorRef, CFUUIDRef, CFUUIDRef)>(); + + int CFPlugInRegisterFactoryFunction( + CFUUIDRef factoryUUID, + CFPlugInFactoryFunction func, + ) { + return _CFPlugInRegisterFactoryFunction( + factoryUUID, + func, + ); + } + + late final _CFPlugInRegisterFactoryFunctionPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFUUIDRef, + CFPlugInFactoryFunction)>>('CFPlugInRegisterFactoryFunction'); + late final _CFPlugInRegisterFactoryFunction = + _CFPlugInRegisterFactoryFunctionPtr.asFunction< + int Function(CFUUIDRef, CFPlugInFactoryFunction)>(); + + int CFPlugInRegisterFactoryFunctionByName( + CFUUIDRef factoryUUID, + CFPlugInRef plugIn, + CFStringRef functionName, + ) { + return _CFPlugInRegisterFactoryFunctionByName( + factoryUUID, + plugIn, + functionName, + ); + } + + late final _CFPlugInRegisterFactoryFunctionByNamePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFUUIDRef, CFPlugInRef, + CFStringRef)>>('CFPlugInRegisterFactoryFunctionByName'); + late final _CFPlugInRegisterFactoryFunctionByName = + _CFPlugInRegisterFactoryFunctionByNamePtr.asFunction< + int Function(CFUUIDRef, CFPlugInRef, CFStringRef)>(); + + int CFPlugInUnregisterFactory( + CFUUIDRef factoryUUID, + ) { + return _CFPlugInUnregisterFactory( + factoryUUID, + ); + } + + late final _CFPlugInUnregisterFactoryPtr = + _lookup>( + 'CFPlugInUnregisterFactory'); + late final _CFPlugInUnregisterFactory = + _CFPlugInUnregisterFactoryPtr.asFunction(); + + int CFPlugInRegisterPlugInType( + CFUUIDRef factoryUUID, + CFUUIDRef typeUUID, + ) { + return _CFPlugInRegisterPlugInType( + factoryUUID, + typeUUID, + ); + } + + late final _CFPlugInRegisterPlugInTypePtr = + _lookup>( + 'CFPlugInRegisterPlugInType'); + late final _CFPlugInRegisterPlugInType = _CFPlugInRegisterPlugInTypePtr + .asFunction(); + + int CFPlugInUnregisterPlugInType( + CFUUIDRef factoryUUID, + CFUUIDRef typeUUID, + ) { + return _CFPlugInUnregisterPlugInType( + factoryUUID, + typeUUID, + ); + } + + late final _CFPlugInUnregisterPlugInTypePtr = + _lookup>( + 'CFPlugInUnregisterPlugInType'); + late final _CFPlugInUnregisterPlugInType = _CFPlugInUnregisterPlugInTypePtr + .asFunction(); + + void CFPlugInAddInstanceForFactory( + CFUUIDRef factoryID, + ) { + return _CFPlugInAddInstanceForFactory( + factoryID, + ); + } + + late final _CFPlugInAddInstanceForFactoryPtr = + _lookup>( + 'CFPlugInAddInstanceForFactory'); + late final _CFPlugInAddInstanceForFactory = + _CFPlugInAddInstanceForFactoryPtr.asFunction(); + + void CFPlugInRemoveInstanceForFactory( + CFUUIDRef factoryID, + ) { + return _CFPlugInRemoveInstanceForFactory( + factoryID, + ); + } + + late final _CFPlugInRemoveInstanceForFactoryPtr = + _lookup>( + 'CFPlugInRemoveInstanceForFactory'); + late final _CFPlugInRemoveInstanceForFactory = + _CFPlugInRemoveInstanceForFactoryPtr.asFunction< + void Function(CFUUIDRef)>(); + + int CFPlugInInstanceGetInterfaceFunctionTable( + CFPlugInInstanceRef instance, + CFStringRef interfaceName, + ffi.Pointer> ftbl, + ) { + return _CFPlugInInstanceGetInterfaceFunctionTable( + instance, + interfaceName, + ftbl, + ); + } + + late final _CFPlugInInstanceGetInterfaceFunctionTablePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFPlugInInstanceRef, CFStringRef, + ffi.Pointer>)>>( + 'CFPlugInInstanceGetInterfaceFunctionTable'); + late final _CFPlugInInstanceGetInterfaceFunctionTable = + _CFPlugInInstanceGetInterfaceFunctionTablePtr.asFunction< + int Function(CFPlugInInstanceRef, CFStringRef, + ffi.Pointer>)>(); + + CFStringRef CFPlugInInstanceGetFactoryName( + CFPlugInInstanceRef instance, + ) { + return _CFPlugInInstanceGetFactoryName( + instance, + ); + } + + late final _CFPlugInInstanceGetFactoryNamePtr = + _lookup>( + 'CFPlugInInstanceGetFactoryName'); + late final _CFPlugInInstanceGetFactoryName = + _CFPlugInInstanceGetFactoryNamePtr.asFunction< + CFStringRef Function(CFPlugInInstanceRef)>(); + + ffi.Pointer CFPlugInInstanceGetInstanceData( + CFPlugInInstanceRef instance, + ) { + return _CFPlugInInstanceGetInstanceData( + instance, + ); + } + + late final _CFPlugInInstanceGetInstanceDataPtr = _lookup< + ffi + .NativeFunction Function(CFPlugInInstanceRef)>>( + 'CFPlugInInstanceGetInstanceData'); + late final _CFPlugInInstanceGetInstanceData = + _CFPlugInInstanceGetInstanceDataPtr.asFunction< + ffi.Pointer Function(CFPlugInInstanceRef)>(); + + int CFPlugInInstanceGetTypeID() { + return _CFPlugInInstanceGetTypeID(); + } + + late final _CFPlugInInstanceGetTypeIDPtr = + _lookup>( + 'CFPlugInInstanceGetTypeID'); + late final _CFPlugInInstanceGetTypeID = + _CFPlugInInstanceGetTypeIDPtr.asFunction(); + + CFPlugInInstanceRef CFPlugInInstanceCreateWithInstanceDataSize( + CFAllocatorRef allocator, + int instanceDataSize, + CFPlugInInstanceDeallocateInstanceDataFunction deallocateInstanceFunction, + CFStringRef factoryName, + CFPlugInInstanceGetInterfaceFunction getInterfaceFunction, + ) { + return _CFPlugInInstanceCreateWithInstanceDataSize( + allocator, + instanceDataSize, + deallocateInstanceFunction, + factoryName, + getInterfaceFunction, + ); + } + + late final _CFPlugInInstanceCreateWithInstanceDataSizePtr = _lookup< + ffi.NativeFunction< + CFPlugInInstanceRef Function( + CFAllocatorRef, + CFIndex, + CFPlugInInstanceDeallocateInstanceDataFunction, + CFStringRef, + CFPlugInInstanceGetInterfaceFunction)>>( + 'CFPlugInInstanceCreateWithInstanceDataSize'); + late final _CFPlugInInstanceCreateWithInstanceDataSize = + _CFPlugInInstanceCreateWithInstanceDataSizePtr.asFunction< + CFPlugInInstanceRef Function( + CFAllocatorRef, + int, + CFPlugInInstanceDeallocateInstanceDataFunction, + CFStringRef, + CFPlugInInstanceGetInterfaceFunction)>(); + + int CFMachPortGetTypeID() { + return _CFMachPortGetTypeID(); + } + + late final _CFMachPortGetTypeIDPtr = + _lookup>('CFMachPortGetTypeID'); + late final _CFMachPortGetTypeID = + _CFMachPortGetTypeIDPtr.asFunction(); + + CFMachPortRef CFMachPortCreate( + CFAllocatorRef allocator, + CFMachPortCallBack callout, + ffi.Pointer context, + ffi.Pointer shouldFreeInfo, + ) { + return _CFMachPortCreate( + allocator, + callout, + context, + shouldFreeInfo, + ); + } + + late final _CFMachPortCreatePtr = _lookup< + ffi.NativeFunction< + CFMachPortRef Function( + CFAllocatorRef, + CFMachPortCallBack, + ffi.Pointer, + ffi.Pointer)>>('CFMachPortCreate'); + late final _CFMachPortCreate = _CFMachPortCreatePtr.asFunction< + CFMachPortRef Function(CFAllocatorRef, CFMachPortCallBack, + ffi.Pointer, ffi.Pointer)>(); + + CFMachPortRef CFMachPortCreateWithPort( + CFAllocatorRef allocator, + int portNum, + CFMachPortCallBack callout, + ffi.Pointer context, + ffi.Pointer shouldFreeInfo, + ) { + return _CFMachPortCreateWithPort( + allocator, + portNum, + callout, + context, + shouldFreeInfo, + ); + } + + late final _CFMachPortCreateWithPortPtr = _lookup< + ffi.NativeFunction< + CFMachPortRef Function( + CFAllocatorRef, + mach_port_t, + CFMachPortCallBack, + ffi.Pointer, + ffi.Pointer)>>('CFMachPortCreateWithPort'); + late final _CFMachPortCreateWithPort = + _CFMachPortCreateWithPortPtr.asFunction< + CFMachPortRef Function(CFAllocatorRef, int, CFMachPortCallBack, + ffi.Pointer, ffi.Pointer)>(); + + int CFMachPortGetPort( + CFMachPortRef port, + ) { + return _CFMachPortGetPort( + port, + ); + } + + late final _CFMachPortGetPortPtr = + _lookup>( + 'CFMachPortGetPort'); + late final _CFMachPortGetPort = + _CFMachPortGetPortPtr.asFunction(); + + void CFMachPortGetContext( + CFMachPortRef port, + ffi.Pointer context, + ) { + return _CFMachPortGetContext( + port, + context, + ); + } + + late final _CFMachPortGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMachPortRef, + ffi.Pointer)>>('CFMachPortGetContext'); + late final _CFMachPortGetContext = _CFMachPortGetContextPtr.asFunction< + void Function(CFMachPortRef, ffi.Pointer)>(); + + void CFMachPortInvalidate( + CFMachPortRef port, + ) { + return _CFMachPortInvalidate( + port, + ); + } + + late final _CFMachPortInvalidatePtr = + _lookup>( + 'CFMachPortInvalidate'); + late final _CFMachPortInvalidate = + _CFMachPortInvalidatePtr.asFunction(); + + int CFMachPortIsValid( + CFMachPortRef port, + ) { + return _CFMachPortIsValid( + port, + ); + } + + late final _CFMachPortIsValidPtr = + _lookup>( + 'CFMachPortIsValid'); + late final _CFMachPortIsValid = + _CFMachPortIsValidPtr.asFunction(); + + CFMachPortInvalidationCallBack CFMachPortGetInvalidationCallBack( + CFMachPortRef port, + ) { + return _CFMachPortGetInvalidationCallBack( + port, + ); + } + + late final _CFMachPortGetInvalidationCallBackPtr = _lookup< + ffi.NativeFunction< + CFMachPortInvalidationCallBack Function( + CFMachPortRef)>>('CFMachPortGetInvalidationCallBack'); + late final _CFMachPortGetInvalidationCallBack = + _CFMachPortGetInvalidationCallBackPtr.asFunction< + CFMachPortInvalidationCallBack Function(CFMachPortRef)>(); + + void CFMachPortSetInvalidationCallBack( + CFMachPortRef port, + CFMachPortInvalidationCallBack callout, + ) { + return _CFMachPortSetInvalidationCallBack( + port, + callout, + ); + } + + late final _CFMachPortSetInvalidationCallBackPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFMachPortRef, CFMachPortInvalidationCallBack)>>( + 'CFMachPortSetInvalidationCallBack'); + late final _CFMachPortSetInvalidationCallBack = + _CFMachPortSetInvalidationCallBackPtr.asFunction< + void Function(CFMachPortRef, CFMachPortInvalidationCallBack)>(); + + CFRunLoopSourceRef CFMachPortCreateRunLoopSource( + CFAllocatorRef allocator, + CFMachPortRef port, + int order, + ) { + return _CFMachPortCreateRunLoopSource( + allocator, + port, + order, + ); + } + + late final _CFMachPortCreateRunLoopSourcePtr = _lookup< + ffi.NativeFunction< + CFRunLoopSourceRef Function(CFAllocatorRef, CFMachPortRef, + CFIndex)>>('CFMachPortCreateRunLoopSource'); + late final _CFMachPortCreateRunLoopSource = + _CFMachPortCreateRunLoopSourcePtr.asFunction< + CFRunLoopSourceRef Function(CFAllocatorRef, CFMachPortRef, int)>(); + + int CFAttributedStringGetTypeID() { + return _CFAttributedStringGetTypeID(); + } + + late final _CFAttributedStringGetTypeIDPtr = + _lookup>( + 'CFAttributedStringGetTypeID'); + late final _CFAttributedStringGetTypeID = + _CFAttributedStringGetTypeIDPtr.asFunction(); + + CFAttributedStringRef CFAttributedStringCreate( + CFAllocatorRef alloc, + CFStringRef str, + CFDictionaryRef attributes, + ) { + return _CFAttributedStringCreate( + alloc, + str, + attributes, + ); + } + + late final _CFAttributedStringCreatePtr = _lookup< + ffi.NativeFunction< + CFAttributedStringRef Function(CFAllocatorRef, CFStringRef, + CFDictionaryRef)>>('CFAttributedStringCreate'); + late final _CFAttributedStringCreate = + _CFAttributedStringCreatePtr.asFunction< + CFAttributedStringRef Function( + CFAllocatorRef, CFStringRef, CFDictionaryRef)>(); + + CFAttributedStringRef CFAttributedStringCreateWithSubstring( + CFAllocatorRef alloc, + CFAttributedStringRef aStr, + CFRange range, + ) { + return _CFAttributedStringCreateWithSubstring( + alloc, + aStr, + range, + ); + } + + late final _CFAttributedStringCreateWithSubstringPtr = _lookup< + ffi.NativeFunction< + CFAttributedStringRef Function(CFAllocatorRef, CFAttributedStringRef, + CFRange)>>('CFAttributedStringCreateWithSubstring'); + late final _CFAttributedStringCreateWithSubstring = + _CFAttributedStringCreateWithSubstringPtr.asFunction< + CFAttributedStringRef Function( + CFAllocatorRef, CFAttributedStringRef, CFRange)>(); + + CFAttributedStringRef CFAttributedStringCreateCopy( + CFAllocatorRef alloc, + CFAttributedStringRef aStr, + ) { + return _CFAttributedStringCreateCopy( + alloc, + aStr, + ); + } + + late final _CFAttributedStringCreateCopyPtr = _lookup< + ffi.NativeFunction< + CFAttributedStringRef Function(CFAllocatorRef, + CFAttributedStringRef)>>('CFAttributedStringCreateCopy'); + late final _CFAttributedStringCreateCopy = + _CFAttributedStringCreateCopyPtr.asFunction< + CFAttributedStringRef Function( + CFAllocatorRef, CFAttributedStringRef)>(); + + CFStringRef CFAttributedStringGetString( + CFAttributedStringRef aStr, + ) { + return _CFAttributedStringGetString( + aStr, + ); + } + + late final _CFAttributedStringGetStringPtr = + _lookup>( + 'CFAttributedStringGetString'); + late final _CFAttributedStringGetString = _CFAttributedStringGetStringPtr + .asFunction(); + + int CFAttributedStringGetLength( + CFAttributedStringRef aStr, + ) { + return _CFAttributedStringGetLength( + aStr, + ); + } + + late final _CFAttributedStringGetLengthPtr = + _lookup>( + 'CFAttributedStringGetLength'); + late final _CFAttributedStringGetLength = _CFAttributedStringGetLengthPtr + .asFunction(); + + CFDictionaryRef CFAttributedStringGetAttributes( + CFAttributedStringRef aStr, + int loc, + ffi.Pointer effectiveRange, + ) { + return _CFAttributedStringGetAttributes( + aStr, + loc, + effectiveRange, + ); + } + + late final _CFAttributedStringGetAttributesPtr = _lookup< + ffi.NativeFunction< + CFDictionaryRef Function(CFAttributedStringRef, CFIndex, + ffi.Pointer)>>('CFAttributedStringGetAttributes'); + late final _CFAttributedStringGetAttributes = + _CFAttributedStringGetAttributesPtr.asFunction< + CFDictionaryRef Function( + CFAttributedStringRef, int, ffi.Pointer)>(); + + CFTypeRef CFAttributedStringGetAttribute( + CFAttributedStringRef aStr, + int loc, + CFStringRef attrName, + ffi.Pointer effectiveRange, + ) { + return _CFAttributedStringGetAttribute( + aStr, + loc, + attrName, + effectiveRange, + ); + } + + late final _CFAttributedStringGetAttributePtr = _lookup< + ffi.NativeFunction< + CFTypeRef Function(CFAttributedStringRef, CFIndex, CFStringRef, + ffi.Pointer)>>('CFAttributedStringGetAttribute'); + late final _CFAttributedStringGetAttribute = + _CFAttributedStringGetAttributePtr.asFunction< + CFTypeRef Function( + CFAttributedStringRef, int, CFStringRef, ffi.Pointer)>(); + + CFDictionaryRef CFAttributedStringGetAttributesAndLongestEffectiveRange( + CFAttributedStringRef aStr, + int loc, + CFRange inRange, + ffi.Pointer longestEffectiveRange, + ) { + return _CFAttributedStringGetAttributesAndLongestEffectiveRange( + aStr, + loc, + inRange, + longestEffectiveRange, + ); + } + + late final _CFAttributedStringGetAttributesAndLongestEffectiveRangePtr = + _lookup< + ffi.NativeFunction< + CFDictionaryRef Function(CFAttributedStringRef, CFIndex, + CFRange, ffi.Pointer)>>( + 'CFAttributedStringGetAttributesAndLongestEffectiveRange'); + late final _CFAttributedStringGetAttributesAndLongestEffectiveRange = + _CFAttributedStringGetAttributesAndLongestEffectiveRangePtr.asFunction< + CFDictionaryRef Function( + CFAttributedStringRef, int, CFRange, ffi.Pointer)>(); + + CFTypeRef CFAttributedStringGetAttributeAndLongestEffectiveRange( + CFAttributedStringRef aStr, + int loc, + CFStringRef attrName, + CFRange inRange, + ffi.Pointer longestEffectiveRange, + ) { + return _CFAttributedStringGetAttributeAndLongestEffectiveRange( + aStr, + loc, + attrName, + inRange, + longestEffectiveRange, + ); + } + + late final _CFAttributedStringGetAttributeAndLongestEffectiveRangePtr = + _lookup< + ffi.NativeFunction< + CFTypeRef Function(CFAttributedStringRef, CFIndex, + CFStringRef, CFRange, ffi.Pointer)>>( + 'CFAttributedStringGetAttributeAndLongestEffectiveRange'); + late final _CFAttributedStringGetAttributeAndLongestEffectiveRange = + _CFAttributedStringGetAttributeAndLongestEffectiveRangePtr.asFunction< + CFTypeRef Function(CFAttributedStringRef, int, CFStringRef, CFRange, + ffi.Pointer)>(); + + CFMutableAttributedStringRef CFAttributedStringCreateMutableCopy( + CFAllocatorRef alloc, + int maxLength, + CFAttributedStringRef aStr, + ) { + return _CFAttributedStringCreateMutableCopy( + alloc, + maxLength, + aStr, + ); + } + + late final _CFAttributedStringCreateMutableCopyPtr = _lookup< + ffi.NativeFunction< + CFMutableAttributedStringRef Function(CFAllocatorRef, CFIndex, + CFAttributedStringRef)>>('CFAttributedStringCreateMutableCopy'); + late final _CFAttributedStringCreateMutableCopy = + _CFAttributedStringCreateMutableCopyPtr.asFunction< + CFMutableAttributedStringRef Function( + CFAllocatorRef, int, CFAttributedStringRef)>(); + + CFMutableAttributedStringRef CFAttributedStringCreateMutable( + CFAllocatorRef alloc, + int maxLength, + ) { + return _CFAttributedStringCreateMutable( + alloc, + maxLength, + ); + } + + late final _CFAttributedStringCreateMutablePtr = _lookup< + ffi.NativeFunction< + CFMutableAttributedStringRef Function( + CFAllocatorRef, CFIndex)>>('CFAttributedStringCreateMutable'); + late final _CFAttributedStringCreateMutable = + _CFAttributedStringCreateMutablePtr.asFunction< + CFMutableAttributedStringRef Function(CFAllocatorRef, int)>(); + + void CFAttributedStringReplaceString( + CFMutableAttributedStringRef aStr, + CFRange range, + CFStringRef replacement, + ) { + return _CFAttributedStringReplaceString( + aStr, + range, + replacement, + ); + } + + late final _CFAttributedStringReplaceStringPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableAttributedStringRef, CFRange, + CFStringRef)>>('CFAttributedStringReplaceString'); + late final _CFAttributedStringReplaceString = + _CFAttributedStringReplaceStringPtr.asFunction< + void Function(CFMutableAttributedStringRef, CFRange, CFStringRef)>(); + + CFMutableStringRef CFAttributedStringGetMutableString( + CFMutableAttributedStringRef aStr, + ) { + return _CFAttributedStringGetMutableString( + aStr, + ); + } + + late final _CFAttributedStringGetMutableStringPtr = _lookup< + ffi.NativeFunction< + CFMutableStringRef Function(CFMutableAttributedStringRef)>>( + 'CFAttributedStringGetMutableString'); + late final _CFAttributedStringGetMutableString = + _CFAttributedStringGetMutableStringPtr.asFunction< + CFMutableStringRef Function(CFMutableAttributedStringRef)>(); + + void CFAttributedStringSetAttributes( + CFMutableAttributedStringRef aStr, + CFRange range, + CFDictionaryRef replacement, + int clearOtherAttributes, + ) { + return _CFAttributedStringSetAttributes( + aStr, + range, + replacement, + clearOtherAttributes, + ); + } + + late final _CFAttributedStringSetAttributesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableAttributedStringRef, CFRange, + CFDictionaryRef, Boolean)>>('CFAttributedStringSetAttributes'); + late final _CFAttributedStringSetAttributes = + _CFAttributedStringSetAttributesPtr.asFunction< + void Function( + CFMutableAttributedStringRef, CFRange, CFDictionaryRef, int)>(); + + void CFAttributedStringSetAttribute( + CFMutableAttributedStringRef aStr, + CFRange range, + CFStringRef attrName, + CFTypeRef value, + ) { + return _CFAttributedStringSetAttribute( + aStr, + range, + attrName, + value, + ); + } + + late final _CFAttributedStringSetAttributePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableAttributedStringRef, CFRange, CFStringRef, + CFTypeRef)>>('CFAttributedStringSetAttribute'); + late final _CFAttributedStringSetAttribute = + _CFAttributedStringSetAttributePtr.asFunction< + void Function( + CFMutableAttributedStringRef, CFRange, CFStringRef, CFTypeRef)>(); + + void CFAttributedStringRemoveAttribute( + CFMutableAttributedStringRef aStr, + CFRange range, + CFStringRef attrName, + ) { + return _CFAttributedStringRemoveAttribute( + aStr, + range, + attrName, + ); + } + + late final _CFAttributedStringRemoveAttributePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableAttributedStringRef, CFRange, + CFStringRef)>>('CFAttributedStringRemoveAttribute'); + late final _CFAttributedStringRemoveAttribute = + _CFAttributedStringRemoveAttributePtr.asFunction< + void Function(CFMutableAttributedStringRef, CFRange, CFStringRef)>(); + + void CFAttributedStringReplaceAttributedString( + CFMutableAttributedStringRef aStr, + CFRange range, + CFAttributedStringRef replacement, + ) { + return _CFAttributedStringReplaceAttributedString( + aStr, + range, + replacement, + ); + } + + late final _CFAttributedStringReplaceAttributedStringPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFMutableAttributedStringRef, CFRange, + CFAttributedStringRef)>>( + 'CFAttributedStringReplaceAttributedString'); + late final _CFAttributedStringReplaceAttributedString = + _CFAttributedStringReplaceAttributedStringPtr.asFunction< + void Function( + CFMutableAttributedStringRef, CFRange, CFAttributedStringRef)>(); + + void CFAttributedStringBeginEditing( + CFMutableAttributedStringRef aStr, + ) { + return _CFAttributedStringBeginEditing( + aStr, + ); + } + + late final _CFAttributedStringBeginEditingPtr = _lookup< + ffi.NativeFunction>( + 'CFAttributedStringBeginEditing'); + late final _CFAttributedStringBeginEditing = + _CFAttributedStringBeginEditingPtr.asFunction< + void Function(CFMutableAttributedStringRef)>(); + + void CFAttributedStringEndEditing( + CFMutableAttributedStringRef aStr, + ) { + return _CFAttributedStringEndEditing( + aStr, + ); + } + + late final _CFAttributedStringEndEditingPtr = _lookup< + ffi.NativeFunction>( + 'CFAttributedStringEndEditing'); + late final _CFAttributedStringEndEditing = _CFAttributedStringEndEditingPtr + .asFunction(); + + int CFURLEnumeratorGetTypeID() { + return _CFURLEnumeratorGetTypeID(); + } + + late final _CFURLEnumeratorGetTypeIDPtr = + _lookup>( + 'CFURLEnumeratorGetTypeID'); + late final _CFURLEnumeratorGetTypeID = + _CFURLEnumeratorGetTypeIDPtr.asFunction(); + + CFURLEnumeratorRef CFURLEnumeratorCreateForDirectoryURL( + CFAllocatorRef alloc, + CFURLRef directoryURL, + CFURLEnumeratorOptions option, + CFArrayRef propertyKeys, + ) { + return _CFURLEnumeratorCreateForDirectoryURL( + alloc, + directoryURL, + option.value, + propertyKeys, + ); + } + + late final _CFURLEnumeratorCreateForDirectoryURLPtr = _lookup< + ffi.NativeFunction< + CFURLEnumeratorRef Function(CFAllocatorRef, CFURLRef, CFOptionFlags, + CFArrayRef)>>('CFURLEnumeratorCreateForDirectoryURL'); + late final _CFURLEnumeratorCreateForDirectoryURL = + _CFURLEnumeratorCreateForDirectoryURLPtr.asFunction< + CFURLEnumeratorRef Function( + CFAllocatorRef, CFURLRef, int, CFArrayRef)>(); + + CFURLEnumeratorRef CFURLEnumeratorCreateForMountedVolumes( + CFAllocatorRef alloc, + CFURLEnumeratorOptions option, + CFArrayRef propertyKeys, + ) { + return _CFURLEnumeratorCreateForMountedVolumes( + alloc, + option.value, + propertyKeys, + ); + } + + late final _CFURLEnumeratorCreateForMountedVolumesPtr = _lookup< + ffi.NativeFunction< + CFURLEnumeratorRef Function(CFAllocatorRef, CFOptionFlags, + CFArrayRef)>>('CFURLEnumeratorCreateForMountedVolumes'); + late final _CFURLEnumeratorCreateForMountedVolumes = + _CFURLEnumeratorCreateForMountedVolumesPtr.asFunction< + CFURLEnumeratorRef Function(CFAllocatorRef, int, CFArrayRef)>(); + + CFURLEnumeratorResult CFURLEnumeratorGetNextURL( + CFURLEnumeratorRef enumerator, + ffi.Pointer url, + ffi.Pointer error, + ) { + return CFURLEnumeratorResult.fromValue(_CFURLEnumeratorGetNextURL( + enumerator, + url, + error, + )); + } + + late final _CFURLEnumeratorGetNextURLPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFURLEnumeratorRef, ffi.Pointer, + ffi.Pointer)>>('CFURLEnumeratorGetNextURL'); + late final _CFURLEnumeratorGetNextURL = + _CFURLEnumeratorGetNextURLPtr.asFunction< + int Function(CFURLEnumeratorRef, ffi.Pointer, + ffi.Pointer)>(); + + void CFURLEnumeratorSkipDescendents( + CFURLEnumeratorRef enumerator, + ) { + return _CFURLEnumeratorSkipDescendents( + enumerator, + ); + } + + late final _CFURLEnumeratorSkipDescendentsPtr = + _lookup>( + 'CFURLEnumeratorSkipDescendents'); + late final _CFURLEnumeratorSkipDescendents = + _CFURLEnumeratorSkipDescendentsPtr.asFunction< + void Function(CFURLEnumeratorRef)>(); + + int CFURLEnumeratorGetDescendentLevel( + CFURLEnumeratorRef enumerator, + ) { + return _CFURLEnumeratorGetDescendentLevel( + enumerator, + ); + } + + late final _CFURLEnumeratorGetDescendentLevelPtr = + _lookup>( + 'CFURLEnumeratorGetDescendentLevel'); + late final _CFURLEnumeratorGetDescendentLevel = + _CFURLEnumeratorGetDescendentLevelPtr.asFunction< + int Function(CFURLEnumeratorRef)>(); + + int CFURLEnumeratorGetSourceDidChange( + CFURLEnumeratorRef enumerator, + ) { + return _CFURLEnumeratorGetSourceDidChange( + enumerator, + ); + } + + late final _CFURLEnumeratorGetSourceDidChangePtr = + _lookup>( + 'CFURLEnumeratorGetSourceDidChange'); + late final _CFURLEnumeratorGetSourceDidChange = + _CFURLEnumeratorGetSourceDidChangePtr.asFunction< + int Function(CFURLEnumeratorRef)>(); + + acl_t acl_dup( + acl_t acl, + ) { + return _acl_dup( + acl, + ); + } + + late final _acl_dupPtr = + _lookup>('acl_dup'); + late final _acl_dup = _acl_dupPtr.asFunction(); + + int acl_free( + ffi.Pointer obj_p, + ) { + return _acl_free( + obj_p, + ); + } + + late final _acl_freePtr = + _lookup)>>( + 'acl_free'); + late final _acl_free = + _acl_freePtr.asFunction)>(); + + acl_t acl_init( + int count, + ) { + return _acl_init( + count, + ); + } + + late final _acl_initPtr = + _lookup>('acl_init'); + late final _acl_init = _acl_initPtr.asFunction(); + + int acl_copy_entry( + acl_entry_t dest_d, + acl_entry_t src_d, + ) { + return _acl_copy_entry( + dest_d, + src_d, + ); + } + + late final _acl_copy_entryPtr = + _lookup>( + 'acl_copy_entry'); + late final _acl_copy_entry = + _acl_copy_entryPtr.asFunction(); + + int acl_create_entry( + ffi.Pointer acl_p, + ffi.Pointer entry_p, + ) { + return _acl_create_entry( + acl_p, + entry_p, + ); + } + + late final _acl_create_entryPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>('acl_create_entry'); + late final _acl_create_entry = _acl_create_entryPtr + .asFunction, ffi.Pointer)>(); + + int acl_create_entry_np( + ffi.Pointer acl_p, + ffi.Pointer entry_p, + int entry_index, + ) { + return _acl_create_entry_np( + acl_p, + entry_p, + entry_index, + ); + } + + late final _acl_create_entry_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Int)>>('acl_create_entry_np'); + late final _acl_create_entry_np = _acl_create_entry_npPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int acl_delete_entry( + acl_t acl, + acl_entry_t entry_d, + ) { + return _acl_delete_entry( + acl, + entry_d, + ); + } + + late final _acl_delete_entryPtr = + _lookup>( + 'acl_delete_entry'); + late final _acl_delete_entry = + _acl_delete_entryPtr.asFunction(); + + int acl_get_entry( + acl_t acl, + int entry_id, + ffi.Pointer entry_p, + ) { + return _acl_get_entry( + acl, + entry_id, + entry_p, + ); + } + + late final _acl_get_entryPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + acl_t, ffi.Int, ffi.Pointer)>>('acl_get_entry'); + late final _acl_get_entry = _acl_get_entryPtr + .asFunction)>(); + + int acl_valid( + acl_t acl, + ) { + return _acl_valid( + acl, + ); + } + + late final _acl_validPtr = + _lookup>('acl_valid'); + late final _acl_valid = _acl_validPtr.asFunction(); + + int acl_valid_fd_np( + int fd, + acl_type_t type, + acl_t acl, + ) { + return _acl_valid_fd_np( + fd, + type.value, + acl, + ); + } + + late final _acl_valid_fd_npPtr = _lookup< + ffi + .NativeFunction>( + 'acl_valid_fd_np'); + late final _acl_valid_fd_np = + _acl_valid_fd_npPtr.asFunction(); + + int acl_valid_file_np( + ffi.Pointer path, + acl_type_t type, + acl_t acl, + ) { + return _acl_valid_file_np( + path, + type.value, + acl, + ); + } + + late final _acl_valid_file_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.UnsignedInt, + acl_t)>>('acl_valid_file_np'); + late final _acl_valid_file_np = _acl_valid_file_npPtr + .asFunction, int, acl_t)>(); + + int acl_valid_link_np( + ffi.Pointer path, + acl_type_t type, + acl_t acl, + ) { + return _acl_valid_link_np( + path, + type.value, + acl, + ); + } + + late final _acl_valid_link_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.UnsignedInt, + acl_t)>>('acl_valid_link_np'); + late final _acl_valid_link_np = _acl_valid_link_npPtr + .asFunction, int, acl_t)>(); + + int acl_add_perm( + acl_permset_t permset_d, + acl_perm_t perm, + ) { + return _acl_add_perm( + permset_d, + perm.value, + ); + } + + late final _acl_add_permPtr = _lookup< + ffi.NativeFunction>( + 'acl_add_perm'); + late final _acl_add_perm = + _acl_add_permPtr.asFunction(); + + int acl_calc_mask( + ffi.Pointer acl_p, + ) { + return _acl_calc_mask( + acl_p, + ); + } + + late final _acl_calc_maskPtr = + _lookup)>>( + 'acl_calc_mask'); + late final _acl_calc_mask = + _acl_calc_maskPtr.asFunction)>(); + + int acl_clear_perms( + acl_permset_t permset_d, + ) { + return _acl_clear_perms( + permset_d, + ); + } + + late final _acl_clear_permsPtr = + _lookup>( + 'acl_clear_perms'); + late final _acl_clear_perms = + _acl_clear_permsPtr.asFunction(); + + int acl_delete_perm( + acl_permset_t permset_d, + acl_perm_t perm, + ) { + return _acl_delete_perm( + permset_d, + perm.value, + ); + } + + late final _acl_delete_permPtr = _lookup< + ffi.NativeFunction>( + 'acl_delete_perm'); + late final _acl_delete_perm = + _acl_delete_permPtr.asFunction(); + + int acl_get_perm_np( + acl_permset_t permset_d, + acl_perm_t perm, + ) { + return _acl_get_perm_np( + permset_d, + perm.value, + ); + } + + late final _acl_get_perm_npPtr = _lookup< + ffi.NativeFunction>( + 'acl_get_perm_np'); + late final _acl_get_perm_np = + _acl_get_perm_npPtr.asFunction(); + + int acl_get_permset( + acl_entry_t entry_d, + ffi.Pointer permset_p, + ) { + return _acl_get_permset( + entry_d, + permset_p, + ); + } + + late final _acl_get_permsetPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + acl_entry_t, ffi.Pointer)>>('acl_get_permset'); + late final _acl_get_permset = _acl_get_permsetPtr + .asFunction)>(); + + int acl_set_permset( + acl_entry_t entry_d, + acl_permset_t permset_d, + ) { + return _acl_set_permset( + entry_d, + permset_d, + ); + } + + late final _acl_set_permsetPtr = + _lookup>( + 'acl_set_permset'); + late final _acl_set_permset = _acl_set_permsetPtr + .asFunction(); + + int acl_maximal_permset_mask_np( + ffi.Pointer mask_p, + ) { + return _acl_maximal_permset_mask_np( + mask_p, + ); + } + + late final _acl_maximal_permset_mask_npPtr = _lookup< + ffi + .NativeFunction)>>( + 'acl_maximal_permset_mask_np'); + late final _acl_maximal_permset_mask_np = _acl_maximal_permset_mask_npPtr + .asFunction)>(); + + int acl_get_permset_mask_np( + acl_entry_t entry_d, + ffi.Pointer mask_p, + ) { + return _acl_get_permset_mask_np( + entry_d, + mask_p, + ); + } + + late final _acl_get_permset_mask_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(acl_entry_t, + ffi.Pointer)>>('acl_get_permset_mask_np'); + late final _acl_get_permset_mask_np = _acl_get_permset_mask_npPtr + .asFunction)>(); + + int acl_set_permset_mask_np( + acl_entry_t entry_d, + int mask, + ) { + return _acl_set_permset_mask_np( + entry_d, + mask, + ); + } + + late final _acl_set_permset_mask_npPtr = _lookup< + ffi + .NativeFunction>( + 'acl_set_permset_mask_np'); + late final _acl_set_permset_mask_np = + _acl_set_permset_mask_npPtr.asFunction(); + + int acl_add_flag_np( + acl_flagset_t flagset_d, + acl_flag_t flag, + ) { + return _acl_add_flag_np( + flagset_d, + flag.value, + ); + } + + late final _acl_add_flag_npPtr = _lookup< + ffi.NativeFunction>( + 'acl_add_flag_np'); + late final _acl_add_flag_np = + _acl_add_flag_npPtr.asFunction(); + + int acl_clear_flags_np( + acl_flagset_t flagset_d, + ) { + return _acl_clear_flags_np( + flagset_d, + ); + } + + late final _acl_clear_flags_npPtr = + _lookup>( + 'acl_clear_flags_np'); + late final _acl_clear_flags_np = + _acl_clear_flags_npPtr.asFunction(); + + int acl_delete_flag_np( + acl_flagset_t flagset_d, + acl_flag_t flag, + ) { + return _acl_delete_flag_np( + flagset_d, + flag.value, + ); + } + + late final _acl_delete_flag_npPtr = _lookup< + ffi.NativeFunction>( + 'acl_delete_flag_np'); + late final _acl_delete_flag_np = + _acl_delete_flag_npPtr.asFunction(); + + int acl_get_flag_np( + acl_flagset_t flagset_d, + acl_flag_t flag, + ) { + return _acl_get_flag_np( + flagset_d, + flag.value, + ); + } + + late final _acl_get_flag_npPtr = _lookup< + ffi.NativeFunction>( + 'acl_get_flag_np'); + late final _acl_get_flag_np = + _acl_get_flag_npPtr.asFunction(); + + int acl_get_flagset_np( + ffi.Pointer obj_p, + ffi.Pointer flagset_p, + ) { + return _acl_get_flagset_np( + obj_p, + flagset_p, + ); + } + + late final _acl_get_flagset_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>('acl_get_flagset_np'); + late final _acl_get_flagset_np = _acl_get_flagset_npPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer)>(); + + int acl_set_flagset_np( + ffi.Pointer obj_p, + acl_flagset_t flagset_d, + ) { + return _acl_set_flagset_np( + obj_p, + flagset_d, + ); + } + + late final _acl_set_flagset_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, acl_flagset_t)>>('acl_set_flagset_np'); + late final _acl_set_flagset_np = _acl_set_flagset_npPtr + .asFunction, acl_flagset_t)>(); + + ffi.Pointer acl_get_qualifier( + acl_entry_t entry_d, + ) { + return _acl_get_qualifier( + entry_d, + ); + } + + late final _acl_get_qualifierPtr = + _lookup Function(acl_entry_t)>>( + 'acl_get_qualifier'); + late final _acl_get_qualifier = _acl_get_qualifierPtr + .asFunction Function(acl_entry_t)>(); + + int acl_get_tag_type( + acl_entry_t entry_d, + ffi.Pointer tag_type_p, + ) { + return _acl_get_tag_type( + entry_d, + tag_type_p, + ); + } + + late final _acl_get_tag_typePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + acl_entry_t, ffi.Pointer)>>('acl_get_tag_type'); + late final _acl_get_tag_type = _acl_get_tag_typePtr + .asFunction)>(); + + int acl_set_qualifier( + acl_entry_t entry_d, + ffi.Pointer tag_qualifier_p, + ) { + return _acl_set_qualifier( + entry_d, + tag_qualifier_p, + ); + } + + late final _acl_set_qualifierPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + acl_entry_t, ffi.Pointer)>>('acl_set_qualifier'); + late final _acl_set_qualifier = _acl_set_qualifierPtr + .asFunction)>(); + + int acl_set_tag_type( + acl_entry_t entry_d, + acl_tag_t tag_type, + ) { + return _acl_set_tag_type( + entry_d, + tag_type.value, + ); + } + + late final _acl_set_tag_typePtr = _lookup< + ffi.NativeFunction>( + 'acl_set_tag_type'); + late final _acl_set_tag_type = + _acl_set_tag_typePtr.asFunction(); + + int acl_delete_def_file( + ffi.Pointer path_p, + ) { + return _acl_delete_def_file( + path_p, + ); + } + + late final _acl_delete_def_filePtr = + _lookup)>>( + 'acl_delete_def_file'); + late final _acl_delete_def_file = + _acl_delete_def_filePtr.asFunction)>(); + + acl_t acl_get_fd( + int fd, + ) { + return _acl_get_fd( + fd, + ); + } + + late final _acl_get_fdPtr = + _lookup>('acl_get_fd'); + late final _acl_get_fd = _acl_get_fdPtr.asFunction(); + + acl_t acl_get_fd_np( + int fd, + acl_type_t type, + ) { + return _acl_get_fd_np( + fd, + type.value, + ); + } + + late final _acl_get_fd_npPtr = + _lookup>( + 'acl_get_fd_np'); + late final _acl_get_fd_np = + _acl_get_fd_npPtr.asFunction(); + + acl_t acl_get_file( + ffi.Pointer path_p, + acl_type_t type, + ) { + return _acl_get_file( + path_p, + type.value, + ); + } + + late final _acl_get_filePtr = _lookup< + ffi.NativeFunction< + acl_t Function( + ffi.Pointer, ffi.UnsignedInt)>>('acl_get_file'); + late final _acl_get_file = + _acl_get_filePtr.asFunction, int)>(); + + acl_t acl_get_link_np( + ffi.Pointer path_p, + acl_type_t type, + ) { + return _acl_get_link_np( + path_p, + type.value, + ); + } + + late final _acl_get_link_npPtr = _lookup< + ffi.NativeFunction< + acl_t Function( + ffi.Pointer, ffi.UnsignedInt)>>('acl_get_link_np'); + late final _acl_get_link_np = _acl_get_link_npPtr + .asFunction, int)>(); + + int acl_set_fd( + int fd, + acl_t acl, + ) { + return _acl_set_fd( + fd, + acl, + ); + } + + late final _acl_set_fdPtr = + _lookup>( + 'acl_set_fd'); + late final _acl_set_fd = + _acl_set_fdPtr.asFunction(); + + int acl_set_fd_np( + int fd, + acl_t acl, + acl_type_t acl_type, + ) { + return _acl_set_fd_np( + fd, + acl, + acl_type.value, + ); + } + + late final _acl_set_fd_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, acl_t, ffi.UnsignedInt)>>('acl_set_fd_np'); + late final _acl_set_fd_np = + _acl_set_fd_npPtr.asFunction(); + + int acl_set_file( + ffi.Pointer path_p, + acl_type_t type, + acl_t acl, + ) { + return _acl_set_file( + path_p, + type.value, + acl, + ); + } + + late final _acl_set_filePtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.UnsignedInt, acl_t)>>('acl_set_file'); + late final _acl_set_file = _acl_set_filePtr + .asFunction, int, acl_t)>(); + + int acl_set_link_np( + ffi.Pointer path_p, + acl_type_t type, + acl_t acl, + ) { + return _acl_set_link_np( + path_p, + type.value, + acl, + ); + } + + late final _acl_set_link_npPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.UnsignedInt, + acl_t)>>('acl_set_link_np'); + late final _acl_set_link_np = _acl_set_link_npPtr + .asFunction, int, acl_t)>(); + + int acl_copy_ext( + ffi.Pointer buf_p, + acl_t acl, + int size, + ) { + return _acl_copy_ext( + buf_p, + acl, + size, + ); + } + + late final _acl_copy_extPtr = _lookup< + ffi.NativeFunction< + ssize_t Function( + ffi.Pointer, acl_t, ssize_t)>>('acl_copy_ext'); + late final _acl_copy_ext = _acl_copy_extPtr + .asFunction, acl_t, int)>(); + + int acl_copy_ext_native( + ffi.Pointer buf_p, + acl_t acl, + int size, + ) { + return _acl_copy_ext_native( + buf_p, + acl, + size, + ); + } + + late final _acl_copy_ext_nativePtr = _lookup< + ffi.NativeFunction< + ssize_t Function( + ffi.Pointer, acl_t, ssize_t)>>('acl_copy_ext_native'); + late final _acl_copy_ext_native = _acl_copy_ext_nativePtr + .asFunction, acl_t, int)>(); + + acl_t acl_copy_int( + ffi.Pointer buf_p, + ) { + return _acl_copy_int( + buf_p, + ); + } + + late final _acl_copy_intPtr = + _lookup)>>( + 'acl_copy_int'); + late final _acl_copy_int = + _acl_copy_intPtr.asFunction)>(); + + acl_t acl_copy_int_native( + ffi.Pointer buf_p, + ) { + return _acl_copy_int_native( + buf_p, + ); + } + + late final _acl_copy_int_nativePtr = + _lookup)>>( + 'acl_copy_int_native'); + late final _acl_copy_int_native = _acl_copy_int_nativePtr + .asFunction)>(); + + acl_t acl_from_text( + ffi.Pointer buf_p, + ) { + return _acl_from_text( + buf_p, + ); + } + + late final _acl_from_textPtr = + _lookup)>>( + 'acl_from_text'); + late final _acl_from_text = + _acl_from_textPtr.asFunction)>(); + + int acl_size( + acl_t acl, + ) { + return _acl_size( + acl, + ); + } + + late final _acl_sizePtr = + _lookup>('acl_size'); + late final _acl_size = _acl_sizePtr.asFunction(); + + ffi.Pointer acl_to_text( + acl_t acl, + ffi.Pointer len_p, + ) { + return _acl_to_text( + acl, + len_p, + ); + } + + late final _acl_to_textPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + acl_t, ffi.Pointer)>>('acl_to_text'); + late final _acl_to_text = _acl_to_textPtr.asFunction< + ffi.Pointer Function(acl_t, ffi.Pointer)>(); + + int CFFileSecurityGetTypeID() { + return _CFFileSecurityGetTypeID(); + } + + late final _CFFileSecurityGetTypeIDPtr = + _lookup>( + 'CFFileSecurityGetTypeID'); + late final _CFFileSecurityGetTypeID = + _CFFileSecurityGetTypeIDPtr.asFunction(); + + CFFileSecurityRef CFFileSecurityCreate( + CFAllocatorRef allocator, + ) { + return _CFFileSecurityCreate( + allocator, + ); + } + + late final _CFFileSecurityCreatePtr = + _lookup>( + 'CFFileSecurityCreate'); + late final _CFFileSecurityCreate = _CFFileSecurityCreatePtr.asFunction< + CFFileSecurityRef Function(CFAllocatorRef)>(); + + CFFileSecurityRef CFFileSecurityCreateCopy( + CFAllocatorRef allocator, + CFFileSecurityRef fileSec, + ) { + return _CFFileSecurityCreateCopy( + allocator, + fileSec, + ); + } + + late final _CFFileSecurityCreateCopyPtr = _lookup< + ffi.NativeFunction< + CFFileSecurityRef Function( + CFAllocatorRef, CFFileSecurityRef)>>('CFFileSecurityCreateCopy'); + late final _CFFileSecurityCreateCopy = + _CFFileSecurityCreateCopyPtr.asFunction< + CFFileSecurityRef Function(CFAllocatorRef, CFFileSecurityRef)>(); + + int CFFileSecurityCopyOwnerUUID( + CFFileSecurityRef fileSec, + ffi.Pointer ownerUUID, + ) { + return _CFFileSecurityCopyOwnerUUID( + fileSec, + ownerUUID, + ); + } + + late final _CFFileSecurityCopyOwnerUUIDPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFFileSecurityRef, + ffi.Pointer)>>('CFFileSecurityCopyOwnerUUID'); + late final _CFFileSecurityCopyOwnerUUID = _CFFileSecurityCopyOwnerUUIDPtr + .asFunction)>(); + + int CFFileSecuritySetOwnerUUID( + CFFileSecurityRef fileSec, + CFUUIDRef ownerUUID, + ) { + return _CFFileSecuritySetOwnerUUID( + fileSec, + ownerUUID, + ); + } + + late final _CFFileSecuritySetOwnerUUIDPtr = _lookup< + ffi.NativeFunction>( + 'CFFileSecuritySetOwnerUUID'); + late final _CFFileSecuritySetOwnerUUID = _CFFileSecuritySetOwnerUUIDPtr + .asFunction(); + + int CFFileSecurityCopyGroupUUID( + CFFileSecurityRef fileSec, + ffi.Pointer groupUUID, + ) { + return _CFFileSecurityCopyGroupUUID( + fileSec, + groupUUID, + ); + } + + late final _CFFileSecurityCopyGroupUUIDPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFFileSecurityRef, + ffi.Pointer)>>('CFFileSecurityCopyGroupUUID'); + late final _CFFileSecurityCopyGroupUUID = _CFFileSecurityCopyGroupUUIDPtr + .asFunction)>(); + + int CFFileSecuritySetGroupUUID( + CFFileSecurityRef fileSec, + CFUUIDRef groupUUID, + ) { + return _CFFileSecuritySetGroupUUID( + fileSec, + groupUUID, + ); + } + + late final _CFFileSecuritySetGroupUUIDPtr = _lookup< + ffi.NativeFunction>( + 'CFFileSecuritySetGroupUUID'); + late final _CFFileSecuritySetGroupUUID = _CFFileSecuritySetGroupUUIDPtr + .asFunction(); + + int CFFileSecurityCopyAccessControlList( + CFFileSecurityRef fileSec, + ffi.Pointer accessControlList, + ) { + return _CFFileSecurityCopyAccessControlList( + fileSec, + accessControlList, + ); + } + + late final _CFFileSecurityCopyAccessControlListPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFFileSecurityRef, + ffi.Pointer)>>('CFFileSecurityCopyAccessControlList'); + late final _CFFileSecurityCopyAccessControlList = + _CFFileSecurityCopyAccessControlListPtr.asFunction< + int Function(CFFileSecurityRef, ffi.Pointer)>(); + + int CFFileSecuritySetAccessControlList( + CFFileSecurityRef fileSec, + acl_t accessControlList, + ) { + return _CFFileSecuritySetAccessControlList( + fileSec, + accessControlList, + ); + } + + late final _CFFileSecuritySetAccessControlListPtr = + _lookup>( + 'CFFileSecuritySetAccessControlList'); + late final _CFFileSecuritySetAccessControlList = + _CFFileSecuritySetAccessControlListPtr.asFunction< + int Function(CFFileSecurityRef, acl_t)>(); + + int CFFileSecurityGetOwner( + CFFileSecurityRef fileSec, + ffi.Pointer owner, + ) { + return _CFFileSecurityGetOwner( + fileSec, + owner, + ); + } + + late final _CFFileSecurityGetOwnerPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFFileSecurityRef, + ffi.Pointer)>>('CFFileSecurityGetOwner'); + late final _CFFileSecurityGetOwner = _CFFileSecurityGetOwnerPtr.asFunction< + int Function(CFFileSecurityRef, ffi.Pointer)>(); + + int CFFileSecuritySetOwner( + CFFileSecurityRef fileSec, + int owner, + ) { + return _CFFileSecuritySetOwner( + fileSec, + owner, + ); + } + + late final _CFFileSecuritySetOwnerPtr = + _lookup>( + 'CFFileSecuritySetOwner'); + late final _CFFileSecuritySetOwner = _CFFileSecuritySetOwnerPtr.asFunction< + int Function(CFFileSecurityRef, int)>(); + + int CFFileSecurityGetGroup( + CFFileSecurityRef fileSec, + ffi.Pointer group, + ) { + return _CFFileSecurityGetGroup( + fileSec, + group, + ); + } + + late final _CFFileSecurityGetGroupPtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFFileSecurityRef, + ffi.Pointer)>>('CFFileSecurityGetGroup'); + late final _CFFileSecurityGetGroup = _CFFileSecurityGetGroupPtr.asFunction< + int Function(CFFileSecurityRef, ffi.Pointer)>(); + + int CFFileSecuritySetGroup( + CFFileSecurityRef fileSec, + int group, + ) { + return _CFFileSecuritySetGroup( + fileSec, + group, + ); + } + + late final _CFFileSecuritySetGroupPtr = + _lookup>( + 'CFFileSecuritySetGroup'); + late final _CFFileSecuritySetGroup = _CFFileSecuritySetGroupPtr.asFunction< + int Function(CFFileSecurityRef, int)>(); + + int CFFileSecurityGetMode( + CFFileSecurityRef fileSec, + ffi.Pointer mode, + ) { + return _CFFileSecurityGetMode( + fileSec, + mode, + ); + } + + late final _CFFileSecurityGetModePtr = _lookup< + ffi.NativeFunction< + Boolean Function(CFFileSecurityRef, + ffi.Pointer)>>('CFFileSecurityGetMode'); + late final _CFFileSecurityGetMode = _CFFileSecurityGetModePtr.asFunction< + int Function(CFFileSecurityRef, ffi.Pointer)>(); + + int CFFileSecuritySetMode( + CFFileSecurityRef fileSec, + int mode, + ) { + return _CFFileSecuritySetMode( + fileSec, + mode, + ); + } + + late final _CFFileSecuritySetModePtr = + _lookup>( + 'CFFileSecuritySetMode'); + late final _CFFileSecuritySetMode = _CFFileSecuritySetModePtr.asFunction< + int Function(CFFileSecurityRef, int)>(); + + DartBoolean CFFileSecurityClearProperties( + CFFileSecurityRef fileSec, + CFFileSecurityClearOptions clearPropertyMask, + ) { + return _CFFileSecurityClearProperties( + fileSec, + clearPropertyMask.value, + ); + } + + late final _CFFileSecurityClearPropertiesPtr = _lookup< + ffi + .NativeFunction>( + 'CFFileSecurityClearProperties'); + late final _CFFileSecurityClearProperties = _CFFileSecurityClearPropertiesPtr + .asFunction(); + + CFStringRef CFStringTokenizerCopyBestStringLanguage( + CFStringRef string, + CFRange range, + ) { + return _CFStringTokenizerCopyBestStringLanguage( + string, + range, + ); + } + + late final _CFStringTokenizerCopyBestStringLanguagePtr = + _lookup>( + 'CFStringTokenizerCopyBestStringLanguage'); + late final _CFStringTokenizerCopyBestStringLanguage = + _CFStringTokenizerCopyBestStringLanguagePtr.asFunction< + CFStringRef Function(CFStringRef, CFRange)>(); + + int CFStringTokenizerGetTypeID() { + return _CFStringTokenizerGetTypeID(); + } + + late final _CFStringTokenizerGetTypeIDPtr = + _lookup>( + 'CFStringTokenizerGetTypeID'); + late final _CFStringTokenizerGetTypeID = + _CFStringTokenizerGetTypeIDPtr.asFunction(); + + CFStringTokenizerRef CFStringTokenizerCreate( + CFAllocatorRef alloc, + CFStringRef string, + CFRange range, + int options, + CFLocaleRef locale, + ) { + return _CFStringTokenizerCreate( + alloc, + string, + range, + options, + locale, + ); + } + + late final _CFStringTokenizerCreatePtr = _lookup< + ffi.NativeFunction< + CFStringTokenizerRef Function(CFAllocatorRef, CFStringRef, CFRange, + CFOptionFlags, CFLocaleRef)>>('CFStringTokenizerCreate'); + late final _CFStringTokenizerCreate = _CFStringTokenizerCreatePtr.asFunction< + CFStringTokenizerRef Function( + CFAllocatorRef, CFStringRef, CFRange, int, CFLocaleRef)>(); + + void CFStringTokenizerSetString( + CFStringTokenizerRef tokenizer, + CFStringRef string, + CFRange range, + ) { + return _CFStringTokenizerSetString( + tokenizer, + string, + range, + ); + } + + late final _CFStringTokenizerSetStringPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFStringTokenizerRef, CFStringRef, + CFRange)>>('CFStringTokenizerSetString'); + late final _CFStringTokenizerSetString = _CFStringTokenizerSetStringPtr + .asFunction(); + + CFStringTokenizerTokenType CFStringTokenizerGoToTokenAtIndex( + CFStringTokenizerRef tokenizer, + DartCFIndex index, + ) { + return CFStringTokenizerTokenType.fromValue( + _CFStringTokenizerGoToTokenAtIndex( + tokenizer, + index, + )); + } + + late final _CFStringTokenizerGoToTokenAtIndexPtr = _lookup< + ffi.NativeFunction< + CFOptionFlags Function(CFStringTokenizerRef, + CFIndex)>>('CFStringTokenizerGoToTokenAtIndex'); + late final _CFStringTokenizerGoToTokenAtIndex = + _CFStringTokenizerGoToTokenAtIndexPtr.asFunction< + int Function(CFStringTokenizerRef, int)>(); + + CFStringTokenizerTokenType CFStringTokenizerAdvanceToNextToken( + CFStringTokenizerRef tokenizer, + ) { + return CFStringTokenizerTokenType.fromValue( + _CFStringTokenizerAdvanceToNextToken( + tokenizer, + )); + } + + late final _CFStringTokenizerAdvanceToNextTokenPtr = + _lookup>( + 'CFStringTokenizerAdvanceToNextToken'); + late final _CFStringTokenizerAdvanceToNextToken = + _CFStringTokenizerAdvanceToNextTokenPtr.asFunction< + int Function(CFStringTokenizerRef)>(); + + CFRange CFStringTokenizerGetCurrentTokenRange( + CFStringTokenizerRef tokenizer, + ) { + return _CFStringTokenizerGetCurrentTokenRange( + tokenizer, + ); + } + + late final _CFStringTokenizerGetCurrentTokenRangePtr = + _lookup>( + 'CFStringTokenizerGetCurrentTokenRange'); + late final _CFStringTokenizerGetCurrentTokenRange = + _CFStringTokenizerGetCurrentTokenRangePtr.asFunction< + CFRange Function(CFStringTokenizerRef)>(); + + CFTypeRef CFStringTokenizerCopyCurrentTokenAttribute( + CFStringTokenizerRef tokenizer, + int attribute, + ) { + return _CFStringTokenizerCopyCurrentTokenAttribute( + tokenizer, + attribute, + ); + } + + late final _CFStringTokenizerCopyCurrentTokenAttributePtr = _lookup< + ffi.NativeFunction< + CFTypeRef Function(CFStringTokenizerRef, + CFOptionFlags)>>('CFStringTokenizerCopyCurrentTokenAttribute'); + late final _CFStringTokenizerCopyCurrentTokenAttribute = + _CFStringTokenizerCopyCurrentTokenAttributePtr.asFunction< + CFTypeRef Function(CFStringTokenizerRef, int)>(); + + int CFStringTokenizerGetCurrentSubTokens( + CFStringTokenizerRef tokenizer, + ffi.Pointer ranges, + int maxRangeLength, + CFMutableArrayRef derivedSubTokens, + ) { + return _CFStringTokenizerGetCurrentSubTokens( + tokenizer, + ranges, + maxRangeLength, + derivedSubTokens, + ); + } + + late final _CFStringTokenizerGetCurrentSubTokensPtr = _lookup< + ffi.NativeFunction< + CFIndex Function(CFStringTokenizerRef, ffi.Pointer, CFIndex, + CFMutableArrayRef)>>('CFStringTokenizerGetCurrentSubTokens'); + late final _CFStringTokenizerGetCurrentSubTokens = + _CFStringTokenizerGetCurrentSubTokensPtr.asFunction< + int Function(CFStringTokenizerRef, ffi.Pointer, int, + CFMutableArrayRef)>(); + + int CFFileDescriptorGetTypeID() { + return _CFFileDescriptorGetTypeID(); + } + + late final _CFFileDescriptorGetTypeIDPtr = + _lookup>( + 'CFFileDescriptorGetTypeID'); + late final _CFFileDescriptorGetTypeID = + _CFFileDescriptorGetTypeIDPtr.asFunction(); + + CFFileDescriptorRef CFFileDescriptorCreate( + CFAllocatorRef allocator, + int fd, + int closeOnInvalidate, + CFFileDescriptorCallBack callout, + ffi.Pointer context, + ) { + return _CFFileDescriptorCreate( + allocator, + fd, + closeOnInvalidate, + callout, + context, + ); + } + + late final _CFFileDescriptorCreatePtr = _lookup< + ffi.NativeFunction< + CFFileDescriptorRef Function( + CFAllocatorRef, + CFFileDescriptorNativeDescriptor, + Boolean, + CFFileDescriptorCallBack, + ffi.Pointer)>>('CFFileDescriptorCreate'); + late final _CFFileDescriptorCreate = _CFFileDescriptorCreatePtr.asFunction< + CFFileDescriptorRef Function(CFAllocatorRef, int, int, + CFFileDescriptorCallBack, ffi.Pointer)>(); + + int CFFileDescriptorGetNativeDescriptor( + CFFileDescriptorRef f, + ) { + return _CFFileDescriptorGetNativeDescriptor( + f, + ); + } + + late final _CFFileDescriptorGetNativeDescriptorPtr = _lookup< + ffi.NativeFunction< + CFFileDescriptorNativeDescriptor Function( + CFFileDescriptorRef)>>('CFFileDescriptorGetNativeDescriptor'); + late final _CFFileDescriptorGetNativeDescriptor = + _CFFileDescriptorGetNativeDescriptorPtr.asFunction< + int Function(CFFileDescriptorRef)>(); + + void CFFileDescriptorGetContext( + CFFileDescriptorRef f, + ffi.Pointer context, + ) { + return _CFFileDescriptorGetContext( + f, + context, + ); + } + + late final _CFFileDescriptorGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFFileDescriptorRef, ffi.Pointer)>>( + 'CFFileDescriptorGetContext'); + late final _CFFileDescriptorGetContext = + _CFFileDescriptorGetContextPtr.asFunction< + void Function( + CFFileDescriptorRef, ffi.Pointer)>(); + + void CFFileDescriptorEnableCallBacks( + CFFileDescriptorRef f, + int callBackTypes, + ) { + return _CFFileDescriptorEnableCallBacks( + f, + callBackTypes, + ); + } + + late final _CFFileDescriptorEnableCallBacksPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFFileDescriptorRef, + CFOptionFlags)>>('CFFileDescriptorEnableCallBacks'); + late final _CFFileDescriptorEnableCallBacks = + _CFFileDescriptorEnableCallBacksPtr.asFunction< + void Function(CFFileDescriptorRef, int)>(); + + void CFFileDescriptorDisableCallBacks( + CFFileDescriptorRef f, + int callBackTypes, + ) { + return _CFFileDescriptorDisableCallBacks( + f, + callBackTypes, + ); + } + + late final _CFFileDescriptorDisableCallBacksPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFFileDescriptorRef, + CFOptionFlags)>>('CFFileDescriptorDisableCallBacks'); + late final _CFFileDescriptorDisableCallBacks = + _CFFileDescriptorDisableCallBacksPtr.asFunction< + void Function(CFFileDescriptorRef, int)>(); + + void CFFileDescriptorInvalidate( + CFFileDescriptorRef f, + ) { + return _CFFileDescriptorInvalidate( + f, + ); + } + + late final _CFFileDescriptorInvalidatePtr = + _lookup>( + 'CFFileDescriptorInvalidate'); + late final _CFFileDescriptorInvalidate = _CFFileDescriptorInvalidatePtr + .asFunction(); + + int CFFileDescriptorIsValid( + CFFileDescriptorRef f, + ) { + return _CFFileDescriptorIsValid( + f, + ); + } + + late final _CFFileDescriptorIsValidPtr = + _lookup>( + 'CFFileDescriptorIsValid'); + late final _CFFileDescriptorIsValid = _CFFileDescriptorIsValidPtr.asFunction< + int Function(CFFileDescriptorRef)>(); + + CFRunLoopSourceRef CFFileDescriptorCreateRunLoopSource( + CFAllocatorRef allocator, + CFFileDescriptorRef f, + int order, + ) { + return _CFFileDescriptorCreateRunLoopSource( + allocator, + f, + order, + ); + } + + late final _CFFileDescriptorCreateRunLoopSourcePtr = _lookup< + ffi.NativeFunction< + CFRunLoopSourceRef Function(CFAllocatorRef, CFFileDescriptorRef, + CFIndex)>>('CFFileDescriptorCreateRunLoopSource'); + late final _CFFileDescriptorCreateRunLoopSource = + _CFFileDescriptorCreateRunLoopSourcePtr.asFunction< + CFRunLoopSourceRef Function( + CFAllocatorRef, CFFileDescriptorRef, int)>(); + + int CFUserNotificationGetTypeID() { + return _CFUserNotificationGetTypeID(); + } + + late final _CFUserNotificationGetTypeIDPtr = + _lookup>( + 'CFUserNotificationGetTypeID'); + late final _CFUserNotificationGetTypeID = + _CFUserNotificationGetTypeIDPtr.asFunction(); + + CFUserNotificationRef CFUserNotificationCreate( + CFAllocatorRef allocator, + double timeout, + int flags, + ffi.Pointer error, + CFDictionaryRef dictionary, + ) { + return _CFUserNotificationCreate( + allocator, + timeout, + flags, + error, + dictionary, + ); + } + + late final _CFUserNotificationCreatePtr = _lookup< + ffi.NativeFunction< + CFUserNotificationRef Function( + CFAllocatorRef, + CFTimeInterval, + CFOptionFlags, + ffi.Pointer, + CFDictionaryRef)>>('CFUserNotificationCreate'); + late final _CFUserNotificationCreate = + _CFUserNotificationCreatePtr.asFunction< + CFUserNotificationRef Function(CFAllocatorRef, double, int, + ffi.Pointer, CFDictionaryRef)>(); + + int CFUserNotificationReceiveResponse( + CFUserNotificationRef userNotification, + double timeout, + ffi.Pointer responseFlags, + ) { + return _CFUserNotificationReceiveResponse( + userNotification, + timeout, + responseFlags, + ); + } + + late final _CFUserNotificationReceiveResponsePtr = _lookup< + ffi.NativeFunction< + SInt32 Function(CFUserNotificationRef, CFTimeInterval, + ffi.Pointer)>>( + 'CFUserNotificationReceiveResponse'); + late final _CFUserNotificationReceiveResponse = + _CFUserNotificationReceiveResponsePtr.asFunction< + int Function( + CFUserNotificationRef, double, ffi.Pointer)>(); + + CFStringRef CFUserNotificationGetResponseValue( + CFUserNotificationRef userNotification, + CFStringRef key, + int idx, + ) { + return _CFUserNotificationGetResponseValue( + userNotification, + key, + idx, + ); + } + + late final _CFUserNotificationGetResponseValuePtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFUserNotificationRef, CFStringRef, + CFIndex)>>('CFUserNotificationGetResponseValue'); + late final _CFUserNotificationGetResponseValue = + _CFUserNotificationGetResponseValuePtr.asFunction< + CFStringRef Function(CFUserNotificationRef, CFStringRef, int)>(); + + CFDictionaryRef CFUserNotificationGetResponseDictionary( + CFUserNotificationRef userNotification, + ) { + return _CFUserNotificationGetResponseDictionary( + userNotification, + ); + } + + late final _CFUserNotificationGetResponseDictionaryPtr = _lookup< + ffi.NativeFunction>( + 'CFUserNotificationGetResponseDictionary'); + late final _CFUserNotificationGetResponseDictionary = + _CFUserNotificationGetResponseDictionaryPtr.asFunction< + CFDictionaryRef Function(CFUserNotificationRef)>(); + + int CFUserNotificationUpdate( + CFUserNotificationRef userNotification, + double timeout, + int flags, + CFDictionaryRef dictionary, + ) { + return _CFUserNotificationUpdate( + userNotification, + timeout, + flags, + dictionary, + ); + } + + late final _CFUserNotificationUpdatePtr = _lookup< + ffi.NativeFunction< + SInt32 Function(CFUserNotificationRef, CFTimeInterval, CFOptionFlags, + CFDictionaryRef)>>('CFUserNotificationUpdate'); + late final _CFUserNotificationUpdate = + _CFUserNotificationUpdatePtr.asFunction< + int Function(CFUserNotificationRef, double, int, CFDictionaryRef)>(); + + int CFUserNotificationCancel( + CFUserNotificationRef userNotification, + ) { + return _CFUserNotificationCancel( + userNotification, + ); + } + + late final _CFUserNotificationCancelPtr = + _lookup>( + 'CFUserNotificationCancel'); + late final _CFUserNotificationCancel = _CFUserNotificationCancelPtr + .asFunction(); + + CFRunLoopSourceRef CFUserNotificationCreateRunLoopSource( + CFAllocatorRef allocator, + CFUserNotificationRef userNotification, + CFUserNotificationCallBack callout, + int order, + ) { + return _CFUserNotificationCreateRunLoopSource( + allocator, + userNotification, + callout, + order, + ); + } + + late final _CFUserNotificationCreateRunLoopSourcePtr = _lookup< + ffi.NativeFunction< + CFRunLoopSourceRef Function( + CFAllocatorRef, + CFUserNotificationRef, + CFUserNotificationCallBack, + CFIndex)>>('CFUserNotificationCreateRunLoopSource'); + late final _CFUserNotificationCreateRunLoopSource = + _CFUserNotificationCreateRunLoopSourcePtr.asFunction< + CFRunLoopSourceRef Function(CFAllocatorRef, CFUserNotificationRef, + CFUserNotificationCallBack, int)>(); + + int CFUserNotificationDisplayNotice( + double timeout, + int flags, + CFURLRef iconURL, + CFURLRef soundURL, + CFURLRef localizationURL, + CFStringRef alertHeader, + CFStringRef alertMessage, + CFStringRef defaultButtonTitle, + ) { + return _CFUserNotificationDisplayNotice( + timeout, + flags, + iconURL, + soundURL, + localizationURL, + alertHeader, + alertMessage, + defaultButtonTitle, + ); + } + + late final _CFUserNotificationDisplayNoticePtr = _lookup< + ffi.NativeFunction< + SInt32 Function( + CFTimeInterval, + CFOptionFlags, + CFURLRef, + CFURLRef, + CFURLRef, + CFStringRef, + CFStringRef, + CFStringRef)>>('CFUserNotificationDisplayNotice'); + late final _CFUserNotificationDisplayNotice = + _CFUserNotificationDisplayNoticePtr.asFunction< + int Function(double, int, CFURLRef, CFURLRef, CFURLRef, CFStringRef, + CFStringRef, CFStringRef)>(); + + int CFUserNotificationDisplayAlert( + double timeout, + int flags, + CFURLRef iconURL, + CFURLRef soundURL, + CFURLRef localizationURL, + CFStringRef alertHeader, + CFStringRef alertMessage, + CFStringRef defaultButtonTitle, + CFStringRef alternateButtonTitle, + CFStringRef otherButtonTitle, + ffi.Pointer responseFlags, + ) { + return _CFUserNotificationDisplayAlert( + timeout, + flags, + iconURL, + soundURL, + localizationURL, + alertHeader, + alertMessage, + defaultButtonTitle, + alternateButtonTitle, + otherButtonTitle, + responseFlags, + ); + } + + late final _CFUserNotificationDisplayAlertPtr = _lookup< + ffi.NativeFunction< + SInt32 Function( + CFTimeInterval, + CFOptionFlags, + CFURLRef, + CFURLRef, + CFURLRef, + CFStringRef, + CFStringRef, + CFStringRef, + CFStringRef, + CFStringRef, + ffi.Pointer)>>('CFUserNotificationDisplayAlert'); + late final _CFUserNotificationDisplayAlert = + _CFUserNotificationDisplayAlertPtr.asFunction< + int Function( + double, + int, + CFURLRef, + CFURLRef, + CFURLRef, + CFStringRef, + CFStringRef, + CFStringRef, + CFStringRef, + CFStringRef, + ffi.Pointer)>(); + + late final ffi.Pointer _kCFUserNotificationIconURLKey = + _lookup('kCFUserNotificationIconURLKey'); + + CFStringRef get kCFUserNotificationIconURLKey => + _kCFUserNotificationIconURLKey.value; + + late final ffi.Pointer _kCFUserNotificationSoundURLKey = + _lookup('kCFUserNotificationSoundURLKey'); + + CFStringRef get kCFUserNotificationSoundURLKey => + _kCFUserNotificationSoundURLKey.value; + + late final ffi.Pointer _kCFUserNotificationLocalizationURLKey = + _lookup('kCFUserNotificationLocalizationURLKey'); + + CFStringRef get kCFUserNotificationLocalizationURLKey => + _kCFUserNotificationLocalizationURLKey.value; + + late final ffi.Pointer _kCFUserNotificationAlertHeaderKey = + _lookup('kCFUserNotificationAlertHeaderKey'); + + CFStringRef get kCFUserNotificationAlertHeaderKey => + _kCFUserNotificationAlertHeaderKey.value; + + late final ffi.Pointer _kCFUserNotificationAlertMessageKey = + _lookup('kCFUserNotificationAlertMessageKey'); + + CFStringRef get kCFUserNotificationAlertMessageKey => + _kCFUserNotificationAlertMessageKey.value; + + late final ffi.Pointer + _kCFUserNotificationDefaultButtonTitleKey = + _lookup('kCFUserNotificationDefaultButtonTitleKey'); + + CFStringRef get kCFUserNotificationDefaultButtonTitleKey => + _kCFUserNotificationDefaultButtonTitleKey.value; + + late final ffi.Pointer + _kCFUserNotificationAlternateButtonTitleKey = + _lookup('kCFUserNotificationAlternateButtonTitleKey'); + + CFStringRef get kCFUserNotificationAlternateButtonTitleKey => + _kCFUserNotificationAlternateButtonTitleKey.value; + + late final ffi.Pointer _kCFUserNotificationOtherButtonTitleKey = + _lookup('kCFUserNotificationOtherButtonTitleKey'); + + CFStringRef get kCFUserNotificationOtherButtonTitleKey => + _kCFUserNotificationOtherButtonTitleKey.value; + + late final ffi.Pointer + _kCFUserNotificationProgressIndicatorValueKey = + _lookup('kCFUserNotificationProgressIndicatorValueKey'); + + CFStringRef get kCFUserNotificationProgressIndicatorValueKey => + _kCFUserNotificationProgressIndicatorValueKey.value; + + late final ffi.Pointer _kCFUserNotificationPopUpTitlesKey = + _lookup('kCFUserNotificationPopUpTitlesKey'); + + CFStringRef get kCFUserNotificationPopUpTitlesKey => + _kCFUserNotificationPopUpTitlesKey.value; + + late final ffi.Pointer _kCFUserNotificationTextFieldTitlesKey = + _lookup('kCFUserNotificationTextFieldTitlesKey'); + + CFStringRef get kCFUserNotificationTextFieldTitlesKey => + _kCFUserNotificationTextFieldTitlesKey.value; + + late final ffi.Pointer _kCFUserNotificationCheckBoxTitlesKey = + _lookup('kCFUserNotificationCheckBoxTitlesKey'); + + CFStringRef get kCFUserNotificationCheckBoxTitlesKey => + _kCFUserNotificationCheckBoxTitlesKey.value; + + late final ffi.Pointer _kCFUserNotificationTextFieldValuesKey = + _lookup('kCFUserNotificationTextFieldValuesKey'); + + CFStringRef get kCFUserNotificationTextFieldValuesKey => + _kCFUserNotificationTextFieldValuesKey.value; + + late final ffi.Pointer _kCFUserNotificationPopUpSelectionKey = + _lookup('kCFUserNotificationPopUpSelectionKey'); + + CFStringRef get kCFUserNotificationPopUpSelectionKey => + _kCFUserNotificationPopUpSelectionKey.value; + + late final ffi.Pointer _kCFUserNotificationAlertTopMostKey = + _lookup('kCFUserNotificationAlertTopMostKey'); + + CFStringRef get kCFUserNotificationAlertTopMostKey => + _kCFUserNotificationAlertTopMostKey.value; + + late final ffi.Pointer _kCFUserNotificationKeyboardTypesKey = + _lookup('kCFUserNotificationKeyboardTypesKey'); + + CFStringRef get kCFUserNotificationKeyboardTypesKey => + _kCFUserNotificationKeyboardTypesKey.value; + + int CFXMLNodeGetTypeID() { + return _CFXMLNodeGetTypeID(); + } + + late final _CFXMLNodeGetTypeIDPtr = + _lookup>('CFXMLNodeGetTypeID'); + late final _CFXMLNodeGetTypeID = + _CFXMLNodeGetTypeIDPtr.asFunction(); + + CFXMLNodeRef CFXMLNodeCreate( + CFAllocatorRef alloc, + CFXMLNodeTypeCode xmlType, + CFStringRef dataString, + ffi.Pointer additionalInfoPtr, + DartCFIndex version, + ) { + return _CFXMLNodeCreate( + alloc, + xmlType.value, + dataString, + additionalInfoPtr, + version, + ); + } + + late final _CFXMLNodeCreatePtr = _lookup< + ffi.NativeFunction< + CFXMLNodeRef Function(CFAllocatorRef, CFIndex, CFStringRef, + ffi.Pointer, CFIndex)>>('CFXMLNodeCreate'); + late final _CFXMLNodeCreate = _CFXMLNodeCreatePtr.asFunction< + CFXMLNodeRef Function( + CFAllocatorRef, int, CFStringRef, ffi.Pointer, int)>(); + + CFXMLNodeRef CFXMLNodeCreateCopy( + CFAllocatorRef alloc, + CFXMLNodeRef origNode, + ) { + return _CFXMLNodeCreateCopy( + alloc, + origNode, + ); + } + + late final _CFXMLNodeCreateCopyPtr = _lookup< + ffi + .NativeFunction>( + 'CFXMLNodeCreateCopy'); + late final _CFXMLNodeCreateCopy = _CFXMLNodeCreateCopyPtr.asFunction< + CFXMLNodeRef Function(CFAllocatorRef, CFXMLNodeRef)>(); + + CFXMLNodeTypeCode CFXMLNodeGetTypeCode( + CFXMLNodeRef node, + ) { + return CFXMLNodeTypeCode.fromValue(_CFXMLNodeGetTypeCode( + node, + )); + } + + late final _CFXMLNodeGetTypeCodePtr = + _lookup>( + 'CFXMLNodeGetTypeCode'); + late final _CFXMLNodeGetTypeCode = + _CFXMLNodeGetTypeCodePtr.asFunction(); + + CFStringRef CFXMLNodeGetString( + CFXMLNodeRef node, + ) { + return _CFXMLNodeGetString( + node, + ); + } + + late final _CFXMLNodeGetStringPtr = + _lookup>( + 'CFXMLNodeGetString'); + late final _CFXMLNodeGetString = + _CFXMLNodeGetStringPtr.asFunction(); + + ffi.Pointer CFXMLNodeGetInfoPtr( + CFXMLNodeRef node, + ) { + return _CFXMLNodeGetInfoPtr( + node, + ); + } + + late final _CFXMLNodeGetInfoPtrPtr = + _lookup Function(CFXMLNodeRef)>>( + 'CFXMLNodeGetInfoPtr'); + late final _CFXMLNodeGetInfoPtr = _CFXMLNodeGetInfoPtrPtr.asFunction< + ffi.Pointer Function(CFXMLNodeRef)>(); + + int CFXMLNodeGetVersion( + CFXMLNodeRef node, + ) { + return _CFXMLNodeGetVersion( + node, + ); + } + + late final _CFXMLNodeGetVersionPtr = + _lookup>( + 'CFXMLNodeGetVersion'); + late final _CFXMLNodeGetVersion = + _CFXMLNodeGetVersionPtr.asFunction(); + + CFXMLTreeRef CFXMLTreeCreateWithNode( + CFAllocatorRef allocator, + CFXMLNodeRef node, + ) { + return _CFXMLTreeCreateWithNode( + allocator, + node, + ); + } + + late final _CFXMLTreeCreateWithNodePtr = _lookup< + ffi + .NativeFunction>( + 'CFXMLTreeCreateWithNode'); + late final _CFXMLTreeCreateWithNode = _CFXMLTreeCreateWithNodePtr.asFunction< + CFXMLTreeRef Function(CFAllocatorRef, CFXMLNodeRef)>(); + + CFXMLNodeRef CFXMLTreeGetNode( + CFXMLTreeRef xmlTree, + ) { + return _CFXMLTreeGetNode( + xmlTree, + ); + } + + late final _CFXMLTreeGetNodePtr = + _lookup>( + 'CFXMLTreeGetNode'); + late final _CFXMLTreeGetNode = + _CFXMLTreeGetNodePtr.asFunction(); + + int CFXMLParserGetTypeID() { + return _CFXMLParserGetTypeID(); + } + + late final _CFXMLParserGetTypeIDPtr = + _lookup>('CFXMLParserGetTypeID'); + late final _CFXMLParserGetTypeID = + _CFXMLParserGetTypeIDPtr.asFunction(); + + CFXMLParserRef CFXMLParserCreate( + CFAllocatorRef allocator, + CFDataRef xmlData, + CFURLRef dataSource, + int parseOptions, + int versionOfNodes, + ffi.Pointer callBacks, + ffi.Pointer context, + ) { + return _CFXMLParserCreate( + allocator, + xmlData, + dataSource, + parseOptions, + versionOfNodes, + callBacks, + context, + ); + } + + late final _CFXMLParserCreatePtr = _lookup< + ffi.NativeFunction< + CFXMLParserRef Function( + CFAllocatorRef, + CFDataRef, + CFURLRef, + CFOptionFlags, + CFIndex, + ffi.Pointer, + ffi.Pointer)>>('CFXMLParserCreate'); + late final _CFXMLParserCreate = _CFXMLParserCreatePtr.asFunction< + CFXMLParserRef Function( + CFAllocatorRef, + CFDataRef, + CFURLRef, + int, + int, + ffi.Pointer, + ffi.Pointer)>(); + + CFXMLParserRef CFXMLParserCreateWithDataFromURL( + CFAllocatorRef allocator, + CFURLRef dataSource, + int parseOptions, + int versionOfNodes, + ffi.Pointer callBacks, + ffi.Pointer context, + ) { + return _CFXMLParserCreateWithDataFromURL( + allocator, + dataSource, + parseOptions, + versionOfNodes, + callBacks, + context, + ); + } + + late final _CFXMLParserCreateWithDataFromURLPtr = _lookup< + ffi.NativeFunction< + CFXMLParserRef Function( + CFAllocatorRef, + CFURLRef, + CFOptionFlags, + CFIndex, + ffi.Pointer, + ffi.Pointer)>>( + 'CFXMLParserCreateWithDataFromURL'); + late final _CFXMLParserCreateWithDataFromURL = + _CFXMLParserCreateWithDataFromURLPtr.asFunction< + CFXMLParserRef Function( + CFAllocatorRef, + CFURLRef, + int, + int, + ffi.Pointer, + ffi.Pointer)>(); + + void CFXMLParserGetContext( + CFXMLParserRef parser, + ffi.Pointer context, + ) { + return _CFXMLParserGetContext( + parser, + context, + ); + } + + late final _CFXMLParserGetContextPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFXMLParserRef, + ffi.Pointer)>>('CFXMLParserGetContext'); + late final _CFXMLParserGetContext = _CFXMLParserGetContextPtr.asFunction< + void Function(CFXMLParserRef, ffi.Pointer)>(); + + void CFXMLParserGetCallBacks( + CFXMLParserRef parser, + ffi.Pointer callBacks, + ) { + return _CFXMLParserGetCallBacks( + parser, + callBacks, + ); + } + + late final _CFXMLParserGetCallBacksPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(CFXMLParserRef, + ffi.Pointer)>>('CFXMLParserGetCallBacks'); + late final _CFXMLParserGetCallBacks = _CFXMLParserGetCallBacksPtr.asFunction< + void Function(CFXMLParserRef, ffi.Pointer)>(); + + CFURLRef CFXMLParserGetSourceURL( + CFXMLParserRef parser, + ) { + return _CFXMLParserGetSourceURL( + parser, + ); + } + + late final _CFXMLParserGetSourceURLPtr = + _lookup>( + 'CFXMLParserGetSourceURL'); + late final _CFXMLParserGetSourceURL = _CFXMLParserGetSourceURLPtr.asFunction< + CFURLRef Function(CFXMLParserRef)>(); + + int CFXMLParserGetLocation( + CFXMLParserRef parser, + ) { + return _CFXMLParserGetLocation( + parser, + ); + } + + late final _CFXMLParserGetLocationPtr = + _lookup>( + 'CFXMLParserGetLocation'); + late final _CFXMLParserGetLocation = + _CFXMLParserGetLocationPtr.asFunction(); + + int CFXMLParserGetLineNumber( + CFXMLParserRef parser, + ) { + return _CFXMLParserGetLineNumber( + parser, + ); + } + + late final _CFXMLParserGetLineNumberPtr = + _lookup>( + 'CFXMLParserGetLineNumber'); + late final _CFXMLParserGetLineNumber = + _CFXMLParserGetLineNumberPtr.asFunction(); + + ffi.Pointer CFXMLParserGetDocument( + CFXMLParserRef parser, + ) { + return _CFXMLParserGetDocument( + parser, + ); + } + + late final _CFXMLParserGetDocumentPtr = _lookup< + ffi.NativeFunction Function(CFXMLParserRef)>>( + 'CFXMLParserGetDocument'); + late final _CFXMLParserGetDocument = _CFXMLParserGetDocumentPtr.asFunction< + ffi.Pointer Function(CFXMLParserRef)>(); + + CFXMLParserStatusCode CFXMLParserGetStatusCode( + CFXMLParserRef parser, + ) { + return CFXMLParserStatusCode.fromValue(_CFXMLParserGetStatusCode( + parser, + )); + } + + late final _CFXMLParserGetStatusCodePtr = + _lookup>( + 'CFXMLParserGetStatusCode'); + late final _CFXMLParserGetStatusCode = + _CFXMLParserGetStatusCodePtr.asFunction(); + + CFStringRef CFXMLParserCopyErrorDescription( + CFXMLParserRef parser, + ) { + return _CFXMLParserCopyErrorDescription( + parser, + ); + } + + late final _CFXMLParserCopyErrorDescriptionPtr = + _lookup>( + 'CFXMLParserCopyErrorDescription'); + late final _CFXMLParserCopyErrorDescription = + _CFXMLParserCopyErrorDescriptionPtr.asFunction< + CFStringRef Function(CFXMLParserRef)>(); + + void CFXMLParserAbort( + CFXMLParserRef parser, + CFXMLParserStatusCode errorCode, + CFStringRef errorDescription, + ) { + return _CFXMLParserAbort( + parser, + errorCode.value, + errorDescription, + ); + } + + late final _CFXMLParserAbortPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + CFXMLParserRef, CFIndex, CFStringRef)>>('CFXMLParserAbort'); + late final _CFXMLParserAbort = _CFXMLParserAbortPtr.asFunction< + void Function(CFXMLParserRef, int, CFStringRef)>(); + + int CFXMLParserParse( + CFXMLParserRef parser, + ) { + return _CFXMLParserParse( + parser, + ); + } + + late final _CFXMLParserParsePtr = + _lookup>( + 'CFXMLParserParse'); + late final _CFXMLParserParse = + _CFXMLParserParsePtr.asFunction(); + + CFXMLTreeRef CFXMLTreeCreateFromData( + CFAllocatorRef allocator, + CFDataRef xmlData, + CFURLRef dataSource, + int parseOptions, + int versionOfNodes, + ) { + return _CFXMLTreeCreateFromData( + allocator, + xmlData, + dataSource, + parseOptions, + versionOfNodes, + ); + } + + late final _CFXMLTreeCreateFromDataPtr = _lookup< + ffi.NativeFunction< + CFXMLTreeRef Function(CFAllocatorRef, CFDataRef, CFURLRef, + CFOptionFlags, CFIndex)>>('CFXMLTreeCreateFromData'); + late final _CFXMLTreeCreateFromData = _CFXMLTreeCreateFromDataPtr.asFunction< + CFXMLTreeRef Function(CFAllocatorRef, CFDataRef, CFURLRef, int, int)>(); + + CFXMLTreeRef CFXMLTreeCreateFromDataWithError( + CFAllocatorRef allocator, + CFDataRef xmlData, + CFURLRef dataSource, + int parseOptions, + int versionOfNodes, + ffi.Pointer errorDict, + ) { + return _CFXMLTreeCreateFromDataWithError( + allocator, + xmlData, + dataSource, + parseOptions, + versionOfNodes, + errorDict, + ); + } + + late final _CFXMLTreeCreateFromDataWithErrorPtr = _lookup< + ffi.NativeFunction< + CFXMLTreeRef Function(CFAllocatorRef, CFDataRef, CFURLRef, + CFOptionFlags, CFIndex, ffi.Pointer)>>( + 'CFXMLTreeCreateFromDataWithError'); + late final _CFXMLTreeCreateFromDataWithError = + _CFXMLTreeCreateFromDataWithErrorPtr.asFunction< + CFXMLTreeRef Function(CFAllocatorRef, CFDataRef, CFURLRef, int, int, + ffi.Pointer)>(); + + CFXMLTreeRef CFXMLTreeCreateWithDataFromURL( + CFAllocatorRef allocator, + CFURLRef dataSource, + int parseOptions, + int versionOfNodes, + ) { + return _CFXMLTreeCreateWithDataFromURL( + allocator, + dataSource, + parseOptions, + versionOfNodes, + ); + } + + late final _CFXMLTreeCreateWithDataFromURLPtr = _lookup< + ffi.NativeFunction< + CFXMLTreeRef Function(CFAllocatorRef, CFURLRef, CFOptionFlags, + CFIndex)>>('CFXMLTreeCreateWithDataFromURL'); + late final _CFXMLTreeCreateWithDataFromURL = + _CFXMLTreeCreateWithDataFromURLPtr.asFunction< + CFXMLTreeRef Function(CFAllocatorRef, CFURLRef, int, int)>(); + + CFDataRef CFXMLTreeCreateXMLData( + CFAllocatorRef allocator, + CFXMLTreeRef xmlTree, + ) { + return _CFXMLTreeCreateXMLData( + allocator, + xmlTree, + ); + } + + late final _CFXMLTreeCreateXMLDataPtr = _lookup< + ffi.NativeFunction>( + 'CFXMLTreeCreateXMLData'); + late final _CFXMLTreeCreateXMLData = _CFXMLTreeCreateXMLDataPtr.asFunction< + CFDataRef Function(CFAllocatorRef, CFXMLTreeRef)>(); + + CFStringRef CFXMLCreateStringByEscapingEntities( + CFAllocatorRef allocator, + CFStringRef string, + CFDictionaryRef entitiesDictionary, + ) { + return _CFXMLCreateStringByEscapingEntities( + allocator, + string, + entitiesDictionary, + ); + } + + late final _CFXMLCreateStringByEscapingEntitiesPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef, + CFDictionaryRef)>>('CFXMLCreateStringByEscapingEntities'); + late final _CFXMLCreateStringByEscapingEntities = + _CFXMLCreateStringByEscapingEntitiesPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef, CFDictionaryRef)>(); + + CFStringRef CFXMLCreateStringByUnescapingEntities( + CFAllocatorRef allocator, + CFStringRef string, + CFDictionaryRef entitiesDictionary, + ) { + return _CFXMLCreateStringByUnescapingEntities( + allocator, + string, + entitiesDictionary, + ); + } + + late final _CFXMLCreateStringByUnescapingEntitiesPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef, + CFDictionaryRef)>>('CFXMLCreateStringByUnescapingEntities'); + late final _CFXMLCreateStringByUnescapingEntities = + _CFXMLCreateStringByUnescapingEntitiesPtr.asFunction< + CFStringRef Function(CFAllocatorRef, CFStringRef, CFDictionaryRef)>(); + + late final ffi.Pointer _kCFXMLTreeErrorDescription = + _lookup('kCFXMLTreeErrorDescription'); + + CFStringRef get kCFXMLTreeErrorDescription => + _kCFXMLTreeErrorDescription.value; + + late final ffi.Pointer _kCFXMLTreeErrorLineNumber = + _lookup('kCFXMLTreeErrorLineNumber'); + + CFStringRef get kCFXMLTreeErrorLineNumber => _kCFXMLTreeErrorLineNumber.value; + + late final ffi.Pointer _kCFXMLTreeErrorLocation = + _lookup('kCFXMLTreeErrorLocation'); + + CFStringRef get kCFXMLTreeErrorLocation => _kCFXMLTreeErrorLocation.value; + + late final ffi.Pointer _kCFXMLTreeErrorStatusCode = + _lookup('kCFXMLTreeErrorStatusCode'); + + CFStringRef get kCFXMLTreeErrorStatusCode => _kCFXMLTreeErrorStatusCode.value; + + late final ffi.Pointer _gGuidCssm = + _lookup('gGuidCssm'); + + CSSM_GUID get gGuidCssm => _gGuidCssm.ref; + + late final ffi.Pointer _gGuidAppleFileDL = + _lookup('gGuidAppleFileDL'); + + CSSM_GUID get gGuidAppleFileDL => _gGuidAppleFileDL.ref; + + late final ffi.Pointer _gGuidAppleCSP = + _lookup('gGuidAppleCSP'); + + CSSM_GUID get gGuidAppleCSP => _gGuidAppleCSP.ref; + + late final ffi.Pointer _gGuidAppleCSPDL = + _lookup('gGuidAppleCSPDL'); + + CSSM_GUID get gGuidAppleCSPDL => _gGuidAppleCSPDL.ref; + + late final ffi.Pointer _gGuidAppleX509CL = + _lookup('gGuidAppleX509CL'); + + CSSM_GUID get gGuidAppleX509CL => _gGuidAppleX509CL.ref; + + late final ffi.Pointer _gGuidAppleX509TP = + _lookup('gGuidAppleX509TP'); + + CSSM_GUID get gGuidAppleX509TP => _gGuidAppleX509TP.ref; + + late final ffi.Pointer _gGuidAppleLDAPDL = + _lookup('gGuidAppleLDAPDL'); + + CSSM_GUID get gGuidAppleLDAPDL => _gGuidAppleLDAPDL.ref; + + late final ffi.Pointer _gGuidAppleDotMacTP = + _lookup('gGuidAppleDotMacTP'); + + CSSM_GUID get gGuidAppleDotMacTP => _gGuidAppleDotMacTP.ref; + + late final ffi.Pointer _gGuidAppleSdCSPDL = + _lookup('gGuidAppleSdCSPDL'); + + CSSM_GUID get gGuidAppleSdCSPDL => _gGuidAppleSdCSPDL.ref; + + late final ffi.Pointer _gGuidAppleDotMacDL = + _lookup('gGuidAppleDotMacDL'); + + CSSM_GUID get gGuidAppleDotMacDL => _gGuidAppleDotMacDL.ref; + + void cssmPerror( + ffi.Pointer how, + int error, + ) { + return _cssmPerror( + how, + error, + ); + } + + late final _cssmPerrorPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, CSSM_RETURN)>>('cssmPerror'); + late final _cssmPerror = + _cssmPerrorPtr.asFunction, int)>(); + + bool cssmOidToAlg( + ffi.Pointer oid, + ffi.Pointer alg, + ) { + return _cssmOidToAlg( + oid, + alg, + ); + } + + late final _cssmOidToAlgPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer)>>('cssmOidToAlg'); + late final _cssmOidToAlg = _cssmOidToAlgPtr.asFunction< + bool Function(ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer cssmAlgToOid( + int algId, + ) { + return _cssmAlgToOid( + algId, + ); + } + + late final _cssmAlgToOidPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(CSSM_ALGORITHMS)>>('cssmAlgToOid'); + late final _cssmAlgToOid = + _cssmAlgToOidPtr.asFunction Function(int)>(); + + late final ffi.Pointer _kSecPropertyTypeTitle = + _lookup('kSecPropertyTypeTitle'); + + CFStringRef get kSecPropertyTypeTitle => _kSecPropertyTypeTitle.value; + + set kSecPropertyTypeTitle(CFStringRef value) => + _kSecPropertyTypeTitle.value = value; + + late final ffi.Pointer _kSecPropertyTypeError = + _lookup('kSecPropertyTypeError'); + + CFStringRef get kSecPropertyTypeError => _kSecPropertyTypeError.value; + + set kSecPropertyTypeError(CFStringRef value) => + _kSecPropertyTypeError.value = value; + + late final ffi.Pointer _kSecTrustEvaluationDate = + _lookup('kSecTrustEvaluationDate'); + + CFStringRef get kSecTrustEvaluationDate => _kSecTrustEvaluationDate.value; + + set kSecTrustEvaluationDate(CFStringRef value) => + _kSecTrustEvaluationDate.value = value; + + late final ffi.Pointer _kSecTrustExtendedValidation = + _lookup('kSecTrustExtendedValidation'); + + CFStringRef get kSecTrustExtendedValidation => + _kSecTrustExtendedValidation.value; + + set kSecTrustExtendedValidation(CFStringRef value) => + _kSecTrustExtendedValidation.value = value; + + late final ffi.Pointer _kSecTrustOrganizationName = + _lookup('kSecTrustOrganizationName'); + + CFStringRef get kSecTrustOrganizationName => _kSecTrustOrganizationName.value; + + set kSecTrustOrganizationName(CFStringRef value) => + _kSecTrustOrganizationName.value = value; + + late final ffi.Pointer _kSecTrustResultValue = + _lookup('kSecTrustResultValue'); + + CFStringRef get kSecTrustResultValue => _kSecTrustResultValue.value; + + set kSecTrustResultValue(CFStringRef value) => + _kSecTrustResultValue.value = value; + + late final ffi.Pointer _kSecTrustRevocationChecked = + _lookup('kSecTrustRevocationChecked'); + + CFStringRef get kSecTrustRevocationChecked => + _kSecTrustRevocationChecked.value; + + set kSecTrustRevocationChecked(CFStringRef value) => + _kSecTrustRevocationChecked.value = value; + + late final ffi.Pointer _kSecTrustRevocationValidUntilDate = + _lookup('kSecTrustRevocationValidUntilDate'); + + CFStringRef get kSecTrustRevocationValidUntilDate => + _kSecTrustRevocationValidUntilDate.value; + + set kSecTrustRevocationValidUntilDate(CFStringRef value) => + _kSecTrustRevocationValidUntilDate.value = value; + + late final ffi.Pointer _kSecTrustCertificateTransparency = + _lookup('kSecTrustCertificateTransparency'); + + CFStringRef get kSecTrustCertificateTransparency => + _kSecTrustCertificateTransparency.value; + + set kSecTrustCertificateTransparency(CFStringRef value) => + _kSecTrustCertificateTransparency.value = value; + + late final ffi.Pointer + _kSecTrustCertificateTransparencyWhiteList = + _lookup('kSecTrustCertificateTransparencyWhiteList'); + + CFStringRef get kSecTrustCertificateTransparencyWhiteList => + _kSecTrustCertificateTransparencyWhiteList.value; + + set kSecTrustCertificateTransparencyWhiteList(CFStringRef value) => + _kSecTrustCertificateTransparencyWhiteList.value = value; + + int SecTrustGetTypeID() { + return _SecTrustGetTypeID(); + } + + late final _SecTrustGetTypeIDPtr = + _lookup>('SecTrustGetTypeID'); + late final _SecTrustGetTypeID = + _SecTrustGetTypeIDPtr.asFunction(); + + int SecTrustCreateWithCertificates( + CFTypeRef certificates, + CFTypeRef policies, + ffi.Pointer trust, + ) { + return _SecTrustCreateWithCertificates( + certificates, + policies, + trust, + ); + } + + late final _SecTrustCreateWithCertificatesPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(CFTypeRef, CFTypeRef, + ffi.Pointer)>>('SecTrustCreateWithCertificates'); + late final _SecTrustCreateWithCertificates = + _SecTrustCreateWithCertificatesPtr.asFunction< + int Function(CFTypeRef, CFTypeRef, ffi.Pointer)>(); + + int SecTrustSetPolicies( + SecTrustRef trust, + CFTypeRef policies, + ) { + return _SecTrustSetPolicies( + trust, + policies, + ); + } + + late final _SecTrustSetPoliciesPtr = + _lookup>( + 'SecTrustSetPolicies'); + late final _SecTrustSetPolicies = _SecTrustSetPoliciesPtr.asFunction< + int Function(SecTrustRef, CFTypeRef)>(); + + int SecTrustCopyPolicies( + SecTrustRef trust, + ffi.Pointer policies, + ) { + return _SecTrustCopyPolicies( + trust, + policies, + ); + } + + late final _SecTrustCopyPoliciesPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SecTrustRef, ffi.Pointer)>>('SecTrustCopyPolicies'); + late final _SecTrustCopyPolicies = _SecTrustCopyPoliciesPtr.asFunction< + int Function(SecTrustRef, ffi.Pointer)>(); + + int SecTrustSetNetworkFetchAllowed( + SecTrustRef trust, + int allowFetch, + ) { + return _SecTrustSetNetworkFetchAllowed( + trust, + allowFetch, + ); + } + + late final _SecTrustSetNetworkFetchAllowedPtr = + _lookup>( + 'SecTrustSetNetworkFetchAllowed'); + late final _SecTrustSetNetworkFetchAllowed = + _SecTrustSetNetworkFetchAllowedPtr.asFunction< + int Function(SecTrustRef, int)>(); + + int SecTrustGetNetworkFetchAllowed( + SecTrustRef trust, + ffi.Pointer allowFetch, + ) { + return _SecTrustGetNetworkFetchAllowed( + trust, + allowFetch, + ); + } + + late final _SecTrustGetNetworkFetchAllowedPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecTrustRef, + ffi.Pointer)>>('SecTrustGetNetworkFetchAllowed'); + late final _SecTrustGetNetworkFetchAllowed = + _SecTrustGetNetworkFetchAllowedPtr.asFunction< + int Function(SecTrustRef, ffi.Pointer)>(); + + int SecTrustSetAnchorCertificates( + SecTrustRef trust, + CFArrayRef anchorCertificates, + ) { + return _SecTrustSetAnchorCertificates( + trust, + anchorCertificates, + ); + } + + late final _SecTrustSetAnchorCertificatesPtr = + _lookup>( + 'SecTrustSetAnchorCertificates'); + late final _SecTrustSetAnchorCertificates = _SecTrustSetAnchorCertificatesPtr + .asFunction(); + + int SecTrustSetAnchorCertificatesOnly( + SecTrustRef trust, + int anchorCertificatesOnly, + ) { + return _SecTrustSetAnchorCertificatesOnly( + trust, + anchorCertificatesOnly, + ); + } + + late final _SecTrustSetAnchorCertificatesOnlyPtr = + _lookup>( + 'SecTrustSetAnchorCertificatesOnly'); + late final _SecTrustSetAnchorCertificatesOnly = + _SecTrustSetAnchorCertificatesOnlyPtr.asFunction< + int Function(SecTrustRef, int)>(); + + int SecTrustCopyCustomAnchorCertificates( + SecTrustRef trust, + ffi.Pointer anchors, + ) { + return _SecTrustCopyCustomAnchorCertificates( + trust, + anchors, + ); + } + + late final _SecTrustCopyCustomAnchorCertificatesPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecTrustRef, ffi.Pointer)>>( + 'SecTrustCopyCustomAnchorCertificates'); + late final _SecTrustCopyCustomAnchorCertificates = + _SecTrustCopyCustomAnchorCertificatesPtr.asFunction< + int Function(SecTrustRef, ffi.Pointer)>(); + + int SecTrustSetVerifyDate( + SecTrustRef trust, + CFDateRef verifyDate, + ) { + return _SecTrustSetVerifyDate( + trust, + verifyDate, + ); + } + + late final _SecTrustSetVerifyDatePtr = + _lookup>( + 'SecTrustSetVerifyDate'); + late final _SecTrustSetVerifyDate = _SecTrustSetVerifyDatePtr.asFunction< + int Function(SecTrustRef, CFDateRef)>(); + + double SecTrustGetVerifyTime( + SecTrustRef trust, + ) { + return _SecTrustGetVerifyTime( + trust, + ); + } + + late final _SecTrustGetVerifyTimePtr = + _lookup>( + 'SecTrustGetVerifyTime'); + late final _SecTrustGetVerifyTime = + _SecTrustGetVerifyTimePtr.asFunction(); + + int SecTrustEvaluate( + SecTrustRef trust, + ffi.Pointer result, + ) { + return _SecTrustEvaluate( + trust, + result, + ); + } + + late final _SecTrustEvaluatePtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SecTrustRef, ffi.Pointer)>>('SecTrustEvaluate'); + late final _SecTrustEvaluate = _SecTrustEvaluatePtr.asFunction< + int Function(SecTrustRef, ffi.Pointer)>(); + + DartSInt32 SecTrustEvaluateAsync( + SecTrustRef trust, + Dartdispatch_queue_t? queue, + DartSecTrustCallback result, + ) { + return _SecTrustEvaluateAsync( + trust, + queue?.ref.pointer ?? ffi.nullptr, + result.ref.pointer, + ); + } + + late final _SecTrustEvaluateAsyncPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecTrustRef, dispatch_queue_t, + SecTrustCallback)>>('SecTrustEvaluateAsync'); + late final _SecTrustEvaluateAsync = _SecTrustEvaluateAsyncPtr.asFunction< + int Function(SecTrustRef, dispatch_queue_t, SecTrustCallback)>(); + + bool SecTrustEvaluateWithError( + SecTrustRef trust, + ffi.Pointer error, + ) { + return _SecTrustEvaluateWithError( + trust, + error, + ); + } + + late final _SecTrustEvaluateWithErrorPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function(SecTrustRef, + ffi.Pointer)>>('SecTrustEvaluateWithError'); + late final _SecTrustEvaluateWithError = _SecTrustEvaluateWithErrorPtr + .asFunction)>(); + + DartSInt32 SecTrustEvaluateAsyncWithError( + SecTrustRef trust, + Dartdispatch_queue_t queue, + DartSecTrustWithErrorCallback result, + ) { + return _SecTrustEvaluateAsyncWithError( + trust, + queue.ref.pointer, + result.ref.pointer, + ); + } + + late final _SecTrustEvaluateAsyncWithErrorPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecTrustRef, dispatch_queue_t, + SecTrustWithErrorCallback)>>('SecTrustEvaluateAsyncWithError'); + late final _SecTrustEvaluateAsyncWithError = + _SecTrustEvaluateAsyncWithErrorPtr.asFunction< + int Function( + SecTrustRef, dispatch_queue_t, SecTrustWithErrorCallback)>(); + + int SecTrustGetTrustResult( + SecTrustRef trust, + ffi.Pointer result, + ) { + return _SecTrustGetTrustResult( + trust, + result, + ); + } + + late final _SecTrustGetTrustResultPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SecTrustRef, ffi.Pointer)>>('SecTrustGetTrustResult'); + late final _SecTrustGetTrustResult = _SecTrustGetTrustResultPtr.asFunction< + int Function(SecTrustRef, ffi.Pointer)>(); + + SecKeyRef SecTrustCopyPublicKey( + SecTrustRef trust, + ) { + return _SecTrustCopyPublicKey( + trust, + ); + } + + late final _SecTrustCopyPublicKeyPtr = + _lookup>( + 'SecTrustCopyPublicKey'); + late final _SecTrustCopyPublicKey = + _SecTrustCopyPublicKeyPtr.asFunction(); + + SecKeyRef SecTrustCopyKey( + SecTrustRef trust, + ) { + return _SecTrustCopyKey( + trust, + ); + } + + late final _SecTrustCopyKeyPtr = + _lookup>( + 'SecTrustCopyKey'); + late final _SecTrustCopyKey = + _SecTrustCopyKeyPtr.asFunction(); + + int SecTrustGetCertificateCount( + SecTrustRef trust, + ) { + return _SecTrustGetCertificateCount( + trust, + ); + } + + late final _SecTrustGetCertificateCountPtr = + _lookup>( + 'SecTrustGetCertificateCount'); + late final _SecTrustGetCertificateCount = + _SecTrustGetCertificateCountPtr.asFunction(); + + SecCertificateRef SecTrustGetCertificateAtIndex( + SecTrustRef trust, + int ix, + ) { + return _SecTrustGetCertificateAtIndex( + trust, + ix, + ); + } + + late final _SecTrustGetCertificateAtIndexPtr = _lookup< + ffi.NativeFunction>( + 'SecTrustGetCertificateAtIndex'); + late final _SecTrustGetCertificateAtIndex = _SecTrustGetCertificateAtIndexPtr + .asFunction(); + + CFDataRef SecTrustCopyExceptions( + SecTrustRef trust, + ) { + return _SecTrustCopyExceptions( + trust, + ); + } + + late final _SecTrustCopyExceptionsPtr = + _lookup>( + 'SecTrustCopyExceptions'); + late final _SecTrustCopyExceptions = + _SecTrustCopyExceptionsPtr.asFunction(); + + bool SecTrustSetExceptions( + SecTrustRef trust, + CFDataRef exceptions, + ) { + return _SecTrustSetExceptions( + trust, + exceptions, + ); + } + + late final _SecTrustSetExceptionsPtr = + _lookup>( + 'SecTrustSetExceptions'); + late final _SecTrustSetExceptions = _SecTrustSetExceptionsPtr.asFunction< + bool Function(SecTrustRef, CFDataRef)>(); + + CFArrayRef SecTrustCopyProperties( + SecTrustRef trust, + ) { + return _SecTrustCopyProperties( + trust, + ); + } + + late final _SecTrustCopyPropertiesPtr = + _lookup>( + 'SecTrustCopyProperties'); + late final _SecTrustCopyProperties = + _SecTrustCopyPropertiesPtr.asFunction(); + + CFDictionaryRef SecTrustCopyResult( + SecTrustRef trust, + ) { + return _SecTrustCopyResult( + trust, + ); + } + + late final _SecTrustCopyResultPtr = + _lookup>( + 'SecTrustCopyResult'); + late final _SecTrustCopyResult = _SecTrustCopyResultPtr.asFunction< + CFDictionaryRef Function(SecTrustRef)>(); + + int SecTrustSetOCSPResponse( + SecTrustRef trust, + CFTypeRef responseData, + ) { + return _SecTrustSetOCSPResponse( + trust, + responseData, + ); + } + + late final _SecTrustSetOCSPResponsePtr = + _lookup>( + 'SecTrustSetOCSPResponse'); + late final _SecTrustSetOCSPResponse = _SecTrustSetOCSPResponsePtr.asFunction< + int Function(SecTrustRef, CFTypeRef)>(); + + int SecTrustSetSignedCertificateTimestamps( + SecTrustRef trust, + CFArrayRef sctArray, + ) { + return _SecTrustSetSignedCertificateTimestamps( + trust, + sctArray, + ); + } + + late final _SecTrustSetSignedCertificateTimestampsPtr = + _lookup>( + 'SecTrustSetSignedCertificateTimestamps'); + late final _SecTrustSetSignedCertificateTimestamps = + _SecTrustSetSignedCertificateTimestampsPtr.asFunction< + int Function(SecTrustRef, CFArrayRef)>(); + + CFArrayRef SecTrustCopyCertificateChain( + SecTrustRef trust, + ) { + return _SecTrustCopyCertificateChain( + trust, + ); + } + + late final _SecTrustCopyCertificateChainPtr = + _lookup>( + 'SecTrustCopyCertificateChain'); + late final _SecTrustCopyCertificateChain = _SecTrustCopyCertificateChainPtr + .asFunction(); + + DartSInt32 SecTrustSetOptions( + SecTrustRef trustRef, + SecTrustOptionFlags options, + ) { + return _SecTrustSetOptions( + trustRef, + options.value, + ); + } + + late final _SecTrustSetOptionsPtr = + _lookup>( + 'SecTrustSetOptions'); + late final _SecTrustSetOptions = + _SecTrustSetOptionsPtr.asFunction(); + + int SecTrustSetParameters( + SecTrustRef trustRef, + int action, + CFDataRef actionData, + ) { + return _SecTrustSetParameters( + trustRef, + action, + actionData, + ); + } + + late final _SecTrustSetParametersPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecTrustRef, CSSM_TP_ACTION, + CFDataRef)>>('SecTrustSetParameters'); + late final _SecTrustSetParameters = _SecTrustSetParametersPtr.asFunction< + int Function(SecTrustRef, int, CFDataRef)>(); + + int SecTrustSetKeychains( + SecTrustRef trust, + CFTypeRef keychainOrArray, + ) { + return _SecTrustSetKeychains( + trust, + keychainOrArray, + ); + } + + late final _SecTrustSetKeychainsPtr = + _lookup>( + 'SecTrustSetKeychains'); + late final _SecTrustSetKeychains = _SecTrustSetKeychainsPtr.asFunction< + int Function(SecTrustRef, CFTypeRef)>(); + + int SecTrustGetResult( + SecTrustRef trustRef, + ffi.Pointer result, + ffi.Pointer certChain, + ffi.Pointer> statusChain, + ) { + return _SecTrustGetResult( + trustRef, + result, + certChain, + statusChain, + ); + } + + late final _SecTrustGetResultPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SecTrustRef, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>( + 'SecTrustGetResult'); + late final _SecTrustGetResult = _SecTrustGetResultPtr.asFunction< + int Function( + SecTrustRef, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); + + int SecTrustGetCssmResult( + SecTrustRef trust, + ffi.Pointer result, + ) { + return _SecTrustGetCssmResult( + trust, + result, + ); + } + + late final _SecTrustGetCssmResultPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecTrustRef, + ffi.Pointer)>>( + 'SecTrustGetCssmResult'); + late final _SecTrustGetCssmResult = _SecTrustGetCssmResultPtr.asFunction< + int Function( + SecTrustRef, ffi.Pointer)>(); + + int SecTrustGetCssmResultCode( + SecTrustRef trust, + ffi.Pointer resultCode, + ) { + return _SecTrustGetCssmResultCode( + trust, + resultCode, + ); + } + + late final _SecTrustGetCssmResultCodePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecTrustRef, + ffi.Pointer)>>('SecTrustGetCssmResultCode'); + late final _SecTrustGetCssmResultCode = _SecTrustGetCssmResultCodePtr + .asFunction)>(); + + int SecTrustGetTPHandle( + SecTrustRef trust, + ffi.Pointer handle, + ) { + return _SecTrustGetTPHandle( + trust, + handle, + ); + } + + late final _SecTrustGetTPHandlePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecTrustRef, + ffi.Pointer)>>('SecTrustGetTPHandle'); + late final _SecTrustGetTPHandle = _SecTrustGetTPHandlePtr.asFunction< + int Function(SecTrustRef, ffi.Pointer)>(); + + int SecTrustCopyAnchorCertificates( + ffi.Pointer anchors, + ) { + return _SecTrustCopyAnchorCertificates( + anchors, + ); + } + + late final _SecTrustCopyAnchorCertificatesPtr = + _lookup)>>( + 'SecTrustCopyAnchorCertificates'); + late final _SecTrustCopyAnchorCertificates = + _SecTrustCopyAnchorCertificatesPtr.asFunction< + int Function(ffi.Pointer)>(); + + int SecCertificateGetTypeID() { + return _SecCertificateGetTypeID(); + } + + late final _SecCertificateGetTypeIDPtr = + _lookup>( + 'SecCertificateGetTypeID'); + late final _SecCertificateGetTypeID = + _SecCertificateGetTypeIDPtr.asFunction(); + + SecCertificateRef SecCertificateCreateWithData( + CFAllocatorRef allocator, + CFDataRef data, + ) { + return _SecCertificateCreateWithData( + allocator, + data, + ); + } + + late final _SecCertificateCreateWithDataPtr = _lookup< + ffi.NativeFunction< + SecCertificateRef Function( + CFAllocatorRef, CFDataRef)>>('SecCertificateCreateWithData'); + late final _SecCertificateCreateWithData = _SecCertificateCreateWithDataPtr + .asFunction(); + + CFDataRef SecCertificateCopyData( + SecCertificateRef certificate, + ) { + return _SecCertificateCopyData( + certificate, + ); + } + + late final _SecCertificateCopyDataPtr = + _lookup>( + 'SecCertificateCopyData'); + late final _SecCertificateCopyData = _SecCertificateCopyDataPtr.asFunction< + CFDataRef Function(SecCertificateRef)>(); + + CFStringRef SecCertificateCopySubjectSummary( + SecCertificateRef certificate, + ) { + return _SecCertificateCopySubjectSummary( + certificate, + ); + } + + late final _SecCertificateCopySubjectSummaryPtr = + _lookup>( + 'SecCertificateCopySubjectSummary'); + late final _SecCertificateCopySubjectSummary = + _SecCertificateCopySubjectSummaryPtr.asFunction< + CFStringRef Function(SecCertificateRef)>(); + + int SecCertificateCopyCommonName( + SecCertificateRef certificate, + ffi.Pointer commonName, + ) { + return _SecCertificateCopyCommonName( + certificate, + commonName, + ); + } + + late final _SecCertificateCopyCommonNamePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, + ffi.Pointer)>>('SecCertificateCopyCommonName'); + late final _SecCertificateCopyCommonName = _SecCertificateCopyCommonNamePtr + .asFunction)>(); + + int SecCertificateCopyEmailAddresses( + SecCertificateRef certificate, + ffi.Pointer emailAddresses, + ) { + return _SecCertificateCopyEmailAddresses( + certificate, + emailAddresses, + ); + } + + late final _SecCertificateCopyEmailAddressesPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, + ffi.Pointer)>>('SecCertificateCopyEmailAddresses'); + late final _SecCertificateCopyEmailAddresses = + _SecCertificateCopyEmailAddressesPtr.asFunction< + int Function(SecCertificateRef, ffi.Pointer)>(); + + CFDataRef SecCertificateCopyNormalizedIssuerSequence( + SecCertificateRef certificate, + ) { + return _SecCertificateCopyNormalizedIssuerSequence( + certificate, + ); + } + + late final _SecCertificateCopyNormalizedIssuerSequencePtr = + _lookup>( + 'SecCertificateCopyNormalizedIssuerSequence'); + late final _SecCertificateCopyNormalizedIssuerSequence = + _SecCertificateCopyNormalizedIssuerSequencePtr.asFunction< + CFDataRef Function(SecCertificateRef)>(); + + CFDataRef SecCertificateCopyNormalizedSubjectSequence( + SecCertificateRef certificate, + ) { + return _SecCertificateCopyNormalizedSubjectSequence( + certificate, + ); + } + + late final _SecCertificateCopyNormalizedSubjectSequencePtr = + _lookup>( + 'SecCertificateCopyNormalizedSubjectSequence'); + late final _SecCertificateCopyNormalizedSubjectSequence = + _SecCertificateCopyNormalizedSubjectSequencePtr.asFunction< + CFDataRef Function(SecCertificateRef)>(); + + SecKeyRef SecCertificateCopyKey( + SecCertificateRef certificate, + ) { + return _SecCertificateCopyKey( + certificate, + ); + } + + late final _SecCertificateCopyKeyPtr = + _lookup>( + 'SecCertificateCopyKey'); + late final _SecCertificateCopyKey = _SecCertificateCopyKeyPtr.asFunction< + SecKeyRef Function(SecCertificateRef)>(); + + int SecCertificateCopyPublicKey( + SecCertificateRef certificate, + ffi.Pointer key, + ) { + return _SecCertificateCopyPublicKey( + certificate, + key, + ); + } + + late final _SecCertificateCopyPublicKeyPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, + ffi.Pointer)>>('SecCertificateCopyPublicKey'); + late final _SecCertificateCopyPublicKey = _SecCertificateCopyPublicKeyPtr + .asFunction)>(); + + CFDataRef SecCertificateCopySerialNumberData( + SecCertificateRef certificate, + ffi.Pointer error, + ) { + return _SecCertificateCopySerialNumberData( + certificate, + error, + ); + } + + late final _SecCertificateCopySerialNumberDataPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(SecCertificateRef, + ffi.Pointer)>>('SecCertificateCopySerialNumberData'); + late final _SecCertificateCopySerialNumberData = + _SecCertificateCopySerialNumberDataPtr.asFunction< + CFDataRef Function(SecCertificateRef, ffi.Pointer)>(); + + CFDataRef SecCertificateCopySerialNumber( + SecCertificateRef certificate, + ffi.Pointer error, + ) { + return _SecCertificateCopySerialNumber( + certificate, + error, + ); + } + + late final _SecCertificateCopySerialNumberPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(SecCertificateRef, + ffi.Pointer)>>('SecCertificateCopySerialNumber'); + late final _SecCertificateCopySerialNumber = + _SecCertificateCopySerialNumberPtr.asFunction< + CFDataRef Function(SecCertificateRef, ffi.Pointer)>(); + + int SecCertificateCreateFromData( + ffi.Pointer data, + int type, + int encoding, + ffi.Pointer certificate, + ) { + return _SecCertificateCreateFromData( + data, + type, + encoding, + certificate, + ); + } + + late final _SecCertificateCreateFromDataPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + ffi.Pointer, + CSSM_CERT_TYPE, + CSSM_CERT_ENCODING, + ffi.Pointer)>>('SecCertificateCreateFromData'); + late final _SecCertificateCreateFromData = + _SecCertificateCreateFromDataPtr.asFunction< + int Function(ffi.Pointer, int, int, + ffi.Pointer)>(); + + int SecCertificateAddToKeychain( + SecCertificateRef certificate, + SecKeychainRef keychain, + ) { + return _SecCertificateAddToKeychain( + certificate, + keychain, + ); + } + + late final _SecCertificateAddToKeychainPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, + SecKeychainRef)>>('SecCertificateAddToKeychain'); + late final _SecCertificateAddToKeychain = _SecCertificateAddToKeychainPtr + .asFunction(); + + int SecCertificateGetData( + SecCertificateRef certificate, + CSSM_DATA_PTR data, + ) { + return _SecCertificateGetData( + certificate, + data, + ); + } + + late final _SecCertificateGetDataPtr = _lookup< + ffi + .NativeFunction>( + 'SecCertificateGetData'); + late final _SecCertificateGetData = _SecCertificateGetDataPtr.asFunction< + int Function(SecCertificateRef, CSSM_DATA_PTR)>(); + + int SecCertificateGetType( + SecCertificateRef certificate, + ffi.Pointer certificateType, + ) { + return _SecCertificateGetType( + certificate, + certificateType, + ); + } + + late final _SecCertificateGetTypePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, + ffi.Pointer)>>('SecCertificateGetType'); + late final _SecCertificateGetType = _SecCertificateGetTypePtr.asFunction< + int Function(SecCertificateRef, ffi.Pointer)>(); + + int SecCertificateGetSubject( + SecCertificateRef certificate, + ffi.Pointer> subject, + ) { + return _SecCertificateGetSubject( + certificate, + subject, + ); + } + + late final _SecCertificateGetSubjectPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, + ffi.Pointer>)>>( + 'SecCertificateGetSubject'); + late final _SecCertificateGetSubject = + _SecCertificateGetSubjectPtr.asFunction< + int Function( + SecCertificateRef, ffi.Pointer>)>(); + + int SecCertificateGetIssuer( + SecCertificateRef certificate, + ffi.Pointer> issuer, + ) { + return _SecCertificateGetIssuer( + certificate, + issuer, + ); + } + + late final _SecCertificateGetIssuerPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, + ffi.Pointer>)>>( + 'SecCertificateGetIssuer'); + late final _SecCertificateGetIssuer = _SecCertificateGetIssuerPtr.asFunction< + int Function( + SecCertificateRef, ffi.Pointer>)>(); + + int SecCertificateGetCLHandle( + SecCertificateRef certificate, + ffi.Pointer clHandle, + ) { + return _SecCertificateGetCLHandle( + certificate, + clHandle, + ); + } + + late final _SecCertificateGetCLHandlePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, + ffi.Pointer)>>('SecCertificateGetCLHandle'); + late final _SecCertificateGetCLHandle = + _SecCertificateGetCLHandlePtr.asFunction< + int Function(SecCertificateRef, ffi.Pointer)>(); + + int SecCertificateGetAlgorithmID( + SecCertificateRef certificate, + ffi.Pointer> algid, + ) { + return _SecCertificateGetAlgorithmID( + certificate, + algid, + ); + } + + late final _SecCertificateGetAlgorithmIDPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SecCertificateRef, ffi.Pointer>)>>( + 'SecCertificateGetAlgorithmID'); + late final _SecCertificateGetAlgorithmID = + _SecCertificateGetAlgorithmIDPtr.asFunction< + int Function( + SecCertificateRef, ffi.Pointer>)>(); + + int SecCertificateCopyPreference( + CFStringRef name, + int keyUsage, + ffi.Pointer certificate, + ) { + return _SecCertificateCopyPreference( + name, + keyUsage, + certificate, + ); + } + + late final _SecCertificateCopyPreferencePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(CFStringRef, uint32, + ffi.Pointer)>>('SecCertificateCopyPreference'); + late final _SecCertificateCopyPreference = + _SecCertificateCopyPreferencePtr.asFunction< + int Function(CFStringRef, int, ffi.Pointer)>(); + + SecCertificateRef SecCertificateCopyPreferred( + CFStringRef name, + CFArrayRef keyUsage, + ) { + return _SecCertificateCopyPreferred( + name, + keyUsage, + ); + } + + late final _SecCertificateCopyPreferredPtr = _lookup< + ffi + .NativeFunction>( + 'SecCertificateCopyPreferred'); + late final _SecCertificateCopyPreferred = _SecCertificateCopyPreferredPtr + .asFunction(); + + int SecCertificateSetPreference( + SecCertificateRef certificate, + CFStringRef name, + int keyUsage, + CFDateRef date, + ) { + return _SecCertificateSetPreference( + certificate, + name, + keyUsage, + date, + ); + } + + late final _SecCertificateSetPreferencePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, CFStringRef, uint32, + CFDateRef)>>('SecCertificateSetPreference'); + late final _SecCertificateSetPreference = + _SecCertificateSetPreferencePtr.asFunction< + int Function(SecCertificateRef, CFStringRef, int, CFDateRef)>(); + + int SecCertificateSetPreferred( + SecCertificateRef certificate, + CFStringRef name, + CFArrayRef keyUsage, + ) { + return _SecCertificateSetPreferred( + certificate, + name, + keyUsage, + ); + } + + late final _SecCertificateSetPreferredPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecCertificateRef, CFStringRef, + CFArrayRef)>>('SecCertificateSetPreferred'); + late final _SecCertificateSetPreferred = _SecCertificateSetPreferredPtr + .asFunction(); + + late final ffi.Pointer _kSecPropertyKeyType = + _lookup('kSecPropertyKeyType'); + + CFStringRef get kSecPropertyKeyType => _kSecPropertyKeyType.value; + + set kSecPropertyKeyType(CFStringRef value) => + _kSecPropertyKeyType.value = value; + + late final ffi.Pointer _kSecPropertyKeyLabel = + _lookup('kSecPropertyKeyLabel'); + + CFStringRef get kSecPropertyKeyLabel => _kSecPropertyKeyLabel.value; + + set kSecPropertyKeyLabel(CFStringRef value) => + _kSecPropertyKeyLabel.value = value; + + late final ffi.Pointer _kSecPropertyKeyLocalizedLabel = + _lookup('kSecPropertyKeyLocalizedLabel'); + + CFStringRef get kSecPropertyKeyLocalizedLabel => + _kSecPropertyKeyLocalizedLabel.value; + + set kSecPropertyKeyLocalizedLabel(CFStringRef value) => + _kSecPropertyKeyLocalizedLabel.value = value; + + late final ffi.Pointer _kSecPropertyKeyValue = + _lookup('kSecPropertyKeyValue'); + + CFStringRef get kSecPropertyKeyValue => _kSecPropertyKeyValue.value; + + set kSecPropertyKeyValue(CFStringRef value) => + _kSecPropertyKeyValue.value = value; + + late final ffi.Pointer _kSecPropertyTypeWarning = + _lookup('kSecPropertyTypeWarning'); + + CFStringRef get kSecPropertyTypeWarning => _kSecPropertyTypeWarning.value; + + set kSecPropertyTypeWarning(CFStringRef value) => + _kSecPropertyTypeWarning.value = value; + + late final ffi.Pointer _kSecPropertyTypeSuccess = + _lookup('kSecPropertyTypeSuccess'); + + CFStringRef get kSecPropertyTypeSuccess => _kSecPropertyTypeSuccess.value; + + set kSecPropertyTypeSuccess(CFStringRef value) => + _kSecPropertyTypeSuccess.value = value; + + late final ffi.Pointer _kSecPropertyTypeSection = + _lookup('kSecPropertyTypeSection'); + + CFStringRef get kSecPropertyTypeSection => _kSecPropertyTypeSection.value; + + set kSecPropertyTypeSection(CFStringRef value) => + _kSecPropertyTypeSection.value = value; + + late final ffi.Pointer _kSecPropertyTypeData = + _lookup('kSecPropertyTypeData'); + + CFStringRef get kSecPropertyTypeData => _kSecPropertyTypeData.value; + + set kSecPropertyTypeData(CFStringRef value) => + _kSecPropertyTypeData.value = value; + + late final ffi.Pointer _kSecPropertyTypeString = + _lookup('kSecPropertyTypeString'); + + CFStringRef get kSecPropertyTypeString => _kSecPropertyTypeString.value; + + set kSecPropertyTypeString(CFStringRef value) => + _kSecPropertyTypeString.value = value; + + late final ffi.Pointer _kSecPropertyTypeURL = + _lookup('kSecPropertyTypeURL'); + + CFStringRef get kSecPropertyTypeURL => _kSecPropertyTypeURL.value; + + set kSecPropertyTypeURL(CFStringRef value) => + _kSecPropertyTypeURL.value = value; + + late final ffi.Pointer _kSecPropertyTypeDate = + _lookup('kSecPropertyTypeDate'); + + CFStringRef get kSecPropertyTypeDate => _kSecPropertyTypeDate.value; + + set kSecPropertyTypeDate(CFStringRef value) => + _kSecPropertyTypeDate.value = value; + + late final ffi.Pointer _kSecPropertyTypeArray = + _lookup('kSecPropertyTypeArray'); + + CFStringRef get kSecPropertyTypeArray => _kSecPropertyTypeArray.value; + + set kSecPropertyTypeArray(CFStringRef value) => + _kSecPropertyTypeArray.value = value; + + late final ffi.Pointer _kSecPropertyTypeNumber = + _lookup('kSecPropertyTypeNumber'); + + CFStringRef get kSecPropertyTypeNumber => _kSecPropertyTypeNumber.value; + + set kSecPropertyTypeNumber(CFStringRef value) => + _kSecPropertyTypeNumber.value = value; + + CFDictionaryRef SecCertificateCopyValues( + SecCertificateRef certificate, + CFArrayRef keys, + ffi.Pointer error, + ) { + return _SecCertificateCopyValues( + certificate, + keys, + error, + ); + } + + late final _SecCertificateCopyValuesPtr = _lookup< + ffi.NativeFunction< + CFDictionaryRef Function(SecCertificateRef, CFArrayRef, + ffi.Pointer)>>('SecCertificateCopyValues'); + late final _SecCertificateCopyValues = + _SecCertificateCopyValuesPtr.asFunction< + CFDictionaryRef Function( + SecCertificateRef, CFArrayRef, ffi.Pointer)>(); + + CFStringRef SecCertificateCopyLongDescription( + CFAllocatorRef alloc, + SecCertificateRef certificate, + ffi.Pointer error, + ) { + return _SecCertificateCopyLongDescription( + alloc, + certificate, + error, + ); + } + + late final _SecCertificateCopyLongDescriptionPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, SecCertificateRef, + ffi.Pointer)>>('SecCertificateCopyLongDescription'); + late final _SecCertificateCopyLongDescription = + _SecCertificateCopyLongDescriptionPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, SecCertificateRef, ffi.Pointer)>(); + + CFStringRef SecCertificateCopyShortDescription( + CFAllocatorRef alloc, + SecCertificateRef certificate, + ffi.Pointer error, + ) { + return _SecCertificateCopyShortDescription( + alloc, + certificate, + error, + ); + } + + late final _SecCertificateCopyShortDescriptionPtr = _lookup< + ffi.NativeFunction< + CFStringRef Function(CFAllocatorRef, SecCertificateRef, + ffi.Pointer)>>('SecCertificateCopyShortDescription'); + late final _SecCertificateCopyShortDescription = + _SecCertificateCopyShortDescriptionPtr.asFunction< + CFStringRef Function( + CFAllocatorRef, SecCertificateRef, ffi.Pointer)>(); + + CFDataRef SecCertificateCopyNormalizedIssuerContent( + SecCertificateRef certificate, + ffi.Pointer error, + ) { + return _SecCertificateCopyNormalizedIssuerContent( + certificate, + error, + ); + } + + late final _SecCertificateCopyNormalizedIssuerContentPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(SecCertificateRef, ffi.Pointer)>>( + 'SecCertificateCopyNormalizedIssuerContent'); + late final _SecCertificateCopyNormalizedIssuerContent = + _SecCertificateCopyNormalizedIssuerContentPtr.asFunction< + CFDataRef Function(SecCertificateRef, ffi.Pointer)>(); + + CFDataRef SecCertificateCopyNormalizedSubjectContent( + SecCertificateRef certificate, + ffi.Pointer error, + ) { + return _SecCertificateCopyNormalizedSubjectContent( + certificate, + error, + ); + } + + late final _SecCertificateCopyNormalizedSubjectContentPtr = _lookup< + ffi.NativeFunction< + CFDataRef Function(SecCertificateRef, ffi.Pointer)>>( + 'SecCertificateCopyNormalizedSubjectContent'); + late final _SecCertificateCopyNormalizedSubjectContent = + _SecCertificateCopyNormalizedSubjectContentPtr.asFunction< + CFDataRef Function(SecCertificateRef, ffi.Pointer)>(); + + int SecIdentityGetTypeID() { + return _SecIdentityGetTypeID(); + } + + late final _SecIdentityGetTypeIDPtr = + _lookup>('SecIdentityGetTypeID'); + late final _SecIdentityGetTypeID = + _SecIdentityGetTypeIDPtr.asFunction(); + + int SecIdentityCreateWithCertificate( + CFTypeRef keychainOrArray, + SecCertificateRef certificateRef, + ffi.Pointer identityRef, + ) { + return _SecIdentityCreateWithCertificate( + keychainOrArray, + certificateRef, + identityRef, + ); + } + + late final _SecIdentityCreateWithCertificatePtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + CFTypeRef, SecCertificateRef, ffi.Pointer)>>( + 'SecIdentityCreateWithCertificate'); + late final _SecIdentityCreateWithCertificate = + _SecIdentityCreateWithCertificatePtr.asFunction< + int Function( + CFTypeRef, SecCertificateRef, ffi.Pointer)>(); + + int SecIdentityCopyCertificate( + SecIdentityRef identityRef, + ffi.Pointer certificateRef, + ) { + return _SecIdentityCopyCertificate( + identityRef, + certificateRef, + ); + } + + late final _SecIdentityCopyCertificatePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecIdentityRef, + ffi.Pointer)>>('SecIdentityCopyCertificate'); + late final _SecIdentityCopyCertificate = + _SecIdentityCopyCertificatePtr.asFunction< + int Function(SecIdentityRef, ffi.Pointer)>(); + + int SecIdentityCopyPrivateKey( + SecIdentityRef identityRef, + ffi.Pointer privateKeyRef, + ) { + return _SecIdentityCopyPrivateKey( + identityRef, + privateKeyRef, + ); + } + + late final _SecIdentityCopyPrivateKeyPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecIdentityRef, + ffi.Pointer)>>('SecIdentityCopyPrivateKey'); + late final _SecIdentityCopyPrivateKey = _SecIdentityCopyPrivateKeyPtr + .asFunction)>(); + + int SecIdentityCopyPreference( + CFStringRef name, + int keyUsage, + CFArrayRef validIssuers, + ffi.Pointer identity, + ) { + return _SecIdentityCopyPreference( + name, + keyUsage, + validIssuers, + identity, + ); + } + + late final _SecIdentityCopyPreferencePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(CFStringRef, CSSM_KEYUSE, CFArrayRef, + ffi.Pointer)>>('SecIdentityCopyPreference'); + late final _SecIdentityCopyPreference = + _SecIdentityCopyPreferencePtr.asFunction< + int Function( + CFStringRef, int, CFArrayRef, ffi.Pointer)>(); + + SecIdentityRef SecIdentityCopyPreferred( + CFStringRef name, + CFArrayRef keyUsage, + CFArrayRef validIssuers, + ) { + return _SecIdentityCopyPreferred( + name, + keyUsage, + validIssuers, + ); + } + + late final _SecIdentityCopyPreferredPtr = _lookup< + ffi.NativeFunction< + SecIdentityRef Function(CFStringRef, CFArrayRef, + CFArrayRef)>>('SecIdentityCopyPreferred'); + late final _SecIdentityCopyPreferred = + _SecIdentityCopyPreferredPtr.asFunction< + SecIdentityRef Function(CFStringRef, CFArrayRef, CFArrayRef)>(); + + int SecIdentitySetPreference( + SecIdentityRef identity, + CFStringRef name, + int keyUsage, + ) { + return _SecIdentitySetPreference( + identity, + name, + keyUsage, + ); + } + + late final _SecIdentitySetPreferencePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecIdentityRef, CFStringRef, + CSSM_KEYUSE)>>('SecIdentitySetPreference'); + late final _SecIdentitySetPreference = _SecIdentitySetPreferencePtr + .asFunction(); + + int SecIdentitySetPreferred( + SecIdentityRef identity, + CFStringRef name, + CFArrayRef keyUsage, + ) { + return _SecIdentitySetPreferred( + identity, + name, + keyUsage, + ); + } + + late final _SecIdentitySetPreferredPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SecIdentityRef, CFStringRef, + CFArrayRef)>>('SecIdentitySetPreferred'); + late final _SecIdentitySetPreferred = _SecIdentitySetPreferredPtr.asFunction< + int Function(SecIdentityRef, CFStringRef, CFArrayRef)>(); + + int SecIdentityCopySystemIdentity( + CFStringRef domain, + ffi.Pointer idRef, + ffi.Pointer actualDomain, + ) { + return _SecIdentityCopySystemIdentity( + domain, + idRef, + actualDomain, + ); + } + + late final _SecIdentityCopySystemIdentityPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(CFStringRef, ffi.Pointer, + ffi.Pointer)>>('SecIdentityCopySystemIdentity'); + late final _SecIdentityCopySystemIdentity = + _SecIdentityCopySystemIdentityPtr.asFunction< + int Function(CFStringRef, ffi.Pointer, + ffi.Pointer)>(); + + int SecIdentitySetSystemIdentity( + CFStringRef domain, + SecIdentityRef idRef, + ) { + return _SecIdentitySetSystemIdentity( + domain, + idRef, + ); + } + + late final _SecIdentitySetSystemIdentityPtr = _lookup< + ffi.NativeFunction>( + 'SecIdentitySetSystemIdentity'); + late final _SecIdentitySetSystemIdentity = _SecIdentitySetSystemIdentityPtr + .asFunction(); + + late final ffi.Pointer _kSecIdentityDomainDefault = + _lookup('kSecIdentityDomainDefault'); + + CFStringRef get kSecIdentityDomainDefault => _kSecIdentityDomainDefault.value; + + set kSecIdentityDomainDefault(CFStringRef value) => + _kSecIdentityDomainDefault.value = value; + + late final ffi.Pointer _kSecIdentityDomainKerberosKDC = + _lookup('kSecIdentityDomainKerberosKDC'); + + CFStringRef get kSecIdentityDomainKerberosKDC => + _kSecIdentityDomainKerberosKDC.value; + + set kSecIdentityDomainKerberosKDC(CFStringRef value) => + _kSecIdentityDomainKerberosKDC.value = value; + + Dartsec_trust_t? sec_trust_create( + SecTrustRef trust, + ) { + return _sec_trust_create( + trust, + ).address == + 0 + ? null + : objc.NSObject.castFromPointer( + _sec_trust_create( + trust, + ), + retain: false, + release: true); + } + + late final _sec_trust_createPtr = + _lookup>( + 'sec_trust_create'); + late final _sec_trust_create = + _sec_trust_createPtr.asFunction(); + + SecTrustRef sec_trust_copy_ref( + Dartsec_trust_t trust, + ) { + return _sec_trust_copy_ref( + trust.ref.pointer, + ); + } + + late final _sec_trust_copy_refPtr = + _lookup>( + 'sec_trust_copy_ref'); + late final _sec_trust_copy_ref = + _sec_trust_copy_refPtr.asFunction(); + + Dartsec_identity_t? sec_identity_create( + SecIdentityRef identity, + ) { + return _sec_identity_create( + identity, + ).address == + 0 + ? null + : objc.NSObject.castFromPointer( + _sec_identity_create( + identity, + ), + retain: false, + release: true); + } + + late final _sec_identity_createPtr = + _lookup>( + 'sec_identity_create'); + late final _sec_identity_create = _sec_identity_createPtr + .asFunction(); + + Dartsec_identity_t? sec_identity_create_with_certificates( + SecIdentityRef identity, + CFArrayRef certificates, + ) { + return _sec_identity_create_with_certificates( + identity, + certificates, + ).address == + 0 + ? null + : objc.NSObject.castFromPointer( + _sec_identity_create_with_certificates( + identity, + certificates, + ), + retain: false, + release: true); + } + + late final _sec_identity_create_with_certificatesPtr = _lookup< + ffi + .NativeFunction>( + 'sec_identity_create_with_certificates'); + late final _sec_identity_create_with_certificates = + _sec_identity_create_with_certificatesPtr + .asFunction(); + + bool sec_identity_access_certificates( + Dartsec_identity_t identity, + objc.ObjCBlock handler, + ) { + return _sec_identity_access_certificates( + identity.ref.pointer, + handler.ref.pointer, + ); + } + + late final _sec_identity_access_certificatesPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function( + sec_identity_t, ffi.Pointer)>>( + 'sec_identity_access_certificates'); + late final _sec_identity_access_certificates = + _sec_identity_access_certificatesPtr.asFunction< + bool Function(sec_identity_t, ffi.Pointer)>(); + + SecIdentityRef sec_identity_copy_ref( + Dartsec_identity_t identity, + ) { + return _sec_identity_copy_ref( + identity.ref.pointer, + ); + } + + late final _sec_identity_copy_refPtr = + _lookup>( + 'sec_identity_copy_ref'); + late final _sec_identity_copy_ref = _sec_identity_copy_refPtr + .asFunction(); + + CFArrayRef sec_identity_copy_certificates_ref( + Dartsec_identity_t identity, + ) { + return _sec_identity_copy_certificates_ref( + identity.ref.pointer, + ); + } + + late final _sec_identity_copy_certificates_refPtr = + _lookup>( + 'sec_identity_copy_certificates_ref'); + late final _sec_identity_copy_certificates_ref = + _sec_identity_copy_certificates_refPtr + .asFunction(); + + Dartsec_certificate_t? sec_certificate_create( + SecCertificateRef certificate, + ) { + return _sec_certificate_create( + certificate, + ).address == + 0 + ? null + : objc.NSObject.castFromPointer( + _sec_certificate_create( + certificate, + ), + retain: false, + release: true); + } + + late final _sec_certificate_createPtr = _lookup< + ffi.NativeFunction>( + 'sec_certificate_create'); + late final _sec_certificate_create = _sec_certificate_createPtr + .asFunction(); + + SecCertificateRef sec_certificate_copy_ref( + Dartsec_certificate_t certificate, + ) { + return _sec_certificate_copy_ref( + certificate.ref.pointer, + ); + } + + late final _sec_certificate_copy_refPtr = _lookup< + ffi.NativeFunction>( + 'sec_certificate_copy_ref'); + late final _sec_certificate_copy_ref = _sec_certificate_copy_refPtr + .asFunction(); + + ffi.Pointer sec_protocol_metadata_get_negotiated_protocol( + Dartsec_protocol_metadata_t metadata, + ) { + return _sec_protocol_metadata_get_negotiated_protocol( + metadata.ref.pointer, + ); + } + + late final _sec_protocol_metadata_get_negotiated_protocolPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(sec_protocol_metadata_t)>>( + 'sec_protocol_metadata_get_negotiated_protocol'); + late final _sec_protocol_metadata_get_negotiated_protocol = + _sec_protocol_metadata_get_negotiated_protocolPtr.asFunction< + ffi.Pointer Function(sec_protocol_metadata_t)>(); + + Dartdispatch_data_t? sec_protocol_metadata_copy_peer_public_key( + Dartsec_protocol_metadata_t metadata, + ) { + return _sec_protocol_metadata_copy_peer_public_key( + metadata.ref.pointer, + ).address == + 0 + ? null + : objc.NSObject.castFromPointer( + _sec_protocol_metadata_copy_peer_public_key( + metadata.ref.pointer, + ), + retain: false, + release: true); + } + + late final _sec_protocol_metadata_copy_peer_public_keyPtr = _lookup< + ffi + .NativeFunction>( + 'sec_protocol_metadata_copy_peer_public_key'); + late final _sec_protocol_metadata_copy_peer_public_key = + _sec_protocol_metadata_copy_peer_public_keyPtr + .asFunction(); + + tls_protocol_version_t + sec_protocol_metadata_get_negotiated_tls_protocol_version( + Dartsec_protocol_metadata_t metadata, + ) { + return tls_protocol_version_t + .fromValue(_sec_protocol_metadata_get_negotiated_tls_protocol_version( + metadata.ref.pointer, + )); + } + + late final _sec_protocol_metadata_get_negotiated_tls_protocol_versionPtr = + _lookup>( + 'sec_protocol_metadata_get_negotiated_tls_protocol_version'); + late final _sec_protocol_metadata_get_negotiated_tls_protocol_version = + _sec_protocol_metadata_get_negotiated_tls_protocol_versionPtr + .asFunction(); + + SSLProtocol sec_protocol_metadata_get_negotiated_protocol_version( + Dartsec_protocol_metadata_t metadata, + ) { + return SSLProtocol.fromValue( + _sec_protocol_metadata_get_negotiated_protocol_version( + metadata.ref.pointer, + )); + } + + late final _sec_protocol_metadata_get_negotiated_protocol_versionPtr = + _lookup< + ffi.NativeFunction< + ffi.UnsignedInt Function(sec_protocol_metadata_t)>>( + 'sec_protocol_metadata_get_negotiated_protocol_version'); + late final _sec_protocol_metadata_get_negotiated_protocol_version = + _sec_protocol_metadata_get_negotiated_protocol_versionPtr + .asFunction(); + + tls_ciphersuite_t sec_protocol_metadata_get_negotiated_tls_ciphersuite( + Dartsec_protocol_metadata_t metadata, + ) { + return tls_ciphersuite_t + .fromValue(_sec_protocol_metadata_get_negotiated_tls_ciphersuite( + metadata.ref.pointer, + )); + } + + late final _sec_protocol_metadata_get_negotiated_tls_ciphersuitePtr = + _lookup>( + 'sec_protocol_metadata_get_negotiated_tls_ciphersuite'); + late final _sec_protocol_metadata_get_negotiated_tls_ciphersuite = + _sec_protocol_metadata_get_negotiated_tls_ciphersuitePtr + .asFunction(); + + DartSSLCipherSuite sec_protocol_metadata_get_negotiated_ciphersuite( + Dartsec_protocol_metadata_t metadata, + ) { + return _sec_protocol_metadata_get_negotiated_ciphersuite( + metadata.ref.pointer, + ); + } + + late final _sec_protocol_metadata_get_negotiated_ciphersuitePtr = _lookup< + ffi.NativeFunction>( + 'sec_protocol_metadata_get_negotiated_ciphersuite'); + late final _sec_protocol_metadata_get_negotiated_ciphersuite = + _sec_protocol_metadata_get_negotiated_ciphersuitePtr + .asFunction(); + + bool sec_protocol_metadata_get_early_data_accepted( + Dartsec_protocol_metadata_t metadata, + ) { + return _sec_protocol_metadata_get_early_data_accepted( + metadata.ref.pointer, + ); + } + + late final _sec_protocol_metadata_get_early_data_acceptedPtr = + _lookup>( + 'sec_protocol_metadata_get_early_data_accepted'); + late final _sec_protocol_metadata_get_early_data_accepted = + _sec_protocol_metadata_get_early_data_acceptedPtr + .asFunction(); + + bool sec_protocol_metadata_access_peer_certificate_chain( + Dartsec_protocol_metadata_t metadata, + objc.ObjCBlock handler, + ) { + return _sec_protocol_metadata_access_peer_certificate_chain( + metadata.ref.pointer, + handler.ref.pointer, + ); + } + + late final _sec_protocol_metadata_access_peer_certificate_chainPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function( + sec_protocol_metadata_t, ffi.Pointer)>>( + 'sec_protocol_metadata_access_peer_certificate_chain'); + late final _sec_protocol_metadata_access_peer_certificate_chain = + _sec_protocol_metadata_access_peer_certificate_chainPtr.asFunction< + bool Function( + sec_protocol_metadata_t, ffi.Pointer)>(); + + bool sec_protocol_metadata_access_ocsp_response( + Dartsec_protocol_metadata_t metadata, + objc.ObjCBlock handler, + ) { + return _sec_protocol_metadata_access_ocsp_response( + metadata.ref.pointer, + handler.ref.pointer, + ); + } + + late final _sec_protocol_metadata_access_ocsp_responsePtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function( + sec_protocol_metadata_t, ffi.Pointer)>>( + 'sec_protocol_metadata_access_ocsp_response'); + late final _sec_protocol_metadata_access_ocsp_response = + _sec_protocol_metadata_access_ocsp_responsePtr.asFunction< + bool Function( + sec_protocol_metadata_t, ffi.Pointer)>(); + + bool sec_protocol_metadata_access_supported_signature_algorithms( + Dartsec_protocol_metadata_t metadata, + objc.ObjCBlock handler, + ) { + return _sec_protocol_metadata_access_supported_signature_algorithms( + metadata.ref.pointer, + handler.ref.pointer, + ); + } + + late final _sec_protocol_metadata_access_supported_signature_algorithmsPtr = + _lookup< + ffi.NativeFunction< + ffi.Bool Function(sec_protocol_metadata_t, + ffi.Pointer)>>( + 'sec_protocol_metadata_access_supported_signature_algorithms'); + late final _sec_protocol_metadata_access_supported_signature_algorithms = + _sec_protocol_metadata_access_supported_signature_algorithmsPtr + .asFunction< + bool Function( + sec_protocol_metadata_t, ffi.Pointer)>(); + + bool sec_protocol_metadata_access_distinguished_names( + Dartsec_protocol_metadata_t metadata, + objc.ObjCBlock handler, + ) { + return _sec_protocol_metadata_access_distinguished_names( + metadata.ref.pointer, + handler.ref.pointer, + ); + } + + late final _sec_protocol_metadata_access_distinguished_namesPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function( + sec_protocol_metadata_t, ffi.Pointer)>>( + 'sec_protocol_metadata_access_distinguished_names'); + late final _sec_protocol_metadata_access_distinguished_names = + _sec_protocol_metadata_access_distinguished_namesPtr.asFunction< + bool Function( + sec_protocol_metadata_t, ffi.Pointer)>(); + + bool sec_protocol_metadata_access_pre_shared_keys( + Dartsec_protocol_metadata_t metadata, + objc.ObjCBlock handler, + ) { + return _sec_protocol_metadata_access_pre_shared_keys( + metadata.ref.pointer, + handler.ref.pointer, + ); + } + + late final _sec_protocol_metadata_access_pre_shared_keysPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function( + sec_protocol_metadata_t, ffi.Pointer)>>( + 'sec_protocol_metadata_access_pre_shared_keys'); + late final _sec_protocol_metadata_access_pre_shared_keys = + _sec_protocol_metadata_access_pre_shared_keysPtr.asFunction< + bool Function( + sec_protocol_metadata_t, ffi.Pointer)>(); + + ffi.Pointer sec_protocol_metadata_get_server_name( + Dartsec_protocol_metadata_t metadata, + ) { + return _sec_protocol_metadata_get_server_name( + metadata.ref.pointer, + ); + } + + late final _sec_protocol_metadata_get_server_namePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(sec_protocol_metadata_t)>>( + 'sec_protocol_metadata_get_server_name'); + late final _sec_protocol_metadata_get_server_name = + _sec_protocol_metadata_get_server_namePtr.asFunction< + ffi.Pointer Function(sec_protocol_metadata_t)>(); + + bool sec_protocol_metadata_peers_are_equal( + Dartsec_protocol_metadata_t metadataA, + Dartsec_protocol_metadata_t metadataB, + ) { + return _sec_protocol_metadata_peers_are_equal( + metadataA.ref.pointer, + metadataB.ref.pointer, + ); + } + + late final _sec_protocol_metadata_peers_are_equalPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function( + sec_protocol_metadata_t, sec_protocol_metadata_t)>>( + 'sec_protocol_metadata_peers_are_equal'); + late final _sec_protocol_metadata_peers_are_equal = + _sec_protocol_metadata_peers_are_equalPtr.asFunction< + bool Function(sec_protocol_metadata_t, sec_protocol_metadata_t)>(); + + bool sec_protocol_metadata_challenge_parameters_are_equal( + Dartsec_protocol_metadata_t metadataA, + Dartsec_protocol_metadata_t metadataB, + ) { + return _sec_protocol_metadata_challenge_parameters_are_equal( + metadataA.ref.pointer, + metadataB.ref.pointer, + ); + } + + late final _sec_protocol_metadata_challenge_parameters_are_equalPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function( + sec_protocol_metadata_t, sec_protocol_metadata_t)>>( + 'sec_protocol_metadata_challenge_parameters_are_equal'); + late final _sec_protocol_metadata_challenge_parameters_are_equal = + _sec_protocol_metadata_challenge_parameters_are_equalPtr.asFunction< + bool Function(sec_protocol_metadata_t, sec_protocol_metadata_t)>(); + + Dartdispatch_data_t? sec_protocol_metadata_create_secret( + Dartsec_protocol_metadata_t metadata, + int label_len, + ffi.Pointer label, + int exporter_length, + ) { + return _sec_protocol_metadata_create_secret( + metadata.ref.pointer, + label_len, + label, + exporter_length, + ).address == + 0 + ? null + : objc.NSObject.castFromPointer( + _sec_protocol_metadata_create_secret( + metadata.ref.pointer, + label_len, + label, + exporter_length, + ), + retain: false, + release: true); + } + + late final _sec_protocol_metadata_create_secretPtr = _lookup< + ffi.NativeFunction< + dispatch_data_t Function( + sec_protocol_metadata_t, + ffi.Size, + ffi.Pointer, + ffi.Size)>>('sec_protocol_metadata_create_secret'); + late final _sec_protocol_metadata_create_secret = + _sec_protocol_metadata_create_secretPtr.asFunction< + dispatch_data_t Function( + sec_protocol_metadata_t, int, ffi.Pointer, int)>(); + + Dartdispatch_data_t? sec_protocol_metadata_create_secret_with_context( + Dartsec_protocol_metadata_t metadata, + int label_len, + ffi.Pointer label, + int context_len, + ffi.Pointer context, + int exporter_length, + ) { + return _sec_protocol_metadata_create_secret_with_context( + metadata.ref.pointer, + label_len, + label, + context_len, + context, + exporter_length, + ).address == + 0 + ? null + : objc.NSObject.castFromPointer( + _sec_protocol_metadata_create_secret_with_context( + metadata.ref.pointer, + label_len, + label, + context_len, + context, + exporter_length, + ), + retain: false, + release: true); + } + + late final _sec_protocol_metadata_create_secret_with_contextPtr = _lookup< + ffi.NativeFunction< + dispatch_data_t Function( + sec_protocol_metadata_t, + ffi.Size, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Size)>>('sec_protocol_metadata_create_secret_with_context'); + late final _sec_protocol_metadata_create_secret_with_context = + _sec_protocol_metadata_create_secret_with_contextPtr.asFunction< + dispatch_data_t Function(sec_protocol_metadata_t, int, + ffi.Pointer, int, ffi.Pointer, int)>(); + + bool sec_protocol_options_are_equal( + Dartsec_protocol_options_t optionsA, + Dartsec_protocol_options_t optionsB, + ) { + return _sec_protocol_options_are_equal( + optionsA.ref.pointer, + optionsB.ref.pointer, + ); + } + + late final _sec_protocol_options_are_equalPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function(sec_protocol_options_t, + sec_protocol_options_t)>>('sec_protocol_options_are_equal'); + late final _sec_protocol_options_are_equal = + _sec_protocol_options_are_equalPtr.asFunction< + bool Function(sec_protocol_options_t, sec_protocol_options_t)>(); + + void sec_protocol_options_set_local_identity( + Dartsec_protocol_options_t options, + Dartsec_identity_t identity, + ) { + return _sec_protocol_options_set_local_identity( + options.ref.pointer, + identity.ref.pointer, + ); + } + + late final _sec_protocol_options_set_local_identityPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, + sec_identity_t)>>('sec_protocol_options_set_local_identity'); + late final _sec_protocol_options_set_local_identity = + _sec_protocol_options_set_local_identityPtr + .asFunction(); + + void sec_protocol_options_append_tls_ciphersuite( + Dartsec_protocol_options_t options, + tls_ciphersuite_t ciphersuite, + ) { + return _sec_protocol_options_append_tls_ciphersuite( + options.ref.pointer, + ciphersuite.value, + ); + } + + late final _sec_protocol_options_append_tls_ciphersuitePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, + ffi.Uint16)>>('sec_protocol_options_append_tls_ciphersuite'); + late final _sec_protocol_options_append_tls_ciphersuite = + _sec_protocol_options_append_tls_ciphersuitePtr + .asFunction(); + + void sec_protocol_options_add_tls_ciphersuite( + Dartsec_protocol_options_t options, + DartSSLCipherSuite ciphersuite, + ) { + return _sec_protocol_options_add_tls_ciphersuite( + options.ref.pointer, + ciphersuite, + ); + } + + late final _sec_protocol_options_add_tls_ciphersuitePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, + SSLCipherSuite)>>('sec_protocol_options_add_tls_ciphersuite'); + late final _sec_protocol_options_add_tls_ciphersuite = + _sec_protocol_options_add_tls_ciphersuitePtr + .asFunction(); + + void sec_protocol_options_append_tls_ciphersuite_group( + Dartsec_protocol_options_t options, + tls_ciphersuite_group_t group, + ) { + return _sec_protocol_options_append_tls_ciphersuite_group( + options.ref.pointer, + group.value, + ); + } + + late final _sec_protocol_options_append_tls_ciphersuite_groupPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, ffi.Uint16)>>( + 'sec_protocol_options_append_tls_ciphersuite_group'); + late final _sec_protocol_options_append_tls_ciphersuite_group = + _sec_protocol_options_append_tls_ciphersuite_groupPtr + .asFunction(); + + void sec_protocol_options_add_tls_ciphersuite_group( + Dartsec_protocol_options_t options, + SSLCiphersuiteGroup group, + ) { + return _sec_protocol_options_add_tls_ciphersuite_group( + options.ref.pointer, + group.value, + ); + } + + late final _sec_protocol_options_add_tls_ciphersuite_groupPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, ffi.UnsignedInt)>>( + 'sec_protocol_options_add_tls_ciphersuite_group'); + late final _sec_protocol_options_add_tls_ciphersuite_group = + _sec_protocol_options_add_tls_ciphersuite_groupPtr + .asFunction(); + + void sec_protocol_options_set_tls_min_version( + Dartsec_protocol_options_t options, + SSLProtocol version, + ) { + return _sec_protocol_options_set_tls_min_version( + options.ref.pointer, + version.value, + ); + } + + late final _sec_protocol_options_set_tls_min_versionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, + ffi.UnsignedInt)>>('sec_protocol_options_set_tls_min_version'); + late final _sec_protocol_options_set_tls_min_version = + _sec_protocol_options_set_tls_min_versionPtr + .asFunction(); + + void sec_protocol_options_set_min_tls_protocol_version( + Dartsec_protocol_options_t options, + tls_protocol_version_t version, + ) { + return _sec_protocol_options_set_min_tls_protocol_version( + options.ref.pointer, + version.value, + ); + } + + late final _sec_protocol_options_set_min_tls_protocol_versionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, ffi.Uint16)>>( + 'sec_protocol_options_set_min_tls_protocol_version'); + late final _sec_protocol_options_set_min_tls_protocol_version = + _sec_protocol_options_set_min_tls_protocol_versionPtr + .asFunction(); + + tls_protocol_version_t + sec_protocol_options_get_default_min_tls_protocol_version() { + return tls_protocol_version_t.fromValue( + _sec_protocol_options_get_default_min_tls_protocol_version()); + } + + late final _sec_protocol_options_get_default_min_tls_protocol_versionPtr = + _lookup>( + 'sec_protocol_options_get_default_min_tls_protocol_version'); + late final _sec_protocol_options_get_default_min_tls_protocol_version = + _sec_protocol_options_get_default_min_tls_protocol_versionPtr + .asFunction(); + + tls_protocol_version_t + sec_protocol_options_get_default_min_dtls_protocol_version() { + return tls_protocol_version_t.fromValue( + _sec_protocol_options_get_default_min_dtls_protocol_version()); + } + + late final _sec_protocol_options_get_default_min_dtls_protocol_versionPtr = + _lookup>( + 'sec_protocol_options_get_default_min_dtls_protocol_version'); + late final _sec_protocol_options_get_default_min_dtls_protocol_version = + _sec_protocol_options_get_default_min_dtls_protocol_versionPtr + .asFunction(); + + void sec_protocol_options_set_tls_max_version( + Dartsec_protocol_options_t options, + SSLProtocol version, + ) { + return _sec_protocol_options_set_tls_max_version( + options.ref.pointer, + version.value, + ); + } + + late final _sec_protocol_options_set_tls_max_versionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, + ffi.UnsignedInt)>>('sec_protocol_options_set_tls_max_version'); + late final _sec_protocol_options_set_tls_max_version = + _sec_protocol_options_set_tls_max_versionPtr + .asFunction(); + + void sec_protocol_options_set_max_tls_protocol_version( + Dartsec_protocol_options_t options, + tls_protocol_version_t version, + ) { + return _sec_protocol_options_set_max_tls_protocol_version( + options.ref.pointer, + version.value, + ); + } + + late final _sec_protocol_options_set_max_tls_protocol_versionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, ffi.Uint16)>>( + 'sec_protocol_options_set_max_tls_protocol_version'); + late final _sec_protocol_options_set_max_tls_protocol_version = + _sec_protocol_options_set_max_tls_protocol_versionPtr + .asFunction(); + + tls_protocol_version_t + sec_protocol_options_get_default_max_tls_protocol_version() { + return tls_protocol_version_t.fromValue( + _sec_protocol_options_get_default_max_tls_protocol_version()); + } + + late final _sec_protocol_options_get_default_max_tls_protocol_versionPtr = + _lookup>( + 'sec_protocol_options_get_default_max_tls_protocol_version'); + late final _sec_protocol_options_get_default_max_tls_protocol_version = + _sec_protocol_options_get_default_max_tls_protocol_versionPtr + .asFunction(); + + tls_protocol_version_t + sec_protocol_options_get_default_max_dtls_protocol_version() { + return tls_protocol_version_t.fromValue( + _sec_protocol_options_get_default_max_dtls_protocol_version()); + } + + late final _sec_protocol_options_get_default_max_dtls_protocol_versionPtr = + _lookup>( + 'sec_protocol_options_get_default_max_dtls_protocol_version'); + late final _sec_protocol_options_get_default_max_dtls_protocol_version = + _sec_protocol_options_get_default_max_dtls_protocol_versionPtr + .asFunction(); + + bool sec_protocol_options_get_enable_encrypted_client_hello( + Dartsec_protocol_options_t options, + ) { + return _sec_protocol_options_get_enable_encrypted_client_hello( + options.ref.pointer, + ); + } + + late final _sec_protocol_options_get_enable_encrypted_client_helloPtr = + _lookup>( + 'sec_protocol_options_get_enable_encrypted_client_hello'); + late final _sec_protocol_options_get_enable_encrypted_client_hello = + _sec_protocol_options_get_enable_encrypted_client_helloPtr + .asFunction(); + + bool sec_protocol_options_get_quic_use_legacy_codepoint( + Dartsec_protocol_options_t options, + ) { + return _sec_protocol_options_get_quic_use_legacy_codepoint( + options.ref.pointer, + ); + } + + late final _sec_protocol_options_get_quic_use_legacy_codepointPtr = + _lookup>( + 'sec_protocol_options_get_quic_use_legacy_codepoint'); + late final _sec_protocol_options_get_quic_use_legacy_codepoint = + _sec_protocol_options_get_quic_use_legacy_codepointPtr + .asFunction(); + + void sec_protocol_options_add_tls_application_protocol( + Dartsec_protocol_options_t options, + ffi.Pointer application_protocol, + ) { + return _sec_protocol_options_add_tls_application_protocol( + options.ref.pointer, + application_protocol, + ); + } + + late final _sec_protocol_options_add_tls_application_protocolPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + sec_protocol_options_t, ffi.Pointer)>>( + 'sec_protocol_options_add_tls_application_protocol'); + late final _sec_protocol_options_add_tls_application_protocol = + _sec_protocol_options_add_tls_application_protocolPtr.asFunction< + void Function(sec_protocol_options_t, ffi.Pointer)>(); + + void sec_protocol_options_set_tls_server_name( + Dartsec_protocol_options_t options, + ffi.Pointer server_name, + ) { + return _sec_protocol_options_set_tls_server_name( + options.ref.pointer, + server_name, + ); + } + + late final _sec_protocol_options_set_tls_server_namePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + sec_protocol_options_t, ffi.Pointer)>>( + 'sec_protocol_options_set_tls_server_name'); + late final _sec_protocol_options_set_tls_server_name = + _sec_protocol_options_set_tls_server_namePtr.asFunction< + void Function(sec_protocol_options_t, ffi.Pointer)>(); + + void sec_protocol_options_set_tls_diffie_hellman_parameters( + Dartsec_protocol_options_t options, + Dartdispatch_data_t params, + ) { + return _sec_protocol_options_set_tls_diffie_hellman_parameters( + options.ref.pointer, + params.ref.pointer, + ); + } + + late final _sec_protocol_options_set_tls_diffie_hellman_parametersPtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, dispatch_data_t)>>( + 'sec_protocol_options_set_tls_diffie_hellman_parameters'); + late final _sec_protocol_options_set_tls_diffie_hellman_parameters = + _sec_protocol_options_set_tls_diffie_hellman_parametersPtr + .asFunction(); + + void sec_protocol_options_add_pre_shared_key( + Dartsec_protocol_options_t options, + Dartdispatch_data_t psk, + Dartdispatch_data_t psk_identity, + ) { + return _sec_protocol_options_add_pre_shared_key( + options.ref.pointer, + psk.ref.pointer, + psk_identity.ref.pointer, + ); + } + + late final _sec_protocol_options_add_pre_shared_keyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, dispatch_data_t, + dispatch_data_t)>>('sec_protocol_options_add_pre_shared_key'); + late final _sec_protocol_options_add_pre_shared_key = + _sec_protocol_options_add_pre_shared_keyPtr.asFunction< + void Function( + sec_protocol_options_t, dispatch_data_t, dispatch_data_t)>(); + + void sec_protocol_options_set_tls_pre_shared_key_identity_hint( + Dartsec_protocol_options_t options, + Dartdispatch_data_t psk_identity_hint, + ) { + return _sec_protocol_options_set_tls_pre_shared_key_identity_hint( + options.ref.pointer, + psk_identity_hint.ref.pointer, + ); + } + + late final _sec_protocol_options_set_tls_pre_shared_key_identity_hintPtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, dispatch_data_t)>>( + 'sec_protocol_options_set_tls_pre_shared_key_identity_hint'); + late final _sec_protocol_options_set_tls_pre_shared_key_identity_hint = + _sec_protocol_options_set_tls_pre_shared_key_identity_hintPtr + .asFunction(); + + void sec_protocol_options_set_pre_shared_key_selection_block( + Dartsec_protocol_options_t options, + Dartsec_protocol_pre_shared_key_selection_t psk_selection_block, + Dartdispatch_queue_t psk_selection_queue, + ) { + return _sec_protocol_options_set_pre_shared_key_selection_block( + options.ref.pointer, + psk_selection_block.ref.pointer, + psk_selection_queue.ref.pointer, + ); + } + + late final _sec_protocol_options_set_pre_shared_key_selection_blockPtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function( + sec_protocol_options_t, + sec_protocol_pre_shared_key_selection_t, + dispatch_queue_t)>>( + 'sec_protocol_options_set_pre_shared_key_selection_block'); + late final _sec_protocol_options_set_pre_shared_key_selection_block = + _sec_protocol_options_set_pre_shared_key_selection_blockPtr.asFunction< + void Function(sec_protocol_options_t, + sec_protocol_pre_shared_key_selection_t, dispatch_queue_t)>(); + + void sec_protocol_options_set_tls_tickets_enabled( + Dartsec_protocol_options_t options, + bool tickets_enabled, + ) { + return _sec_protocol_options_set_tls_tickets_enabled( + options.ref.pointer, + tickets_enabled, + ); + } + + late final _sec_protocol_options_set_tls_tickets_enabledPtr = _lookup< + ffi + .NativeFunction>( + 'sec_protocol_options_set_tls_tickets_enabled'); + late final _sec_protocol_options_set_tls_tickets_enabled = + _sec_protocol_options_set_tls_tickets_enabledPtr + .asFunction(); + + void sec_protocol_options_set_tls_is_fallback_attempt( + Dartsec_protocol_options_t options, + bool is_fallback_attempt, + ) { + return _sec_protocol_options_set_tls_is_fallback_attempt( + options.ref.pointer, + is_fallback_attempt, + ); + } + + late final _sec_protocol_options_set_tls_is_fallback_attemptPtr = _lookup< + ffi + .NativeFunction>( + 'sec_protocol_options_set_tls_is_fallback_attempt'); + late final _sec_protocol_options_set_tls_is_fallback_attempt = + _sec_protocol_options_set_tls_is_fallback_attemptPtr + .asFunction(); + + void sec_protocol_options_set_tls_resumption_enabled( + Dartsec_protocol_options_t options, + bool resumption_enabled, + ) { + return _sec_protocol_options_set_tls_resumption_enabled( + options.ref.pointer, + resumption_enabled, + ); + } + + late final _sec_protocol_options_set_tls_resumption_enabledPtr = _lookup< + ffi + .NativeFunction>( + 'sec_protocol_options_set_tls_resumption_enabled'); + late final _sec_protocol_options_set_tls_resumption_enabled = + _sec_protocol_options_set_tls_resumption_enabledPtr + .asFunction(); + + void sec_protocol_options_set_tls_false_start_enabled( + Dartsec_protocol_options_t options, + bool false_start_enabled, + ) { + return _sec_protocol_options_set_tls_false_start_enabled( + options.ref.pointer, + false_start_enabled, + ); + } + + late final _sec_protocol_options_set_tls_false_start_enabledPtr = _lookup< + ffi + .NativeFunction>( + 'sec_protocol_options_set_tls_false_start_enabled'); + late final _sec_protocol_options_set_tls_false_start_enabled = + _sec_protocol_options_set_tls_false_start_enabledPtr + .asFunction(); + + void sec_protocol_options_set_tls_ocsp_enabled( + Dartsec_protocol_options_t options, + bool ocsp_enabled, + ) { + return _sec_protocol_options_set_tls_ocsp_enabled( + options.ref.pointer, + ocsp_enabled, + ); + } + + late final _sec_protocol_options_set_tls_ocsp_enabledPtr = _lookup< + ffi + .NativeFunction>( + 'sec_protocol_options_set_tls_ocsp_enabled'); + late final _sec_protocol_options_set_tls_ocsp_enabled = + _sec_protocol_options_set_tls_ocsp_enabledPtr + .asFunction(); + + void sec_protocol_options_set_tls_sct_enabled( + Dartsec_protocol_options_t options, + bool sct_enabled, + ) { + return _sec_protocol_options_set_tls_sct_enabled( + options.ref.pointer, + sct_enabled, + ); + } + + late final _sec_protocol_options_set_tls_sct_enabledPtr = _lookup< + ffi + .NativeFunction>( + 'sec_protocol_options_set_tls_sct_enabled'); + late final _sec_protocol_options_set_tls_sct_enabled = + _sec_protocol_options_set_tls_sct_enabledPtr + .asFunction(); + + void sec_protocol_options_set_tls_renegotiation_enabled( + Dartsec_protocol_options_t options, + bool renegotiation_enabled, + ) { + return _sec_protocol_options_set_tls_renegotiation_enabled( + options.ref.pointer, + renegotiation_enabled, + ); + } + + late final _sec_protocol_options_set_tls_renegotiation_enabledPtr = _lookup< + ffi + .NativeFunction>( + 'sec_protocol_options_set_tls_renegotiation_enabled'); + late final _sec_protocol_options_set_tls_renegotiation_enabled = + _sec_protocol_options_set_tls_renegotiation_enabledPtr + .asFunction(); + + void sec_protocol_options_set_peer_authentication_required( + Dartsec_protocol_options_t options, + bool peer_authentication_required, + ) { + return _sec_protocol_options_set_peer_authentication_required( + options.ref.pointer, + peer_authentication_required, + ); + } + + late final _sec_protocol_options_set_peer_authentication_requiredPtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, ffi.Bool)>>( + 'sec_protocol_options_set_peer_authentication_required'); + late final _sec_protocol_options_set_peer_authentication_required = + _sec_protocol_options_set_peer_authentication_requiredPtr + .asFunction(); + + void sec_protocol_options_set_peer_authentication_optional( + Dartsec_protocol_options_t options, + bool peer_authentication_optional, + ) { + return _sec_protocol_options_set_peer_authentication_optional( + options.ref.pointer, + peer_authentication_optional, + ); + } + + late final _sec_protocol_options_set_peer_authentication_optionalPtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, ffi.Bool)>>( + 'sec_protocol_options_set_peer_authentication_optional'); + late final _sec_protocol_options_set_peer_authentication_optional = + _sec_protocol_options_set_peer_authentication_optionalPtr + .asFunction(); + + void sec_protocol_options_set_enable_encrypted_client_hello( + Dartsec_protocol_options_t options, + bool enable_encrypted_client_hello, + ) { + return _sec_protocol_options_set_enable_encrypted_client_hello( + options.ref.pointer, + enable_encrypted_client_hello, + ); + } + + late final _sec_protocol_options_set_enable_encrypted_client_helloPtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, ffi.Bool)>>( + 'sec_protocol_options_set_enable_encrypted_client_hello'); + late final _sec_protocol_options_set_enable_encrypted_client_hello = + _sec_protocol_options_set_enable_encrypted_client_helloPtr + .asFunction(); + + void sec_protocol_options_set_quic_use_legacy_codepoint( + Dartsec_protocol_options_t options, + bool quic_use_legacy_codepoint, + ) { + return _sec_protocol_options_set_quic_use_legacy_codepoint( + options.ref.pointer, + quic_use_legacy_codepoint, + ); + } + + late final _sec_protocol_options_set_quic_use_legacy_codepointPtr = _lookup< + ffi + .NativeFunction>( + 'sec_protocol_options_set_quic_use_legacy_codepoint'); + late final _sec_protocol_options_set_quic_use_legacy_codepoint = + _sec_protocol_options_set_quic_use_legacy_codepointPtr + .asFunction(); + + void sec_protocol_options_set_key_update_block( + Dartsec_protocol_options_t options, + Dartsec_protocol_key_update_t key_update_block, + Dartdispatch_queue_t key_update_queue, + ) { + return _sec_protocol_options_set_key_update_block( + options.ref.pointer, + key_update_block.ref.pointer, + key_update_queue.ref.pointer, + ); + } + + late final _sec_protocol_options_set_key_update_blockPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, sec_protocol_key_update_t, + dispatch_queue_t)>>('sec_protocol_options_set_key_update_block'); + late final _sec_protocol_options_set_key_update_block = + _sec_protocol_options_set_key_update_blockPtr.asFunction< + void Function(sec_protocol_options_t, sec_protocol_key_update_t, + dispatch_queue_t)>(); + + void sec_protocol_options_set_challenge_block( + Dartsec_protocol_options_t options, + Dartsec_protocol_challenge_t challenge_block, + Dartdispatch_queue_t challenge_queue, + ) { + return _sec_protocol_options_set_challenge_block( + options.ref.pointer, + challenge_block.ref.pointer, + challenge_queue.ref.pointer, + ); + } + + late final _sec_protocol_options_set_challenge_blockPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, sec_protocol_challenge_t, + dispatch_queue_t)>>('sec_protocol_options_set_challenge_block'); + late final _sec_protocol_options_set_challenge_block = + _sec_protocol_options_set_challenge_blockPtr.asFunction< + void Function(sec_protocol_options_t, sec_protocol_challenge_t, + dispatch_queue_t)>(); + + void sec_protocol_options_set_verify_block( + Dartsec_protocol_options_t options, + Dartsec_protocol_verify_t verify_block, + Dartdispatch_queue_t verify_block_queue, + ) { + return _sec_protocol_options_set_verify_block( + options.ref.pointer, + verify_block.ref.pointer, + verify_block_queue.ref.pointer, + ); + } + + late final _sec_protocol_options_set_verify_blockPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_options_t, sec_protocol_verify_t, + dispatch_queue_t)>>('sec_protocol_options_set_verify_block'); + late final _sec_protocol_options_set_verify_block = + _sec_protocol_options_set_verify_blockPtr.asFunction< + void Function(sec_protocol_options_t, sec_protocol_verify_t, + dispatch_queue_t)>(); + + late final ffi.Pointer _kSSLSessionConfig_default = + _lookup('kSSLSessionConfig_default'); + + CFStringRef get kSSLSessionConfig_default => _kSSLSessionConfig_default.value; + + set kSSLSessionConfig_default(CFStringRef value) => + _kSSLSessionConfig_default.value = value; + + late final ffi.Pointer _kSSLSessionConfig_ATSv1 = + _lookup('kSSLSessionConfig_ATSv1'); + + CFStringRef get kSSLSessionConfig_ATSv1 => _kSSLSessionConfig_ATSv1.value; + + set kSSLSessionConfig_ATSv1(CFStringRef value) => + _kSSLSessionConfig_ATSv1.value = value; + + late final ffi.Pointer _kSSLSessionConfig_ATSv1_noPFS = + _lookup('kSSLSessionConfig_ATSv1_noPFS'); + + CFStringRef get kSSLSessionConfig_ATSv1_noPFS => + _kSSLSessionConfig_ATSv1_noPFS.value; + + set kSSLSessionConfig_ATSv1_noPFS(CFStringRef value) => + _kSSLSessionConfig_ATSv1_noPFS.value = value; + + late final ffi.Pointer _kSSLSessionConfig_standard = + _lookup('kSSLSessionConfig_standard'); + + CFStringRef get kSSLSessionConfig_standard => + _kSSLSessionConfig_standard.value; + + set kSSLSessionConfig_standard(CFStringRef value) => + _kSSLSessionConfig_standard.value = value; + + late final ffi.Pointer _kSSLSessionConfig_RC4_fallback = + _lookup('kSSLSessionConfig_RC4_fallback'); + + CFStringRef get kSSLSessionConfig_RC4_fallback => + _kSSLSessionConfig_RC4_fallback.value; + + set kSSLSessionConfig_RC4_fallback(CFStringRef value) => + _kSSLSessionConfig_RC4_fallback.value = value; + + late final ffi.Pointer _kSSLSessionConfig_TLSv1_fallback = + _lookup('kSSLSessionConfig_TLSv1_fallback'); + + CFStringRef get kSSLSessionConfig_TLSv1_fallback => + _kSSLSessionConfig_TLSv1_fallback.value; + + set kSSLSessionConfig_TLSv1_fallback(CFStringRef value) => + _kSSLSessionConfig_TLSv1_fallback.value = value; + + late final ffi.Pointer _kSSLSessionConfig_TLSv1_RC4_fallback = + _lookup('kSSLSessionConfig_TLSv1_RC4_fallback'); + + CFStringRef get kSSLSessionConfig_TLSv1_RC4_fallback => + _kSSLSessionConfig_TLSv1_RC4_fallback.value; + + set kSSLSessionConfig_TLSv1_RC4_fallback(CFStringRef value) => + _kSSLSessionConfig_TLSv1_RC4_fallback.value = value; + + late final ffi.Pointer _kSSLSessionConfig_legacy = + _lookup('kSSLSessionConfig_legacy'); + + CFStringRef get kSSLSessionConfig_legacy => _kSSLSessionConfig_legacy.value; + + set kSSLSessionConfig_legacy(CFStringRef value) => + _kSSLSessionConfig_legacy.value = value; + + late final ffi.Pointer _kSSLSessionConfig_legacy_DHE = + _lookup('kSSLSessionConfig_legacy_DHE'); + + CFStringRef get kSSLSessionConfig_legacy_DHE => + _kSSLSessionConfig_legacy_DHE.value; + + set kSSLSessionConfig_legacy_DHE(CFStringRef value) => + _kSSLSessionConfig_legacy_DHE.value = value; + + late final ffi.Pointer _kSSLSessionConfig_anonymous = + _lookup('kSSLSessionConfig_anonymous'); + + CFStringRef get kSSLSessionConfig_anonymous => + _kSSLSessionConfig_anonymous.value; + + set kSSLSessionConfig_anonymous(CFStringRef value) => + _kSSLSessionConfig_anonymous.value = value; + + late final ffi.Pointer _kSSLSessionConfig_3DES_fallback = + _lookup('kSSLSessionConfig_3DES_fallback'); + + CFStringRef get kSSLSessionConfig_3DES_fallback => + _kSSLSessionConfig_3DES_fallback.value; + + set kSSLSessionConfig_3DES_fallback(CFStringRef value) => + _kSSLSessionConfig_3DES_fallback.value = value; + + late final ffi.Pointer _kSSLSessionConfig_TLSv1_3DES_fallback = + _lookup('kSSLSessionConfig_TLSv1_3DES_fallback'); + + CFStringRef get kSSLSessionConfig_TLSv1_3DES_fallback => + _kSSLSessionConfig_TLSv1_3DES_fallback.value; + + set kSSLSessionConfig_TLSv1_3DES_fallback(CFStringRef value) => + _kSSLSessionConfig_TLSv1_3DES_fallback.value = value; + + int SSLContextGetTypeID() { + return _SSLContextGetTypeID(); + } + + late final _SSLContextGetTypeIDPtr = + _lookup>('SSLContextGetTypeID'); + late final _SSLContextGetTypeID = + _SSLContextGetTypeIDPtr.asFunction(); + + SSLContextRef SSLCreateContext( + CFAllocatorRef alloc, + SSLProtocolSide protocolSide, + SSLConnectionType connectionType, + ) { + return _SSLCreateContext( + alloc, + protocolSide.value, + connectionType.value, + ); + } + + late final _SSLCreateContextPtr = _lookup< + ffi.NativeFunction< + SSLContextRef Function(CFAllocatorRef, ffi.UnsignedInt, + ffi.UnsignedInt)>>('SSLCreateContext'); + late final _SSLCreateContext = _SSLCreateContextPtr.asFunction< + SSLContextRef Function(CFAllocatorRef, int, int)>(); + + int SSLNewContext( + int isServer, + ffi.Pointer contextPtr, + ) { + return _SSLNewContext( + isServer, + contextPtr, + ); + } + + late final _SSLNewContextPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + Boolean, ffi.Pointer)>>('SSLNewContext'); + late final _SSLNewContext = _SSLNewContextPtr.asFunction< + int Function(int, ffi.Pointer)>(); + + int SSLDisposeContext( + SSLContextRef context, + ) { + return _SSLDisposeContext( + context, + ); + } + + late final _SSLDisposeContextPtr = + _lookup>( + 'SSLDisposeContext'); + late final _SSLDisposeContext = + _SSLDisposeContextPtr.asFunction(); + + int SSLGetSessionState( + SSLContextRef context, + ffi.Pointer state, + ) { + return _SSLGetSessionState( + context, + state, + ); + } + + late final _SSLGetSessionStatePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetSessionState'); + late final _SSLGetSessionState = _SSLGetSessionStatePtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + DartSInt32 SSLSetSessionOption( + SSLContextRef context, + SSLSessionOption option, + DartBoolean value, + ) { + return _SSLSetSessionOption( + context, + option.value, + value, + ); + } + + late final _SSLSetSessionOptionPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, ffi.UnsignedInt, Boolean)>>('SSLSetSessionOption'); + late final _SSLSetSessionOption = _SSLSetSessionOptionPtr.asFunction< + int Function(SSLContextRef, int, int)>(); + + DartSInt32 SSLGetSessionOption( + SSLContextRef context, + SSLSessionOption option, + ffi.Pointer value, + ) { + return _SSLGetSessionOption( + context, + option.value, + value, + ); + } + + late final _SSLGetSessionOptionPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.UnsignedInt, + ffi.Pointer)>>('SSLGetSessionOption'); + late final _SSLGetSessionOption = _SSLGetSessionOptionPtr.asFunction< + int Function(SSLContextRef, int, ffi.Pointer)>(); + + int SSLSetIOFuncs( + SSLContextRef context, + SSLReadFunc readFunc, + SSLWriteFunc writeFunc, + ) { + return _SSLSetIOFuncs( + context, + readFunc, + writeFunc, + ); + } + + late final _SSLSetIOFuncsPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, SSLReadFunc, SSLWriteFunc)>>('SSLSetIOFuncs'); + late final _SSLSetIOFuncs = _SSLSetIOFuncsPtr.asFunction< + int Function(SSLContextRef, SSLReadFunc, SSLWriteFunc)>(); + + int SSLSetSessionConfig( + SSLContextRef context, + CFStringRef config, + ) { + return _SSLSetSessionConfig( + context, + config, + ); + } + + late final _SSLSetSessionConfigPtr = _lookup< + ffi.NativeFunction>( + 'SSLSetSessionConfig'); + late final _SSLSetSessionConfig = _SSLSetSessionConfigPtr.asFunction< + int Function(SSLContextRef, CFStringRef)>(); + + DartSInt32 SSLSetProtocolVersionMin( + SSLContextRef context, + SSLProtocol minVersion, + ) { + return _SSLSetProtocolVersionMin( + context, + minVersion.value, + ); + } + + late final _SSLSetProtocolVersionMinPtr = _lookup< + ffi + .NativeFunction>( + 'SSLSetProtocolVersionMin'); + late final _SSLSetProtocolVersionMin = _SSLSetProtocolVersionMinPtr + .asFunction(); + + int SSLGetProtocolVersionMin( + SSLContextRef context, + ffi.Pointer minVersion, + ) { + return _SSLGetProtocolVersionMin( + context, + minVersion, + ); + } + + late final _SSLGetProtocolVersionMinPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetProtocolVersionMin'); + late final _SSLGetProtocolVersionMin = _SSLGetProtocolVersionMinPtr + .asFunction)>(); + + DartSInt32 SSLSetProtocolVersionMax( + SSLContextRef context, + SSLProtocol maxVersion, + ) { + return _SSLSetProtocolVersionMax( + context, + maxVersion.value, + ); + } + + late final _SSLSetProtocolVersionMaxPtr = _lookup< + ffi + .NativeFunction>( + 'SSLSetProtocolVersionMax'); + late final _SSLSetProtocolVersionMax = _SSLSetProtocolVersionMaxPtr + .asFunction(); + + int SSLGetProtocolVersionMax( + SSLContextRef context, + ffi.Pointer maxVersion, + ) { + return _SSLGetProtocolVersionMax( + context, + maxVersion, + ); + } + + late final _SSLGetProtocolVersionMaxPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetProtocolVersionMax'); + late final _SSLGetProtocolVersionMax = _SSLGetProtocolVersionMaxPtr + .asFunction)>(); + + DartSInt32 SSLSetProtocolVersionEnabled( + SSLContextRef context, + SSLProtocol protocol, + DartBoolean enable, + ) { + return _SSLSetProtocolVersionEnabled( + context, + protocol.value, + enable, + ); + } + + late final _SSLSetProtocolVersionEnabledPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.UnsignedInt, + Boolean)>>('SSLSetProtocolVersionEnabled'); + late final _SSLSetProtocolVersionEnabled = _SSLSetProtocolVersionEnabledPtr + .asFunction(); + + DartSInt32 SSLGetProtocolVersionEnabled( + SSLContextRef context, + SSLProtocol protocol, + ffi.Pointer enable, + ) { + return _SSLGetProtocolVersionEnabled( + context, + protocol.value, + enable, + ); + } + + late final _SSLGetProtocolVersionEnabledPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.UnsignedInt, + ffi.Pointer)>>('SSLGetProtocolVersionEnabled'); + late final _SSLGetProtocolVersionEnabled = _SSLGetProtocolVersionEnabledPtr + .asFunction)>(); + + DartSInt32 SSLSetProtocolVersion( + SSLContextRef context, + SSLProtocol version, + ) { + return _SSLSetProtocolVersion( + context, + version.value, + ); + } + + late final _SSLSetProtocolVersionPtr = _lookup< + ffi + .NativeFunction>( + 'SSLSetProtocolVersion'); + late final _SSLSetProtocolVersion = + _SSLSetProtocolVersionPtr.asFunction(); + + int SSLGetProtocolVersion( + SSLContextRef context, + ffi.Pointer protocol, + ) { + return _SSLGetProtocolVersion( + context, + protocol, + ); + } + + late final _SSLGetProtocolVersionPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetProtocolVersion'); + late final _SSLGetProtocolVersion = _SSLGetProtocolVersionPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLSetCertificate( + SSLContextRef context, + CFArrayRef certRefs, + ) { + return _SSLSetCertificate( + context, + certRefs, + ); + } + + late final _SSLSetCertificatePtr = + _lookup>( + 'SSLSetCertificate'); + late final _SSLSetCertificate = _SSLSetCertificatePtr.asFunction< + int Function(SSLContextRef, CFArrayRef)>(); + + int SSLSetConnection( + SSLContextRef context, + SSLConnectionRef connection, + ) { + return _SSLSetConnection( + context, + connection, + ); + } + + late final _SSLSetConnectionPtr = _lookup< + ffi + .NativeFunction>( + 'SSLSetConnection'); + late final _SSLSetConnection = _SSLSetConnectionPtr.asFunction< + int Function(SSLContextRef, SSLConnectionRef)>(); + + int SSLGetConnection( + SSLContextRef context, + ffi.Pointer connection, + ) { + return _SSLGetConnection( + context, + connection, + ); + } + + late final _SSLGetConnectionPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetConnection'); + late final _SSLGetConnection = _SSLGetConnectionPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLSetPeerDomainName( + SSLContextRef context, + ffi.Pointer peerName, + int peerNameLen, + ) { + return _SSLSetPeerDomainName( + context, + peerName, + peerNameLen, + ); + } + + late final _SSLSetPeerDomainNamePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, + ffi.Size)>>('SSLSetPeerDomainName'); + late final _SSLSetPeerDomainName = _SSLSetPeerDomainNamePtr.asFunction< + int Function(SSLContextRef, ffi.Pointer, int)>(); + + int SSLGetPeerDomainNameLength( + SSLContextRef context, + ffi.Pointer peerNameLen, + ) { + return _SSLGetPeerDomainNameLength( + context, + peerNameLen, + ); + } + + late final _SSLGetPeerDomainNameLengthPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetPeerDomainNameLength'); + late final _SSLGetPeerDomainNameLength = _SSLGetPeerDomainNameLengthPtr + .asFunction)>(); + + int SSLGetPeerDomainName( + SSLContextRef context, + ffi.Pointer peerName, + ffi.Pointer peerNameLen, + ) { + return _SSLGetPeerDomainName( + context, + peerName, + peerNameLen, + ); + } + + late final _SSLGetPeerDomainNamePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, + ffi.Pointer)>>('SSLGetPeerDomainName'); + late final _SSLGetPeerDomainName = _SSLGetPeerDomainNamePtr.asFunction< + int Function( + SSLContextRef, ffi.Pointer, ffi.Pointer)>(); + + int SSLCopyRequestedPeerNameLength( + SSLContextRef ctx, + ffi.Pointer peerNameLen, + ) { + return _SSLCopyRequestedPeerNameLength( + ctx, + peerNameLen, + ); + } + + late final _SSLCopyRequestedPeerNameLengthPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLCopyRequestedPeerNameLength'); + late final _SSLCopyRequestedPeerNameLength = + _SSLCopyRequestedPeerNameLengthPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLCopyRequestedPeerName( + SSLContextRef context, + ffi.Pointer peerName, + ffi.Pointer peerNameLen, + ) { + return _SSLCopyRequestedPeerName( + context, + peerName, + peerNameLen, + ); + } + + late final _SSLCopyRequestedPeerNamePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, + ffi.Pointer)>>('SSLCopyRequestedPeerName'); + late final _SSLCopyRequestedPeerName = + _SSLCopyRequestedPeerNamePtr.asFunction< + int Function( + SSLContextRef, ffi.Pointer, ffi.Pointer)>(); + + int SSLSetDatagramHelloCookie( + SSLContextRef dtlsContext, + ffi.Pointer cookie, + int cookieLen, + ) { + return _SSLSetDatagramHelloCookie( + dtlsContext, + cookie, + cookieLen, + ); + } + + late final _SSLSetDatagramHelloCookiePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, + ffi.Size)>>('SSLSetDatagramHelloCookie'); + late final _SSLSetDatagramHelloCookie = _SSLSetDatagramHelloCookiePtr + .asFunction, int)>(); + + int SSLSetMaxDatagramRecordSize( + SSLContextRef dtlsContext, + int maxSize, + ) { + return _SSLSetMaxDatagramRecordSize( + dtlsContext, + maxSize, + ); + } + + late final _SSLSetMaxDatagramRecordSizePtr = + _lookup>( + 'SSLSetMaxDatagramRecordSize'); + late final _SSLSetMaxDatagramRecordSize = _SSLSetMaxDatagramRecordSizePtr + .asFunction(); + + int SSLGetMaxDatagramRecordSize( + SSLContextRef dtlsContext, + ffi.Pointer maxSize, + ) { + return _SSLGetMaxDatagramRecordSize( + dtlsContext, + maxSize, + ); + } + + late final _SSLGetMaxDatagramRecordSizePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetMaxDatagramRecordSize'); + late final _SSLGetMaxDatagramRecordSize = _SSLGetMaxDatagramRecordSizePtr + .asFunction)>(); + + int SSLGetNegotiatedProtocolVersion( + SSLContextRef context, + ffi.Pointer protocol, + ) { + return _SSLGetNegotiatedProtocolVersion( + context, + protocol, + ); + } + + late final _SSLGetNegotiatedProtocolVersionPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer)>>( + 'SSLGetNegotiatedProtocolVersion'); + late final _SSLGetNegotiatedProtocolVersion = + _SSLGetNegotiatedProtocolVersionPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLGetNumberSupportedCiphers( + SSLContextRef context, + ffi.Pointer numCiphers, + ) { + return _SSLGetNumberSupportedCiphers( + context, + numCiphers, + ); + } + + late final _SSLGetNumberSupportedCiphersPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetNumberSupportedCiphers'); + late final _SSLGetNumberSupportedCiphers = _SSLGetNumberSupportedCiphersPtr + .asFunction)>(); + + int SSLGetSupportedCiphers( + SSLContextRef context, + ffi.Pointer ciphers, + ffi.Pointer numCiphers, + ) { + return _SSLGetSupportedCiphers( + context, + ciphers, + numCiphers, + ); + } + + late final _SSLGetSupportedCiphersPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, + ffi.Pointer)>>('SSLGetSupportedCiphers'); + late final _SSLGetSupportedCiphers = _SSLGetSupportedCiphersPtr.asFunction< + int Function( + SSLContextRef, ffi.Pointer, ffi.Pointer)>(); + + int SSLGetNumberEnabledCiphers( + SSLContextRef context, + ffi.Pointer numCiphers, + ) { + return _SSLGetNumberEnabledCiphers( + context, + numCiphers, + ); + } + + late final _SSLGetNumberEnabledCiphersPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetNumberEnabledCiphers'); + late final _SSLGetNumberEnabledCiphers = _SSLGetNumberEnabledCiphersPtr + .asFunction)>(); + + int SSLSetEnabledCiphers( + SSLContextRef context, + ffi.Pointer ciphers, + int numCiphers, + ) { + return _SSLSetEnabledCiphers( + context, + ciphers, + numCiphers, + ); + } + + late final _SSLSetEnabledCiphersPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, + ffi.Size)>>('SSLSetEnabledCiphers'); + late final _SSLSetEnabledCiphers = _SSLSetEnabledCiphersPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer, int)>(); + + int SSLGetEnabledCiphers( + SSLContextRef context, + ffi.Pointer ciphers, + ffi.Pointer numCiphers, + ) { + return _SSLGetEnabledCiphers( + context, + ciphers, + numCiphers, + ); + } + + late final _SSLGetEnabledCiphersPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, + ffi.Pointer)>>('SSLGetEnabledCiphers'); + late final _SSLGetEnabledCiphers = _SSLGetEnabledCiphersPtr.asFunction< + int Function( + SSLContextRef, ffi.Pointer, ffi.Pointer)>(); + + int SSLSetSessionTicketsEnabled( + SSLContextRef context, + int enabled, + ) { + return _SSLSetSessionTicketsEnabled( + context, + enabled, + ); + } + + late final _SSLSetSessionTicketsEnabledPtr = + _lookup>( + 'SSLSetSessionTicketsEnabled'); + late final _SSLSetSessionTicketsEnabled = _SSLSetSessionTicketsEnabledPtr + .asFunction(); + + int SSLSetEnableCertVerify( + SSLContextRef context, + int enableVerify, + ) { + return _SSLSetEnableCertVerify( + context, + enableVerify, + ); + } + + late final _SSLSetEnableCertVerifyPtr = + _lookup>( + 'SSLSetEnableCertVerify'); + late final _SSLSetEnableCertVerify = + _SSLSetEnableCertVerifyPtr.asFunction(); + + int SSLGetEnableCertVerify( + SSLContextRef context, + ffi.Pointer enableVerify, + ) { + return _SSLGetEnableCertVerify( + context, + enableVerify, + ); + } + + late final _SSLGetEnableCertVerifyPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, ffi.Pointer)>>('SSLGetEnableCertVerify'); + late final _SSLGetEnableCertVerify = _SSLGetEnableCertVerifyPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLSetAllowsExpiredCerts( + SSLContextRef context, + int allowsExpired, + ) { + return _SSLSetAllowsExpiredCerts( + context, + allowsExpired, + ); + } + + late final _SSLSetAllowsExpiredCertsPtr = + _lookup>( + 'SSLSetAllowsExpiredCerts'); + late final _SSLSetAllowsExpiredCerts = _SSLSetAllowsExpiredCertsPtr + .asFunction(); + + int SSLGetAllowsExpiredCerts( + SSLContextRef context, + ffi.Pointer allowsExpired, + ) { + return _SSLGetAllowsExpiredCerts( + context, + allowsExpired, + ); + } + + late final _SSLGetAllowsExpiredCertsPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetAllowsExpiredCerts'); + late final _SSLGetAllowsExpiredCerts = _SSLGetAllowsExpiredCertsPtr + .asFunction)>(); + + int SSLSetAllowsExpiredRoots( + SSLContextRef context, + int allowsExpired, + ) { + return _SSLSetAllowsExpiredRoots( + context, + allowsExpired, + ); + } + + late final _SSLSetAllowsExpiredRootsPtr = + _lookup>( + 'SSLSetAllowsExpiredRoots'); + late final _SSLSetAllowsExpiredRoots = _SSLSetAllowsExpiredRootsPtr + .asFunction(); + + int SSLGetAllowsExpiredRoots( + SSLContextRef context, + ffi.Pointer allowsExpired, + ) { + return _SSLGetAllowsExpiredRoots( + context, + allowsExpired, + ); + } + + late final _SSLGetAllowsExpiredRootsPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetAllowsExpiredRoots'); + late final _SSLGetAllowsExpiredRoots = _SSLGetAllowsExpiredRootsPtr + .asFunction)>(); + + int SSLSetAllowsAnyRoot( + SSLContextRef context, + int anyRoot, + ) { + return _SSLSetAllowsAnyRoot( + context, + anyRoot, + ); + } + + late final _SSLSetAllowsAnyRootPtr = + _lookup>( + 'SSLSetAllowsAnyRoot'); + late final _SSLSetAllowsAnyRoot = + _SSLSetAllowsAnyRootPtr.asFunction(); + + int SSLGetAllowsAnyRoot( + SSLContextRef context, + ffi.Pointer anyRoot, + ) { + return _SSLGetAllowsAnyRoot( + context, + anyRoot, + ); + } + + late final _SSLGetAllowsAnyRootPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, ffi.Pointer)>>('SSLGetAllowsAnyRoot'); + late final _SSLGetAllowsAnyRoot = _SSLGetAllowsAnyRootPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLSetTrustedRoots( + SSLContextRef context, + CFArrayRef trustedRoots, + int replaceExisting, + ) { + return _SSLSetTrustedRoots( + context, + trustedRoots, + replaceExisting, + ); + } + + late final _SSLSetTrustedRootsPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, CFArrayRef, Boolean)>>('SSLSetTrustedRoots'); + late final _SSLSetTrustedRoots = _SSLSetTrustedRootsPtr.asFunction< + int Function(SSLContextRef, CFArrayRef, int)>(); + + int SSLCopyTrustedRoots( + SSLContextRef context, + ffi.Pointer trustedRoots, + ) { + return _SSLCopyTrustedRoots( + context, + trustedRoots, + ); + } + + late final _SSLCopyTrustedRootsPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, ffi.Pointer)>>('SSLCopyTrustedRoots'); + late final _SSLCopyTrustedRoots = _SSLCopyTrustedRootsPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLCopyPeerCertificates( + SSLContextRef context, + ffi.Pointer certs, + ) { + return _SSLCopyPeerCertificates( + context, + certs, + ); + } + + late final _SSLCopyPeerCertificatesPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLCopyPeerCertificates'); + late final _SSLCopyPeerCertificates = _SSLCopyPeerCertificatesPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLCopyPeerTrust( + SSLContextRef context, + ffi.Pointer trust, + ) { + return _SSLCopyPeerTrust( + context, + trust, + ); + } + + late final _SSLCopyPeerTrustPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, ffi.Pointer)>>('SSLCopyPeerTrust'); + late final _SSLCopyPeerTrust = _SSLCopyPeerTrustPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLSetPeerID( + SSLContextRef context, + ffi.Pointer peerID, + int peerIDLen, + ) { + return _SSLSetPeerID( + context, + peerID, + peerIDLen, + ); + } + + late final _SSLSetPeerIDPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, ffi.Pointer, ffi.Size)>>('SSLSetPeerID'); + late final _SSLSetPeerID = _SSLSetPeerIDPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer, int)>(); + + int SSLGetPeerID( + SSLContextRef context, + ffi.Pointer> peerID, + ffi.Pointer peerIDLen, + ) { + return _SSLGetPeerID( + context, + peerID, + peerIDLen, + ); + } + + late final _SSLGetPeerIDPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer>, + ffi.Pointer)>>('SSLGetPeerID'); + late final _SSLGetPeerID = _SSLGetPeerIDPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer>, + ffi.Pointer)>(); + + int SSLGetNegotiatedCipher( + SSLContextRef context, + ffi.Pointer cipherSuite, + ) { + return _SSLGetNegotiatedCipher( + context, + cipherSuite, + ); + } + + late final _SSLGetNegotiatedCipherPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetNegotiatedCipher'); + late final _SSLGetNegotiatedCipher = _SSLGetNegotiatedCipherPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLSetALPNProtocols( + SSLContextRef context, + CFArrayRef protocols, + ) { + return _SSLSetALPNProtocols( + context, + protocols, + ); + } + + late final _SSLSetALPNProtocolsPtr = + _lookup>( + 'SSLSetALPNProtocols'); + late final _SSLSetALPNProtocols = _SSLSetALPNProtocolsPtr.asFunction< + int Function(SSLContextRef, CFArrayRef)>(); + + int SSLCopyALPNProtocols( + SSLContextRef context, + ffi.Pointer protocols, + ) { + return _SSLCopyALPNProtocols( + context, + protocols, + ); + } + + late final _SSLCopyALPNProtocolsPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, ffi.Pointer)>>('SSLCopyALPNProtocols'); + late final _SSLCopyALPNProtocols = _SSLCopyALPNProtocolsPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLSetOCSPResponse( + SSLContextRef context, + CFDataRef response, + ) { + return _SSLSetOCSPResponse( + context, + response, + ); + } + + late final _SSLSetOCSPResponsePtr = + _lookup>( + 'SSLSetOCSPResponse'); + late final _SSLSetOCSPResponse = _SSLSetOCSPResponsePtr.asFunction< + int Function(SSLContextRef, CFDataRef)>(); + + int SSLSetEncryptionCertificate( + SSLContextRef context, + CFArrayRef certRefs, + ) { + return _SSLSetEncryptionCertificate( + context, + certRefs, + ); + } + + late final _SSLSetEncryptionCertificatePtr = + _lookup>( + 'SSLSetEncryptionCertificate'); + late final _SSLSetEncryptionCertificate = _SSLSetEncryptionCertificatePtr + .asFunction(); + + DartSInt32 SSLSetClientSideAuthenticate( + SSLContextRef context, + SSLAuthenticate auth, + ) { + return _SSLSetClientSideAuthenticate( + context, + auth.value, + ); + } + + late final _SSLSetClientSideAuthenticatePtr = _lookup< + ffi + .NativeFunction>( + 'SSLSetClientSideAuthenticate'); + late final _SSLSetClientSideAuthenticate = _SSLSetClientSideAuthenticatePtr + .asFunction(); + + int SSLAddDistinguishedName( + SSLContextRef context, + ffi.Pointer derDN, + int derDNLen, + ) { + return _SSLAddDistinguishedName( + context, + derDN, + derDNLen, + ); + } + + late final _SSLAddDistinguishedNamePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, + ffi.Size)>>('SSLAddDistinguishedName'); + late final _SSLAddDistinguishedName = _SSLAddDistinguishedNamePtr.asFunction< + int Function(SSLContextRef, ffi.Pointer, int)>(); + + int SSLSetCertificateAuthorities( + SSLContextRef context, + CFTypeRef certificateOrArray, + int replaceExisting, + ) { + return _SSLSetCertificateAuthorities( + context, + certificateOrArray, + replaceExisting, + ); + } + + late final _SSLSetCertificateAuthoritiesPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, CFTypeRef, + Boolean)>>('SSLSetCertificateAuthorities'); + late final _SSLSetCertificateAuthorities = _SSLSetCertificateAuthoritiesPtr + .asFunction(); + + int SSLCopyCertificateAuthorities( + SSLContextRef context, + ffi.Pointer certificates, + ) { + return _SSLCopyCertificateAuthorities( + context, + certificates, + ); + } + + late final _SSLCopyCertificateAuthoritiesPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLCopyCertificateAuthorities'); + late final _SSLCopyCertificateAuthorities = _SSLCopyCertificateAuthoritiesPtr + .asFunction)>(); + + int SSLCopyDistinguishedNames( + SSLContextRef context, + ffi.Pointer names, + ) { + return _SSLCopyDistinguishedNames( + context, + names, + ); + } + + late final _SSLCopyDistinguishedNamesPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLCopyDistinguishedNames'); + late final _SSLCopyDistinguishedNames = _SSLCopyDistinguishedNamesPtr + .asFunction)>(); + + int SSLGetClientCertificateState( + SSLContextRef context, + ffi.Pointer clientState, + ) { + return _SSLGetClientCertificateState( + context, + clientState, + ); + } + + late final _SSLGetClientCertificateStatePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetClientCertificateState'); + late final _SSLGetClientCertificateState = _SSLGetClientCertificateStatePtr + .asFunction)>(); + + int SSLSetDiffieHellmanParams( + SSLContextRef context, + ffi.Pointer dhParams, + int dhParamsLen, + ) { + return _SSLSetDiffieHellmanParams( + context, + dhParams, + dhParamsLen, + ); + } + + late final _SSLSetDiffieHellmanParamsPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, + ffi.Size)>>('SSLSetDiffieHellmanParams'); + late final _SSLSetDiffieHellmanParams = _SSLSetDiffieHellmanParamsPtr + .asFunction, int)>(); + + int SSLGetDiffieHellmanParams( + SSLContextRef context, + ffi.Pointer> dhParams, + ffi.Pointer dhParamsLen, + ) { + return _SSLGetDiffieHellmanParams( + context, + dhParams, + dhParamsLen, + ); + } + + late final _SSLGetDiffieHellmanParamsPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer>, + ffi.Pointer)>>('SSLGetDiffieHellmanParams'); + late final _SSLGetDiffieHellmanParams = + _SSLGetDiffieHellmanParamsPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer>, + ffi.Pointer)>(); + + int SSLSetRsaBlinding( + SSLContextRef context, + int blinding, + ) { + return _SSLSetRsaBlinding( + context, + blinding, + ); + } + + late final _SSLSetRsaBlindingPtr = + _lookup>( + 'SSLSetRsaBlinding'); + late final _SSLSetRsaBlinding = + _SSLSetRsaBlindingPtr.asFunction(); + + int SSLGetRsaBlinding( + SSLContextRef context, + ffi.Pointer blinding, + ) { + return _SSLGetRsaBlinding( + context, + blinding, + ); + } + + late final _SSLGetRsaBlindingPtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, ffi.Pointer)>>('SSLGetRsaBlinding'); + late final _SSLGetRsaBlinding = _SSLGetRsaBlindingPtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLHandshake( + SSLContextRef context, + ) { + return _SSLHandshake( + context, + ); + } + + late final _SSLHandshakePtr = + _lookup>( + 'SSLHandshake'); + late final _SSLHandshake = + _SSLHandshakePtr.asFunction(); + + int SSLReHandshake( + SSLContextRef context, + ) { + return _SSLReHandshake( + context, + ); + } + + late final _SSLReHandshakePtr = + _lookup>( + 'SSLReHandshake'); + late final _SSLReHandshake = + _SSLReHandshakePtr.asFunction(); + + int SSLWrite( + SSLContextRef context, + ffi.Pointer data, + int dataLength, + ffi.Pointer processed, + ) { + return _SSLWrite( + context, + data, + dataLength, + processed, + ); + } + + late final _SSLWritePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, ffi.Size, + ffi.Pointer)>>('SSLWrite'); + late final _SSLWrite = _SSLWritePtr.asFunction< + int Function( + SSLContextRef, ffi.Pointer, int, ffi.Pointer)>(); + + int SSLRead( + SSLContextRef context, + ffi.Pointer data, + int dataLength, + ffi.Pointer processed, + ) { + return _SSLRead( + context, + data, + dataLength, + processed, + ); + } + + late final _SSLReadPtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, ffi.Pointer, ffi.Size, + ffi.Pointer)>>('SSLRead'); + late final _SSLRead = _SSLReadPtr.asFunction< + int Function( + SSLContextRef, ffi.Pointer, int, ffi.Pointer)>(); + + int SSLGetBufferedReadSize( + SSLContextRef context, + ffi.Pointer bufferSize, + ) { + return _SSLGetBufferedReadSize( + context, + bufferSize, + ); + } + + late final _SSLGetBufferedReadSizePtr = _lookup< + ffi.NativeFunction< + OSStatus Function( + SSLContextRef, ffi.Pointer)>>('SSLGetBufferedReadSize'); + late final _SSLGetBufferedReadSize = _SSLGetBufferedReadSizePtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLGetDatagramWriteSize( + SSLContextRef dtlsContext, + ffi.Pointer bufSize, + ) { + return _SSLGetDatagramWriteSize( + dtlsContext, + bufSize, + ); + } + + late final _SSLGetDatagramWriteSizePtr = _lookup< + ffi.NativeFunction< + OSStatus Function(SSLContextRef, + ffi.Pointer)>>('SSLGetDatagramWriteSize'); + late final _SSLGetDatagramWriteSize = _SSLGetDatagramWriteSizePtr.asFunction< + int Function(SSLContextRef, ffi.Pointer)>(); + + int SSLClose( + SSLContextRef context, + ) { + return _SSLClose( + context, + ); + } + + late final _SSLClosePtr = + _lookup>('SSLClose'); + late final _SSLClose = _SSLClosePtr.asFunction(); + + int SSLSetError( + SSLContextRef context, + int status, + ) { + return _SSLSetError( + context, + status, + ); + } + + late final _SSLSetErrorPtr = + _lookup>( + 'SSLSetError'); + late final _SSLSetError = + _SSLSetErrorPtr.asFunction(); + + /// -1LL + late final ffi.Pointer _NSURLSessionTransferSizeUnknown = + _lookup('NSURLSessionTransferSizeUnknown'); + + int get NSURLSessionTransferSizeUnknown => + _NSURLSessionTransferSizeUnknown.value; + + late final ffi.Pointer _NSURLSessionTaskPriorityDefault = + _lookup('NSURLSessionTaskPriorityDefault'); + + double get NSURLSessionTaskPriorityDefault => + _NSURLSessionTaskPriorityDefault.value; + + late final ffi.Pointer _NSURLSessionTaskPriorityLow = + _lookup('NSURLSessionTaskPriorityLow'); + + double get NSURLSessionTaskPriorityLow => _NSURLSessionTaskPriorityLow.value; + + late final ffi.Pointer _NSURLSessionTaskPriorityHigh = + _lookup('NSURLSessionTaskPriorityHigh'); + + double get NSURLSessionTaskPriorityHigh => + _NSURLSessionTaskPriorityHigh.value; + + /// Key in the userInfo dictionary of an NSError received during a failed download. + late final ffi.Pointer> + _NSURLSessionDownloadTaskResumeData = + _lookup>( + 'NSURLSessionDownloadTaskResumeData'); + + objc.NSString get NSURLSessionDownloadTaskResumeData => + objc.NSString.castFromPointer(_NSURLSessionDownloadTaskResumeData.value, + retain: true, release: true); + + set NSURLSessionDownloadTaskResumeData(objc.NSString value) { + objc.NSString.castFromPointer(_NSURLSessionDownloadTaskResumeData.value, + retain: false, release: true) + .ref + .release(); + _NSURLSessionDownloadTaskResumeData.value = + value.ref.retainAndReturnPointer(); + } + + /// Key in the userInfo dictionary of an NSError received during a failed upload. + late final ffi.Pointer> + _NSURLSessionUploadTaskResumeData = + _lookup>('NSURLSessionUploadTaskResumeData'); + + objc.NSString get NSURLSessionUploadTaskResumeData => + objc.NSString.castFromPointer(_NSURLSessionUploadTaskResumeData.value, + retain: true, release: true); + + set NSURLSessionUploadTaskResumeData(objc.NSString value) { + objc.NSString.castFromPointer(_NSURLSessionUploadTaskResumeData.value, + retain: false, release: true) + .ref + .release(); + _NSURLSessionUploadTaskResumeData.value = + value.ref.retainAndReturnPointer(); + } + + NSRange NSUnionRange( + NSRange range1, + NSRange range2, + ) { + return _NSUnionRange( + range1, + range2, + ); + } + + late final _NSUnionRangePtr = + _lookup>( + 'NSUnionRange'); + late final _NSUnionRange = + _NSUnionRangePtr.asFunction(); + + NSRange NSIntersectionRange( + NSRange range1, + NSRange range2, + ) { + return _NSIntersectionRange( + range1, + range2, + ); + } + + late final _NSIntersectionRangePtr = + _lookup>( + 'NSIntersectionRange'); + late final _NSIntersectionRange = + _NSIntersectionRangePtr.asFunction(); + + objc.NSString NSStringFromRange( + NSRange range, + ) { + return objc.NSString.castFromPointer( + _NSStringFromRange( + range, + ), + retain: true, + release: true); + } + + late final _NSStringFromRangePtr = _lookup< + ffi.NativeFunction Function(NSRange)>>( + 'NSStringFromRange'); + late final _NSStringFromRange = _NSStringFromRangePtr.asFunction< + ffi.Pointer Function(NSRange)>(); + + NSRange NSRangeFromString( + objc.NSString aString, + ) { + return _NSRangeFromString( + aString.ref.pointer, + ); + } + + late final _NSRangeFromStringPtr = _lookup< + ffi.NativeFunction)>>( + 'NSRangeFromString'); + late final _NSRangeFromString = _NSRangeFromStringPtr.asFunction< + NSRange Function(ffi.Pointer)>(); + + late final ffi.Pointer> + _NSItemProviderPreferredImageSizeKey = + _lookup>( + 'NSItemProviderPreferredImageSizeKey'); + + objc.NSString get NSItemProviderPreferredImageSizeKey => + objc.NSString.castFromPointer(_NSItemProviderPreferredImageSizeKey.value, + retain: true, release: true); + + set NSItemProviderPreferredImageSizeKey(objc.NSString value) { + objc.NSString.castFromPointer(_NSItemProviderPreferredImageSizeKey.value, + retain: false, release: true) + .ref + .release(); + _NSItemProviderPreferredImageSizeKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer> + _NSExtensionJavaScriptPreprocessingResultsKey = + _lookup>( + 'NSExtensionJavaScriptPreprocessingResultsKey'); + + objc.NSString get NSExtensionJavaScriptPreprocessingResultsKey => + objc.NSString.castFromPointer( + _NSExtensionJavaScriptPreprocessingResultsKey.value, + retain: true, + release: true); + + set NSExtensionJavaScriptPreprocessingResultsKey(objc.NSString value) { + objc.NSString.castFromPointer( + _NSExtensionJavaScriptPreprocessingResultsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSExtensionJavaScriptPreprocessingResultsKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer> + _NSExtensionJavaScriptFinalizeArgumentKey = + _lookup>( + 'NSExtensionJavaScriptFinalizeArgumentKey'); + + objc.NSString get NSExtensionJavaScriptFinalizeArgumentKey => + objc.NSString.castFromPointer( + _NSExtensionJavaScriptFinalizeArgumentKey.value, + retain: true, + release: true); + + set NSExtensionJavaScriptFinalizeArgumentKey(objc.NSString value) { + objc.NSString.castFromPointer( + _NSExtensionJavaScriptFinalizeArgumentKey.value, + retain: false, + release: true) + .ref + .release(); + _NSExtensionJavaScriptFinalizeArgumentKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer> + _NSItemProviderErrorDomain = + _lookup>('NSItemProviderErrorDomain'); + + objc.NSString get NSItemProviderErrorDomain => + objc.NSString.castFromPointer(_NSItemProviderErrorDomain.value, + retain: true, release: true); + + set NSItemProviderErrorDomain(objc.NSString value) { + objc.NSString.castFromPointer(_NSItemProviderErrorDomain.value, + retain: false, release: true) + .ref + .release(); + _NSItemProviderErrorDomain.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformLatinToKatakana = + _lookup('NSStringTransformLatinToKatakana'); + + DartNSStringTransform get NSStringTransformLatinToKatakana => + objc.NSString.castFromPointer(_NSStringTransformLatinToKatakana.value, + retain: true, release: true); + + set NSStringTransformLatinToKatakana(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformLatinToKatakana.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformLatinToKatakana.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformLatinToHiragana = + _lookup('NSStringTransformLatinToHiragana'); + + DartNSStringTransform get NSStringTransformLatinToHiragana => + objc.NSString.castFromPointer(_NSStringTransformLatinToHiragana.value, + retain: true, release: true); + + set NSStringTransformLatinToHiragana(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformLatinToHiragana.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformLatinToHiragana.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformLatinToHangul = + _lookup('NSStringTransformLatinToHangul'); + + DartNSStringTransform get NSStringTransformLatinToHangul => + objc.NSString.castFromPointer(_NSStringTransformLatinToHangul.value, + retain: true, release: true); + + set NSStringTransformLatinToHangul(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformLatinToHangul.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformLatinToHangul.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformLatinToArabic = + _lookup('NSStringTransformLatinToArabic'); + + DartNSStringTransform get NSStringTransformLatinToArabic => + objc.NSString.castFromPointer(_NSStringTransformLatinToArabic.value, + retain: true, release: true); + + set NSStringTransformLatinToArabic(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformLatinToArabic.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformLatinToArabic.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformLatinToHebrew = + _lookup('NSStringTransformLatinToHebrew'); + + DartNSStringTransform get NSStringTransformLatinToHebrew => + objc.NSString.castFromPointer(_NSStringTransformLatinToHebrew.value, + retain: true, release: true); + + set NSStringTransformLatinToHebrew(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformLatinToHebrew.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformLatinToHebrew.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformLatinToThai = + _lookup('NSStringTransformLatinToThai'); + + DartNSStringTransform get NSStringTransformLatinToThai => + objc.NSString.castFromPointer(_NSStringTransformLatinToThai.value, + retain: true, release: true); + + set NSStringTransformLatinToThai(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformLatinToThai.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformLatinToThai.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformLatinToCyrillic = + _lookup('NSStringTransformLatinToCyrillic'); + + DartNSStringTransform get NSStringTransformLatinToCyrillic => + objc.NSString.castFromPointer(_NSStringTransformLatinToCyrillic.value, + retain: true, release: true); + + set NSStringTransformLatinToCyrillic(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformLatinToCyrillic.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformLatinToCyrillic.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformLatinToGreek = + _lookup('NSStringTransformLatinToGreek'); + + DartNSStringTransform get NSStringTransformLatinToGreek => + objc.NSString.castFromPointer(_NSStringTransformLatinToGreek.value, + retain: true, release: true); + + set NSStringTransformLatinToGreek(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformLatinToGreek.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformLatinToGreek.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformToLatin = + _lookup('NSStringTransformToLatin'); + + DartNSStringTransform get NSStringTransformToLatin => + objc.NSString.castFromPointer(_NSStringTransformToLatin.value, + retain: true, release: true); + + set NSStringTransformToLatin(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformToLatin.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformToLatin.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformMandarinToLatin = + _lookup('NSStringTransformMandarinToLatin'); + + DartNSStringTransform get NSStringTransformMandarinToLatin => + objc.NSString.castFromPointer(_NSStringTransformMandarinToLatin.value, + retain: true, release: true); + + set NSStringTransformMandarinToLatin(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformMandarinToLatin.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformMandarinToLatin.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringTransformHiraganaToKatakana = + _lookup('NSStringTransformHiraganaToKatakana'); + + DartNSStringTransform get NSStringTransformHiraganaToKatakana => + objc.NSString.castFromPointer(_NSStringTransformHiraganaToKatakana.value, + retain: true, release: true); + + set NSStringTransformHiraganaToKatakana(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformHiraganaToKatakana.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformHiraganaToKatakana.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringTransformFullwidthToHalfwidth = + _lookup('NSStringTransformFullwidthToHalfwidth'); + + DartNSStringTransform get NSStringTransformFullwidthToHalfwidth => + objc.NSString.castFromPointer( + _NSStringTransformFullwidthToHalfwidth.value, + retain: true, + release: true); + + set NSStringTransformFullwidthToHalfwidth(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformFullwidthToHalfwidth.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformFullwidthToHalfwidth.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformToXMLHex = + _lookup('NSStringTransformToXMLHex'); + + DartNSStringTransform get NSStringTransformToXMLHex => + objc.NSString.castFromPointer(_NSStringTransformToXMLHex.value, + retain: true, release: true); + + set NSStringTransformToXMLHex(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformToXMLHex.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformToXMLHex.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformToUnicodeName = + _lookup('NSStringTransformToUnicodeName'); + + DartNSStringTransform get NSStringTransformToUnicodeName => + objc.NSString.castFromPointer(_NSStringTransformToUnicodeName.value, + retain: true, release: true); + + set NSStringTransformToUnicodeName(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformToUnicodeName.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformToUnicodeName.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringTransformStripCombiningMarks = + _lookup('NSStringTransformStripCombiningMarks'); + + DartNSStringTransform get NSStringTransformStripCombiningMarks => + objc.NSString.castFromPointer(_NSStringTransformStripCombiningMarks.value, + retain: true, release: true); + + set NSStringTransformStripCombiningMarks(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformStripCombiningMarks.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformStripCombiningMarks.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSStringTransformStripDiacritics = + _lookup('NSStringTransformStripDiacritics'); + + DartNSStringTransform get NSStringTransformStripDiacritics => + objc.NSString.castFromPointer(_NSStringTransformStripDiacritics.value, + retain: true, release: true); + + set NSStringTransformStripDiacritics(DartNSStringTransform value) { + objc.NSString.castFromPointer(_NSStringTransformStripDiacritics.value, + retain: false, release: true) + .ref + .release(); + _NSStringTransformStripDiacritics.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringEncodingDetectionSuggestedEncodingsKey = + _lookup( + 'NSStringEncodingDetectionSuggestedEncodingsKey'); + + DartNSStringEncodingDetectionOptionsKey + get NSStringEncodingDetectionSuggestedEncodingsKey => + objc.NSString.castFromPointer( + _NSStringEncodingDetectionSuggestedEncodingsKey.value, + retain: true, + release: true); + + set NSStringEncodingDetectionSuggestedEncodingsKey( + DartNSStringEncodingDetectionOptionsKey value) { + objc.NSString.castFromPointer( + _NSStringEncodingDetectionSuggestedEncodingsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSStringEncodingDetectionSuggestedEncodingsKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringEncodingDetectionDisallowedEncodingsKey = + _lookup( + 'NSStringEncodingDetectionDisallowedEncodingsKey'); + + DartNSStringEncodingDetectionOptionsKey + get NSStringEncodingDetectionDisallowedEncodingsKey => + objc.NSString.castFromPointer( + _NSStringEncodingDetectionDisallowedEncodingsKey.value, + retain: true, + release: true); + + set NSStringEncodingDetectionDisallowedEncodingsKey( + DartNSStringEncodingDetectionOptionsKey value) { + objc.NSString.castFromPointer( + _NSStringEncodingDetectionDisallowedEncodingsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSStringEncodingDetectionDisallowedEncodingsKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringEncodingDetectionUseOnlySuggestedEncodingsKey = + _lookup( + 'NSStringEncodingDetectionUseOnlySuggestedEncodingsKey'); + + DartNSStringEncodingDetectionOptionsKey + get NSStringEncodingDetectionUseOnlySuggestedEncodingsKey => + objc.NSString.castFromPointer( + _NSStringEncodingDetectionUseOnlySuggestedEncodingsKey.value, + retain: true, + release: true); + + set NSStringEncodingDetectionUseOnlySuggestedEncodingsKey( + DartNSStringEncodingDetectionOptionsKey value) { + objc.NSString.castFromPointer( + _NSStringEncodingDetectionUseOnlySuggestedEncodingsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSStringEncodingDetectionUseOnlySuggestedEncodingsKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringEncodingDetectionAllowLossyKey = + _lookup( + 'NSStringEncodingDetectionAllowLossyKey'); + + DartNSStringEncodingDetectionOptionsKey + get NSStringEncodingDetectionAllowLossyKey => + objc.NSString.castFromPointer( + _NSStringEncodingDetectionAllowLossyKey.value, + retain: true, + release: true); + + set NSStringEncodingDetectionAllowLossyKey( + DartNSStringEncodingDetectionOptionsKey value) { + objc.NSString.castFromPointer(_NSStringEncodingDetectionAllowLossyKey.value, + retain: false, release: true) + .ref + .release(); + _NSStringEncodingDetectionAllowLossyKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringEncodingDetectionFromWindowsKey = + _lookup( + 'NSStringEncodingDetectionFromWindowsKey'); + + DartNSStringEncodingDetectionOptionsKey + get NSStringEncodingDetectionFromWindowsKey => + objc.NSString.castFromPointer( + _NSStringEncodingDetectionFromWindowsKey.value, + retain: true, + release: true); + + set NSStringEncodingDetectionFromWindowsKey( + DartNSStringEncodingDetectionOptionsKey value) { + objc.NSString.castFromPointer( + _NSStringEncodingDetectionFromWindowsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSStringEncodingDetectionFromWindowsKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringEncodingDetectionLossySubstitutionKey = + _lookup( + 'NSStringEncodingDetectionLossySubstitutionKey'); + + DartNSStringEncodingDetectionOptionsKey + get NSStringEncodingDetectionLossySubstitutionKey => + objc.NSString.castFromPointer( + _NSStringEncodingDetectionLossySubstitutionKey.value, + retain: true, + release: true); + + set NSStringEncodingDetectionLossySubstitutionKey( + DartNSStringEncodingDetectionOptionsKey value) { + objc.NSString.castFromPointer( + _NSStringEncodingDetectionLossySubstitutionKey.value, + retain: false, + release: true) + .ref + .release(); + _NSStringEncodingDetectionLossySubstitutionKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSStringEncodingDetectionLikelyLanguageKey = + _lookup( + 'NSStringEncodingDetectionLikelyLanguageKey'); + + DartNSStringEncodingDetectionOptionsKey + get NSStringEncodingDetectionLikelyLanguageKey => + objc.NSString.castFromPointer( + _NSStringEncodingDetectionLikelyLanguageKey.value, + retain: true, + release: true); + + set NSStringEncodingDetectionLikelyLanguageKey( + DartNSStringEncodingDetectionOptionsKey value) { + objc.NSString.castFromPointer( + _NSStringEncodingDetectionLikelyLanguageKey.value, + retain: false, + release: true) + .ref + .release(); + _NSStringEncodingDetectionLikelyLanguageKey.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSCharacterConversionException = + _lookup('NSCharacterConversionException'); + + DartNSExceptionName get NSCharacterConversionException => + objc.NSString.castFromPointer(_NSCharacterConversionException.value, + retain: true, release: true); + + set NSCharacterConversionException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSCharacterConversionException.value, + retain: false, release: true) + .ref + .release(); + _NSCharacterConversionException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSParseErrorException = + _lookup('NSParseErrorException'); + + DartNSExceptionName get NSParseErrorException => + objc.NSString.castFromPointer(_NSParseErrorException.value, + retain: true, release: true); + + set NSParseErrorException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSParseErrorException.value, + retain: false, release: true) + .ref + .release(); + _NSParseErrorException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer> + _NSHTTPPropertyStatusCodeKey = + _lookup>('NSHTTPPropertyStatusCodeKey'); + + objc.NSString get NSHTTPPropertyStatusCodeKey => + objc.NSString.castFromPointer(_NSHTTPPropertyStatusCodeKey.value, + retain: true, release: true); + + late final ffi.Pointer> + _NSHTTPPropertyStatusReasonKey = + _lookup>('NSHTTPPropertyStatusReasonKey'); + + objc.NSString get NSHTTPPropertyStatusReasonKey => + objc.NSString.castFromPointer(_NSHTTPPropertyStatusReasonKey.value, + retain: true, release: true); + + late final ffi.Pointer> + _NSHTTPPropertyServerHTTPVersionKey = + _lookup>( + 'NSHTTPPropertyServerHTTPVersionKey'); + + objc.NSString get NSHTTPPropertyServerHTTPVersionKey => + objc.NSString.castFromPointer(_NSHTTPPropertyServerHTTPVersionKey.value, + retain: true, release: true); + + late final ffi.Pointer> + _NSHTTPPropertyRedirectionHeadersKey = + _lookup>( + 'NSHTTPPropertyRedirectionHeadersKey'); + + objc.NSString get NSHTTPPropertyRedirectionHeadersKey => + objc.NSString.castFromPointer(_NSHTTPPropertyRedirectionHeadersKey.value, + retain: true, release: true); + + late final ffi.Pointer> + _NSHTTPPropertyErrorPageDataKey = + _lookup>('NSHTTPPropertyErrorPageDataKey'); + + objc.NSString get NSHTTPPropertyErrorPageDataKey => + objc.NSString.castFromPointer(_NSHTTPPropertyErrorPageDataKey.value, + retain: true, release: true); + + late final ffi.Pointer> + _NSHTTPPropertyHTTPProxy = + _lookup>('NSHTTPPropertyHTTPProxy'); + + objc.NSString get NSHTTPPropertyHTTPProxy => + objc.NSString.castFromPointer(_NSHTTPPropertyHTTPProxy.value, + retain: true, release: true); + + late final ffi.Pointer> + _NSFTPPropertyUserLoginKey = + _lookup>('NSFTPPropertyUserLoginKey'); + + objc.NSString get NSFTPPropertyUserLoginKey => + objc.NSString.castFromPointer(_NSFTPPropertyUserLoginKey.value, + retain: true, release: true); + + late final ffi.Pointer> + _NSFTPPropertyUserPasswordKey = + _lookup>('NSFTPPropertyUserPasswordKey'); + + objc.NSString get NSFTPPropertyUserPasswordKey => + objc.NSString.castFromPointer(_NSFTPPropertyUserPasswordKey.value, + retain: true, release: true); + + late final ffi.Pointer> + _NSFTPPropertyActiveTransferModeKey = + _lookup>( + 'NSFTPPropertyActiveTransferModeKey'); + + objc.NSString get NSFTPPropertyActiveTransferModeKey => + objc.NSString.castFromPointer(_NSFTPPropertyActiveTransferModeKey.value, + retain: true, release: true); + + late final ffi.Pointer> + _NSFTPPropertyFileOffsetKey = + _lookup>('NSFTPPropertyFileOffsetKey'); + + objc.NSString get NSFTPPropertyFileOffsetKey => + objc.NSString.castFromPointer(_NSFTPPropertyFileOffsetKey.value, + retain: true, release: true); + + late final ffi.Pointer> _NSFTPPropertyFTPProxy = + _lookup>('NSFTPPropertyFTPProxy'); + + objc.NSString get NSFTPPropertyFTPProxy => + objc.NSString.castFromPointer(_NSFTPPropertyFTPProxy.value, + retain: true, release: true); + + /// A string constant for the "file" URL scheme. If you are using this to compare to a URL's scheme to see if it is a file URL, you should instead use the NSURL fileURL property -- the fileURL property is much faster. + late final ffi.Pointer> _NSURLFileScheme = + _lookup>('NSURLFileScheme'); + + objc.NSString get NSURLFileScheme => + objc.NSString.castFromPointer(_NSURLFileScheme.value, + retain: true, release: true); + + set NSURLFileScheme(objc.NSString value) { + objc.NSString.castFromPointer(_NSURLFileScheme.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileScheme.value = value.ref.retainAndReturnPointer(); + } + + /// Key for the resource properties that have not been set after setResourceValues:error: returns an error, returned as an array of of strings. + late final ffi.Pointer _NSURLKeysOfUnsetValuesKey = + _lookup('NSURLKeysOfUnsetValuesKey'); + + DartNSURLResourceKey get NSURLKeysOfUnsetValuesKey => + objc.NSString.castFromPointer(_NSURLKeysOfUnsetValuesKey.value, + retain: true, release: true); + + set NSURLKeysOfUnsetValuesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLKeysOfUnsetValuesKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLKeysOfUnsetValuesKey.value = value.ref.retainAndReturnPointer(); + } + + /// The resource name provided by the file system (Read-write, value type NSString) + late final ffi.Pointer _NSURLNameKey = + _lookup('NSURLNameKey'); + + DartNSURLResourceKey get NSURLNameKey => + objc.NSString.castFromPointer(_NSURLNameKey.value, + retain: true, release: true); + + set NSURLNameKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLNameKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLNameKey.value = value.ref.retainAndReturnPointer(); + } + + /// Localized or extension-hidden name as displayed to users (Read-only, value type NSString) + late final ffi.Pointer _NSURLLocalizedNameKey = + _lookup('NSURLLocalizedNameKey'); + + DartNSURLResourceKey get NSURLLocalizedNameKey => + objc.NSString.castFromPointer(_NSURLLocalizedNameKey.value, + retain: true, release: true); + + set NSURLLocalizedNameKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLLocalizedNameKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLLocalizedNameKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for regular files (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsRegularFileKey = + _lookup('NSURLIsRegularFileKey'); + + DartNSURLResourceKey get NSURLIsRegularFileKey => + objc.NSString.castFromPointer(_NSURLIsRegularFileKey.value, + retain: true, release: true); + + set NSURLIsRegularFileKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsRegularFileKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsRegularFileKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for directories (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsDirectoryKey = + _lookup('NSURLIsDirectoryKey'); + + DartNSURLResourceKey get NSURLIsDirectoryKey => + objc.NSString.castFromPointer(_NSURLIsDirectoryKey.value, + retain: true, release: true); + + set NSURLIsDirectoryKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsDirectoryKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsDirectoryKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for symlinks (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsSymbolicLinkKey = + _lookup('NSURLIsSymbolicLinkKey'); + + DartNSURLResourceKey get NSURLIsSymbolicLinkKey => + objc.NSString.castFromPointer(_NSURLIsSymbolicLinkKey.value, + retain: true, release: true); + + set NSURLIsSymbolicLinkKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsSymbolicLinkKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsSymbolicLinkKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for the root directory of a volume (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsVolumeKey = + _lookup('NSURLIsVolumeKey'); + + DartNSURLResourceKey get NSURLIsVolumeKey => + objc.NSString.castFromPointer(_NSURLIsVolumeKey.value, + retain: true, release: true); + + set NSURLIsVolumeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsVolumeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsVolumeKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for packaged directories (Read-only 10_6 and 10_7, read-write 10_8, value type boolean NSNumber). Note: You can only set or clear this property on directories; if you try to set this property on non-directory objects, the property is ignored. If the directory is a package for some other reason (extension type, etc), setting this property to false will have no effect. + late final ffi.Pointer _NSURLIsPackageKey = + _lookup('NSURLIsPackageKey'); + + DartNSURLResourceKey get NSURLIsPackageKey => + objc.NSString.castFromPointer(_NSURLIsPackageKey.value, + retain: true, release: true); + + set NSURLIsPackageKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsPackageKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsPackageKey.value = value.ref.retainAndReturnPointer(); + } + + /// True if resource is an application (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsApplicationKey = + _lookup('NSURLIsApplicationKey'); + + DartNSURLResourceKey get NSURLIsApplicationKey => + objc.NSString.castFromPointer(_NSURLIsApplicationKey.value, + retain: true, release: true); + + set NSURLIsApplicationKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsApplicationKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsApplicationKey.value = value.ref.retainAndReturnPointer(); + } + + /// True if the resource is scriptable. Only applies to applications (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLApplicationIsScriptableKey = + _lookup('NSURLApplicationIsScriptableKey'); + + DartNSURLResourceKey get NSURLApplicationIsScriptableKey => + objc.NSString.castFromPointer(_NSURLApplicationIsScriptableKey.value, + retain: true, release: true); + + set NSURLApplicationIsScriptableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLApplicationIsScriptableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLApplicationIsScriptableKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for system-immutable resources (Read-write, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsSystemImmutableKey = + _lookup('NSURLIsSystemImmutableKey'); + + DartNSURLResourceKey get NSURLIsSystemImmutableKey => + objc.NSString.castFromPointer(_NSURLIsSystemImmutableKey.value, + retain: true, release: true); + + set NSURLIsSystemImmutableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsSystemImmutableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsSystemImmutableKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for user-immutable resources (Read-write, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsUserImmutableKey = + _lookup('NSURLIsUserImmutableKey'); + + DartNSURLResourceKey get NSURLIsUserImmutableKey => + objc.NSString.castFromPointer(_NSURLIsUserImmutableKey.value, + retain: true, release: true); + + set NSURLIsUserImmutableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsUserImmutableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsUserImmutableKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for resources normally not displayed to users (Read-write, value type boolean NSNumber). Note: If the resource is a hidden because its name starts with a period, setting this property to false will not change the property. + late final ffi.Pointer _NSURLIsHiddenKey = + _lookup('NSURLIsHiddenKey'); + + DartNSURLResourceKey get NSURLIsHiddenKey => + objc.NSString.castFromPointer(_NSURLIsHiddenKey.value, + retain: true, release: true); + + set NSURLIsHiddenKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsHiddenKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsHiddenKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for resources whose filename extension is removed from the localized name property (Read-write, value type boolean NSNumber) + late final ffi.Pointer _NSURLHasHiddenExtensionKey = + _lookup('NSURLHasHiddenExtensionKey'); + + DartNSURLResourceKey get NSURLHasHiddenExtensionKey => + objc.NSString.castFromPointer(_NSURLHasHiddenExtensionKey.value, + retain: true, release: true); + + set NSURLHasHiddenExtensionKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLHasHiddenExtensionKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLHasHiddenExtensionKey.value = value.ref.retainAndReturnPointer(); + } + + /// The date the resource was created (Read-write, value type NSDate) + late final ffi.Pointer _NSURLCreationDateKey = + _lookup('NSURLCreationDateKey'); + + DartNSURLResourceKey get NSURLCreationDateKey => + objc.NSString.castFromPointer(_NSURLCreationDateKey.value, + retain: true, release: true); + + set NSURLCreationDateKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLCreationDateKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLCreationDateKey.value = value.ref.retainAndReturnPointer(); + } + + /// The date the resource was last accessed (Read-write, value type NSDate) + late final ffi.Pointer _NSURLContentAccessDateKey = + _lookup('NSURLContentAccessDateKey'); + + DartNSURLResourceKey get NSURLContentAccessDateKey => + objc.NSString.castFromPointer(_NSURLContentAccessDateKey.value, + retain: true, release: true); + + set NSURLContentAccessDateKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLContentAccessDateKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLContentAccessDateKey.value = value.ref.retainAndReturnPointer(); + } + + /// The time the resource content was last modified (Read-write, value type NSDate) + late final ffi.Pointer _NSURLContentModificationDateKey = + _lookup('NSURLContentModificationDateKey'); + + DartNSURLResourceKey get NSURLContentModificationDateKey => + objc.NSString.castFromPointer(_NSURLContentModificationDateKey.value, + retain: true, release: true); + + set NSURLContentModificationDateKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLContentModificationDateKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLContentModificationDateKey.value = value.ref.retainAndReturnPointer(); + } + + /// The time the resource's attributes were last modified (Read-only, value type NSDate) + late final ffi.Pointer _NSURLAttributeModificationDateKey = + _lookup('NSURLAttributeModificationDateKey'); + + DartNSURLResourceKey get NSURLAttributeModificationDateKey => + objc.NSString.castFromPointer(_NSURLAttributeModificationDateKey.value, + retain: true, release: true); + + set NSURLAttributeModificationDateKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLAttributeModificationDateKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLAttributeModificationDateKey.value = + value.ref.retainAndReturnPointer(); + } + + /// Number of hard links to the resource (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLLinkCountKey = + _lookup('NSURLLinkCountKey'); + + DartNSURLResourceKey get NSURLLinkCountKey => + objc.NSString.castFromPointer(_NSURLLinkCountKey.value, + retain: true, release: true); + + set NSURLLinkCountKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLLinkCountKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLLinkCountKey.value = value.ref.retainAndReturnPointer(); + } + + /// The resource's parent directory, if any (Read-only, value type NSURL) + late final ffi.Pointer _NSURLParentDirectoryURLKey = + _lookup('NSURLParentDirectoryURLKey'); + + DartNSURLResourceKey get NSURLParentDirectoryURLKey => + objc.NSString.castFromPointer(_NSURLParentDirectoryURLKey.value, + retain: true, release: true); + + set NSURLParentDirectoryURLKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLParentDirectoryURLKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLParentDirectoryURLKey.value = value.ref.retainAndReturnPointer(); + } + + /// URL of the volume on which the resource is stored (Read-only, value type NSURL) + late final ffi.Pointer _NSURLVolumeURLKey = + _lookup('NSURLVolumeURLKey'); + + DartNSURLResourceKey get NSURLVolumeURLKey => + objc.NSString.castFromPointer(_NSURLVolumeURLKey.value, + retain: true, release: true); + + set NSURLVolumeURLKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeURLKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeURLKey.value = value.ref.retainAndReturnPointer(); + } + + /// Uniform type identifier (UTI) for the resource (Read-only, value type NSString) + late final ffi.Pointer _NSURLTypeIdentifierKey = + _lookup('NSURLTypeIdentifierKey'); + + DartNSURLResourceKey get NSURLTypeIdentifierKey => + objc.NSString.castFromPointer(_NSURLTypeIdentifierKey.value, + retain: true, release: true); + + set NSURLTypeIdentifierKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLTypeIdentifierKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLTypeIdentifierKey.value = value.ref.retainAndReturnPointer(); + } + + /// File type (UTType) for the resource (Read-only, value type UTType) + late final ffi.Pointer _NSURLContentTypeKey = + _lookup('NSURLContentTypeKey'); + + DartNSURLResourceKey get NSURLContentTypeKey => + objc.NSString.castFromPointer(_NSURLContentTypeKey.value, + retain: true, release: true); + + set NSURLContentTypeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLContentTypeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLContentTypeKey.value = value.ref.retainAndReturnPointer(); + } + + /// User-visible type or "kind" description (Read-only, value type NSString) + late final ffi.Pointer _NSURLLocalizedTypeDescriptionKey = + _lookup('NSURLLocalizedTypeDescriptionKey'); + + DartNSURLResourceKey get NSURLLocalizedTypeDescriptionKey => + objc.NSString.castFromPointer(_NSURLLocalizedTypeDescriptionKey.value, + retain: true, release: true); + + set NSURLLocalizedTypeDescriptionKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLLocalizedTypeDescriptionKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLLocalizedTypeDescriptionKey.value = + value.ref.retainAndReturnPointer(); + } + + /// The label number assigned to the resource (Read-write, value type NSNumber) + late final ffi.Pointer _NSURLLabelNumberKey = + _lookup('NSURLLabelNumberKey'); + + DartNSURLResourceKey get NSURLLabelNumberKey => + objc.NSString.castFromPointer(_NSURLLabelNumberKey.value, + retain: true, release: true); + + set NSURLLabelNumberKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLLabelNumberKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLLabelNumberKey.value = value.ref.retainAndReturnPointer(); + } + + /// The color of the assigned label (Read-only, value type NSColor) + late final ffi.Pointer _NSURLLabelColorKey = + _lookup('NSURLLabelColorKey'); + + DartNSURLResourceKey get NSURLLabelColorKey => + objc.NSString.castFromPointer(_NSURLLabelColorKey.value, + retain: true, release: true); + + set NSURLLabelColorKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLLabelColorKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLLabelColorKey.value = value.ref.retainAndReturnPointer(); + } + + /// The user-visible label text (Read-only, value type NSString) + late final ffi.Pointer _NSURLLocalizedLabelKey = + _lookup('NSURLLocalizedLabelKey'); + + DartNSURLResourceKey get NSURLLocalizedLabelKey => + objc.NSString.castFromPointer(_NSURLLocalizedLabelKey.value, + retain: true, release: true); + + set NSURLLocalizedLabelKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLLocalizedLabelKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLLocalizedLabelKey.value = value.ref.retainAndReturnPointer(); + } + + /// The icon normally displayed for the resource (Read-only, value type NSImage) + late final ffi.Pointer _NSURLEffectiveIconKey = + _lookup('NSURLEffectiveIconKey'); + + DartNSURLResourceKey get NSURLEffectiveIconKey => + objc.NSString.castFromPointer(_NSURLEffectiveIconKey.value, + retain: true, release: true); + + set NSURLEffectiveIconKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLEffectiveIconKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLEffectiveIconKey.value = value.ref.retainAndReturnPointer(); + } + + /// The custom icon assigned to the resource, if any (Currently not implemented, value type NSImage) + late final ffi.Pointer _NSURLCustomIconKey = + _lookup('NSURLCustomIconKey'); + + DartNSURLResourceKey get NSURLCustomIconKey => + objc.NSString.castFromPointer(_NSURLCustomIconKey.value, + retain: true, release: true); + + set NSURLCustomIconKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLCustomIconKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLCustomIconKey.value = value.ref.retainAndReturnPointer(); + } + + /// An identifier which can be used to compare two file system objects for equality using -isEqual (i.e, two object identifiers are equal if they have the same file system path or if the paths are linked to same inode on the same file system). This identifier is not persistent across system restarts. (Read-only, value type id ) + late final ffi.Pointer _NSURLFileResourceIdentifierKey = + _lookup('NSURLFileResourceIdentifierKey'); + + DartNSURLResourceKey get NSURLFileResourceIdentifierKey => + objc.NSString.castFromPointer(_NSURLFileResourceIdentifierKey.value, + retain: true, release: true); + + set NSURLFileResourceIdentifierKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLFileResourceIdentifierKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceIdentifierKey.value = value.ref.retainAndReturnPointer(); + } + + /// An identifier that can be used to identify the volume the file system object is on. Other objects on the same volume will have the same volume identifier and can be compared using for equality using -isEqual. This identifier is not persistent across system restarts. (Read-only, value type id ) + late final ffi.Pointer _NSURLVolumeIdentifierKey = + _lookup('NSURLVolumeIdentifierKey'); + + DartNSURLResourceKey get NSURLVolumeIdentifierKey => + objc.NSString.castFromPointer(_NSURLVolumeIdentifierKey.value, + retain: true, release: true); + + set NSURLVolumeIdentifierKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIdentifierKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIdentifierKey.value = value.ref.retainAndReturnPointer(); + } + + /// The optimal block size when reading or writing this file's data, or nil if not available. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLPreferredIOBlockSizeKey = + _lookup('NSURLPreferredIOBlockSizeKey'); + + DartNSURLResourceKey get NSURLPreferredIOBlockSizeKey => + objc.NSString.castFromPointer(_NSURLPreferredIOBlockSizeKey.value, + retain: true, release: true); + + set NSURLPreferredIOBlockSizeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLPreferredIOBlockSizeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLPreferredIOBlockSizeKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if this process (as determined by EUID) can read the resource. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsReadableKey = + _lookup('NSURLIsReadableKey'); + + DartNSURLResourceKey get NSURLIsReadableKey => + objc.NSString.castFromPointer(_NSURLIsReadableKey.value, + retain: true, release: true); + + set NSURLIsReadableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsReadableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsReadableKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if this process (as determined by EUID) can write to the resource. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsWritableKey = + _lookup('NSURLIsWritableKey'); + + DartNSURLResourceKey get NSURLIsWritableKey => + objc.NSString.castFromPointer(_NSURLIsWritableKey.value, + retain: true, release: true); + + set NSURLIsWritableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsWritableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsWritableKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if this process (as determined by EUID) can execute a file resource or search a directory resource. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsExecutableKey = + _lookup('NSURLIsExecutableKey'); + + DartNSURLResourceKey get NSURLIsExecutableKey => + objc.NSString.castFromPointer(_NSURLIsExecutableKey.value, + retain: true, release: true); + + set NSURLIsExecutableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsExecutableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsExecutableKey.value = value.ref.retainAndReturnPointer(); + } + + /// The file system object's security information encapsulated in a NSFileSecurity object. (Read-write, Value type NSFileSecurity) + late final ffi.Pointer _NSURLFileSecurityKey = + _lookup('NSURLFileSecurityKey'); + + DartNSURLResourceKey get NSURLFileSecurityKey => + objc.NSString.castFromPointer(_NSURLFileSecurityKey.value, + retain: true, release: true); + + set NSURLFileSecurityKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLFileSecurityKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileSecurityKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if resource should be excluded from backups, false otherwise (Read-write, value type boolean NSNumber). This property is only useful for excluding cache and other application support files which are not needed in a backup. Some operations commonly made to user documents will cause this property to be reset to false and so this property should not be used on user documents. + late final ffi.Pointer _NSURLIsExcludedFromBackupKey = + _lookup('NSURLIsExcludedFromBackupKey'); + + DartNSURLResourceKey get NSURLIsExcludedFromBackupKey => + objc.NSString.castFromPointer(_NSURLIsExcludedFromBackupKey.value, + retain: true, release: true); + + set NSURLIsExcludedFromBackupKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsExcludedFromBackupKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsExcludedFromBackupKey.value = value.ref.retainAndReturnPointer(); + } + + /// The array of Tag names (Read-write, value type NSArray of NSString) + late final ffi.Pointer _NSURLTagNamesKey = + _lookup('NSURLTagNamesKey'); + + DartNSURLResourceKey get NSURLTagNamesKey => + objc.NSString.castFromPointer(_NSURLTagNamesKey.value, + retain: true, release: true); + + set NSURLTagNamesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLTagNamesKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLTagNamesKey.value = value.ref.retainAndReturnPointer(); + } + + /// the URL's path as a file system path (Read-only, value type NSString) + late final ffi.Pointer _NSURLPathKey = + _lookup('NSURLPathKey'); + + DartNSURLResourceKey get NSURLPathKey => + objc.NSString.castFromPointer(_NSURLPathKey.value, + retain: true, release: true); + + set NSURLPathKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLPathKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLPathKey.value = value.ref.retainAndReturnPointer(); + } + + /// the URL's path as a canonical absolute file system path (Read-only, value type NSString) + late final ffi.Pointer _NSURLCanonicalPathKey = + _lookup('NSURLCanonicalPathKey'); + + DartNSURLResourceKey get NSURLCanonicalPathKey => + objc.NSString.castFromPointer(_NSURLCanonicalPathKey.value, + retain: true, release: true); + + set NSURLCanonicalPathKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLCanonicalPathKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLCanonicalPathKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if this URL is a file system trigger directory. Traversing or opening a file system trigger will cause an attempt to mount a file system on the trigger directory. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsMountTriggerKey = + _lookup('NSURLIsMountTriggerKey'); + + DartNSURLResourceKey get NSURLIsMountTriggerKey => + objc.NSString.castFromPointer(_NSURLIsMountTriggerKey.value, + retain: true, release: true); + + set NSURLIsMountTriggerKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsMountTriggerKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsMountTriggerKey.value = value.ref.retainAndReturnPointer(); + } + + /// An opaque generation identifier which can be compared using isEqual: to determine if the data in a document has been modified. For URLs which refer to the same file inode, the generation identifier will change when the data in the file's data fork is changed (changes to extended attributes or other file system metadata do not change the generation identifier). For URLs which refer to the same directory inode, the generation identifier will change when direct children of that directory are added, removed or renamed (changes to the data of the direct children of that directory will not change the generation identifier). The generation identifier is persistent across system restarts. The generation identifier is tied to a specific document on a specific volume and is not transferred when the document is copied to another volume. This property is not supported by all volumes. (Read-only, value type id ) + late final ffi.Pointer _NSURLGenerationIdentifierKey = + _lookup('NSURLGenerationIdentifierKey'); + + DartNSURLResourceKey get NSURLGenerationIdentifierKey => + objc.NSString.castFromPointer(_NSURLGenerationIdentifierKey.value, + retain: true, release: true); + + set NSURLGenerationIdentifierKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLGenerationIdentifierKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLGenerationIdentifierKey.value = value.ref.retainAndReturnPointer(); + } + + /// The document identifier -- a value assigned by the kernel to a document (which can be either a file or directory) and is used to identify the document regardless of where it gets moved on a volume. The document identifier survives "safe save” operations; i.e it is sticky to the path it was assigned to (-replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error: is the preferred safe-save API). The document identifier is persistent across system restarts. The document identifier is not transferred when the file is copied. Document identifiers are only unique within a single volume. This property is not supported by all volumes. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLDocumentIdentifierKey = + _lookup('NSURLDocumentIdentifierKey'); + + DartNSURLResourceKey get NSURLDocumentIdentifierKey => + objc.NSString.castFromPointer(_NSURLDocumentIdentifierKey.value, + retain: true, release: true); + + set NSURLDocumentIdentifierKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLDocumentIdentifierKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLDocumentIdentifierKey.value = value.ref.retainAndReturnPointer(); + } + + /// The date the resource was created, or renamed into or within its parent directory. Note that inconsistent behavior may be observed when this attribute is requested on hard-linked items. This property is not supported by all volumes. (Read-only before macOS 10.15, iOS 13.0, watchOS 6.0, and tvOS 13.0; Read-write after, value type NSDate) + late final ffi.Pointer _NSURLAddedToDirectoryDateKey = + _lookup('NSURLAddedToDirectoryDateKey'); + + DartNSURLResourceKey get NSURLAddedToDirectoryDateKey => + objc.NSString.castFromPointer(_NSURLAddedToDirectoryDateKey.value, + retain: true, release: true); + + set NSURLAddedToDirectoryDateKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLAddedToDirectoryDateKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLAddedToDirectoryDateKey.value = value.ref.retainAndReturnPointer(); + } + + /// The quarantine properties as defined in LSQuarantine.h. To remove quarantine information from a file, pass NSNull as the value when setting this property. (Read-write, value type NSDictionary) + late final ffi.Pointer _NSURLQuarantinePropertiesKey = + _lookup('NSURLQuarantinePropertiesKey'); + + DartNSURLResourceKey get NSURLQuarantinePropertiesKey => + objc.NSString.castFromPointer(_NSURLQuarantinePropertiesKey.value, + retain: true, release: true); + + set NSURLQuarantinePropertiesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLQuarantinePropertiesKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLQuarantinePropertiesKey.value = value.ref.retainAndReturnPointer(); + } + + /// Returns the file system object type. (Read-only, value type NSString) + late final ffi.Pointer _NSURLFileResourceTypeKey = + _lookup('NSURLFileResourceTypeKey'); + + DartNSURLResourceKey get NSURLFileResourceTypeKey => + objc.NSString.castFromPointer(_NSURLFileResourceTypeKey.value, + retain: true, release: true); + + set NSURLFileResourceTypeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLFileResourceTypeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceTypeKey.value = value.ref.retainAndReturnPointer(); + } + + /// The file system's internal inode identifier for the item. This value is not stable for all file systems or across all mounts, so it should be used sparingly and not persisted. It is useful, for example, to match URLs from the URL enumerator with paths from FSEvents. (Read-only, value type NSNumber containing an unsigned long long). + late final ffi.Pointer _NSURLFileIdentifierKey = + _lookup('NSURLFileIdentifierKey'); + + DartNSURLResourceKey get NSURLFileIdentifierKey => + objc.NSString.castFromPointer(_NSURLFileIdentifierKey.value, + retain: true, release: true); + + set NSURLFileIdentifierKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLFileIdentifierKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileIdentifierKey.value = value.ref.retainAndReturnPointer(); + } + + /// A 64-bit value assigned by APFS that identifies a file's content data stream. Only cloned files and their originals can have the same identifier. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLFileContentIdentifierKey = + _lookup('NSURLFileContentIdentifierKey'); + + DartNSURLResourceKey get NSURLFileContentIdentifierKey => + objc.NSString.castFromPointer(_NSURLFileContentIdentifierKey.value, + retain: true, release: true); + + set NSURLFileContentIdentifierKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLFileContentIdentifierKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileContentIdentifierKey.value = value.ref.retainAndReturnPointer(); + } + + /// True for cloned files and their originals that may share all, some, or no data blocks. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLMayShareFileContentKey = + _lookup('NSURLMayShareFileContentKey'); + + DartNSURLResourceKey get NSURLMayShareFileContentKey => + objc.NSString.castFromPointer(_NSURLMayShareFileContentKey.value, + retain: true, release: true); + + set NSURLMayShareFileContentKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLMayShareFileContentKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLMayShareFileContentKey.value = value.ref.retainAndReturnPointer(); + } + + /// True if the file has extended attributes. False guarantees there are none. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLMayHaveExtendedAttributesKey = + _lookup('NSURLMayHaveExtendedAttributesKey'); + + DartNSURLResourceKey get NSURLMayHaveExtendedAttributesKey => + objc.NSString.castFromPointer(_NSURLMayHaveExtendedAttributesKey.value, + retain: true, release: true); + + set NSURLMayHaveExtendedAttributesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLMayHaveExtendedAttributesKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLMayHaveExtendedAttributesKey.value = + value.ref.retainAndReturnPointer(); + } + + /// True if the file can be deleted by the file system when asked to free space. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLIsPurgeableKey = + _lookup('NSURLIsPurgeableKey'); + + DartNSURLResourceKey get NSURLIsPurgeableKey => + objc.NSString.castFromPointer(_NSURLIsPurgeableKey.value, + retain: true, release: true); + + set NSURLIsPurgeableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsPurgeableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsPurgeableKey.value = value.ref.retainAndReturnPointer(); + } + + /// True if the file has sparse regions. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLIsSparseKey = + _lookup('NSURLIsSparseKey'); + + DartNSURLResourceKey get NSURLIsSparseKey => + objc.NSString.castFromPointer(_NSURLIsSparseKey.value, + retain: true, release: true); + + set NSURLIsSparseKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsSparseKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsSparseKey.value = value.ref.retainAndReturnPointer(); + } + + /// The file system object type values returned for the NSURLFileResourceTypeKey + late final ffi.Pointer + _NSURLFileResourceTypeNamedPipe = + _lookup('NSURLFileResourceTypeNamedPipe'); + + DartNSURLFileResourceType get NSURLFileResourceTypeNamedPipe => + objc.NSString.castFromPointer(_NSURLFileResourceTypeNamedPipe.value, + retain: true, release: true); + + set NSURLFileResourceTypeNamedPipe(DartNSURLFileResourceType value) { + objc.NSString.castFromPointer(_NSURLFileResourceTypeNamedPipe.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceTypeNamedPipe.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSURLFileResourceTypeCharacterSpecial = + _lookup('NSURLFileResourceTypeCharacterSpecial'); + + DartNSURLFileResourceType get NSURLFileResourceTypeCharacterSpecial => + objc.NSString.castFromPointer( + _NSURLFileResourceTypeCharacterSpecial.value, + retain: true, + release: true); + + set NSURLFileResourceTypeCharacterSpecial(DartNSURLFileResourceType value) { + objc.NSString.castFromPointer(_NSURLFileResourceTypeCharacterSpecial.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceTypeCharacterSpecial.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSURLFileResourceTypeDirectory = + _lookup('NSURLFileResourceTypeDirectory'); + + DartNSURLFileResourceType get NSURLFileResourceTypeDirectory => + objc.NSString.castFromPointer(_NSURLFileResourceTypeDirectory.value, + retain: true, release: true); + + set NSURLFileResourceTypeDirectory(DartNSURLFileResourceType value) { + objc.NSString.castFromPointer(_NSURLFileResourceTypeDirectory.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceTypeDirectory.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSURLFileResourceTypeBlockSpecial = + _lookup('NSURLFileResourceTypeBlockSpecial'); + + DartNSURLFileResourceType get NSURLFileResourceTypeBlockSpecial => + objc.NSString.castFromPointer(_NSURLFileResourceTypeBlockSpecial.value, + retain: true, release: true); + + set NSURLFileResourceTypeBlockSpecial(DartNSURLFileResourceType value) { + objc.NSString.castFromPointer(_NSURLFileResourceTypeBlockSpecial.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceTypeBlockSpecial.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSURLFileResourceTypeRegular = + _lookup('NSURLFileResourceTypeRegular'); + + DartNSURLFileResourceType get NSURLFileResourceTypeRegular => + objc.NSString.castFromPointer(_NSURLFileResourceTypeRegular.value, + retain: true, release: true); + + set NSURLFileResourceTypeRegular(DartNSURLFileResourceType value) { + objc.NSString.castFromPointer(_NSURLFileResourceTypeRegular.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceTypeRegular.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSURLFileResourceTypeSymbolicLink = + _lookup('NSURLFileResourceTypeSymbolicLink'); + + DartNSURLFileResourceType get NSURLFileResourceTypeSymbolicLink => + objc.NSString.castFromPointer(_NSURLFileResourceTypeSymbolicLink.value, + retain: true, release: true); + + set NSURLFileResourceTypeSymbolicLink(DartNSURLFileResourceType value) { + objc.NSString.castFromPointer(_NSURLFileResourceTypeSymbolicLink.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceTypeSymbolicLink.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSURLFileResourceTypeSocket = + _lookup('NSURLFileResourceTypeSocket'); + + DartNSURLFileResourceType get NSURLFileResourceTypeSocket => + objc.NSString.castFromPointer(_NSURLFileResourceTypeSocket.value, + retain: true, release: true); + + set NSURLFileResourceTypeSocket(DartNSURLFileResourceType value) { + objc.NSString.castFromPointer(_NSURLFileResourceTypeSocket.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceTypeSocket.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSURLFileResourceTypeUnknown = + _lookup('NSURLFileResourceTypeUnknown'); + + DartNSURLFileResourceType get NSURLFileResourceTypeUnknown => + objc.NSString.castFromPointer(_NSURLFileResourceTypeUnknown.value, + retain: true, release: true); + + set NSURLFileResourceTypeUnknown(DartNSURLFileResourceType value) { + objc.NSString.castFromPointer(_NSURLFileResourceTypeUnknown.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileResourceTypeUnknown.value = value.ref.retainAndReturnPointer(); + } + + /// dictionary of NSImage/UIImage objects keyed by size + late final ffi.Pointer _NSURLThumbnailDictionaryKey = + _lookup('NSURLThumbnailDictionaryKey'); + + DartNSURLResourceKey get NSURLThumbnailDictionaryKey => + objc.NSString.castFromPointer(_NSURLThumbnailDictionaryKey.value, + retain: true, release: true); + + set NSURLThumbnailDictionaryKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLThumbnailDictionaryKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLThumbnailDictionaryKey.value = value.ref.retainAndReturnPointer(); + } + + /// returns all thumbnails as a single NSImage + late final ffi.Pointer _NSURLThumbnailKey = + _lookup('NSURLThumbnailKey'); + + DartNSURLResourceKey get NSURLThumbnailKey => + objc.NSString.castFromPointer(_NSURLThumbnailKey.value, + retain: true, release: true); + + set NSURLThumbnailKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLThumbnailKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLThumbnailKey.value = value.ref.retainAndReturnPointer(); + } + + /// size key for a 1024 x 1024 thumbnail image + late final ffi.Pointer + _NSThumbnail1024x1024SizeKey = + _lookup('NSThumbnail1024x1024SizeKey'); + + DartNSURLThumbnailDictionaryItem get NSThumbnail1024x1024SizeKey => + objc.NSString.castFromPointer(_NSThumbnail1024x1024SizeKey.value, + retain: true, release: true); + + set NSThumbnail1024x1024SizeKey(DartNSURLThumbnailDictionaryItem value) { + objc.NSString.castFromPointer(_NSThumbnail1024x1024SizeKey.value, + retain: false, release: true) + .ref + .release(); + _NSThumbnail1024x1024SizeKey.value = value.ref.retainAndReturnPointer(); + } + + /// Total file size in bytes (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLFileSizeKey = + _lookup('NSURLFileSizeKey'); + + DartNSURLResourceKey get NSURLFileSizeKey => + objc.NSString.castFromPointer(_NSURLFileSizeKey.value, + retain: true, release: true); + + set NSURLFileSizeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLFileSizeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileSizeKey.value = value.ref.retainAndReturnPointer(); + } + + /// Total size allocated on disk for the file in bytes (number of blocks times block size) (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLFileAllocatedSizeKey = + _lookup('NSURLFileAllocatedSizeKey'); + + DartNSURLResourceKey get NSURLFileAllocatedSizeKey => + objc.NSString.castFromPointer(_NSURLFileAllocatedSizeKey.value, + retain: true, release: true); + + set NSURLFileAllocatedSizeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLFileAllocatedSizeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileAllocatedSizeKey.value = value.ref.retainAndReturnPointer(); + } + + /// Total displayable size of the file in bytes (this may include space used by metadata), or nil if not available. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLTotalFileSizeKey = + _lookup('NSURLTotalFileSizeKey'); + + DartNSURLResourceKey get NSURLTotalFileSizeKey => + objc.NSString.castFromPointer(_NSURLTotalFileSizeKey.value, + retain: true, release: true); + + set NSURLTotalFileSizeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLTotalFileSizeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLTotalFileSizeKey.value = value.ref.retainAndReturnPointer(); + } + + /// Total allocated size of the file in bytes (this may include space used by metadata), or nil if not available. This can be less than the value returned by NSURLTotalFileSizeKey if the resource is compressed. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLTotalFileAllocatedSizeKey = + _lookup('NSURLTotalFileAllocatedSizeKey'); + + DartNSURLResourceKey get NSURLTotalFileAllocatedSizeKey => + objc.NSString.castFromPointer(_NSURLTotalFileAllocatedSizeKey.value, + retain: true, release: true); + + set NSURLTotalFileAllocatedSizeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLTotalFileAllocatedSizeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLTotalFileAllocatedSizeKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the resource is a Finder alias file or a symlink, false otherwise ( Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsAliasFileKey = + _lookup('NSURLIsAliasFileKey'); + + DartNSURLResourceKey get NSURLIsAliasFileKey => + objc.NSString.castFromPointer(_NSURLIsAliasFileKey.value, + retain: true, release: true); + + set NSURLIsAliasFileKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsAliasFileKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsAliasFileKey.value = value.ref.retainAndReturnPointer(); + } + + /// The protection level for this file + late final ffi.Pointer _NSURLFileProtectionKey = + _lookup('NSURLFileProtectionKey'); + + DartNSURLResourceKey get NSURLFileProtectionKey => + objc.NSString.castFromPointer(_NSURLFileProtectionKey.value, + retain: true, release: true); + + set NSURLFileProtectionKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLFileProtectionKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileProtectionKey.value = value.ref.retainAndReturnPointer(); + } + + /// The file has no special protections associated with it. It can be read from or written to at any time. + late final ffi.Pointer _NSURLFileProtectionNone = + _lookup('NSURLFileProtectionNone'); + + DartNSURLFileProtectionType get NSURLFileProtectionNone => + objc.NSString.castFromPointer(_NSURLFileProtectionNone.value, + retain: true, release: true); + + set NSURLFileProtectionNone(DartNSURLFileProtectionType value) { + objc.NSString.castFromPointer(_NSURLFileProtectionNone.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileProtectionNone.value = value.ref.retainAndReturnPointer(); + } + + /// The file is stored in an encrypted format on disk and cannot be read from or written to while the device is locked or booting. Transient data files with this protection type should be excluded from backups using NSURLIsExcludedFromBackupKey. + late final ffi.Pointer _NSURLFileProtectionComplete = + _lookup('NSURLFileProtectionComplete'); + + DartNSURLFileProtectionType get NSURLFileProtectionComplete => + objc.NSString.castFromPointer(_NSURLFileProtectionComplete.value, + retain: true, release: true); + + set NSURLFileProtectionComplete(DartNSURLFileProtectionType value) { + objc.NSString.castFromPointer(_NSURLFileProtectionComplete.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileProtectionComplete.value = value.ref.retainAndReturnPointer(); + } + + /// The file is stored in an encrypted format on disk. Files can be created while the device is locked, but once closed, cannot be opened again until the device is unlocked. If the file is opened when unlocked, you may continue to access the file normally, even if the user locks the device. There is a small performance penalty when the file is created and opened, though not when being written to or read from. This can be mitigated by changing the file protection to NSURLFileProtectionComplete when the device is unlocked. Transient data files with this protection type should be excluded from backups using NSURLIsExcludedFromBackupKey. + late final ffi.Pointer + _NSURLFileProtectionCompleteUnlessOpen = + _lookup('NSURLFileProtectionCompleteUnlessOpen'); + + DartNSURLFileProtectionType get NSURLFileProtectionCompleteUnlessOpen => + objc.NSString.castFromPointer( + _NSURLFileProtectionCompleteUnlessOpen.value, + retain: true, + release: true); + + set NSURLFileProtectionCompleteUnlessOpen(DartNSURLFileProtectionType value) { + objc.NSString.castFromPointer(_NSURLFileProtectionCompleteUnlessOpen.value, + retain: false, release: true) + .ref + .release(); + _NSURLFileProtectionCompleteUnlessOpen.value = + value.ref.retainAndReturnPointer(); + } + + /// The file is stored in an encrypted format on disk and cannot be accessed until after the device has booted. After the user unlocks the device for the first time, your app can access the file and continue to access it even if the user subsequently locks the device. + late final ffi.Pointer + _NSURLFileProtectionCompleteUntilFirstUserAuthentication = + _lookup( + 'NSURLFileProtectionCompleteUntilFirstUserAuthentication'); + + DartNSURLFileProtectionType + get NSURLFileProtectionCompleteUntilFirstUserAuthentication => + objc.NSString.castFromPointer( + _NSURLFileProtectionCompleteUntilFirstUserAuthentication.value, + retain: true, + release: true); + + set NSURLFileProtectionCompleteUntilFirstUserAuthentication( + DartNSURLFileProtectionType value) { + objc.NSString.castFromPointer( + _NSURLFileProtectionCompleteUntilFirstUserAuthentication.value, + retain: false, + release: true) + .ref + .release(); + _NSURLFileProtectionCompleteUntilFirstUserAuthentication.value = + value.ref.retainAndReturnPointer(); + } + + /// The file is stored in an encrypted format on disk and cannot be accessed until after first unlock after the device has booted. After this first unlock, your app can access the file even while the device is locked until access expiry. Access is renewed once the user unlocks the device again. + late final ffi.Pointer + _NSURLFileProtectionCompleteWhenUserInactive = + _lookup( + 'NSURLFileProtectionCompleteWhenUserInactive'); + + DartNSURLFileProtectionType get NSURLFileProtectionCompleteWhenUserInactive => + objc.NSString.castFromPointer( + _NSURLFileProtectionCompleteWhenUserInactive.value, + retain: true, + release: true); + + set NSURLFileProtectionCompleteWhenUserInactive( + DartNSURLFileProtectionType value) { + objc.NSString.castFromPointer( + _NSURLFileProtectionCompleteWhenUserInactive.value, + retain: false, + release: true) + .ref + .release(); + _NSURLFileProtectionCompleteWhenUserInactive.value = + value.ref.retainAndReturnPointer(); + } + + /// Returns the count of file system objects contained in the directory. This is a count of objects actually stored in the file system, so excludes virtual items like "." and "..". The property is useful for quickly identifying an empty directory for backup and syncing. If the URL is not a directory or the file system cannot cheaply compute the value, `nil` is returned. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLDirectoryEntryCountKey = + _lookup('NSURLDirectoryEntryCountKey'); + + DartNSURLResourceKey get NSURLDirectoryEntryCountKey => + objc.NSString.castFromPointer(_NSURLDirectoryEntryCountKey.value, + retain: true, release: true); + + set NSURLDirectoryEntryCountKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLDirectoryEntryCountKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLDirectoryEntryCountKey.value = value.ref.retainAndReturnPointer(); + } + + /// The user-visible volume format (Read-only, value type NSString) + late final ffi.Pointer + _NSURLVolumeLocalizedFormatDescriptionKey = + _lookup('NSURLVolumeLocalizedFormatDescriptionKey'); + + DartNSURLResourceKey get NSURLVolumeLocalizedFormatDescriptionKey => + objc.NSString.castFromPointer( + _NSURLVolumeLocalizedFormatDescriptionKey.value, + retain: true, + release: true); + + set NSURLVolumeLocalizedFormatDescriptionKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLVolumeLocalizedFormatDescriptionKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLVolumeLocalizedFormatDescriptionKey.value = + value.ref.retainAndReturnPointer(); + } + + /// Total volume capacity in bytes (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLVolumeTotalCapacityKey = + _lookup('NSURLVolumeTotalCapacityKey'); + + DartNSURLResourceKey get NSURLVolumeTotalCapacityKey => + objc.NSString.castFromPointer(_NSURLVolumeTotalCapacityKey.value, + retain: true, release: true); + + set NSURLVolumeTotalCapacityKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeTotalCapacityKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeTotalCapacityKey.value = value.ref.retainAndReturnPointer(); + } + + /// Total free space in bytes (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLVolumeAvailableCapacityKey = + _lookup('NSURLVolumeAvailableCapacityKey'); + + DartNSURLResourceKey get NSURLVolumeAvailableCapacityKey => + objc.NSString.castFromPointer(_NSURLVolumeAvailableCapacityKey.value, + retain: true, release: true); + + set NSURLVolumeAvailableCapacityKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeAvailableCapacityKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeAvailableCapacityKey.value = value.ref.retainAndReturnPointer(); + } + + /// Total number of resources on the volume (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLVolumeResourceCountKey = + _lookup('NSURLVolumeResourceCountKey'); + + DartNSURLResourceKey get NSURLVolumeResourceCountKey => + objc.NSString.castFromPointer(_NSURLVolumeResourceCountKey.value, + retain: true, release: true); + + set NSURLVolumeResourceCountKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeResourceCountKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeResourceCountKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume format supports persistent object identifiers and can look up file system objects by their IDs (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsPersistentIDsKey = + _lookup('NSURLVolumeSupportsPersistentIDsKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsPersistentIDsKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsPersistentIDsKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsPersistentIDsKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsPersistentIDsKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsPersistentIDsKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume format supports symbolic links (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsSymbolicLinksKey = + _lookup('NSURLVolumeSupportsSymbolicLinksKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsSymbolicLinksKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsSymbolicLinksKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsSymbolicLinksKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsSymbolicLinksKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsSymbolicLinksKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume format supports hard links (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeSupportsHardLinksKey = + _lookup('NSURLVolumeSupportsHardLinksKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsHardLinksKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsHardLinksKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsHardLinksKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsHardLinksKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsHardLinksKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume format supports a journal used to speed recovery in case of unplanned restart (such as a power outage or crash). This does not necessarily mean the volume is actively using a journal. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeSupportsJournalingKey = + _lookup('NSURLVolumeSupportsJournalingKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsJournalingKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsJournalingKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsJournalingKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsJournalingKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsJournalingKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume is currently using a journal for speedy recovery after an unplanned restart. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsJournalingKey = + _lookup('NSURLVolumeIsJournalingKey'); + + DartNSURLResourceKey get NSURLVolumeIsJournalingKey => + objc.NSString.castFromPointer(_NSURLVolumeIsJournalingKey.value, + retain: true, release: true); + + set NSURLVolumeIsJournalingKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsJournalingKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsJournalingKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume format supports sparse files, that is, files which can have 'holes' that have never been written to, and thus do not consume space on disk. A sparse file may have an allocated size on disk that is less than its logical length (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeSupportsSparseFilesKey = + _lookup('NSURLVolumeSupportsSparseFilesKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsSparseFilesKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsSparseFilesKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsSparseFilesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsSparseFilesKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsSparseFilesKey.value = + value.ref.retainAndReturnPointer(); + } + + /// For security reasons, parts of a file (runs) that have never been written to must appear to contain zeroes. true if the volume keeps track of allocated but unwritten runs of a file so that it can substitute zeroes without actually writing zeroes to the media. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeSupportsZeroRunsKey = + _lookup('NSURLVolumeSupportsZeroRunsKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsZeroRunsKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsZeroRunsKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsZeroRunsKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsZeroRunsKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsZeroRunsKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume format treats upper and lower case characters in file and directory names as different. Otherwise an upper case character is equivalent to a lower case character, and you can't have two names that differ solely in the case of the characters. (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsCaseSensitiveNamesKey = + _lookup('NSURLVolumeSupportsCaseSensitiveNamesKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsCaseSensitiveNamesKey => + objc.NSString.castFromPointer( + _NSURLVolumeSupportsCaseSensitiveNamesKey.value, + retain: true, + release: true); + + set NSURLVolumeSupportsCaseSensitiveNamesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLVolumeSupportsCaseSensitiveNamesKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLVolumeSupportsCaseSensitiveNamesKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume format preserves the case of file and directory names. Otherwise the volume may change the case of some characters (typically making them all upper or all lower case). (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsCasePreservedNamesKey = + _lookup('NSURLVolumeSupportsCasePreservedNamesKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsCasePreservedNamesKey => + objc.NSString.castFromPointer( + _NSURLVolumeSupportsCasePreservedNamesKey.value, + retain: true, + release: true); + + set NSURLVolumeSupportsCasePreservedNamesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLVolumeSupportsCasePreservedNamesKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLVolumeSupportsCasePreservedNamesKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume supports reliable storage of times for the root directory. (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsRootDirectoryDatesKey = + _lookup('NSURLVolumeSupportsRootDirectoryDatesKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsRootDirectoryDatesKey => + objc.NSString.castFromPointer( + _NSURLVolumeSupportsRootDirectoryDatesKey.value, + retain: true, + release: true); + + set NSURLVolumeSupportsRootDirectoryDatesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLVolumeSupportsRootDirectoryDatesKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLVolumeSupportsRootDirectoryDatesKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume supports returning volume size values (NSURLVolumeTotalCapacityKey and NSURLVolumeAvailableCapacityKey). (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeSupportsVolumeSizesKey = + _lookup('NSURLVolumeSupportsVolumeSizesKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsVolumeSizesKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsVolumeSizesKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsVolumeSizesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsVolumeSizesKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsVolumeSizesKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume can be renamed. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeSupportsRenamingKey = + _lookup('NSURLVolumeSupportsRenamingKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsRenamingKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsRenamingKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsRenamingKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsRenamingKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsRenamingKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume implements whole-file flock(2) style advisory locks, and the O_EXLOCK and O_SHLOCK flags of the open(2) call. (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsAdvisoryFileLockingKey = + _lookup('NSURLVolumeSupportsAdvisoryFileLockingKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsAdvisoryFileLockingKey => + objc.NSString.castFromPointer( + _NSURLVolumeSupportsAdvisoryFileLockingKey.value, + retain: true, + release: true); + + set NSURLVolumeSupportsAdvisoryFileLockingKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLVolumeSupportsAdvisoryFileLockingKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLVolumeSupportsAdvisoryFileLockingKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume implements extended security (ACLs). (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsExtendedSecurityKey = + _lookup('NSURLVolumeSupportsExtendedSecurityKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsExtendedSecurityKey => + objc.NSString.castFromPointer( + _NSURLVolumeSupportsExtendedSecurityKey.value, + retain: true, + release: true); + + set NSURLVolumeSupportsExtendedSecurityKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsExtendedSecurityKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsExtendedSecurityKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume should be visible via the GUI (i.e., appear on the Desktop as a separate volume). (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsBrowsableKey = + _lookup('NSURLVolumeIsBrowsableKey'); + + DartNSURLResourceKey get NSURLVolumeIsBrowsableKey => + objc.NSString.castFromPointer(_NSURLVolumeIsBrowsableKey.value, + retain: true, release: true); + + set NSURLVolumeIsBrowsableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsBrowsableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsBrowsableKey.value = value.ref.retainAndReturnPointer(); + } + + /// The largest file size (in bytes) supported by this file system, or nil if this cannot be determined. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLVolumeMaximumFileSizeKey = + _lookup('NSURLVolumeMaximumFileSizeKey'); + + DartNSURLResourceKey get NSURLVolumeMaximumFileSizeKey => + objc.NSString.castFromPointer(_NSURLVolumeMaximumFileSizeKey.value, + retain: true, release: true); + + set NSURLVolumeMaximumFileSizeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeMaximumFileSizeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeMaximumFileSizeKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume's media is ejectable from the drive mechanism under software control. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsEjectableKey = + _lookup('NSURLVolumeIsEjectableKey'); + + DartNSURLResourceKey get NSURLVolumeIsEjectableKey => + objc.NSString.castFromPointer(_NSURLVolumeIsEjectableKey.value, + retain: true, release: true); + + set NSURLVolumeIsEjectableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsEjectableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsEjectableKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume's media is removable from the drive mechanism. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsRemovableKey = + _lookup('NSURLVolumeIsRemovableKey'); + + DartNSURLResourceKey get NSURLVolumeIsRemovableKey => + objc.NSString.castFromPointer(_NSURLVolumeIsRemovableKey.value, + retain: true, release: true); + + set NSURLVolumeIsRemovableKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsRemovableKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsRemovableKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume's device is connected to an internal bus, false if connected to an external bus, or nil if not available. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsInternalKey = + _lookup('NSURLVolumeIsInternalKey'); + + DartNSURLResourceKey get NSURLVolumeIsInternalKey => + objc.NSString.castFromPointer(_NSURLVolumeIsInternalKey.value, + retain: true, release: true); + + set NSURLVolumeIsInternalKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsInternalKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsInternalKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume is automounted. Note: do not mistake this with the functionality provided by kCFURLVolumeSupportsBrowsingKey. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsAutomountedKey = + _lookup('NSURLVolumeIsAutomountedKey'); + + DartNSURLResourceKey get NSURLVolumeIsAutomountedKey => + objc.NSString.castFromPointer(_NSURLVolumeIsAutomountedKey.value, + retain: true, release: true); + + set NSURLVolumeIsAutomountedKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsAutomountedKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsAutomountedKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume is stored on a local device. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsLocalKey = + _lookup('NSURLVolumeIsLocalKey'); + + DartNSURLResourceKey get NSURLVolumeIsLocalKey => + objc.NSString.castFromPointer(_NSURLVolumeIsLocalKey.value, + retain: true, release: true); + + set NSURLVolumeIsLocalKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsLocalKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsLocalKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume is read-only. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsReadOnlyKey = + _lookup('NSURLVolumeIsReadOnlyKey'); + + DartNSURLResourceKey get NSURLVolumeIsReadOnlyKey => + objc.NSString.castFromPointer(_NSURLVolumeIsReadOnlyKey.value, + retain: true, release: true); + + set NSURLVolumeIsReadOnlyKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsReadOnlyKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsReadOnlyKey.value = value.ref.retainAndReturnPointer(); + } + + /// The volume's creation date, or nil if this cannot be determined. (Read-only, value type NSDate) + late final ffi.Pointer _NSURLVolumeCreationDateKey = + _lookup('NSURLVolumeCreationDateKey'); + + DartNSURLResourceKey get NSURLVolumeCreationDateKey => + objc.NSString.castFromPointer(_NSURLVolumeCreationDateKey.value, + retain: true, release: true); + + set NSURLVolumeCreationDateKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeCreationDateKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeCreationDateKey.value = value.ref.retainAndReturnPointer(); + } + + /// The NSURL needed to remount a network volume, or nil if not available. (Read-only, value type NSURL) + late final ffi.Pointer _NSURLVolumeURLForRemountingKey = + _lookup('NSURLVolumeURLForRemountingKey'); + + DartNSURLResourceKey get NSURLVolumeURLForRemountingKey => + objc.NSString.castFromPointer(_NSURLVolumeURLForRemountingKey.value, + retain: true, release: true); + + set NSURLVolumeURLForRemountingKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeURLForRemountingKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeURLForRemountingKey.value = value.ref.retainAndReturnPointer(); + } + + /// The volume's persistent UUID as a string, or nil if a persistent UUID is not available for the volume. (Read-only, value type NSString) + late final ffi.Pointer _NSURLVolumeUUIDStringKey = + _lookup('NSURLVolumeUUIDStringKey'); + + DartNSURLResourceKey get NSURLVolumeUUIDStringKey => + objc.NSString.castFromPointer(_NSURLVolumeUUIDStringKey.value, + retain: true, release: true); + + set NSURLVolumeUUIDStringKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeUUIDStringKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeUUIDStringKey.value = value.ref.retainAndReturnPointer(); + } + + /// The name of the volume (Read-write if NSURLVolumeSupportsRenamingKey is YES, otherwise read-only, value type NSString) + late final ffi.Pointer _NSURLVolumeNameKey = + _lookup('NSURLVolumeNameKey'); + + DartNSURLResourceKey get NSURLVolumeNameKey => + objc.NSString.castFromPointer(_NSURLVolumeNameKey.value, + retain: true, release: true); + + set NSURLVolumeNameKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeNameKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeNameKey.value = value.ref.retainAndReturnPointer(); + } + + /// The user-presentable name of the volume (Read-only, value type NSString) + late final ffi.Pointer _NSURLVolumeLocalizedNameKey = + _lookup('NSURLVolumeLocalizedNameKey'); + + DartNSURLResourceKey get NSURLVolumeLocalizedNameKey => + objc.NSString.castFromPointer(_NSURLVolumeLocalizedNameKey.value, + retain: true, release: true); + + set NSURLVolumeLocalizedNameKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeLocalizedNameKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeLocalizedNameKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume is encrypted. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsEncryptedKey = + _lookup('NSURLVolumeIsEncryptedKey'); + + DartNSURLResourceKey get NSURLVolumeIsEncryptedKey => + objc.NSString.castFromPointer(_NSURLVolumeIsEncryptedKey.value, + retain: true, release: true); + + set NSURLVolumeIsEncryptedKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsEncryptedKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsEncryptedKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume is the root filesystem. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeIsRootFileSystemKey = + _lookup('NSURLVolumeIsRootFileSystemKey'); + + DartNSURLResourceKey get NSURLVolumeIsRootFileSystemKey => + objc.NSString.castFromPointer(_NSURLVolumeIsRootFileSystemKey.value, + retain: true, release: true); + + set NSURLVolumeIsRootFileSystemKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeIsRootFileSystemKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeIsRootFileSystemKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if the volume supports transparent decompression of compressed files using decmpfs. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeSupportsCompressionKey = + _lookup('NSURLVolumeSupportsCompressionKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsCompressionKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsCompressionKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsCompressionKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsCompressionKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsCompressionKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume supports clonefile(2) (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeSupportsFileCloningKey = + _lookup('NSURLVolumeSupportsFileCloningKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsFileCloningKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsFileCloningKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsFileCloningKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsFileCloningKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsFileCloningKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume supports renamex_np(2)'s RENAME_SWAP option (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLVolumeSupportsSwapRenamingKey = + _lookup('NSURLVolumeSupportsSwapRenamingKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsSwapRenamingKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsSwapRenamingKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsSwapRenamingKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsSwapRenamingKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsSwapRenamingKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume supports renamex_np(2)'s RENAME_EXCL option (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsExclusiveRenamingKey = + _lookup('NSURLVolumeSupportsExclusiveRenamingKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsExclusiveRenamingKey => + objc.NSString.castFromPointer( + _NSURLVolumeSupportsExclusiveRenamingKey.value, + retain: true, + release: true); + + set NSURLVolumeSupportsExclusiveRenamingKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLVolumeSupportsExclusiveRenamingKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLVolumeSupportsExclusiveRenamingKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume supports making files immutable with the NSURLIsUserImmutableKey or NSURLIsSystemImmutableKey properties (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsImmutableFilesKey = + _lookup('NSURLVolumeSupportsImmutableFilesKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsImmutableFilesKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsImmutableFilesKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsImmutableFilesKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsImmutableFilesKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsImmutableFilesKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the volume supports setting POSIX access permissions with the NSURLFileSecurityKey property (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsAccessPermissionsKey = + _lookup('NSURLVolumeSupportsAccessPermissionsKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsAccessPermissionsKey => + objc.NSString.castFromPointer( + _NSURLVolumeSupportsAccessPermissionsKey.value, + retain: true, + release: true); + + set NSURLVolumeSupportsAccessPermissionsKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLVolumeSupportsAccessPermissionsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLVolumeSupportsAccessPermissionsKey.value = + value.ref.retainAndReturnPointer(); + } + + /// True if the volume supports the File Protection attribute (see NSURLFileProtectionKey). (Read-only, value type NSNumber) + late final ffi.Pointer + _NSURLVolumeSupportsFileProtectionKey = + _lookup('NSURLVolumeSupportsFileProtectionKey'); + + DartNSURLResourceKey get NSURLVolumeSupportsFileProtectionKey => + objc.NSString.castFromPointer(_NSURLVolumeSupportsFileProtectionKey.value, + retain: true, release: true); + + set NSURLVolumeSupportsFileProtectionKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSupportsFileProtectionKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSupportsFileProtectionKey.value = + value.ref.retainAndReturnPointer(); + } + + /// (Read-only, value type NSNumber) + late final ffi.Pointer + _NSURLVolumeAvailableCapacityForImportantUsageKey = + _lookup( + 'NSURLVolumeAvailableCapacityForImportantUsageKey'); + + DartNSURLResourceKey get NSURLVolumeAvailableCapacityForImportantUsageKey => + objc.NSString.castFromPointer( + _NSURLVolumeAvailableCapacityForImportantUsageKey.value, + retain: true, + release: true); + + set NSURLVolumeAvailableCapacityForImportantUsageKey( + DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLVolumeAvailableCapacityForImportantUsageKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLVolumeAvailableCapacityForImportantUsageKey.value = + value.ref.retainAndReturnPointer(); + } + + /// (Read-only, value type NSNumber) + late final ffi.Pointer + _NSURLVolumeAvailableCapacityForOpportunisticUsageKey = + _lookup( + 'NSURLVolumeAvailableCapacityForOpportunisticUsageKey'); + + DartNSURLResourceKey + get NSURLVolumeAvailableCapacityForOpportunisticUsageKey => + objc.NSString.castFromPointer( + _NSURLVolumeAvailableCapacityForOpportunisticUsageKey.value, + retain: true, + release: true); + + set NSURLVolumeAvailableCapacityForOpportunisticUsageKey( + DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLVolumeAvailableCapacityForOpportunisticUsageKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLVolumeAvailableCapacityForOpportunisticUsageKey.value = + value.ref.retainAndReturnPointer(); + } + + /// The name of the file system type. (Read-only, value type NSString) + late final ffi.Pointer _NSURLVolumeTypeNameKey = + _lookup('NSURLVolumeTypeNameKey'); + + DartNSURLResourceKey get NSURLVolumeTypeNameKey => + objc.NSString.castFromPointer(_NSURLVolumeTypeNameKey.value, + retain: true, release: true); + + set NSURLVolumeTypeNameKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeTypeNameKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeTypeNameKey.value = value.ref.retainAndReturnPointer(); + } + + /// The file system subtype value. (Read-only, value type NSNumber) + late final ffi.Pointer _NSURLVolumeSubtypeKey = + _lookup('NSURLVolumeSubtypeKey'); + + DartNSURLResourceKey get NSURLVolumeSubtypeKey => + objc.NSString.castFromPointer(_NSURLVolumeSubtypeKey.value, + retain: true, release: true); + + set NSURLVolumeSubtypeKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeSubtypeKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeSubtypeKey.value = value.ref.retainAndReturnPointer(); + } + + /// The volume mounted from location. (Read-only, value type NSString) + late final ffi.Pointer _NSURLVolumeMountFromLocationKey = + _lookup('NSURLVolumeMountFromLocationKey'); + + DartNSURLResourceKey get NSURLVolumeMountFromLocationKey => + objc.NSString.castFromPointer(_NSURLVolumeMountFromLocationKey.value, + retain: true, release: true); + + set NSURLVolumeMountFromLocationKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLVolumeMountFromLocationKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLVolumeMountFromLocationKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if this item is synced to the cloud, false if it is only a local file. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLIsUbiquitousItemKey = + _lookup('NSURLIsUbiquitousItemKey'); + + DartNSURLResourceKey get NSURLIsUbiquitousItemKey => + objc.NSString.castFromPointer(_NSURLIsUbiquitousItemKey.value, + retain: true, release: true); + + set NSURLIsUbiquitousItemKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLIsUbiquitousItemKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLIsUbiquitousItemKey.value = value.ref.retainAndReturnPointer(); + } + + /// true if this item has conflicts outstanding. (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLUbiquitousItemHasUnresolvedConflictsKey = + _lookup('NSURLUbiquitousItemHasUnresolvedConflictsKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemHasUnresolvedConflictsKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemHasUnresolvedConflictsKey.value, + retain: true, + release: true); + + set NSURLUbiquitousItemHasUnresolvedConflictsKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousItemHasUnresolvedConflictsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousItemHasUnresolvedConflictsKey.value = + value.ref.retainAndReturnPointer(); + } + + /// equivalent to NSURLUbiquitousItemDownloadingStatusKey == NSURLUbiquitousItemDownloadingStatusCurrent. Has never behaved as documented in earlier releases, hence deprecated. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLUbiquitousItemIsDownloadedKey = + _lookup('NSURLUbiquitousItemIsDownloadedKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemIsDownloadedKey => + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsDownloadedKey.value, + retain: true, release: true); + + set NSURLUbiquitousItemIsDownloadedKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsDownloadedKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLUbiquitousItemIsDownloadedKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if data is being downloaded for this item. (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLUbiquitousItemIsDownloadingKey = + _lookup('NSURLUbiquitousItemIsDownloadingKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemIsDownloadingKey => + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsDownloadingKey.value, + retain: true, release: true); + + set NSURLUbiquitousItemIsDownloadingKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsDownloadingKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLUbiquitousItemIsDownloadingKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if there is data present in the cloud for this item. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLUbiquitousItemIsUploadedKey = + _lookup('NSURLUbiquitousItemIsUploadedKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemIsUploadedKey => + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsUploadedKey.value, + retain: true, release: true); + + set NSURLUbiquitousItemIsUploadedKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsUploadedKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLUbiquitousItemIsUploadedKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if data is being uploaded for this item. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLUbiquitousItemIsUploadingKey = + _lookup('NSURLUbiquitousItemIsUploadingKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemIsUploadingKey => + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsUploadingKey.value, + retain: true, release: true); + + set NSURLUbiquitousItemIsUploadingKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsUploadingKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLUbiquitousItemIsUploadingKey.value = + value.ref.retainAndReturnPointer(); + } + + /// Use NSMetadataQuery and NSMetadataUbiquitousItemPercentDownloadedKey on NSMetadataItem instead + late final ffi.Pointer + _NSURLUbiquitousItemPercentDownloadedKey = + _lookup('NSURLUbiquitousItemPercentDownloadedKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemPercentDownloadedKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemPercentDownloadedKey.value, + retain: true, + release: true); + + set NSURLUbiquitousItemPercentDownloadedKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousItemPercentDownloadedKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousItemPercentDownloadedKey.value = + value.ref.retainAndReturnPointer(); + } + + /// Use NSMetadataQuery and NSMetadataUbiquitousItemPercentUploadedKey on NSMetadataItem instead + late final ffi.Pointer + _NSURLUbiquitousItemPercentUploadedKey = + _lookup('NSURLUbiquitousItemPercentUploadedKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemPercentUploadedKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemPercentUploadedKey.value, + retain: true, + release: true); + + set NSURLUbiquitousItemPercentUploadedKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLUbiquitousItemPercentUploadedKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLUbiquitousItemPercentUploadedKey.value = + value.ref.retainAndReturnPointer(); + } + + /// returns the download status of this item. (Read-only, value type NSString). Possible values below. + late final ffi.Pointer + _NSURLUbiquitousItemDownloadingStatusKey = + _lookup('NSURLUbiquitousItemDownloadingStatusKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemDownloadingStatusKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadingStatusKey.value, + retain: true, + release: true); + + set NSURLUbiquitousItemDownloadingStatusKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadingStatusKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousItemDownloadingStatusKey.value = + value.ref.retainAndReturnPointer(); + } + + /// returns the error when downloading the item from iCloud failed, see the NSUbiquitousFile section in FoundationErrors.h (Read-only, value type NSError) + late final ffi.Pointer + _NSURLUbiquitousItemDownloadingErrorKey = + _lookup('NSURLUbiquitousItemDownloadingErrorKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemDownloadingErrorKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadingErrorKey.value, + retain: true, + release: true); + + set NSURLUbiquitousItemDownloadingErrorKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLUbiquitousItemDownloadingErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLUbiquitousItemDownloadingErrorKey.value = + value.ref.retainAndReturnPointer(); + } + + /// returns the error when uploading the item to iCloud failed, see the NSUbiquitousFile section in FoundationErrors.h (Read-only, value type NSError) + late final ffi.Pointer + _NSURLUbiquitousItemUploadingErrorKey = + _lookup('NSURLUbiquitousItemUploadingErrorKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemUploadingErrorKey => + objc.NSString.castFromPointer(_NSURLUbiquitousItemUploadingErrorKey.value, + retain: true, release: true); + + set NSURLUbiquitousItemUploadingErrorKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLUbiquitousItemUploadingErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLUbiquitousItemUploadingErrorKey.value = + value.ref.retainAndReturnPointer(); + } + + /// returns whether a download of this item has already been requested with an API like -startDownloadingUbiquitousItemAtURL:error: (Read-only, value type boolean NSNumber) + late final ffi.Pointer + _NSURLUbiquitousItemDownloadRequestedKey = + _lookup('NSURLUbiquitousItemDownloadRequestedKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemDownloadRequestedKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadRequestedKey.value, + retain: true, + release: true); + + set NSURLUbiquitousItemDownloadRequestedKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadRequestedKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousItemDownloadRequestedKey.value = + value.ref.retainAndReturnPointer(); + } + + /// returns the name of this item's container as displayed to users. + late final ffi.Pointer + _NSURLUbiquitousItemContainerDisplayNameKey = + _lookup('NSURLUbiquitousItemContainerDisplayNameKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemContainerDisplayNameKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemContainerDisplayNameKey.value, + retain: true, + release: true); + + set NSURLUbiquitousItemContainerDisplayNameKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousItemContainerDisplayNameKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousItemContainerDisplayNameKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the item is excluded from sync, which means it is locally on disk but won't be available on the server. An excluded item is no longer ubiquitous. (Read-write, value type boolean NSNumber + late final ffi.Pointer + _NSURLUbiquitousItemIsExcludedFromSyncKey = + _lookup('NSURLUbiquitousItemIsExcludedFromSyncKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemIsExcludedFromSyncKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemIsExcludedFromSyncKey.value, + retain: true, + release: true); + + set NSURLUbiquitousItemIsExcludedFromSyncKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousItemIsExcludedFromSyncKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousItemIsExcludedFromSyncKey.value = + value.ref.retainAndReturnPointer(); + } + + /// true if the ubiquitous item is shared. (Read-only, value type boolean NSNumber) + late final ffi.Pointer _NSURLUbiquitousItemIsSharedKey = + _lookup('NSURLUbiquitousItemIsSharedKey'); + + DartNSURLResourceKey get NSURLUbiquitousItemIsSharedKey => + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsSharedKey.value, + retain: true, release: true); + + set NSURLUbiquitousItemIsSharedKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer(_NSURLUbiquitousItemIsSharedKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLUbiquitousItemIsSharedKey.value = value.ref.retainAndReturnPointer(); + } + + /// returns the current user's role for this shared item, or nil if not shared. (Read-only, value type NSString). Possible values below. + late final ffi.Pointer + _NSURLUbiquitousSharedItemCurrentUserRoleKey = + _lookup('NSURLUbiquitousSharedItemCurrentUserRoleKey'); + + DartNSURLResourceKey get NSURLUbiquitousSharedItemCurrentUserRoleKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemCurrentUserRoleKey.value, + retain: true, + release: true); + + set NSURLUbiquitousSharedItemCurrentUserRoleKey(DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemCurrentUserRoleKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousSharedItemCurrentUserRoleKey.value = + value.ref.retainAndReturnPointer(); + } + + /// returns the permissions for the current user, or nil if not shared. (Read-only, value type NSString). Possible values below. + late final ffi.Pointer + _NSURLUbiquitousSharedItemCurrentUserPermissionsKey = + _lookup( + 'NSURLUbiquitousSharedItemCurrentUserPermissionsKey'); + + DartNSURLResourceKey get NSURLUbiquitousSharedItemCurrentUserPermissionsKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemCurrentUserPermissionsKey.value, + retain: true, + release: true); + + set NSURLUbiquitousSharedItemCurrentUserPermissionsKey( + DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemCurrentUserPermissionsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousSharedItemCurrentUserPermissionsKey.value = + value.ref.retainAndReturnPointer(); + } + + /// returns a NSPersonNameComponents, or nil if the current user. (Read-only, value type NSPersonNameComponents) + late final ffi.Pointer + _NSURLUbiquitousSharedItemOwnerNameComponentsKey = + _lookup( + 'NSURLUbiquitousSharedItemOwnerNameComponentsKey'); + + DartNSURLResourceKey get NSURLUbiquitousSharedItemOwnerNameComponentsKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemOwnerNameComponentsKey.value, + retain: true, + release: true); + + set NSURLUbiquitousSharedItemOwnerNameComponentsKey( + DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemOwnerNameComponentsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousSharedItemOwnerNameComponentsKey.value = + value.ref.retainAndReturnPointer(); + } + + /// returns a NSPersonNameComponents for the most recent editor of the document, or nil if it is the current user. (Read-only, value type NSPersonNameComponents) + late final ffi.Pointer + _NSURLUbiquitousSharedItemMostRecentEditorNameComponentsKey = + _lookup( + 'NSURLUbiquitousSharedItemMostRecentEditorNameComponentsKey'); + + DartNSURLResourceKey + get NSURLUbiquitousSharedItemMostRecentEditorNameComponentsKey => + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemMostRecentEditorNameComponentsKey.value, + retain: true, + release: true); + + set NSURLUbiquitousSharedItemMostRecentEditorNameComponentsKey( + DartNSURLResourceKey value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemMostRecentEditorNameComponentsKey.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousSharedItemMostRecentEditorNameComponentsKey.value = + value.ref.retainAndReturnPointer(); + } + + /// this item has not been downloaded yet. Use startDownloadingUbiquitousItemAtURL:error: to download it. + late final ffi.Pointer + _NSURLUbiquitousItemDownloadingStatusNotDownloaded = + _lookup( + 'NSURLUbiquitousItemDownloadingStatusNotDownloaded'); + + DartNSURLUbiquitousItemDownloadingStatus + get NSURLUbiquitousItemDownloadingStatusNotDownloaded => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadingStatusNotDownloaded.value, + retain: true, + release: true); + + set NSURLUbiquitousItemDownloadingStatusNotDownloaded( + DartNSURLUbiquitousItemDownloadingStatus value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadingStatusNotDownloaded.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousItemDownloadingStatusNotDownloaded.value = + value.ref.retainAndReturnPointer(); + } + + /// there is a local version of this item available. The most current version will get downloaded as soon as possible. + late final ffi.Pointer + _NSURLUbiquitousItemDownloadingStatusDownloaded = + _lookup( + 'NSURLUbiquitousItemDownloadingStatusDownloaded'); + + DartNSURLUbiquitousItemDownloadingStatus + get NSURLUbiquitousItemDownloadingStatusDownloaded => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadingStatusDownloaded.value, + retain: true, + release: true); + + set NSURLUbiquitousItemDownloadingStatusDownloaded( + DartNSURLUbiquitousItemDownloadingStatus value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadingStatusDownloaded.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousItemDownloadingStatusDownloaded.value = + value.ref.retainAndReturnPointer(); + } + + /// there is a local version of this item and it is the most up-to-date version known to this device. + late final ffi.Pointer + _NSURLUbiquitousItemDownloadingStatusCurrent = + _lookup( + 'NSURLUbiquitousItemDownloadingStatusCurrent'); + + DartNSURLUbiquitousItemDownloadingStatus + get NSURLUbiquitousItemDownloadingStatusCurrent => + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadingStatusCurrent.value, + retain: true, + release: true); + + set NSURLUbiquitousItemDownloadingStatusCurrent( + DartNSURLUbiquitousItemDownloadingStatus value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousItemDownloadingStatusCurrent.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousItemDownloadingStatusCurrent.value = + value.ref.retainAndReturnPointer(); + } + + /// the current user is the owner of this shared item. + late final ffi.Pointer + _NSURLUbiquitousSharedItemRoleOwner = + _lookup( + 'NSURLUbiquitousSharedItemRoleOwner'); + + DartNSURLUbiquitousSharedItemRole get NSURLUbiquitousSharedItemRoleOwner => + objc.NSString.castFromPointer(_NSURLUbiquitousSharedItemRoleOwner.value, + retain: true, release: true); + + set NSURLUbiquitousSharedItemRoleOwner( + DartNSURLUbiquitousSharedItemRole value) { + objc.NSString.castFromPointer(_NSURLUbiquitousSharedItemRoleOwner.value, + retain: false, release: true) + .ref + .release(); + _NSURLUbiquitousSharedItemRoleOwner.value = + value.ref.retainAndReturnPointer(); + } + + /// the current user is a participant of this shared item. + late final ffi.Pointer + _NSURLUbiquitousSharedItemRoleParticipant = + _lookup( + 'NSURLUbiquitousSharedItemRoleParticipant'); + + DartNSURLUbiquitousSharedItemRole + get NSURLUbiquitousSharedItemRoleParticipant => + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemRoleParticipant.value, + retain: true, + release: true); + + set NSURLUbiquitousSharedItemRoleParticipant( + DartNSURLUbiquitousSharedItemRole value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemRoleParticipant.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousSharedItemRoleParticipant.value = + value.ref.retainAndReturnPointer(); + } + + /// the current user is only allowed to read this item + late final ffi.Pointer + _NSURLUbiquitousSharedItemPermissionsReadOnly = + _lookup( + 'NSURLUbiquitousSharedItemPermissionsReadOnly'); + + DartNSURLUbiquitousSharedItemPermissions + get NSURLUbiquitousSharedItemPermissionsReadOnly => + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemPermissionsReadOnly.value, + retain: true, + release: true); + + set NSURLUbiquitousSharedItemPermissionsReadOnly( + DartNSURLUbiquitousSharedItemPermissions value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemPermissionsReadOnly.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousSharedItemPermissionsReadOnly.value = + value.ref.retainAndReturnPointer(); + } + + /// the current user is allowed to both read and write this item + late final ffi.Pointer + _NSURLUbiquitousSharedItemPermissionsReadWrite = + _lookup( + 'NSURLUbiquitousSharedItemPermissionsReadWrite'); + + DartNSURLUbiquitousSharedItemPermissions + get NSURLUbiquitousSharedItemPermissionsReadWrite => + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemPermissionsReadWrite.value, + retain: true, + release: true); + + set NSURLUbiquitousSharedItemPermissionsReadWrite( + DartNSURLUbiquitousSharedItemPermissions value) { + objc.NSString.castFromPointer( + _NSURLUbiquitousSharedItemPermissionsReadWrite.value, + retain: false, + release: true) + .ref + .release(); + _NSURLUbiquitousSharedItemPermissionsReadWrite.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSGenericException = + _lookup('NSGenericException'); + + DartNSExceptionName get NSGenericException => + objc.NSString.castFromPointer(_NSGenericException.value, + retain: true, release: true); + + set NSGenericException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSGenericException.value, + retain: false, release: true) + .ref + .release(); + _NSGenericException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSRangeException = + _lookup('NSRangeException'); + + DartNSExceptionName get NSRangeException => + objc.NSString.castFromPointer(_NSRangeException.value, + retain: true, release: true); + + set NSRangeException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSRangeException.value, + retain: false, release: true) + .ref + .release(); + _NSRangeException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSInvalidArgumentException = + _lookup('NSInvalidArgumentException'); + + DartNSExceptionName get NSInvalidArgumentException => + objc.NSString.castFromPointer(_NSInvalidArgumentException.value, + retain: true, release: true); + + set NSInvalidArgumentException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSInvalidArgumentException.value, + retain: false, release: true) + .ref + .release(); + _NSInvalidArgumentException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSInternalInconsistencyException = + _lookup('NSInternalInconsistencyException'); + + DartNSExceptionName get NSInternalInconsistencyException => + objc.NSString.castFromPointer(_NSInternalInconsistencyException.value, + retain: true, release: true); + + set NSInternalInconsistencyException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSInternalInconsistencyException.value, + retain: false, release: true) + .ref + .release(); + _NSInternalInconsistencyException.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSMallocException = + _lookup('NSMallocException'); + + DartNSExceptionName get NSMallocException => + objc.NSString.castFromPointer(_NSMallocException.value, + retain: true, release: true); + + set NSMallocException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSMallocException.value, + retain: false, release: true) + .ref + .release(); + _NSMallocException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSObjectInaccessibleException = + _lookup('NSObjectInaccessibleException'); + + DartNSExceptionName get NSObjectInaccessibleException => + objc.NSString.castFromPointer(_NSObjectInaccessibleException.value, + retain: true, release: true); + + set NSObjectInaccessibleException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSObjectInaccessibleException.value, + retain: false, release: true) + .ref + .release(); + _NSObjectInaccessibleException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSObjectNotAvailableException = + _lookup('NSObjectNotAvailableException'); + + DartNSExceptionName get NSObjectNotAvailableException => + objc.NSString.castFromPointer(_NSObjectNotAvailableException.value, + retain: true, release: true); + + set NSObjectNotAvailableException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSObjectNotAvailableException.value, + retain: false, release: true) + .ref + .release(); + _NSObjectNotAvailableException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSDestinationInvalidException = + _lookup('NSDestinationInvalidException'); + + DartNSExceptionName get NSDestinationInvalidException => + objc.NSString.castFromPointer(_NSDestinationInvalidException.value, + retain: true, release: true); + + set NSDestinationInvalidException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSDestinationInvalidException.value, + retain: false, release: true) + .ref + .release(); + _NSDestinationInvalidException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSPortTimeoutException = + _lookup('NSPortTimeoutException'); + + DartNSExceptionName get NSPortTimeoutException => + objc.NSString.castFromPointer(_NSPortTimeoutException.value, + retain: true, release: true); + + set NSPortTimeoutException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSPortTimeoutException.value, + retain: false, release: true) + .ref + .release(); + _NSPortTimeoutException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSInvalidSendPortException = + _lookup('NSInvalidSendPortException'); + + DartNSExceptionName get NSInvalidSendPortException => + objc.NSString.castFromPointer(_NSInvalidSendPortException.value, + retain: true, release: true); + + set NSInvalidSendPortException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSInvalidSendPortException.value, + retain: false, release: true) + .ref + .release(); + _NSInvalidSendPortException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSInvalidReceivePortException = + _lookup('NSInvalidReceivePortException'); + + DartNSExceptionName get NSInvalidReceivePortException => + objc.NSString.castFromPointer(_NSInvalidReceivePortException.value, + retain: true, release: true); + + set NSInvalidReceivePortException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSInvalidReceivePortException.value, + retain: false, release: true) + .ref + .release(); + _NSInvalidReceivePortException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSPortSendException = + _lookup('NSPortSendException'); + + DartNSExceptionName get NSPortSendException => + objc.NSString.castFromPointer(_NSPortSendException.value, + retain: true, release: true); + + set NSPortSendException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSPortSendException.value, + retain: false, release: true) + .ref + .release(); + _NSPortSendException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSPortReceiveException = + _lookup('NSPortReceiveException'); + + DartNSExceptionName get NSPortReceiveException => + objc.NSString.castFromPointer(_NSPortReceiveException.value, + retain: true, release: true); + + set NSPortReceiveException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSPortReceiveException.value, + retain: false, release: true) + .ref + .release(); + _NSPortReceiveException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSOldStyleException = + _lookup('NSOldStyleException'); + + DartNSExceptionName get NSOldStyleException => + objc.NSString.castFromPointer(_NSOldStyleException.value, + retain: true, release: true); + + set NSOldStyleException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSOldStyleException.value, + retain: false, release: true) + .ref + .release(); + _NSOldStyleException.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSInconsistentArchiveException = + _lookup('NSInconsistentArchiveException'); + + DartNSExceptionName get NSInconsistentArchiveException => + objc.NSString.castFromPointer(_NSInconsistentArchiveException.value, + retain: true, release: true); + + set NSInconsistentArchiveException(DartNSExceptionName value) { + objc.NSString.castFromPointer(_NSInconsistentArchiveException.value, + retain: false, release: true) + .ref + .release(); + _NSInconsistentArchiveException.value = value.ref.retainAndReturnPointer(); + } + + ffi.Pointer NSGetUncaughtExceptionHandler() { + return _NSGetUncaughtExceptionHandler(); + } + + late final _NSGetUncaughtExceptionHandlerPtr = _lookup< + ffi + .NativeFunction Function()>>( + 'NSGetUncaughtExceptionHandler'); + late final _NSGetUncaughtExceptionHandler = _NSGetUncaughtExceptionHandlerPtr + .asFunction Function()>(); + + void NSSetUncaughtExceptionHandler( + ffi.Pointer arg0, + ) { + return _NSSetUncaughtExceptionHandler( + arg0, + ); + } + + late final _NSSetUncaughtExceptionHandlerPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer)>>( + 'NSSetUncaughtExceptionHandler'); + late final _NSSetUncaughtExceptionHandler = _NSSetUncaughtExceptionHandlerPtr + .asFunction)>(); + + late final ffi.Pointer> _NSAssertionHandlerKey = + _lookup>('NSAssertionHandlerKey'); + + objc.NSString get NSAssertionHandlerKey => + objc.NSString.castFromPointer(_NSAssertionHandlerKey.value, + retain: true, release: true); + + set NSAssertionHandlerKey(objc.NSString value) { + objc.NSString.castFromPointer(_NSAssertionHandlerKey.value, + retain: false, release: true) + .ref + .release(); + _NSAssertionHandlerKey.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSInvocationOperationVoidResultException = + _lookup('NSInvocationOperationVoidResultException'); + + DartNSExceptionName get NSInvocationOperationVoidResultException => + objc.NSString.castFromPointer( + _NSInvocationOperationVoidResultException.value, + retain: true, + release: true); + + set NSInvocationOperationVoidResultException(DartNSExceptionName value) { + objc.NSString.castFromPointer( + _NSInvocationOperationVoidResultException.value, + retain: false, + release: true) + .ref + .release(); + _NSInvocationOperationVoidResultException.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSInvocationOperationCancelledException = + _lookup('NSInvocationOperationCancelledException'); + + DartNSExceptionName get NSInvocationOperationCancelledException => + objc.NSString.castFromPointer( + _NSInvocationOperationCancelledException.value, + retain: true, + release: true); + + set NSInvocationOperationCancelledException(DartNSExceptionName value) { + objc.NSString.castFromPointer( + _NSInvocationOperationCancelledException.value, + retain: false, + release: true) + .ref + .release(); + _NSInvocationOperationCancelledException.value = + value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer + _NSOperationQueueDefaultMaxConcurrentOperationCount = + _lookup('NSOperationQueueDefaultMaxConcurrentOperationCount'); + + DartNSInteger get NSOperationQueueDefaultMaxConcurrentOperationCount => + _NSOperationQueueDefaultMaxConcurrentOperationCount.value; + + /// Predefined domain for errors from most AppKit and Foundation APIs. + late final ffi.Pointer _NSCocoaErrorDomain = + _lookup('NSCocoaErrorDomain'); + + DartNSErrorDomain get NSCocoaErrorDomain => + objc.NSString.castFromPointer(_NSCocoaErrorDomain.value, + retain: true, release: true); + + set NSCocoaErrorDomain(DartNSErrorDomain value) { + objc.NSString.castFromPointer(_NSCocoaErrorDomain.value, + retain: false, release: true) + .ref + .release(); + _NSCocoaErrorDomain.value = value.ref.retainAndReturnPointer(); + } + + /// Other predefined domains; value of "code" will correspond to preexisting values in these domains. + late final ffi.Pointer _NSPOSIXErrorDomain = + _lookup('NSPOSIXErrorDomain'); + + DartNSErrorDomain get NSPOSIXErrorDomain => + objc.NSString.castFromPointer(_NSPOSIXErrorDomain.value, + retain: true, release: true); + + set NSPOSIXErrorDomain(DartNSErrorDomain value) { + objc.NSString.castFromPointer(_NSPOSIXErrorDomain.value, + retain: false, release: true) + .ref + .release(); + _NSPOSIXErrorDomain.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSOSStatusErrorDomain = + _lookup('NSOSStatusErrorDomain'); + + DartNSErrorDomain get NSOSStatusErrorDomain => + objc.NSString.castFromPointer(_NSOSStatusErrorDomain.value, + retain: true, release: true); + + set NSOSStatusErrorDomain(DartNSErrorDomain value) { + objc.NSString.castFromPointer(_NSOSStatusErrorDomain.value, + retain: false, release: true) + .ref + .release(); + _NSOSStatusErrorDomain.value = value.ref.retainAndReturnPointer(); + } + + late final ffi.Pointer _NSMachErrorDomain = + _lookup('NSMachErrorDomain'); + + DartNSErrorDomain get NSMachErrorDomain => + objc.NSString.castFromPointer(_NSMachErrorDomain.value, + retain: true, release: true); + + set NSMachErrorDomain(DartNSErrorDomain value) { + objc.NSString.castFromPointer(_NSMachErrorDomain.value, + retain: false, release: true) + .ref + .release(); + _NSMachErrorDomain.value = value.ref.retainAndReturnPointer(); + } + + /// Key in userInfo. A recommended standard way to embed NSErrors from underlying calls. The value of this key should be an NSError. + late final ffi.Pointer _NSUnderlyingErrorKey = + _lookup('NSUnderlyingErrorKey'); + + DartNSErrorUserInfoKey get NSUnderlyingErrorKey => + objc.NSString.castFromPointer(_NSUnderlyingErrorKey.value, + retain: true, release: true); + + set NSUnderlyingErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSUnderlyingErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSUnderlyingErrorKey.value = value.ref.retainAndReturnPointer(); + } + + /// Key in userInfo. A recommended standard way to embed a list of several NSErrors from underlying calls. The value of this key should be an NSArray of NSError. This value is independent from the value of `NSUnderlyingErrorKey` - neither, one, or both may be set. + late final ffi.Pointer _NSMultipleUnderlyingErrorsKey = + _lookup('NSMultipleUnderlyingErrorsKey'); + + DartNSErrorUserInfoKey get NSMultipleUnderlyingErrorsKey => + objc.NSString.castFromPointer(_NSMultipleUnderlyingErrorsKey.value, + retain: true, release: true); + + set NSMultipleUnderlyingErrorsKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSMultipleUnderlyingErrorsKey.value, + retain: false, release: true) + .ref + .release(); + _NSMultipleUnderlyingErrorsKey.value = value.ref.retainAndReturnPointer(); + } + + /// NSString, a complete sentence (or more) describing ideally both what failed and why it failed. + late final ffi.Pointer _NSLocalizedDescriptionKey = + _lookup('NSLocalizedDescriptionKey'); + + DartNSErrorUserInfoKey get NSLocalizedDescriptionKey => + objc.NSString.castFromPointer(_NSLocalizedDescriptionKey.value, + retain: true, release: true); + + set NSLocalizedDescriptionKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSLocalizedDescriptionKey.value, + retain: false, release: true) + .ref + .release(); + _NSLocalizedDescriptionKey.value = value.ref.retainAndReturnPointer(); + } + + /// NSString, a complete sentence (or more) describing why the operation failed. + late final ffi.Pointer _NSLocalizedFailureReasonErrorKey = + _lookup('NSLocalizedFailureReasonErrorKey'); + + DartNSErrorUserInfoKey get NSLocalizedFailureReasonErrorKey => + objc.NSString.castFromPointer(_NSLocalizedFailureReasonErrorKey.value, + retain: true, release: true); + + set NSLocalizedFailureReasonErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSLocalizedFailureReasonErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSLocalizedFailureReasonErrorKey.value = + value.ref.retainAndReturnPointer(); + } + + /// NSString, a complete sentence (or more) describing what the user can do to fix the problem. + late final ffi.Pointer + _NSLocalizedRecoverySuggestionErrorKey = + _lookup('NSLocalizedRecoverySuggestionErrorKey'); + + DartNSErrorUserInfoKey get NSLocalizedRecoverySuggestionErrorKey => + objc.NSString.castFromPointer( + _NSLocalizedRecoverySuggestionErrorKey.value, + retain: true, + release: true); + + set NSLocalizedRecoverySuggestionErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSLocalizedRecoverySuggestionErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSLocalizedRecoverySuggestionErrorKey.value = + value.ref.retainAndReturnPointer(); + } + + /// NSArray of NSStrings corresponding to button titles. + late final ffi.Pointer + _NSLocalizedRecoveryOptionsErrorKey = + _lookup('NSLocalizedRecoveryOptionsErrorKey'); + + DartNSErrorUserInfoKey get NSLocalizedRecoveryOptionsErrorKey => + objc.NSString.castFromPointer(_NSLocalizedRecoveryOptionsErrorKey.value, + retain: true, release: true); + + set NSLocalizedRecoveryOptionsErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSLocalizedRecoveryOptionsErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSLocalizedRecoveryOptionsErrorKey.value = + value.ref.retainAndReturnPointer(); + } + + /// Instance of a subclass of NSObject that conforms to the NSErrorRecoveryAttempting informal protocol + late final ffi.Pointer _NSRecoveryAttempterErrorKey = + _lookup('NSRecoveryAttempterErrorKey'); + + DartNSErrorUserInfoKey get NSRecoveryAttempterErrorKey => + objc.NSString.castFromPointer(_NSRecoveryAttempterErrorKey.value, + retain: true, release: true); + + set NSRecoveryAttempterErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSRecoveryAttempterErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSRecoveryAttempterErrorKey.value = value.ref.retainAndReturnPointer(); + } + + /// NSString containing a help anchor + late final ffi.Pointer _NSHelpAnchorErrorKey = + _lookup('NSHelpAnchorErrorKey'); + + DartNSErrorUserInfoKey get NSHelpAnchorErrorKey => + objc.NSString.castFromPointer(_NSHelpAnchorErrorKey.value, + retain: true, release: true); + + set NSHelpAnchorErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSHelpAnchorErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSHelpAnchorErrorKey.value = value.ref.retainAndReturnPointer(); + } + + /// NSString. This provides a string which will be shown when constructing the debugDescription of the NSError, to be used when debugging or when formatting the error with %@. This string will never be used in localizedDescription, so will not be shown to the user. + late final ffi.Pointer _NSDebugDescriptionErrorKey = + _lookup('NSDebugDescriptionErrorKey'); + + DartNSErrorUserInfoKey get NSDebugDescriptionErrorKey => + objc.NSString.castFromPointer(_NSDebugDescriptionErrorKey.value, + retain: true, release: true); + + set NSDebugDescriptionErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSDebugDescriptionErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSDebugDescriptionErrorKey.value = value.ref.retainAndReturnPointer(); + } + + /// NSString, a complete sentence (or more) describing what failed. Setting a value for this key in userInfo dictionary of errors received from framework APIs is a good way to customize and fine tune the localizedDescription of an NSError. As an example, for Foundation error code NSFileWriteOutOfSpaceError, setting the value of this key to "The image library could not be saved." will allow the localizedDescription of the error to come out as "The image library could not be saved. The volume Macintosh HD is out of space." rather than the default (say) “You can't save the file ImgDatabaseV2 because the volume Macintosh HD is out of space." + late final ffi.Pointer _NSLocalizedFailureErrorKey = + _lookup('NSLocalizedFailureErrorKey'); + + DartNSErrorUserInfoKey get NSLocalizedFailureErrorKey => + objc.NSString.castFromPointer(_NSLocalizedFailureErrorKey.value, + retain: true, release: true); + + set NSLocalizedFailureErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSLocalizedFailureErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSLocalizedFailureErrorKey.value = value.ref.retainAndReturnPointer(); + } + + /// NSNumber containing NSStringEncoding + late final ffi.Pointer _NSStringEncodingErrorKey = + _lookup('NSStringEncodingErrorKey'); + + DartNSErrorUserInfoKey get NSStringEncodingErrorKey => + objc.NSString.castFromPointer(_NSStringEncodingErrorKey.value, + retain: true, release: true); + + set NSStringEncodingErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSStringEncodingErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSStringEncodingErrorKey.value = value.ref.retainAndReturnPointer(); + } + + /// NSURL + late final ffi.Pointer _NSURLErrorKey = + _lookup('NSURLErrorKey'); + + DartNSErrorUserInfoKey get NSURLErrorKey => + objc.NSString.castFromPointer(_NSURLErrorKey.value, + retain: true, release: true); + + set NSURLErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSURLErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSURLErrorKey.value = value.ref.retainAndReturnPointer(); + } + + /// NSString + late final ffi.Pointer _NSFilePathErrorKey = + _lookup('NSFilePathErrorKey'); + + DartNSErrorUserInfoKey get NSFilePathErrorKey => + objc.NSString.castFromPointer(_NSFilePathErrorKey.value, + retain: true, release: true); + + set NSFilePathErrorKey(DartNSErrorUserInfoKey value) { + objc.NSString.castFromPointer(_NSFilePathErrorKey.value, + retain: false, release: true) + .ref + .release(); + _NSFilePathErrorKey.value = value.ref.retainAndReturnPointer(); + } + + /// Create a block useable as a + /// `URLSession:downloadTask:didFinishDownloadingToURL:` that can be used to + /// make an async Dart callback behave synchronously. + Dart_DidFinish adaptFinishWithLock( + Dart_DidFinishWithLock block, + ) { + return ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL + .castFromPointer( + _adaptFinishWithLock( + block.ref.pointer, + ), + retain: true, + release: true); + } + + late final _adaptFinishWithLockPtr = + _lookup>( + 'adaptFinishWithLock'); + late final _adaptFinishWithLock = _adaptFinishWithLockPtr + .asFunction<_DidFinish Function(_DidFinishWithLock)>(); +} + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1pl9qdv( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_wjovn7( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1krhfwz( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_tg5tbv( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1dqvvol( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_6enxqz( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_qxvyq2( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_9o8504( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_12a4qua( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_gwxhxt( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_k73ff5( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_15f11yh( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_wjvic9( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_91c9gi( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_14pxqbs( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1s56lr9( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1hcfngn( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_16sve1d( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1f43wec( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_ao4xm9( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_mn1xu3( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_13vswqm( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_37btrl( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_12nszru( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_qm01og( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1uuez7b( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_9qxjkl( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_3lo3bb( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_16ko9u( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_1j2nt86( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_8wbg7l( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_148br51( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_vhbh5h( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_zuf90e( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_ovsamd( + ffi.Pointer block, +); + +@ffi.Native< + ffi.Pointer Function( + ffi.Pointer)>(isLeaf: true) +external ffi.Pointer + _NativeCupertinoHttp_wrapListenerBlock_4ya7yd( + ffi.Pointer block, +); + +typedef __int8_t = ffi.SignedChar; +typedef Dart__int8_t = int; +typedef __uint8_t = ffi.UnsignedChar; +typedef Dart__uint8_t = int; +typedef __int16_t = ffi.Short; +typedef Dart__int16_t = int; +typedef __uint16_t = ffi.UnsignedShort; +typedef Dart__uint16_t = int; +typedef __int32_t = ffi.Int; +typedef Dart__int32_t = int; +typedef __uint32_t = ffi.UnsignedInt; +typedef Dart__uint32_t = int; +typedef __int64_t = ffi.LongLong; +typedef Dart__int64_t = int; +typedef __uint64_t = ffi.UnsignedLongLong; +typedef Dart__uint64_t = int; +typedef __darwin_intptr_t = ffi.Long; +typedef Dart__darwin_intptr_t = int; +typedef __darwin_natural_t = ffi.UnsignedInt; +typedef Dart__darwin_natural_t = int; +typedef __darwin_ct_rune_t = ffi.Int; +typedef Dart__darwin_ct_rune_t = int; + +final class __mbstate_t extends ffi.Union { + @ffi.Array.multi([128]) + external ffi.Array __mbstate8; + + @ffi.LongLong() + external int _mbstateL; +} + +typedef __darwin_mbstate_t = __mbstate_t; +typedef __darwin_ptrdiff_t = ffi.Long; +typedef Dart__darwin_ptrdiff_t = int; +typedef __darwin_size_t = ffi.UnsignedLong; +typedef Dart__darwin_size_t = int; +typedef __builtin_va_list = ffi.Pointer; +typedef __darwin_va_list = __builtin_va_list; +typedef __darwin_wchar_t = ffi.Int; +typedef Dart__darwin_wchar_t = int; +typedef __darwin_rune_t = __darwin_wchar_t; +typedef __darwin_wint_t = ffi.Int; +typedef Dart__darwin_wint_t = int; +typedef __darwin_clock_t = ffi.UnsignedLong; +typedef Dart__darwin_clock_t = int; +typedef __darwin_socklen_t = __uint32_t; +typedef __darwin_ssize_t = ffi.Long; +typedef Dart__darwin_ssize_t = int; +typedef __darwin_time_t = ffi.Long; +typedef Dart__darwin_time_t = int; +typedef __darwin_blkcnt_t = __int64_t; +typedef __darwin_blksize_t = __int32_t; +typedef __darwin_dev_t = __int32_t; +typedef __darwin_fsblkcnt_t = ffi.UnsignedInt; +typedef Dart__darwin_fsblkcnt_t = int; +typedef __darwin_fsfilcnt_t = ffi.UnsignedInt; +typedef Dart__darwin_fsfilcnt_t = int; +typedef __darwin_gid_t = __uint32_t; +typedef __darwin_id_t = __uint32_t; +typedef __darwin_ino64_t = __uint64_t; +typedef __darwin_ino_t = __darwin_ino64_t; +typedef __darwin_mach_port_name_t = __darwin_natural_t; +typedef __darwin_mach_port_t = __darwin_mach_port_name_t; +typedef __darwin_mode_t = __uint16_t; +typedef __darwin_off_t = __int64_t; +typedef __darwin_pid_t = __int32_t; +typedef __darwin_sigset_t = __uint32_t; +typedef __darwin_suseconds_t = __int32_t; +typedef __darwin_uid_t = __uint32_t; +typedef __darwin_useconds_t = __uint32_t; + +final class __darwin_pthread_handler_rec extends ffi.Struct { + external ffi + .Pointer)>> + __routine; + + external ffi.Pointer __arg; + + external ffi.Pointer<__darwin_pthread_handler_rec> __next; +} + +final class _opaque_pthread_attr_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([56]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_cond_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([40]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_condattr_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([8]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_mutex_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([56]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_mutexattr_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([8]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_once_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([8]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_rwlock_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([192]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_rwlockattr_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([16]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + external ffi.Pointer<__darwin_pthread_handler_rec> __cleanup_stack; + + @ffi.Array.multi([8176]) + external ffi.Array __opaque; +} + +typedef __darwin_pthread_attr_t = _opaque_pthread_attr_t; +typedef __darwin_pthread_cond_t = _opaque_pthread_cond_t; +typedef __darwin_pthread_condattr_t = _opaque_pthread_condattr_t; +typedef __darwin_pthread_key_t = ffi.UnsignedLong; +typedef Dart__darwin_pthread_key_t = int; +typedef __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; +typedef __darwin_pthread_mutexattr_t = _opaque_pthread_mutexattr_t; +typedef __darwin_pthread_once_t = _opaque_pthread_once_t; +typedef __darwin_pthread_rwlock_t = _opaque_pthread_rwlock_t; +typedef __darwin_pthread_rwlockattr_t = _opaque_pthread_rwlockattr_t; +typedef __darwin_pthread_t = ffi.Pointer<_opaque_pthread_t>; +typedef __darwin_nl_item = ffi.Int; +typedef Dart__darwin_nl_item = int; +typedef __darwin_wctrans_t = ffi.Int; +typedef Dart__darwin_wctrans_t = int; +typedef __darwin_wctype_t = __uint32_t; + +enum idtype_t { + P_ALL(0), + P_PID(1), + P_PGID(2); + + final int value; + const idtype_t(this.value); + + static idtype_t fromValue(int value) => switch (value) { + 0 => P_ALL, + 1 => P_PID, + 2 => P_PGID, + _ => throw ArgumentError("Unknown value for idtype_t: $value"), + }; +} + +typedef pid_t = __darwin_pid_t; +typedef id_t = __darwin_id_t; +typedef sig_atomic_t = ffi.Int; +typedef Dartsig_atomic_t = int; +typedef u_int8_t = ffi.UnsignedChar; +typedef Dartu_int8_t = int; +typedef u_int16_t = ffi.UnsignedShort; +typedef Dartu_int16_t = int; +typedef u_int32_t = ffi.UnsignedInt; +typedef Dartu_int32_t = int; +typedef u_int64_t = ffi.UnsignedLongLong; +typedef Dartu_int64_t = int; +typedef register_t = ffi.Int64; +typedef Dartregister_t = int; +typedef user_addr_t = u_int64_t; +typedef user_size_t = u_int64_t; +typedef user_ssize_t = ffi.Int64; +typedef Dartuser_ssize_t = int; +typedef user_long_t = ffi.Int64; +typedef Dartuser_long_t = int; +typedef user_ulong_t = u_int64_t; +typedef user_time_t = ffi.Int64; +typedef Dartuser_time_t = int; +typedef user_off_t = ffi.Int64; +typedef Dartuser_off_t = int; +typedef syscall_arg_t = u_int64_t; + +final class __darwin_arm_exception_state extends ffi.Struct { + @__uint32_t() + external int __exception; + + @__uint32_t() + external int __fsr; + + @__uint32_t() + external int __far; +} + +final class __darwin_arm_exception_state64 extends ffi.Struct { + @__uint64_t() + external int __far; + + @__uint32_t() + external int __esr; + + @__uint32_t() + external int __exception; +} + +final class __darwin_arm_thread_state extends ffi.Struct { + @ffi.Array.multi([13]) + external ffi.Array<__uint32_t> __r; + + @__uint32_t() + external int __sp; + + @__uint32_t() + external int __lr; + + @__uint32_t() + external int __pc; + + @__uint32_t() + external int __cpsr; +} + +final class __darwin_arm_thread_state64 extends ffi.Struct { + @ffi.Array.multi([29]) + external ffi.Array<__uint64_t> __x; + + @__uint64_t() + external int __fp; + + @__uint64_t() + external int __lr; + + @__uint64_t() + external int __sp; + + @__uint64_t() + external int __pc; + + @__uint32_t() + external int __cpsr; + + @__uint32_t() + external int __pad; +} + +final class __darwin_arm_vfp_state extends ffi.Struct { + @ffi.Array.multi([64]) + external ffi.Array<__uint32_t> __r; + + @__uint32_t() + external int __fpscr; +} + +final class __darwin_arm_neon_state64 extends ffi.Opaque {} + +final class __darwin_arm_neon_state extends ffi.Opaque {} + +final class __arm_pagein_state extends ffi.Struct { + @ffi.Int() + external int __pagein_error; +} + +final class __arm_legacy_debug_state extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __bvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __bcr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __wvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __wcr; +} + +final class __darwin_arm_debug_state32 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __bvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __bcr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __wvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __wcr; + + @__uint64_t() + external int __mdscr_el1; +} + +final class __darwin_arm_debug_state64 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __bvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __bcr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __wvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __wcr; + + @__uint64_t() + external int __mdscr_el1; +} + +final class __darwin_arm_cpmu_state64 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __ctrs; +} + +final class __darwin_mcontext32 extends ffi.Struct { + external __darwin_arm_exception_state __es; + + external __darwin_arm_thread_state __ss; + + external __darwin_arm_vfp_state __fs; +} + +final class __darwin_mcontext64 extends ffi.Opaque {} + +typedef mcontext_t = ffi.Pointer<__darwin_mcontext64>; +typedef pthread_attr_t = __darwin_pthread_attr_t; + +final class __darwin_sigaltstack extends ffi.Struct { + external ffi.Pointer ss_sp; + + @__darwin_size_t() + external int ss_size; + + @ffi.Int() + external int ss_flags; +} + +typedef stack_t = __darwin_sigaltstack; + +final class __darwin_ucontext extends ffi.Struct { + @ffi.Int() + external int uc_onstack; + + @__darwin_sigset_t() + external int uc_sigmask; + + external __darwin_sigaltstack uc_stack; + + external ffi.Pointer<__darwin_ucontext> uc_link; + + @__darwin_size_t() + external int uc_mcsize; + + external ffi.Pointer<__darwin_mcontext64> uc_mcontext; +} + +typedef ucontext_t = __darwin_ucontext; +typedef sigset_t = __darwin_sigset_t; +typedef uid_t = __darwin_uid_t; + +final class sigval extends ffi.Union { + @ffi.Int() + external int sival_int; + + external ffi.Pointer sival_ptr; +} + +final class sigevent extends ffi.Struct { + @ffi.Int() + external int sigev_notify; + + @ffi.Int() + external int sigev_signo; + + external sigval sigev_value; + + external ffi.Pointer> + sigev_notify_function; + + external ffi.Pointer sigev_notify_attributes; +} + +final class __siginfo extends ffi.Struct { + @ffi.Int() + external int si_signo; + + @ffi.Int() + external int si_errno; + + @ffi.Int() + external int si_code; + + @pid_t() + external int si_pid; + + @uid_t() + external int si_uid; + + @ffi.Int() + external int si_status; + + external ffi.Pointer si_addr; + + external sigval si_value; + + @ffi.Long() + external int si_band; + + @ffi.Array.multi([7]) + external ffi.Array __pad; +} + +typedef siginfo_t = __siginfo; + +final class __sigaction_u extends ffi.Union { + external ffi.Pointer> + __sa_handler; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int, ffi.Pointer<__siginfo>, ffi.Pointer)>> + __sa_sigaction; +} + +final class __sigaction extends ffi.Struct { + external __sigaction_u __sigaction_u1; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Int, ffi.Int, + ffi.Pointer, ffi.Pointer)>> sa_tramp; + + @sigset_t() + external int sa_mask; + + @ffi.Int() + external int sa_flags; +} + +final class sigaction extends ffi.Struct { + external __sigaction_u __sigaction_u1; + + @sigset_t() + external int sa_mask; + + @ffi.Int() + external int sa_flags; +} + +typedef sig_tFunction = ffi.Void Function(ffi.Int); +typedef Dartsig_tFunction = void Function(int); +typedef sig_t = ffi.Pointer>; + +final class sigvec extends ffi.Struct { + external ffi.Pointer> + sv_handler; + + @ffi.Int() + external int sv_mask; + + @ffi.Int() + external int sv_flags; +} + +final class sigstack extends ffi.Struct { + external ffi.Pointer ss_sp; + + @ffi.Int() + external int ss_onstack; +} + +typedef int_least8_t = ffi.Int8; +typedef Dartint_least8_t = int; +typedef int_least16_t = ffi.Int16; +typedef Dartint_least16_t = int; +typedef int_least32_t = ffi.Int32; +typedef Dartint_least32_t = int; +typedef int_least64_t = ffi.Int64; +typedef Dartint_least64_t = int; +typedef uint_least8_t = ffi.Uint8; +typedef Dartuint_least8_t = int; +typedef uint_least16_t = ffi.Uint16; +typedef Dartuint_least16_t = int; +typedef uint_least32_t = ffi.Uint32; +typedef Dartuint_least32_t = int; +typedef uint_least64_t = ffi.Uint64; +typedef Dartuint_least64_t = int; +typedef int_fast8_t = ffi.Int8; +typedef Dartint_fast8_t = int; +typedef int_fast16_t = ffi.Int16; +typedef Dartint_fast16_t = int; +typedef int_fast32_t = ffi.Int32; +typedef Dartint_fast32_t = int; +typedef int_fast64_t = ffi.Int64; +typedef Dartint_fast64_t = int; +typedef uint_fast8_t = ffi.Uint8; +typedef Dartuint_fast8_t = int; +typedef uint_fast16_t = ffi.Uint16; +typedef Dartuint_fast16_t = int; +typedef uint_fast32_t = ffi.Uint32; +typedef Dartuint_fast32_t = int; +typedef uint_fast64_t = ffi.Uint64; +typedef Dartuint_fast64_t = int; +typedef intmax_t = ffi.Long; +typedef Dartintmax_t = int; +typedef uintmax_t = ffi.UnsignedLong; +typedef Dartuintmax_t = int; + +final class timeval extends ffi.Struct { + @__darwin_time_t() + external int tv_sec; + + @__darwin_suseconds_t() + external int tv_usec; +} + +typedef rlim_t = __uint64_t; + +final class rusage extends ffi.Struct { + external timeval ru_utime; + + external timeval ru_stime; + + @ffi.Long() + external int ru_maxrss; + + @ffi.Long() + external int ru_ixrss; + + @ffi.Long() + external int ru_idrss; + + @ffi.Long() + external int ru_isrss; + + @ffi.Long() + external int ru_minflt; + + @ffi.Long() + external int ru_majflt; + + @ffi.Long() + external int ru_nswap; + + @ffi.Long() + external int ru_inblock; + + @ffi.Long() + external int ru_oublock; + + @ffi.Long() + external int ru_msgsnd; + + @ffi.Long() + external int ru_msgrcv; + + @ffi.Long() + external int ru_nsignals; + + @ffi.Long() + external int ru_nvcsw; + + @ffi.Long() + external int ru_nivcsw; +} + +typedef rusage_info_t = ffi.Pointer; + +final class rusage_info_v0 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; +} + +final class rusage_info_v1 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; +} + +final class rusage_info_v2 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; +} + +final class rusage_info_v3 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; + + @ffi.Uint64() + external int ri_cpu_time_qos_default; + + @ffi.Uint64() + external int ri_cpu_time_qos_maintenance; + + @ffi.Uint64() + external int ri_cpu_time_qos_background; + + @ffi.Uint64() + external int ri_cpu_time_qos_utility; + + @ffi.Uint64() + external int ri_cpu_time_qos_legacy; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_initiated; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_interactive; + + @ffi.Uint64() + external int ri_billed_system_time; + + @ffi.Uint64() + external int ri_serviced_system_time; +} + +final class rusage_info_v4 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; + + @ffi.Uint64() + external int ri_cpu_time_qos_default; + + @ffi.Uint64() + external int ri_cpu_time_qos_maintenance; + + @ffi.Uint64() + external int ri_cpu_time_qos_background; + + @ffi.Uint64() + external int ri_cpu_time_qos_utility; + + @ffi.Uint64() + external int ri_cpu_time_qos_legacy; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_initiated; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_interactive; + + @ffi.Uint64() + external int ri_billed_system_time; + + @ffi.Uint64() + external int ri_serviced_system_time; + + @ffi.Uint64() + external int ri_logical_writes; + + @ffi.Uint64() + external int ri_lifetime_max_phys_footprint; + + @ffi.Uint64() + external int ri_instructions; + + @ffi.Uint64() + external int ri_cycles; + + @ffi.Uint64() + external int ri_billed_energy; + + @ffi.Uint64() + external int ri_serviced_energy; + + @ffi.Uint64() + external int ri_interval_max_phys_footprint; + + @ffi.Uint64() + external int ri_runnable_time; +} + +final class rusage_info_v5 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; + + @ffi.Uint64() + external int ri_cpu_time_qos_default; + + @ffi.Uint64() + external int ri_cpu_time_qos_maintenance; + + @ffi.Uint64() + external int ri_cpu_time_qos_background; + + @ffi.Uint64() + external int ri_cpu_time_qos_utility; + + @ffi.Uint64() + external int ri_cpu_time_qos_legacy; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_initiated; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_interactive; + + @ffi.Uint64() + external int ri_billed_system_time; + + @ffi.Uint64() + external int ri_serviced_system_time; + + @ffi.Uint64() + external int ri_logical_writes; + + @ffi.Uint64() + external int ri_lifetime_max_phys_footprint; + + @ffi.Uint64() + external int ri_instructions; + + @ffi.Uint64() + external int ri_cycles; + + @ffi.Uint64() + external int ri_billed_energy; + + @ffi.Uint64() + external int ri_serviced_energy; + + @ffi.Uint64() + external int ri_interval_max_phys_footprint; + + @ffi.Uint64() + external int ri_runnable_time; + + @ffi.Uint64() + external int ri_flags; +} + +final class rusage_info_v6 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; + + @ffi.Uint64() + external int ri_cpu_time_qos_default; + + @ffi.Uint64() + external int ri_cpu_time_qos_maintenance; + + @ffi.Uint64() + external int ri_cpu_time_qos_background; + + @ffi.Uint64() + external int ri_cpu_time_qos_utility; + + @ffi.Uint64() + external int ri_cpu_time_qos_legacy; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_initiated; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_interactive; + + @ffi.Uint64() + external int ri_billed_system_time; + + @ffi.Uint64() + external int ri_serviced_system_time; + + @ffi.Uint64() + external int ri_logical_writes; + + @ffi.Uint64() + external int ri_lifetime_max_phys_footprint; + + @ffi.Uint64() + external int ri_instructions; + + @ffi.Uint64() + external int ri_cycles; + + @ffi.Uint64() + external int ri_billed_energy; + + @ffi.Uint64() + external int ri_serviced_energy; + + @ffi.Uint64() + external int ri_interval_max_phys_footprint; + + @ffi.Uint64() + external int ri_runnable_time; + + @ffi.Uint64() + external int ri_flags; + + @ffi.Uint64() + external int ri_user_ptime; + + @ffi.Uint64() + external int ri_system_ptime; + + @ffi.Uint64() + external int ri_pinstructions; + + @ffi.Uint64() + external int ri_pcycles; + + @ffi.Uint64() + external int ri_energy_nj; + + @ffi.Uint64() + external int ri_penergy_nj; + + @ffi.Uint64() + external int ri_secure_time_in_system; + + @ffi.Uint64() + external int ri_secure_ptime_in_system; + + @ffi.Array.multi([12]) + external ffi.Array ri_reserved; +} + +typedef rusage_info_current = rusage_info_v6; + +final class rlimit extends ffi.Struct { + @rlim_t() + external int rlim_cur; + + @rlim_t() + external int rlim_max; +} + +final class proc_rlimit_control_wakeupmon extends ffi.Struct { + @ffi.Uint32() + external int wm_flags; + + @ffi.Int32() + external int wm_rate; +} + +@ffi.Packed(1) +final class _OSUnalignedU16 extends ffi.Struct { + @ffi.Uint16() + external int __val; +} + +@ffi.Packed(1) +final class _OSUnalignedU32 extends ffi.Struct { + @ffi.Uint32() + external int __val; +} + +@ffi.Packed(1) +final class _OSUnalignedU64 extends ffi.Struct { + @ffi.Uint64() + external int __val; +} + +final class wait extends ffi.Opaque {} + +typedef ct_rune_t = __darwin_ct_rune_t; +typedef rune_t = __darwin_rune_t; + +final class div_t extends ffi.Struct { + @ffi.Int() + external int quot; + + @ffi.Int() + external int rem; +} + +final class ldiv_t extends ffi.Struct { + @ffi.Long() + external int quot; + + @ffi.Long() + external int rem; +} + +final class lldiv_t extends ffi.Struct { + @ffi.LongLong() + external int quot; + + @ffi.LongLong() + external int rem; +} + +typedef malloc_type_id_t = ffi.UnsignedLongLong; +typedef Dartmalloc_type_id_t = int; + +final class _malloc_zone_t extends ffi.Opaque {} + +typedef malloc_zone_t = _malloc_zone_t; +typedef dev_t = __darwin_dev_t; +typedef mode_t = __darwin_mode_t; +void _ObjCBlock_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, +) => + block.ref.target + .cast>() + .asFunction()(); +ffi.Pointer _ObjCBlock_ffiVoid_fnPtrCallable = ffi.Pointer + .fromFunction)>( + _ObjCBlock_ffiVoid_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_closureTrampoline( + ffi.Pointer block, +) => + (objc.getBlockClosure(block) as void Function())(); +ffi.Pointer _ObjCBlock_ffiVoid_closureCallable = ffi.Pointer + .fromFunction)>( + _ObjCBlock_ffiVoid_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_listenerTrampoline( + ffi.Pointer block, +) { + (objc.getBlockClosure(block) as void Function())(); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable)> + _ObjCBlock_ffiVoid_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> ptr) => + objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction(void Function() fn) => + objc.ObjCBlock( + objc.newClosureBlock(_ObjCBlock_ffiVoid_closureCallable, () => fn()), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener(void Function() fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_listenerCallable.nativeFunction.cast(), () => fn()); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1pl9qdv(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_CallExtension + on objc.ObjCBlock { + void call() => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block)>>() + .asFunction)>()( + ref.pointer, + ); +} + +int _ObjCBlock_ffiInt_ffiVoid_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer arg0, ffi.Pointer arg1)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiInt_ffiVoid_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiInt_ffiVoid_ffiVoid_fnPtrTrampoline, 0) + .cast(); +int _ObjCBlock_ffiInt_ffiVoid_ffiVoid_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as int Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiInt_ffiVoid_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiInt_ffiVoid_ffiVoid_closureTrampoline, 0) + .cast(); + +/// Construction methods for `objc.ObjCBlock, ffi.Pointer)>`. +abstract final class ObjCBlock_ffiInt_ffiVoid_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock, ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, ffi.Pointer)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer arg0, + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock, ffi.Pointer)>( + objc.newPointerBlock(_ObjCBlock_ffiInt_ffiVoid_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.Pointer)> + fromFunction( + int Function(ffi.Pointer, ffi.Pointer) fn) => + objc.ObjCBlock< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_ffiInt_ffiVoid_ffiVoid_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => + fn(arg0, arg1)), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, ffi.Pointer)>`. +extension ObjCBlock_ffiInt_ffiVoid_ffiVoid_CallExtension on objc + .ObjCBlock, ffi.Pointer)> { + int call(ffi.Pointer arg0, ffi.Pointer arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, arg1); +} + +typedef ptrdiff_t = ffi.Long; +typedef Dartptrdiff_t = int; +typedef rsize_t = ffi.UnsignedLong; +typedef Dartrsize_t = int; +typedef u_char = ffi.UnsignedChar; +typedef Dartu_char = int; +typedef u_short = ffi.UnsignedShort; +typedef Dartu_short = int; +typedef u_int = ffi.UnsignedInt; +typedef Dartu_int = int; +typedef u_long = ffi.UnsignedLong; +typedef Dartu_long = int; +typedef ushort = ffi.UnsignedShort; +typedef Dartushort = int; +typedef uint = ffi.UnsignedInt; +typedef Dartuint = int; +typedef u_quad_t = u_int64_t; +typedef quad_t = ffi.Int64; +typedef Dartquad_t = int; +typedef qaddr_t = ffi.Pointer; +typedef caddr_t = ffi.Pointer; +typedef daddr_t = ffi.Int32; +typedef Dartdaddr_t = int; +typedef fixpt_t = u_int32_t; +typedef blkcnt_t = __darwin_blkcnt_t; +typedef blksize_t = __darwin_blksize_t; +typedef gid_t = __darwin_gid_t; +typedef in_addr_t = __uint32_t; +typedef in_port_t = __uint16_t; +typedef ino_t = __darwin_ino_t; +typedef ino64_t = __darwin_ino64_t; +typedef key_t = __int32_t; +typedef nlink_t = __uint16_t; +typedef off_t = __darwin_off_t; +typedef segsz_t = ffi.Int32; +typedef Dartsegsz_t = int; +typedef swblk_t = ffi.Int32; +typedef Dartswblk_t = int; +typedef clock_t = __darwin_clock_t; +typedef ssize_t = __darwin_ssize_t; +typedef time_t = __darwin_time_t; +typedef useconds_t = __darwin_useconds_t; +typedef suseconds_t = __darwin_suseconds_t; +typedef errno_t = ffi.Int; +typedef Darterrno_t = int; + +final class fd_set extends ffi.Struct { + @ffi.Array.multi([32]) + external ffi.Array<__int32_t> fds_bits; +} + +typedef fd_mask = __int32_t; +typedef pthread_cond_t = __darwin_pthread_cond_t; +typedef pthread_condattr_t = __darwin_pthread_condattr_t; +typedef pthread_mutex_t = __darwin_pthread_mutex_t; +typedef pthread_mutexattr_t = __darwin_pthread_mutexattr_t; +typedef pthread_once_t = __darwin_pthread_once_t; +typedef pthread_rwlock_t = __darwin_pthread_rwlock_t; +typedef pthread_rwlockattr_t = __darwin_pthread_rwlockattr_t; +typedef pthread_t = __darwin_pthread_t; +typedef pthread_key_t = __darwin_pthread_key_t; +typedef fsblkcnt_t = __darwin_fsblkcnt_t; +typedef fsfilcnt_t = __darwin_fsfilcnt_t; + +final class objc_class extends ffi.Opaque {} + +final class objc_object extends ffi.Struct { + external ffi.Pointer isaAsInt; +} + +final class objc_selector extends ffi.Opaque {} + +typedef IMPFunction = ffi.Void Function(); +typedef DartIMPFunction = void Function(); +typedef IMP = ffi.Pointer>; +typedef objc_zone_t = ffi.Pointer<_malloc_zone_t>; +typedef objc_objectptr_t = ffi.Pointer; +typedef NSInteger = ffi.Long; +typedef DartNSInteger = int; +typedef NSUInteger = ffi.UnsignedLong; +typedef DartNSUInteger = int; + +final class _NSZone extends ffi.Opaque {} + +typedef va_list = __builtin_va_list; +typedef __gnuc_va_list = __builtin_va_list; +typedef NSExceptionName = ffi.Pointer; +typedef DartNSExceptionName = objc.NSString; +typedef NSRunLoopMode = ffi.Pointer; +typedef DartNSRunLoopMode = objc.NSString; +int _ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + int Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer + _ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject_fnPtrCallable = + ffi.Pointer.fromFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject_fnPtrTrampoline, + 0) + .cast(); +int _ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as int Function(ffi.Pointer, + ffi.Pointer))(arg0, arg1); +ffi.Pointer + _ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject_closureCallable = + ffi.Pointer.fromFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject_closureTrampoline, + 0) + .cast(); + +/// Construction methods for `objc.ObjCBlock, ffi.Pointer)>`. +abstract final class ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + NSInteger Function( + ffi.Pointer, ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + NSInteger Function(ffi.Pointer, + ffi.Pointer)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.Pointer)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1)>> ptr) => + objc.ObjCBlock< + NSInteger Function(ffi.Pointer, + ffi.Pointer)>( + objc.newPointerBlock( + _ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, ffi.Pointer)> + fromFunction(objc.NSComparisonResult Function(objc.ObjCObjectBase, objc.ObjCObjectBase) fn) => + objc.ObjCBlock, ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => + fn(objc.ObjCObjectBase(arg0, retain: true, release: true), + objc.ObjCObjectBase(arg1, retain: true, release: true)) + .value), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, ffi.Pointer)>`. +extension ObjCBlock_NSComparisonResult_objcObjCObject_objcObjCObject_CallExtension + on objc.ObjCBlock< + NSInteger Function( + ffi.Pointer, ffi.Pointer)> { + objc.NSComparisonResult call( + objc.ObjCObjectBase arg0, objc.ObjCObjectBase arg1) => + objc.NSComparisonResult.fromValue(ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction, ffi.Pointer, ffi.Pointer)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer)); +} + +typedef NSComparator = ffi.Pointer; +typedef DartNSComparator = objc.ObjCBlock< + NSInteger Function( + ffi.Pointer, ffi.Pointer)>; + +enum NSQualityOfService { + NSQualityOfServiceUserInteractive(33), + NSQualityOfServiceUserInitiated(25), + NSQualityOfServiceUtility(17), + NSQualityOfServiceBackground(9), + NSQualityOfServiceDefault(-1); + + final int value; + const NSQualityOfService(this.value); + + static NSQualityOfService fromValue(int value) => switch (value) { + 33 => NSQualityOfServiceUserInteractive, + 25 => NSQualityOfServiceUserInitiated, + 17 => NSQualityOfServiceUtility, + 9 => NSQualityOfServiceBackground, + -1 => NSQualityOfServiceDefault, + _ => + throw ArgumentError("Unknown value for NSQualityOfService: $value"), + }; +} + +typedef ptrauth_extra_data_t = ffi.UnsignedLong; +typedef Dartptrauth_extra_data_t = int; +typedef ptrauth_generic_signature_t = ffi.UnsignedLong; +typedef Dartptrauth_generic_signature_t = int; +typedef UInt8 = ffi.UnsignedChar; +typedef DartUInt8 = int; +typedef SInt8 = ffi.SignedChar; +typedef DartSInt8 = int; +typedef UInt16 = ffi.UnsignedShort; +typedef DartUInt16 = int; +typedef SInt16 = ffi.Short; +typedef DartSInt16 = int; +typedef UInt32 = ffi.UnsignedInt; +typedef DartUInt32 = int; +typedef SInt32 = ffi.Int; +typedef DartSInt32 = int; + +@ffi.Packed(2) +final class wide extends ffi.Struct { + @UInt32() + external int lo; + + @SInt32() + external int hi; +} + +@ffi.Packed(2) +final class UnsignedWide extends ffi.Struct { + @UInt32() + external int lo; + + @UInt32() + external int hi; +} + +typedef SInt64 = ffi.LongLong; +typedef DartSInt64 = int; +typedef UInt64 = ffi.UnsignedLongLong; +typedef DartUInt64 = int; +typedef Fixed = SInt32; +typedef FixedPtr = ffi.Pointer; +typedef Fract = SInt32; +typedef FractPtr = ffi.Pointer; +typedef UnsignedFixed = UInt32; +typedef UnsignedFixedPtr = ffi.Pointer; +typedef ShortFixed = ffi.Short; +typedef DartShortFixed = int; +typedef ShortFixedPtr = ffi.Pointer; +typedef Float32 = ffi.Float; +typedef DartFloat32 = double; +typedef Float64 = ffi.Double; +typedef DartFloat64 = double; + +final class Float80 extends ffi.Struct { + @SInt16() + external int exp; + + @ffi.Array.multi([4]) + external ffi.Array man; +} + +final class Float96 extends ffi.Struct { + @ffi.Array.multi([2]) + external ffi.Array exp; + + @ffi.Array.multi([4]) + external ffi.Array man; +} + +@ffi.Packed(2) +final class Float32Point extends ffi.Struct { + @Float32() + external double x; + + @Float32() + external double y; +} + +typedef Ptr = ffi.Pointer; +typedef Handle = ffi.Pointer; +typedef Size = ffi.Long; +typedef DartSize = int; +typedef OSErr = SInt16; +typedef OSStatus = SInt32; +typedef LogicalAddress = ffi.Pointer; +typedef ConstLogicalAddress = ffi.Pointer; +typedef PhysicalAddress = ffi.Pointer; +typedef BytePtr = ffi.Pointer; +typedef ByteCount = ffi.UnsignedLong; +typedef DartByteCount = int; +typedef ByteOffset = ffi.UnsignedLong; +typedef DartByteOffset = int; +typedef Duration = SInt32; +typedef AbsoluteTime = UnsignedWide; +typedef OptionBits = UInt32; +typedef ItemCount = ffi.UnsignedLong; +typedef DartItemCount = int; +typedef PBVersion = UInt32; +typedef ScriptCode = SInt16; +typedef LangCode = SInt16; +typedef RegionCode = SInt16; +typedef FourCharCode = UInt32; +typedef OSType = FourCharCode; +typedef ResType = FourCharCode; +typedef OSTypePtr = ffi.Pointer; +typedef ResTypePtr = ffi.Pointer; +typedef Boolean = ffi.UnsignedChar; +typedef DartBoolean = int; +typedef ProcPtrFunction = ffi.Long Function(); +typedef DartProcPtrFunction = int Function(); +typedef ProcPtr = ffi.Pointer>; +typedef Register68kProcPtrFunction = ffi.Void Function(); +typedef DartRegister68kProcPtrFunction = void Function(); +typedef Register68kProcPtr + = ffi.Pointer>; +typedef UniversalProcPtr = ProcPtr; +typedef ProcHandle = ffi.Pointer; +typedef UniversalProcHandle = ffi.Pointer; +typedef PRefCon = ffi.Pointer; +typedef URefCon = ffi.Pointer; +typedef SRefCon = ffi.Pointer; +typedef UnicodeScalarValue = UInt32; +typedef UTF32Char = UInt32; +typedef UniChar = UInt16; +typedef UTF16Char = UInt16; +typedef UTF8Char = UInt8; +typedef UniCharPtr = ffi.Pointer; +typedef UniCharCount = ffi.UnsignedLong; +typedef DartUniCharCount = int; +typedef UniCharCountPtr = ffi.Pointer; +typedef StringPtr = ffi.Pointer; +typedef StringHandle = ffi.Pointer; +typedef ConstStringPtr = ffi.Pointer; +typedef ConstStr255Param = ffi.Pointer; +typedef ConstStr63Param = ffi.Pointer; +typedef ConstStr32Param = ffi.Pointer; +typedef ConstStr31Param = ffi.Pointer; +typedef ConstStr27Param = ffi.Pointer; +typedef ConstStr15Param = ffi.Pointer; +typedef ConstStrFileNameParam = ConstStr63Param; + +@ffi.Packed(2) +final class ProcessSerialNumber extends ffi.Struct { + @UInt32() + external int highLongOfPSN; + + @UInt32() + external int lowLongOfPSN; +} + +typedef ProcessSerialNumberPtr = ffi.Pointer; + +final class Point extends ffi.Struct { + @ffi.Short() + external int v; + + @ffi.Short() + external int h; +} + +typedef PointPtr = ffi.Pointer; + +final class Rect extends ffi.Struct { + @ffi.Short() + external int top; + + @ffi.Short() + external int left; + + @ffi.Short() + external int bottom; + + @ffi.Short() + external int right; +} + +typedef RectPtr = ffi.Pointer; + +@ffi.Packed(2) +final class FixedPoint extends ffi.Struct { + @Fixed() + external int x; + + @Fixed() + external int y; +} + +@ffi.Packed(2) +final class FixedRect extends ffi.Struct { + @Fixed() + external int left; + + @Fixed() + external int top; + + @Fixed() + external int right; + + @Fixed() + external int bottom; +} + +typedef CharParameter = ffi.Short; +typedef DartCharParameter = int; +typedef Style = ffi.UnsignedChar; +typedef DartStyle = int; +typedef StyleParameter = ffi.Short; +typedef DartStyleParameter = int; +typedef StyleField = Style; +typedef TimeValue = SInt32; +typedef TimeScale = SInt32; +typedef CompTimeValue = wide; +typedef TimeValue64 = SInt64; + +final class TimeBaseRecord extends ffi.Opaque {} + +typedef TimeBase = ffi.Pointer; + +@ffi.Packed(2) +final class TimeRecord extends ffi.Struct { + external CompTimeValue value; + + @TimeScale() + external int scale; + + external TimeBase base; +} + +final class NumVersion extends ffi.Struct { + @UInt8() + external int nonRelRev; + + @UInt8() + external int stage; + + @UInt8() + external int minorAndBugRev; + + @UInt8() + external int majorRev; +} + +final class NumVersionVariant extends ffi.Union { + external NumVersion parts; + + @UInt32() + external int whole; +} + +typedef NumVersionVariantPtr = ffi.Pointer; +typedef NumVersionVariantHandle = ffi.Pointer; + +final class VersRec extends ffi.Struct { + external NumVersion numericVersion; + + @ffi.Short() + external int countryCode; + + @ffi.Array.multi([256]) + external ffi.Array shortVersion; + + @ffi.Array.multi([256]) + external ffi.Array reserved; +} + +typedef VersRecPtr = ffi.Pointer; +typedef VersRecHndl = ffi.Pointer; +typedef Byte = UInt8; +typedef SignedByte = SInt8; +typedef WidePtr = ffi.Pointer; +typedef UnsignedWidePtr = ffi.Pointer; +typedef extended80 = Float80; +typedef extended96 = Float96; +typedef VHSelect = SInt8; +typedef CFTypeID = ffi.UnsignedLong; +typedef DartCFTypeID = int; +typedef CFOptionFlags = ffi.UnsignedLong; +typedef DartCFOptionFlags = int; +typedef CFHashCode = ffi.UnsignedLong; +typedef DartCFHashCode = int; +typedef CFIndex = ffi.Long; +typedef DartCFIndex = int; +typedef CFTypeRef = ffi.Pointer; + +final class __CFString extends ffi.Opaque {} + +typedef CFStringRef = ffi.Pointer<__CFString>; +typedef CFMutableStringRef = ffi.Pointer<__CFString>; +typedef CFPropertyListRef = CFTypeRef; + +enum CFComparisonResult { + kCFCompareLessThan(-1), + kCFCompareEqualTo(0), + kCFCompareGreaterThan(1); + + final int value; + const CFComparisonResult(this.value); + + static CFComparisonResult fromValue(int value) => switch (value) { + -1 => kCFCompareLessThan, + 0 => kCFCompareEqualTo, + 1 => kCFCompareGreaterThan, + _ => + throw ArgumentError("Unknown value for CFComparisonResult: $value"), + }; +} + +typedef CFComparatorFunctionFunction = CFIndex Function( + ffi.Pointer val1, + ffi.Pointer val2, + ffi.Pointer context); +typedef DartCFComparatorFunctionFunction = CFComparisonResult Function( + ffi.Pointer val1, + ffi.Pointer val2, + ffi.Pointer context); +typedef CFComparatorFunction + = ffi.Pointer>; + +final class CFRange extends ffi.Struct { + @CFIndex() + external int location; + + @CFIndex() + external int length; +} + +final class __CFNull extends ffi.Opaque {} + +typedef CFNullRef = ffi.Pointer<__CFNull>; + +final class __CFAllocator extends ffi.Opaque {} + +typedef CFAllocatorRef = ffi.Pointer<__CFAllocator>; +typedef CFAllocatorRetainCallBackFunction = ffi.Pointer Function( + ffi.Pointer info); +typedef CFAllocatorRetainCallBack + = ffi.Pointer>; +typedef CFAllocatorReleaseCallBackFunction = ffi.Void Function( + ffi.Pointer info); +typedef DartCFAllocatorReleaseCallBackFunction = void Function( + ffi.Pointer info); +typedef CFAllocatorReleaseCallBack + = ffi.Pointer>; +typedef CFAllocatorCopyDescriptionCallBackFunction = CFStringRef Function( + ffi.Pointer info); +typedef CFAllocatorCopyDescriptionCallBack = ffi + .Pointer>; +typedef CFAllocatorAllocateCallBackFunction = ffi.Pointer Function( + CFIndex allocSize, CFOptionFlags hint, ffi.Pointer info); +typedef DartCFAllocatorAllocateCallBackFunction + = ffi.Pointer Function(DartCFIndex allocSize, + DartCFOptionFlags hint, ffi.Pointer info); +typedef CFAllocatorAllocateCallBack + = ffi.Pointer>; +typedef CFAllocatorReallocateCallBackFunction = ffi.Pointer Function( + ffi.Pointer ptr, + CFIndex newsize, + CFOptionFlags hint, + ffi.Pointer info); +typedef DartCFAllocatorReallocateCallBackFunction + = ffi.Pointer Function( + ffi.Pointer ptr, + DartCFIndex newsize, + DartCFOptionFlags hint, + ffi.Pointer info); +typedef CFAllocatorReallocateCallBack + = ffi.Pointer>; +typedef CFAllocatorDeallocateCallBackFunction = ffi.Void Function( + ffi.Pointer ptr, ffi.Pointer info); +typedef DartCFAllocatorDeallocateCallBackFunction = void Function( + ffi.Pointer ptr, ffi.Pointer info); +typedef CFAllocatorDeallocateCallBack + = ffi.Pointer>; +typedef CFAllocatorPreferredSizeCallBackFunction = CFIndex Function( + CFIndex size, CFOptionFlags hint, ffi.Pointer info); +typedef DartCFAllocatorPreferredSizeCallBackFunction = DartCFIndex Function( + DartCFIndex size, DartCFOptionFlags hint, ffi.Pointer info); +typedef CFAllocatorPreferredSizeCallBack + = ffi.Pointer>; + +final class CFAllocatorContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external CFAllocatorRetainCallBack retain; + + external CFAllocatorReleaseCallBack release; + + external CFAllocatorCopyDescriptionCallBack copyDescription; + + external CFAllocatorAllocateCallBack allocate; + + external CFAllocatorReallocateCallBack reallocate; + + external CFAllocatorDeallocateCallBack deallocate; + + external CFAllocatorPreferredSizeCallBack preferredSize; +} + +typedef NSZone = _NSZone; +late final _class_NSObject = objc.getClass("NSObject"); +late final _sel_version = objc.registerName("version"); +final _objc_msgSend_1hz7y9r = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setVersion_ = objc.registerName("setVersion:"); +final _objc_msgSend_4sp4xj = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Long)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_classForCoder = objc.registerName("classForCoder"); +final _objc_msgSend_1x359cv = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_replacementObjectForCoder_ = + objc.registerName("replacementObjectForCoder:"); +final _objc_msgSend_62nh5j = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_awakeAfterUsingCoder_ = + objc.registerName("awakeAfterUsingCoder:"); + +/// NSCoderMethods +extension NSCoderMethods on objc.NSObject { + /// version + static DartNSInteger version() { + return _objc_msgSend_1hz7y9r(_class_NSObject, _sel_version); + } + + /// setVersion: + static void setVersion_(DartNSInteger aVersion) { + _objc_msgSend_4sp4xj(_class_NSObject, _sel_setVersion_, aVersion); + } + + /// classForCoder + objc.ObjCObjectBase get classForCoder { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_classForCoder); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// replacementObjectForCoder: + objc.ObjCObjectBase? replacementObjectForCoder_(objc.NSCoder coder) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_replacementObjectForCoder_, coder.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// awakeAfterUsingCoder: + objc.ObjCObjectBase? awakeAfterUsingCoder_(objc.NSCoder coder) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_awakeAfterUsingCoder_, coder.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: false, release: true); + } +} + +late final _sel_poseAsClass_ = objc.registerName("poseAsClass:"); +final _objc_msgSend_1jdvcbf = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + +/// NSDeprecatedMethods +extension NSDeprecatedMethods on objc.NSObject { + /// poseAsClass: + static void poseAsClass_(objc.ObjCObjectBase aClass) { + _objc_msgSend_1jdvcbf( + _class_NSObject, _sel_poseAsClass_, aClass.ref.pointer); + } +} + +late final _sel_autoContentAccessingProxy = + objc.registerName("autoContentAccessingProxy"); + +/// NSDiscardableContentProxy +extension NSDiscardableContentProxy on objc.NSObject { + /// autoContentAccessingProxy + objc.ObjCObjectBase get autoContentAccessingProxy { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_autoContentAccessingProxy); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } +} + +/// ! +/// @enum NSURLCacheStoragePolicy +/// +/// @discussion The NSURLCacheStoragePolicy enum defines constants that +/// can be used to specify the type of storage that is allowable for an +/// NSCachedURLResponse object that is to be stored in an NSURLCache. +/// +/// @constant NSURLCacheStorageAllowed Specifies that storage in an +/// NSURLCache is allowed without restriction. +/// +/// @constant NSURLCacheStorageAllowedInMemoryOnly Specifies that +/// storage in an NSURLCache is allowed; however storage should be +/// done in memory only, no disk storage should be done. +/// +/// @constant NSURLCacheStorageNotAllowed Specifies that storage in an +/// NSURLCache is not allowed in any fashion, either in memory or on +/// disk. +enum NSURLCacheStoragePolicy { + NSURLCacheStorageAllowed(0), + NSURLCacheStorageAllowedInMemoryOnly(1), + NSURLCacheStorageNotAllowed(2); + + final int value; + const NSURLCacheStoragePolicy(this.value); + + static NSURLCacheStoragePolicy fromValue(int value) => switch (value) { + 0 => NSURLCacheStorageAllowed, + 1 => NSURLCacheStorageAllowedInMemoryOnly, + 2 => NSURLCacheStorageNotAllowed, + _ => throw ArgumentError( + "Unknown value for NSURLCacheStoragePolicy: $value"), + }; +} + +/// WARNING: NSCachedURLResponse is a stub. To generate bindings for this class, include +/// NSCachedURLResponse in your config's objc-interfaces list. +/// +/// ! +/// @class NSCachedURLResponse +/// NSCachedURLResponse is a class whose objects functions as a wrapper for +/// objects that are stored in the framework's caching system. +/// It is used to maintain characteristics and attributes of a cached +/// object. +class NSCachedURLResponse extends objc.NSObject { + NSCachedURLResponse._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSCachedURLResponse] that points to the same underlying object as [other]. + NSCachedURLResponse.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSCachedURLResponse] that wraps the given raw object pointer. + NSCachedURLResponse.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _class_NSURLCache = objc.getClass("NSURLCache"); +late final _sel_isKindOfClass_ = objc.registerName("isKindOfClass:"); +final _objc_msgSend_69e0x1 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + +/// WARNING: NSURLSessionDataTask is a stub. To generate bindings for this class, include +/// NSURLSessionDataTask in your config's objc-interfaces list. +/// +/// NSURLSessionDataTask +class NSURLSessionDataTask extends NSURLSessionTask { + NSURLSessionDataTask._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSessionDataTask] that points to the same underlying object as [other]. + NSURLSessionDataTask.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSessionDataTask] that wraps the given raw object pointer. + NSURLSessionDataTask.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _sel_storeCachedResponse_forDataTask_ = + objc.registerName("storeCachedResponse:forDataTask:"); +final _objc_msgSend_wjvic9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +void _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSCachedURLResponse_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSCachedURLResponse_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSCachedURLResponse_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerTrampoline( + ffi.Pointer block, ffi.Pointer arg0) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerCallable = ffi + .NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSCachedURLResponse { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSCachedURLResponse_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(NSCachedURLResponse?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSCachedURLResponse_closureCallable, + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : NSCachedURLResponse.castFromPointer(arg0, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(NSCachedURLResponse?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSCachedURLResponse_listenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : NSCachedURLResponse.castFromPointer(arg0, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSCachedURLResponse_CallExtension + on objc.ObjCBlock { + void call(NSCachedURLResponse? arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_getCachedResponseForDataTask_completionHandler_ = + objc.registerName("getCachedResponseForDataTask:completionHandler:"); +final _objc_msgSend_14pxqbs = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_removeCachedResponseForDataTask_ = + objc.registerName("removeCachedResponseForDataTask:"); + +/// NSURLSessionTaskAdditions +extension NSURLSessionTaskAdditions on NSURLCache { + /// storeCachedResponse:forDataTask: + void storeCachedResponse_forDataTask_( + NSCachedURLResponse cachedResponse, NSURLSessionDataTask dataTask) { + _objc_msgSend_wjvic9( + this.ref.pointer, + _sel_storeCachedResponse_forDataTask_, + cachedResponse.ref.pointer, + dataTask.ref.pointer); + } + + /// getCachedResponseForDataTask:completionHandler: + void getCachedResponseForDataTask_completionHandler_( + NSURLSessionDataTask dataTask, + objc.ObjCBlock + completionHandler) { + _objc_msgSend_14pxqbs( + this.ref.pointer, + _sel_getCachedResponseForDataTask_completionHandler_, + dataTask.ref.pointer, + completionHandler.ref.pointer); + } + + /// removeCachedResponseForDataTask: + void removeCachedResponseForDataTask_(NSURLSessionDataTask dataTask) { + _objc_msgSend_1jdvcbf(this.ref.pointer, + _sel_removeCachedResponseForDataTask_, dataTask.ref.pointer); + } +} + +late final _sel_sharedURLCache = objc.registerName("sharedURLCache"); +late final _sel_setSharedURLCache_ = objc.registerName("setSharedURLCache:"); +typedef instancetype = ffi.Pointer; +typedef Dartinstancetype = objc.ObjCObjectBase; +late final _sel_initWithMemoryCapacity_diskCapacity_diskPath_ = + objc.registerName("initWithMemoryCapacity:diskCapacity:diskPath:"); +final _objc_msgSend_1dlfwfh = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.UnsignedLong, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + int, + ffi.Pointer)>(); +late final _sel_initWithMemoryCapacity_diskCapacity_directoryURL_ = + objc.registerName("initWithMemoryCapacity:diskCapacity:directoryURL:"); +late final _class_NSURLRequest = objc.getClass("NSURLRequest"); +late final _sel_HTTPMethod = objc.registerName("HTTPMethod"); +late final _sel_allHTTPHeaderFields = objc.registerName("allHTTPHeaderFields"); +late final _sel_valueForHTTPHeaderField_ = + objc.registerName("valueForHTTPHeaderField:"); +late final _sel_HTTPBody = objc.registerName("HTTPBody"); +late final _sel_HTTPBodyStream = objc.registerName("HTTPBodyStream"); +late final _sel_HTTPShouldHandleCookies = + objc.registerName("HTTPShouldHandleCookies"); +final _objc_msgSend_91o635 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + bool Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_HTTPShouldUsePipelining = + objc.registerName("HTTPShouldUsePipelining"); + +/// ! +/// @category NSURLRequest(NSHTTPURLRequest) +/// The NSHTTPURLRequest on NSURLRequest provides methods for accessing +/// information specific to HTTP protocol requests. +extension NSHTTPURLRequest on NSURLRequest { + /// ! + /// @abstract Returns the HTTP request method of the receiver. + /// @result the HTTP request method of the receiver. + objc.NSString? get HTTPMethod { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_HTTPMethod); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Returns a dictionary containing all the HTTP header fields + /// of the receiver. + /// @result a dictionary containing all the HTTP header fields of the + /// receiver. + objc.NSDictionary? get allHTTPHeaderFields { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_allHTTPHeaderFields); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @method valueForHTTPHeaderField: + /// @abstract Returns the value which corresponds to the given header + /// field. Note that, in keeping with the HTTP RFC, HTTP header field + /// names are case-insensitive. + /// @param field the header field name to use for the lookup + /// (case-insensitive). + /// @result the value associated with the given header field, or nil if + /// there is no value associated with the given header field. + objc.NSString? valueForHTTPHeaderField_(objc.NSString field) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_valueForHTTPHeaderField_, field.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Returns the request body data of the receiver. + /// @discussion This data is sent as the message body of the request, as + /// in done in an HTTP POST request. + /// @result The request body data of the receiver. + objc.NSData? get HTTPBody { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_HTTPBody); + return _ret.address == 0 + ? null + : objc.NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Returns the request body stream of the receiver + /// if any has been set + /// @discussion The stream is returned for examination only; it is + /// not safe for the caller to manipulate the stream in any way. Also + /// note that the HTTPBodyStream and HTTPBody are mutually exclusive - only + /// one can be set on a given request. Also note that the body stream is + /// preserved across copies, but is LOST when the request is coded via the + /// NSCoding protocol + /// @result The request body stream of the receiver. + objc.NSInputStream? get HTTPBodyStream { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_HTTPBodyStream); + return _ret.address == 0 + ? null + : objc.NSInputStream.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Determine whether default cookie handling will happen for + /// this request. + /// @discussion NOTE: This value is not used prior to 10.3 + /// @result YES if cookies will be sent with and set for this request; + /// otherwise NO. + bool get HTTPShouldHandleCookies { + return _objc_msgSend_91o635(this.ref.pointer, _sel_HTTPShouldHandleCookies); + } + + /// ! + /// @abstract Reports whether the receiver is not expected to wait for the + /// previous response before transmitting. + /// @result YES if the receiver should transmit before the previous response + /// is received. NO if the receiver should wait for the previous response + /// before transmitting. + bool get HTTPShouldUsePipelining { + return _objc_msgSend_91o635(this.ref.pointer, _sel_HTTPShouldUsePipelining); + } +} + +late final _sel_requestWithURL_ = objc.registerName("requestWithURL:"); +late final _sel_supportsSecureCoding = + objc.registerName("supportsSecureCoding"); +bool _ObjCBlock_bool_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_bool_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_bool_ffiVoid_fnPtrTrampoline, false) + .cast(); +bool _ObjCBlock_bool_ffiVoid_closureTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + (objc.getBlockClosure(block) as bool Function(ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_bool_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_bool_ffiVoid_closureTrampoline, false) + .cast(); + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_bool_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_bool_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> fromFunction( + bool Function(ffi.Pointer) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock(_ObjCBlock_bool_ffiVoid_closureCallable, + (ffi.Pointer arg0) => fn(arg0)), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_bool_ffiVoid_CallExtension + on objc.ObjCBlock)> { + bool call(ffi.Pointer arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + bool Function(ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0); +} + +/// ! +/// @enum NSURLRequestCachePolicy +/// +/// @discussion The NSURLRequestCachePolicy enum defines constants that +/// can be used to specify the type of interactions that take place with +/// the caching system when the URL loading system processes a request. +/// Specifically, these constants cover interactions that have to do +/// with whether already-existing cache data is returned to satisfy a +/// URL load request. +/// +/// @constant NSURLRequestUseProtocolCachePolicy Specifies that the +/// caching logic defined in the protocol implementation, if any, is +/// used for a particular URL load request. This is the default policy +/// for URL load requests. +/// +/// @constant NSURLRequestReloadIgnoringLocalCacheData Specifies that the +/// data for the URL load should be loaded from the origin source. No +/// existing local cache data, regardless of its freshness or validity, +/// should be used to satisfy a URL load request. +/// +/// @constant NSURLRequestReloadIgnoringLocalAndRemoteCacheData Specifies that +/// not only should the local cache data be ignored, but that proxies and +/// other intermediates should be instructed to disregard their caches +/// so far as the protocol allows. +/// +/// @constant NSURLRequestReloadIgnoringCacheData Older name for +/// NSURLRequestReloadIgnoringLocalCacheData. +/// +/// @constant NSURLRequestReturnCacheDataElseLoad Specifies that the +/// existing cache data should be used to satisfy a URL load request, +/// regardless of its age or expiration date. However, if there is no +/// existing data in the cache corresponding to a URL load request, +/// the URL is loaded from the origin source. +/// +/// @constant NSURLRequestReturnCacheDataDontLoad Specifies that the +/// existing cache data should be used to satisfy a URL load request, +/// regardless of its age or expiration date. However, if there is no +/// existing data in the cache corresponding to a URL load request, no +/// attempt is made to load the URL from the origin source, and the +/// load is considered to have failed. This constant specifies a +/// behavior that is similar to an "offline" mode. +/// +/// @constant NSURLRequestReloadRevalidatingCacheData Specifies that +/// the existing cache data may be used provided the origin source +/// confirms its validity, otherwise the URL is loaded from the +/// origin source. +enum NSURLRequestCachePolicy { + NSURLRequestUseProtocolCachePolicy(0), + NSURLRequestReloadIgnoringLocalCacheData(1), + NSURLRequestReloadIgnoringLocalAndRemoteCacheData(4), + NSURLRequestReturnCacheDataElseLoad(2), + NSURLRequestReturnCacheDataDontLoad(3), + NSURLRequestReloadRevalidatingCacheData(5); + + static const NSURLRequestReloadIgnoringCacheData = + NSURLRequestReloadIgnoringLocalCacheData; + + final int value; + const NSURLRequestCachePolicy(this.value); + + static NSURLRequestCachePolicy fromValue(int value) => switch (value) { + 0 => NSURLRequestUseProtocolCachePolicy, + 1 => NSURLRequestReloadIgnoringLocalCacheData, + 4 => NSURLRequestReloadIgnoringLocalAndRemoteCacheData, + 2 => NSURLRequestReturnCacheDataElseLoad, + 3 => NSURLRequestReturnCacheDataDontLoad, + 5 => NSURLRequestReloadRevalidatingCacheData, + _ => throw ArgumentError( + "Unknown value for NSURLRequestCachePolicy: $value"), + }; + + @override + String toString() { + if (this == NSURLRequestReloadIgnoringLocalCacheData) + return "NSURLRequestCachePolicy.NSURLRequestReloadIgnoringLocalCacheData, NSURLRequestCachePolicy.NSURLRequestReloadIgnoringCacheData"; + return super.toString(); + } +} + +typedef NSTimeInterval = ffi.Double; +typedef DartNSTimeInterval = double; +late final _sel_requestWithURL_cachePolicy_timeoutInterval_ = + objc.registerName("requestWithURL:cachePolicy:timeoutInterval:"); +final _objc_msgSend_3phu9v = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Double)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + double)>(); +late final _sel_initWithURL_ = objc.registerName("initWithURL:"); +late final _sel_initWithURL_cachePolicy_timeoutInterval_ = + objc.registerName("initWithURL:cachePolicy:timeoutInterval:"); +late final _sel_URL = objc.registerName("URL"); +late final _sel_cachePolicy = objc.registerName("cachePolicy"); +final _objc_msgSend_8jm3uo = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSUInteger Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_timeoutInterval = objc.registerName("timeoutInterval"); +final _objc_msgSend_1ukqyt8 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1ukqyt8Fpret = objc.msgSendFpretPointer + .cast< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_mainDocumentURL = objc.registerName("mainDocumentURL"); + +/// ! +/// @enum NSURLRequestNetworkServiceType +/// +/// @discussion The NSURLRequestNetworkServiceType enum defines constants that +/// can be used to specify the service type to associate with this request. The +/// service type is used to provide the networking layers a hint of the purpose +/// of the request. +/// +/// @constant NSURLNetworkServiceTypeDefault Is the default value for an NSURLRequest +/// when created. This value should be left unchanged for the vast majority of requests. +/// +/// @constant NSURLNetworkServiceTypeVoIP Specifies that the request is for voice over IP +/// control traffic. +/// +/// @constant NSURLNetworkServiceTypeVideo Specifies that the request is for video +/// traffic. +/// +/// @constant NSURLNetworkServiceTypeBackground Specifies that the request is for background +/// traffic (such as a file download). +/// +/// @constant NSURLNetworkServiceTypeVoice Specifies that the request is for voice data. +/// +/// @constant NSURLNetworkServiceTypeResponsiveData Specifies that the request is for responsive (time sensitive) data. +/// +/// @constant NSURLNetworkServiceTypeAVStreaming Specifies that the request is streaming audio/video data. +/// +/// @constant NSURLNetworkServiceTypeResponsiveAV Specifies that the request is for responsive (time sensitive) audio/video data. +/// +/// @constant NSURLNetworkServiceTypeCallSignaling Specifies that the request is for call signaling. +enum NSURLRequestNetworkServiceType { + /// Standard internet traffic + NSURLNetworkServiceTypeDefault(0), + + /// Voice over IP control traffic + NSURLNetworkServiceTypeVoIP(1), + + /// Video traffic + NSURLNetworkServiceTypeVideo(2), + + /// Background traffic + NSURLNetworkServiceTypeBackground(3), + + /// Voice data + NSURLNetworkServiceTypeVoice(4), + + /// Responsive data + NSURLNetworkServiceTypeResponsiveData(6), + + /// Multimedia Audio/Video Streaming + NSURLNetworkServiceTypeAVStreaming(8), + + /// Responsive Multimedia Audio/Video + NSURLNetworkServiceTypeResponsiveAV(9), + + /// Call Signaling + NSURLNetworkServiceTypeCallSignaling(11); + + final int value; + const NSURLRequestNetworkServiceType(this.value); + + static NSURLRequestNetworkServiceType fromValue(int value) => switch (value) { + 0 => NSURLNetworkServiceTypeDefault, + 1 => NSURLNetworkServiceTypeVoIP, + 2 => NSURLNetworkServiceTypeVideo, + 3 => NSURLNetworkServiceTypeBackground, + 4 => NSURLNetworkServiceTypeVoice, + 6 => NSURLNetworkServiceTypeResponsiveData, + 8 => NSURLNetworkServiceTypeAVStreaming, + 9 => NSURLNetworkServiceTypeResponsiveAV, + 11 => NSURLNetworkServiceTypeCallSignaling, + _ => throw ArgumentError( + "Unknown value for NSURLRequestNetworkServiceType: $value"), + }; +} + +late final _sel_networkServiceType = objc.registerName("networkServiceType"); +final _objc_msgSend_t4uaw1 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSUInteger Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_allowsCellularAccess = + objc.registerName("allowsCellularAccess"); +late final _sel_allowsExpensiveNetworkAccess = + objc.registerName("allowsExpensiveNetworkAccess"); +late final _sel_allowsConstrainedNetworkAccess = + objc.registerName("allowsConstrainedNetworkAccess"); +late final _sel_assumesHTTP3Capable = objc.registerName("assumesHTTP3Capable"); + +/// ! +/// @enum NSURLRequestAttribution +/// +/// @discussion The NSURLRequestAttribution enum is used to indicate whether the +/// user or developer specified the URL. +/// +/// @constant NSURLRequestAttributionDeveloper Indicates that the URL was specified +/// by the developer. This is the default value for an NSURLRequest when created. +/// +/// @constant NSURLRequestAttributionUser Indicates that the URL was specified by +/// the user. +enum NSURLRequestAttribution { + NSURLRequestAttributionDeveloper(0), + NSURLRequestAttributionUser(1); + + final int value; + const NSURLRequestAttribution(this.value); + + static NSURLRequestAttribution fromValue(int value) => switch (value) { + 0 => NSURLRequestAttributionDeveloper, + 1 => NSURLRequestAttributionUser, + _ => throw ArgumentError( + "Unknown value for NSURLRequestAttribution: $value"), + }; +} + +late final _sel_attribution = objc.registerName("attribution"); +final _objc_msgSend_i3avs9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSUInteger Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_requiresDNSSECValidation = + objc.registerName("requiresDNSSECValidation"); +late final _sel_init = objc.registerName("init"); +late final _sel_new = objc.registerName("new"); +late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); +final _objc_msgSend_hzlb60 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer<_NSZone>)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer<_NSZone>)>(); +late final _sel_alloc = objc.registerName("alloc"); +late final _sel_self = objc.registerName("self"); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer)>()(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_objcObjCObject_ffiVoid_fnPtrTrampoline) + .cast(); +ffi.Pointer + _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as ffi.Pointer Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_objcObjCObject_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_objcObjCObject_ffiVoid_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock Function(ffi.Pointer)>`. +abstract final class ObjCBlock_objcObjCObject_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock Function(ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock Function(ffi.Pointer)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock Function(ffi.Pointer)>( + objc.newPointerBlock(_ObjCBlock_objcObjCObject_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock Function(ffi.Pointer)> + fromFunction(objc.ObjCObjectBase Function(ffi.Pointer) fn) => + objc.ObjCBlock< + ffi.Pointer Function(ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_objcObjCObject_ffiVoid_closureCallable, + (ffi.Pointer arg0) => + fn(arg0).ref.retainAndAutorelease()), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock Function(ffi.Pointer)>`. +extension ObjCBlock_objcObjCObject_ffiVoid_CallExtension on objc + .ObjCBlock Function(ffi.Pointer)> { + objc.ObjCObjectBase call(ffi.Pointer arg0) => objc.ObjCObjectBase( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0), + retain: true, + release: true); +} + +late final _sel_retain = objc.registerName("retain"); +late final _sel_autorelease = objc.registerName("autorelease"); +late final _sel_encodeWithCoder_ = objc.registerName("encodeWithCoder:"); +void _ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, objc.NSCoder)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSCoder { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock, objc.NSCoder)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + objc.NSCoder)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, objc.NSCoder)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock, objc.NSCoder)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSCoder_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, objc.NSCoder)> + fromFunction(void Function(ffi.Pointer, objc.NSCoder) fn) => + objc.ObjCBlock, objc.NSCoder)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSCoder_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => + fn( + arg0, + objc.NSCoder.castFromPointer(arg1, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock, objc.NSCoder)> + listener(void Function(ffi.Pointer, objc.NSCoder) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSCoder_listenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0, ffi.Pointer arg1) => fn( + arg0, + objc.NSCoder.castFromPointer(arg1, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_wjovn7(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, objc.NSCoder)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, objc.NSCoder)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSCoder_CallExtension + on objc.ObjCBlock, objc.NSCoder)> { + void call(ffi.Pointer arg0, objc.NSCoder arg1) => ref + .pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>()( + ref.pointer, arg0, arg1.ref.pointer); +} + +late final _sel_initWithCoder_ = objc.registerName("initWithCoder:"); +instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + instancetype Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + instancetype Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrCallable = + ffi.Pointer.fromFunction< + instancetype Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrTrampoline) + .cast(); +instancetype _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as instancetype Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); +ffi.Pointer _ObjCBlock_instancetype_ffiVoid_NSCoder_closureCallable = + ffi.Pointer.fromFunction< + instancetype Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_instancetype_ffiVoid_NSCoder_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)>`. +abstract final class ObjCBlock_instancetype_ffiVoid_NSCoder { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + objc.Retained?> Function( + ffi.Pointer, objc.NSCoder)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + objc.Retained?> Function( + ffi.Pointer, + objc.NSCoder)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + objc.Retained?> Function( + ffi.Pointer, objc.NSCoder)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1)>> ptr) => + objc.ObjCBlock< + objc.Retained?> Function( + ffi.Pointer, objc.NSCoder)>( + objc.newPointerBlock( + _ObjCBlock_instancetype_ffiVoid_NSCoder_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)> fromFunction( + Dartinstancetype? Function(ffi.Pointer, objc.NSCoder) fn) => + objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)>( + objc.newClosureBlock( + _ObjCBlock_instancetype_ffiVoid_NSCoder_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => + fn(arg0, objc.NSCoder.castFromPointer(arg1, retain: true, release: true)) + ?.ref + .retainAndReturnPointer() ?? + ffi.nullptr), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock?> Function(ffi.Pointer, objc.NSCoder)>`. +extension ObjCBlock_instancetype_ffiVoid_NSCoder_CallExtension + on objc.ObjCBlock< + objc.Retained?> Function( + ffi.Pointer, objc.NSCoder)> { + Dartinstancetype? call(ffi.Pointer arg0, objc.NSCoder arg1) => ref + .pointer.ref.invoke + .cast< + ffi.NativeFunction< + instancetype Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction, ffi.Pointer, ffi.Pointer)>() + (ref.pointer, arg0, arg1.ref.pointer) + .address == + 0 + ? null + : objc.ObjCObjectBase( + ref.pointer.ref.invoke + .cast block, ffi.Pointer arg0, ffi.Pointer arg1)>>() + .asFunction, ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0, arg1.ref.pointer), + retain: false, + release: true); +} + +/// NSURLRequest +class NSURLRequest extends objc.NSObject { + NSURLRequest._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLRequest] that points to the same underlying object as [other]. + NSURLRequest.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLRequest] that wraps the given raw object pointer. + NSURLRequest.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSURLRequest]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLRequest); + } + + /// ! + /// @method requestWithURL: + /// @abstract Allocates and initializes an NSURLRequest with the given + /// URL. + /// @discussion Default values are used for cache policy + /// (NSURLRequestUseProtocolCachePolicy) and timeout interval (60 + /// seconds). + /// @param URL The URL for the request. + /// @result A newly-created and autoreleased NSURLRequest instance. + static NSURLRequest requestWithURL_(objc.NSURL URL) { + final _ret = _objc_msgSend_62nh5j( + _class_NSURLRequest, _sel_requestWithURL_, URL.ref.pointer); + return NSURLRequest.castFromPointer(_ret, retain: true, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635(_class_NSURLRequest, _sel_supportsSecureCoding); + } + + /// ! + /// @method requestWithURL:cachePolicy:timeoutInterval: + /// @abstract Allocates and initializes a NSURLRequest with the given + /// URL and cache policy. + /// @param URL The URL for the request. + /// @param cachePolicy The cache policy for the request. + /// @param timeoutInterval The timeout interval for the request. See the + /// commentary for the timeoutInterval for more information on + /// timeout intervals. + /// @result A newly-created and autoreleased NSURLRequest instance. + static NSURLRequest requestWithURL_cachePolicy_timeoutInterval_( + objc.NSURL URL, + NSURLRequestCachePolicy cachePolicy, + DartNSTimeInterval timeoutInterval) { + final _ret = _objc_msgSend_3phu9v( + _class_NSURLRequest, + _sel_requestWithURL_cachePolicy_timeoutInterval_, + URL.ref.pointer, + cachePolicy.value, + timeoutInterval); + return NSURLRequest.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @method initWithURL: + /// @abstract Initializes an NSURLRequest with the given URL. + /// @discussion Default values are used for cache policy + /// (NSURLRequestUseProtocolCachePolicy) and timeout interval (60 + /// seconds). + /// @param URL The URL for the request. + /// @result An initialized NSURLRequest. + NSURLRequest initWithURL_(objc.NSURL URL) { + final _ret = _objc_msgSend_62nh5j( + this.ref.retainAndReturnPointer(), _sel_initWithURL_, URL.ref.pointer); + return NSURLRequest.castFromPointer(_ret, retain: false, release: true); + } + + /// ! + /// @method initWithURL: + /// @abstract Initializes an NSURLRequest with the given URL and + /// cache policy. + /// @discussion This is the designated initializer for the + /// NSURLRequest class. + /// @param URL The URL for the request. + /// @param cachePolicy The cache policy for the request. + /// @param timeoutInterval The timeout interval for the request. See the + /// commentary for the timeoutInterval for more information on + /// timeout intervals. + /// @result An initialized NSURLRequest. + NSURLRequest initWithURL_cachePolicy_timeoutInterval_(objc.NSURL URL, + NSURLRequestCachePolicy cachePolicy, DartNSTimeInterval timeoutInterval) { + final _ret = _objc_msgSend_3phu9v( + this.ref.retainAndReturnPointer(), + _sel_initWithURL_cachePolicy_timeoutInterval_, + URL.ref.pointer, + cachePolicy.value, + timeoutInterval); + return NSURLRequest.castFromPointer(_ret, retain: false, release: true); + } + + /// ! + /// @abstract Returns the URL of the receiver. + /// @result The URL of the receiver. + objc.NSURL? get URL { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_URL); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Returns the cache policy of the receiver. + /// @result The cache policy of the receiver. + NSURLRequestCachePolicy get cachePolicy { + final _ret = _objc_msgSend_8jm3uo(this.ref.pointer, _sel_cachePolicy); + return NSURLRequestCachePolicy.fromValue(_ret); + } + + /// ! + /// @abstract Returns the timeout interval of the receiver. + /// @discussion The timeout interval specifies the limit on the idle + /// interval allotted to a request in the process of loading. The "idle + /// interval" is defined as the period of time that has passed since the + /// last instance of load activity occurred for a request that is in the + /// process of loading. Hence, when an instance of load activity occurs + /// (e.g. bytes are received from the network for a request), the idle + /// interval for a request is reset to 0. If the idle interval ever + /// becomes greater than or equal to the timeout interval, the request + /// is considered to have timed out. This timeout interval is measured + /// in seconds. + /// @result The timeout interval of the receiver. + DartNSTimeInterval get timeoutInterval { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret(this.ref.pointer, _sel_timeoutInterval) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_timeoutInterval); + } + + /// ! + /// @abstract The main document URL associated with this load. + /// @discussion This URL is used for the cookie "same domain as main + /// document" policy, and attributing the request as a sub-resource + /// of a user-specified URL. There may also be other future uses. + /// See setMainDocumentURL: + /// @result The main document URL. + objc.NSURL? get mainDocumentURL { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_mainDocumentURL); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Returns the NSURLRequestNetworkServiceType associated with this request. + /// @discussion This will return NSURLNetworkServiceTypeDefault for requests that have + /// not explicitly set a networkServiceType (using the setNetworkServiceType method). + /// @result The NSURLRequestNetworkServiceType associated with this request. + NSURLRequestNetworkServiceType get networkServiceType { + final _ret = + _objc_msgSend_t4uaw1(this.ref.pointer, _sel_networkServiceType); + return NSURLRequestNetworkServiceType.fromValue(_ret); + } + + /// ! + /// @abstract returns whether a connection created with this request is allowed to use + /// the built in cellular radios (if present). + /// @result YES if the receiver is allowed to use the built in cellular radios to + /// satisfy the request, NO otherwise. + bool get allowsCellularAccess { + return _objc_msgSend_91o635(this.ref.pointer, _sel_allowsCellularAccess); + } + + /// ! + /// @abstract returns whether a connection created with this request is allowed to use + /// network interfaces which have been marked as expensive. + /// @result YES if the receiver is allowed to use an interface marked as expensive to + /// satisfy the request, NO otherwise. + bool get allowsExpensiveNetworkAccess { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_allowsExpensiveNetworkAccess); + } + + /// ! + /// @abstract returns whether a connection created with this request is allowed to use + /// network interfaces which have been marked as constrained. + /// @result YES if the receiver is allowed to use an interface marked as constrained to + /// satisfy the request, NO otherwise. + bool get allowsConstrainedNetworkAccess { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_allowsConstrainedNetworkAccess); + } + + /// ! + /// @abstract returns whether we assume that server supports HTTP/3. Enables QUIC + /// racing without HTTP/3 service discovery. + /// @result YES if server endpoint is known to support HTTP/3. Defaults to NO. + /// The default may be YES in a future OS update. + bool get assumesHTTP3Capable { + return _objc_msgSend_91o635(this.ref.pointer, _sel_assumesHTTP3Capable); + } + + /// ! + /// @abstract Returns the NSURLRequestAttribution associated with this request. + /// @discussion This will return NSURLRequestAttributionDeveloper for requests that + /// have not explicitly set an attribution. + /// @result The NSURLRequestAttribution associated with this request. + NSURLRequestAttribution get attribution { + final _ret = _objc_msgSend_i3avs9(this.ref.pointer, _sel_attribution); + return NSURLRequestAttribution.fromValue(_ret); + } + + /// ! + /// @abstract sets whether a request is required to do DNSSEC validation during DNS lookup. + /// @discussion YES, if the DNS lookup for this request should require DNSSEC validation, + /// No otherwise. Defaults to NO. + bool get requiresDNSSECValidation { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_requiresDNSSECValidation); + } + + /// init + NSURLRequest init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSURLRequest.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static NSURLRequest new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLRequest, _sel_new); + return NSURLRequest.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static NSURLRequest allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = + _objc_msgSend_hzlb60(_class_NSURLRequest, _sel_allocWithZone_, zone); + return NSURLRequest.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static NSURLRequest alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLRequest, _sel_alloc); + return NSURLRequest.castFromPointer(_ret, retain: false, release: true); + } + + /// self + NSURLRequest self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSURLRequest.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + NSURLRequest retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSURLRequest.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + NSURLRequest autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSURLRequest.castFromPointer(_ret, retain: true, release: true); + } + + /// encodeWithCoder: + void encodeWithCoder_(objc.NSCoder coder) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); + } + + /// initWithCoder: + NSURLRequest? initWithCoder_(objc.NSCoder coder) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithCoder_, coder.ref.pointer); + return _ret.address == 0 + ? null + : NSURLRequest.castFromPointer(_ret, retain: false, release: true); + } +} + +late final _sel_cachedResponseForRequest_ = + objc.registerName("cachedResponseForRequest:"); +late final _sel_storeCachedResponse_forRequest_ = + objc.registerName("storeCachedResponse:forRequest:"); +late final _sel_removeCachedResponseForRequest_ = + objc.registerName("removeCachedResponseForRequest:"); +late final _sel_removeAllCachedResponses = + objc.registerName("removeAllCachedResponses"); +final _objc_msgSend_1pl9qdv = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_removeCachedResponsesSinceDate_ = + objc.registerName("removeCachedResponsesSinceDate:"); +late final _sel_memoryCapacity = objc.registerName("memoryCapacity"); +final _objc_msgSend_xw2lbc = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setMemoryCapacity_ = objc.registerName("setMemoryCapacity:"); +final _objc_msgSend_1i9r4xy = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_diskCapacity = objc.registerName("diskCapacity"); +late final _sel_setDiskCapacity_ = objc.registerName("setDiskCapacity:"); +late final _sel_currentMemoryUsage = objc.registerName("currentMemoryUsage"); +late final _sel_currentDiskUsage = objc.registerName("currentDiskUsage"); + +/// NSURLCache +class NSURLCache extends objc.NSObject { + NSURLCache._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLCache] that points to the same underlying object as [other]. + NSURLCache.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLCache] that wraps the given raw object pointer. + NSURLCache.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSURLCache]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLCache); + } + + /// ! + /// @property sharedURLCache + /// @abstract Returns the shared NSURLCache instance or + /// sets the NSURLCache instance shared by all clients of + /// the current process. This will be the new object returned when + /// calls to the sharedURLCache method are made. + /// @discussion Unless set explicitly through a call to + /// +setSharedURLCache:, this method returns an NSURLCache + /// instance created with the following default values: + ///
    + ///
  • Memory capacity: 4 megabytes (4 * 1024 * 1024 bytes) + ///
  • Disk capacity: 20 megabytes (20 * 1024 * 1024 bytes) + ///
  • Disk path: (user home directory)/Library/Caches/(application bundle id) + ///
+ ///

Users who do not have special caching requirements or + /// constraints should find the default shared cache instance + /// acceptable. If this default shared cache instance is not + /// acceptable, +setSharedURLCache: can be called to set a + /// different NSURLCache instance to be returned from this method. + /// Callers should take care to ensure that the setter is called + /// at a time when no other caller has a reference to the previously-set + /// shared URL cache. This is to prevent storing cache data from + /// becoming unexpectedly unretrievable. + /// @result the shared NSURLCache instance. + static NSURLCache getSharedURLCache() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLCache, _sel_sharedURLCache); + return NSURLCache.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @property sharedURLCache + /// @abstract Returns the shared NSURLCache instance or + /// sets the NSURLCache instance shared by all clients of + /// the current process. This will be the new object returned when + /// calls to the sharedURLCache method are made. + /// @discussion Unless set explicitly through a call to + /// +setSharedURLCache:, this method returns an NSURLCache + /// instance created with the following default values: + ///

    + ///
  • Memory capacity: 4 megabytes (4 * 1024 * 1024 bytes) + ///
  • Disk capacity: 20 megabytes (20 * 1024 * 1024 bytes) + ///
  • Disk path: (user home directory)/Library/Caches/(application bundle id) + ///
+ ///

Users who do not have special caching requirements or + /// constraints should find the default shared cache instance + /// acceptable. If this default shared cache instance is not + /// acceptable, +setSharedURLCache: can be called to set a + /// different NSURLCache instance to be returned from this method. + /// Callers should take care to ensure that the setter is called + /// at a time when no other caller has a reference to the previously-set + /// shared URL cache. This is to prevent storing cache data from + /// becoming unexpectedly unretrievable. + /// @result the shared NSURLCache instance. + static void setSharedURLCache(NSURLCache value) { + return _objc_msgSend_1jdvcbf( + _class_NSURLCache, _sel_setSharedURLCache_, value.ref.pointer); + } + + /// ! + /// @method initWithMemoryCapacity:diskCapacity:diskPath: + /// @abstract Initializes an NSURLCache with the given capacity and + /// path. + /// @discussion The returned NSURLCache is backed by disk, so + /// developers can be more liberal with space when choosing the + /// capacity for this kind of cache. A disk cache measured in the tens + /// of megabytes should be acceptable in most cases. + /// @param memoryCapacity the capacity, measured in bytes, for the cache in memory. + /// @param diskCapacity the capacity, measured in bytes, for the cache on disk. + /// @param path the path on disk where the cache data is stored. + /// @result an initialized NSURLCache, with the given capacity, backed + /// by disk. + NSURLCache initWithMemoryCapacity_diskCapacity_diskPath_( + DartNSUInteger memoryCapacity, + DartNSUInteger diskCapacity, + objc.NSString? path) { + final _ret = _objc_msgSend_1dlfwfh( + this.ref.retainAndReturnPointer(), + _sel_initWithMemoryCapacity_diskCapacity_diskPath_, + memoryCapacity, + diskCapacity, + path?.ref.pointer ?? ffi.nullptr); + return NSURLCache.castFromPointer(_ret, retain: false, release: true); + } + + /// ! + /// @method initWithMemoryCapacity:diskCapacity:directoryURL: + /// @abstract Initializes an NSURLCache with the given capacity and directory. + /// @param memoryCapacity the capacity, measured in bytes, for the cache in memory. Or 0 to disable memory cache. + /// @param diskCapacity the capacity, measured in bytes, for the cache on disk. Or 0 to disable disk cache. + /// @param directoryURL the path to a directory on disk where the cache data is stored. Or nil for default directory. + /// @result an initialized NSURLCache, with the given capacity, optionally backed by disk. + NSURLCache initWithMemoryCapacity_diskCapacity_directoryURL_( + DartNSUInteger memoryCapacity, + DartNSUInteger diskCapacity, + objc.NSURL? directoryURL) { + final _ret = _objc_msgSend_1dlfwfh( + this.ref.retainAndReturnPointer(), + _sel_initWithMemoryCapacity_diskCapacity_directoryURL_, + memoryCapacity, + diskCapacity, + directoryURL?.ref.pointer ?? ffi.nullptr); + return NSURLCache.castFromPointer(_ret, retain: false, release: true); + } + + /// ! + /// @method cachedResponseForRequest: + /// @abstract Returns the NSCachedURLResponse stored in the cache with + /// the given request. + /// @discussion The method returns nil if there is no + /// NSCachedURLResponse stored using the given request. + /// @param request the NSURLRequest to use as a key for the lookup. + /// @result The NSCachedURLResponse stored in the cache with the given + /// request, or nil if there is no NSCachedURLResponse stored with the + /// given request. + NSCachedURLResponse? cachedResponseForRequest_(NSURLRequest request) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_cachedResponseForRequest_, request.ref.pointer); + return _ret.address == 0 + ? null + : NSCachedURLResponse.castFromPointer(_ret, + retain: true, release: true); + } + + /// ! + /// @method storeCachedResponse:forRequest: + /// @abstract Stores the given NSCachedURLResponse in the cache using + /// the given request. + /// @param cachedResponse The cached response to store. + /// @param request the NSURLRequest to use as a key for the storage. + void storeCachedResponse_forRequest_( + NSCachedURLResponse cachedResponse, NSURLRequest request) { + _objc_msgSend_wjvic9(this.ref.pointer, _sel_storeCachedResponse_forRequest_, + cachedResponse.ref.pointer, request.ref.pointer); + } + + /// ! + /// @method removeCachedResponseForRequest: + /// @abstract Removes the NSCachedURLResponse from the cache that is + /// stored using the given request. + /// @discussion No action is taken if there is no NSCachedURLResponse + /// stored with the given request. + /// @param request the NSURLRequest to use as a key for the lookup. + void removeCachedResponseForRequest_(NSURLRequest request) { + _objc_msgSend_1jdvcbf(this.ref.pointer, + _sel_removeCachedResponseForRequest_, request.ref.pointer); + } + + /// ! + /// @method removeAllCachedResponses + /// @abstract Clears the given cache, removing all NSCachedURLResponse + /// objects that it stores. + void removeAllCachedResponses() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_removeAllCachedResponses); + } + + /// ! + /// @method removeCachedResponsesSince: + /// @abstract Clears the given cache of any cached responses since the provided date. + void removeCachedResponsesSinceDate_(objc.NSDate date) { + _objc_msgSend_1jdvcbf(this.ref.pointer, + _sel_removeCachedResponsesSinceDate_, date.ref.pointer); + } + + /// ! + /// @abstract In-memory capacity of the receiver. + /// @discussion At the time this call is made, the in-memory cache will truncate its contents to the size given, if necessary. + /// @result The in-memory capacity, measured in bytes, for the receiver. + DartNSUInteger get memoryCapacity { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_memoryCapacity); + } + + /// ! + /// @abstract In-memory capacity of the receiver. + /// @discussion At the time this call is made, the in-memory cache will truncate its contents to the size given, if necessary. + /// @result The in-memory capacity, measured in bytes, for the receiver. + set memoryCapacity(DartNSUInteger value) { + return _objc_msgSend_1i9r4xy( + this.ref.pointer, _sel_setMemoryCapacity_, value); + } + + /// ! + /// @abstract The on-disk capacity of the receiver. + /// @discussion The on-disk capacity, measured in bytes, for the receiver. On mutation the on-disk cache will truncate its contents to the size given, if necessary. + DartNSUInteger get diskCapacity { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_diskCapacity); + } + + /// ! + /// @abstract The on-disk capacity of the receiver. + /// @discussion The on-disk capacity, measured in bytes, for the receiver. On mutation the on-disk cache will truncate its contents to the size given, if necessary. + set diskCapacity(DartNSUInteger value) { + return _objc_msgSend_1i9r4xy( + this.ref.pointer, _sel_setDiskCapacity_, value); + } + + /// ! + /// @abstract Returns the current amount of space consumed by the + /// in-memory cache of the receiver. + /// @discussion This size, measured in bytes, indicates the current + /// usage of the in-memory cache. + /// @result the current usage of the in-memory cache of the receiver. + DartNSUInteger get currentMemoryUsage { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_currentMemoryUsage); + } + + /// ! + /// @abstract Returns the current amount of space consumed by the + /// on-disk cache of the receiver. + /// @discussion This size, measured in bytes, indicates the current + /// usage of the on-disk cache. + /// @result the current usage of the on-disk cache of the receiver. + DartNSUInteger get currentDiskUsage { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_currentDiskUsage); + } + + /// init + NSURLCache init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSURLCache.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static NSURLCache new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLCache, _sel_new); + return NSURLCache.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static NSURLCache allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = + _objc_msgSend_hzlb60(_class_NSURLCache, _sel_allocWithZone_, zone); + return NSURLCache.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static NSURLCache alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLCache, _sel_alloc); + return NSURLCache.castFromPointer(_ret, retain: false, release: true); + } + + /// self + NSURLCache self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSURLCache.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + NSURLCache retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSURLCache.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + NSURLCache autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSURLCache.castFromPointer(_ret, retain: true, release: true); + } +} + +typedef NSNotificationName = ffi.Pointer; +typedef DartNSNotificationName = objc.NSString; +late final _class_NSNotification = objc.getClass("NSNotification"); +late final _sel_notificationWithName_object_ = + objc.registerName("notificationWithName:object:"); +final _objc_msgSend_rsfdlh = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_notificationWithName_object_userInfo_ = + objc.registerName("notificationWithName:object:userInfo:"); +final _objc_msgSend_582s3n = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + +/// NSNotificationCreation +extension NSNotificationCreation on objc.NSNotification { + /// notificationWithName:object: + static objc.NSNotification notificationWithName_object_( + DartNSNotificationName aName, objc.ObjCObjectBase? anObject) { + final _ret = _objc_msgSend_rsfdlh( + _class_NSNotification, + _sel_notificationWithName_object_, + aName.ref.pointer, + anObject?.ref.pointer ?? ffi.nullptr); + return objc.NSNotification.castFromPointer(_ret, + retain: true, release: true); + } + + /// notificationWithName:object:userInfo: + static objc.NSNotification notificationWithName_object_userInfo_( + DartNSNotificationName aName, + objc.ObjCObjectBase? anObject, + objc.NSDictionary? aUserInfo) { + final _ret = _objc_msgSend_582s3n( + _class_NSNotification, + _sel_notificationWithName_object_userInfo_, + aName.ref.pointer, + anObject?.ref.pointer ?? ffi.nullptr, + aUserInfo?.ref.pointer ?? ffi.nullptr); + return objc.NSNotification.castFromPointer(_ret, + retain: true, release: true); + } + + /// init + objc.NSNotification init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return objc.NSNotification.castFromPointer(_ret, + retain: false, release: true); + } +} + +late final _class_NSDate = objc.getClass("NSDate"); +late final _sel_timeIntervalSinceDate_ = + objc.registerName("timeIntervalSinceDate:"); +final _objc_msgSend_hlyk7w = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Double Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_hlyk7wFpret = objc.msgSendFpretPointer + .cast< + ffi.NativeFunction< + ffi.Double Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_timeIntervalSinceNow = + objc.registerName("timeIntervalSinceNow"); +late final _sel_timeIntervalSince1970 = + objc.registerName("timeIntervalSince1970"); +late final _sel_addTimeInterval_ = objc.registerName("addTimeInterval:"); +final _objc_msgSend_1x911p2 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Double)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, double)>(); +late final _sel_dateByAddingTimeInterval_ = + objc.registerName("dateByAddingTimeInterval:"); +late final _sel_earlierDate_ = objc.registerName("earlierDate:"); +late final _sel_laterDate_ = objc.registerName("laterDate:"); +late final _sel_compare_ = objc.registerName("compare:"); +final _objc_msgSend_1wpduvy = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_isEqualToDate_ = objc.registerName("isEqualToDate:"); +late final _sel_description = objc.registerName("description"); +late final _sel_descriptionWithLocale_ = + objc.registerName("descriptionWithLocale:"); +late final _sel_timeIntervalSinceReferenceDate = + objc.registerName("timeIntervalSinceReferenceDate"); + +/// NSExtendedDate +extension NSExtendedDate on objc.NSDate { + /// timeIntervalSinceDate: + DartNSTimeInterval timeIntervalSinceDate_(objc.NSDate anotherDate) { + return objc.useMsgSendVariants + ? _objc_msgSend_hlyk7wFpret(this.ref.pointer, + _sel_timeIntervalSinceDate_, anotherDate.ref.pointer) + : _objc_msgSend_hlyk7w(this.ref.pointer, _sel_timeIntervalSinceDate_, + anotherDate.ref.pointer); + } + + /// timeIntervalSinceNow + DartNSTimeInterval get timeIntervalSinceNow { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret( + this.ref.pointer, _sel_timeIntervalSinceNow) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_timeIntervalSinceNow); + } + + /// timeIntervalSince1970 + DartNSTimeInterval get timeIntervalSince1970 { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret( + this.ref.pointer, _sel_timeIntervalSince1970) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_timeIntervalSince1970); + } + + /// addTimeInterval: + objc.ObjCObjectBase addTimeInterval_(DartNSTimeInterval seconds) { + final _ret = + _objc_msgSend_1x911p2(this.ref.pointer, _sel_addTimeInterval_, seconds); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// dateByAddingTimeInterval: + objc.NSDate dateByAddingTimeInterval_(DartNSTimeInterval ti) { + final _ret = _objc_msgSend_1x911p2( + this.ref.pointer, _sel_dateByAddingTimeInterval_, ti); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// earlierDate: + objc.NSDate earlierDate_(objc.NSDate anotherDate) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_earlierDate_, anotherDate.ref.pointer); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// laterDate: + objc.NSDate laterDate_(objc.NSDate anotherDate) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_laterDate_, anotherDate.ref.pointer); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// compare: + objc.NSComparisonResult compare_(objc.NSDate other) { + final _ret = _objc_msgSend_1wpduvy( + this.ref.pointer, _sel_compare_, other.ref.pointer); + return objc.NSComparisonResult.fromValue(_ret); + } + + /// isEqualToDate: + bool isEqualToDate_(objc.NSDate otherDate) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_isEqualToDate_, otherDate.ref.pointer); + } + + /// description + objc.NSString get description { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_description); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// descriptionWithLocale: + objc.NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// timeIntervalSinceReferenceDate + static DartNSTimeInterval getTimeIntervalSinceReferenceDate() { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret( + _class_NSDate, _sel_timeIntervalSinceReferenceDate) + : _objc_msgSend_1ukqyt8( + _class_NSDate, _sel_timeIntervalSinceReferenceDate); + } +} + +late final _sel_date = objc.registerName("date"); +late final _sel_dateWithTimeIntervalSinceNow_ = + objc.registerName("dateWithTimeIntervalSinceNow:"); +late final _sel_dateWithTimeIntervalSinceReferenceDate_ = + objc.registerName("dateWithTimeIntervalSinceReferenceDate:"); +late final _sel_dateWithTimeIntervalSince1970_ = + objc.registerName("dateWithTimeIntervalSince1970:"); +late final _sel_dateWithTimeInterval_sinceDate_ = + objc.registerName("dateWithTimeInterval:sinceDate:"); +final _objc_msgSend_xh7c7e = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Double, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + double, + ffi.Pointer)>(); +late final _sel_distantFuture = objc.registerName("distantFuture"); +late final _sel_distantPast = objc.registerName("distantPast"); +late final _sel_now = objc.registerName("now"); +late final _sel_initWithTimeIntervalSinceNow_ = + objc.registerName("initWithTimeIntervalSinceNow:"); +late final _sel_initWithTimeIntervalSince1970_ = + objc.registerName("initWithTimeIntervalSince1970:"); +late final _sel_initWithTimeInterval_sinceDate_ = + objc.registerName("initWithTimeInterval:sinceDate:"); + +/// NSDateCreation +extension NSDateCreation on objc.NSDate { + /// date + static objc.NSDate date() { + final _ret = _objc_msgSend_1x359cv(_class_NSDate, _sel_date); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// dateWithTimeIntervalSinceNow: + static objc.NSDate dateWithTimeIntervalSinceNow_(DartNSTimeInterval secs) { + final _ret = _objc_msgSend_1x911p2( + _class_NSDate, _sel_dateWithTimeIntervalSinceNow_, secs); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// dateWithTimeIntervalSinceReferenceDate: + static objc.NSDate dateWithTimeIntervalSinceReferenceDate_( + DartNSTimeInterval ti) { + final _ret = _objc_msgSend_1x911p2( + _class_NSDate, _sel_dateWithTimeIntervalSinceReferenceDate_, ti); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// dateWithTimeIntervalSince1970: + static objc.NSDate dateWithTimeIntervalSince1970_(DartNSTimeInterval secs) { + final _ret = _objc_msgSend_1x911p2( + _class_NSDate, _sel_dateWithTimeIntervalSince1970_, secs); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// dateWithTimeInterval:sinceDate: + static objc.NSDate dateWithTimeInterval_sinceDate_( + DartNSTimeInterval secsToBeAdded, objc.NSDate date) { + final _ret = _objc_msgSend_xh7c7e(_class_NSDate, + _sel_dateWithTimeInterval_sinceDate_, secsToBeAdded, date.ref.pointer); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// distantFuture + static objc.NSDate getDistantFuture() { + final _ret = _objc_msgSend_1x359cv(_class_NSDate, _sel_distantFuture); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// distantPast + static objc.NSDate getDistantPast() { + final _ret = _objc_msgSend_1x359cv(_class_NSDate, _sel_distantPast); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// now + static objc.NSDate getNow() { + final _ret = _objc_msgSend_1x359cv(_class_NSDate, _sel_now); + return objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// initWithTimeIntervalSinceNow: + objc.NSDate initWithTimeIntervalSinceNow_(DartNSTimeInterval secs) { + final _ret = _objc_msgSend_1x911p2(this.ref.retainAndReturnPointer(), + _sel_initWithTimeIntervalSinceNow_, secs); + return objc.NSDate.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithTimeIntervalSince1970: + objc.NSDate initWithTimeIntervalSince1970_(DartNSTimeInterval secs) { + final _ret = _objc_msgSend_1x911p2(this.ref.retainAndReturnPointer(), + _sel_initWithTimeIntervalSince1970_, secs); + return objc.NSDate.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithTimeInterval:sinceDate: + objc.NSDate initWithTimeInterval_sinceDate_( + DartNSTimeInterval secsToBeAdded, objc.NSDate date) { + final _ret = _objc_msgSend_xh7c7e(this.ref.retainAndReturnPointer(), + _sel_initWithTimeInterval_sinceDate_, secsToBeAdded, date.ref.pointer); + return objc.NSDate.castFromPointer(_ret, retain: false, release: true); + } +} + +late final _class_NSMutableURLRequest = objc.getClass("NSMutableURLRequest"); +late final _sel_setHTTPMethod_ = objc.registerName("setHTTPMethod:"); +late final _sel_setAllHTTPHeaderFields_ = + objc.registerName("setAllHTTPHeaderFields:"); +late final _sel_setValue_forHTTPHeaderField_ = + objc.registerName("setValue:forHTTPHeaderField:"); +late final _sel_addValue_forHTTPHeaderField_ = + objc.registerName("addValue:forHTTPHeaderField:"); +late final _sel_setHTTPBody_ = objc.registerName("setHTTPBody:"); +late final _sel_setHTTPBodyStream_ = objc.registerName("setHTTPBodyStream:"); +late final _sel_setHTTPShouldHandleCookies_ = + objc.registerName("setHTTPShouldHandleCookies:"); +final _objc_msgSend_1s56lr9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Bool)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, bool)>(); +late final _sel_setHTTPShouldUsePipelining_ = + objc.registerName("setHTTPShouldUsePipelining:"); + +/// ! +/// @category NSMutableURLRequest(NSMutableHTTPURLRequest) +/// The NSMutableHTTPURLRequest on NSMutableURLRequest provides methods +/// for configuring information specific to HTTP protocol requests. +extension NSMutableHTTPURLRequest on NSMutableURLRequest { + /// ! + /// @abstract Sets the HTTP request method of the receiver. + objc.NSString get HTTPMethod { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_HTTPMethod); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Sets the HTTP request method of the receiver. + set HTTPMethod(objc.NSString value) { + return _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setHTTPMethod_, value.ref.pointer); + } + + /// ! + /// @abstract Sets the HTTP header fields of the receiver to the given + /// dictionary. + /// @discussion This method replaces all header fields that may have + /// existed before this method call. + ///

Since HTTP header fields must be string values, each object and + /// key in the dictionary passed to this method must answer YES when + /// sent an -isKindOfClass:[NSString class] message. If either + /// the key or value for a key-value pair answers NO when sent this + /// message, the key-value pair is skipped. + objc.NSDictionary? get allHTTPHeaderFields { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_allHTTPHeaderFields); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Sets the HTTP header fields of the receiver to the given + /// dictionary. + /// @discussion This method replaces all header fields that may have + /// existed before this method call. + ///

Since HTTP header fields must be string values, each object and + /// key in the dictionary passed to this method must answer YES when + /// sent an -isKindOfClass:[NSString class] message. If either + /// the key or value for a key-value pair answers NO when sent this + /// message, the key-value pair is skipped. + set allHTTPHeaderFields(objc.NSDictionary? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setAllHTTPHeaderFields_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// ! + /// @method setValue:forHTTPHeaderField: + /// @abstract Sets the value of the given HTTP header field. + /// @discussion If a value was previously set for the given header + /// field, that value is replaced with the given value. Note that, in + /// keeping with the HTTP RFC, HTTP header field names are + /// case-insensitive. + /// @param value the header field value. + /// @param field the header field name (case-insensitive). + void setValue_forHTTPHeaderField_(objc.NSString? value, objc.NSString field) { + _objc_msgSend_wjvic9(this.ref.pointer, _sel_setValue_forHTTPHeaderField_, + value?.ref.pointer ?? ffi.nullptr, field.ref.pointer); + } + + /// ! + /// @method addValue:forHTTPHeaderField: + /// @abstract Adds an HTTP header field in the current header + /// dictionary. + /// @discussion This method provides a way to add values to header + /// fields incrementally. If a value was previously set for the given + /// header field, the given value is appended to the previously-existing + /// value. The appropriate field delimiter, a comma in the case of HTTP, + /// is added by the implementation, and should not be added to the given + /// value by the caller. Note that, in keeping with the HTTP RFC, HTTP + /// header field names are case-insensitive. + /// @param value the header field value. + /// @param field the header field name (case-insensitive). + void addValue_forHTTPHeaderField_(objc.NSString value, objc.NSString field) { + _objc_msgSend_wjvic9(this.ref.pointer, _sel_addValue_forHTTPHeaderField_, + value.ref.pointer, field.ref.pointer); + } + + /// ! + /// @abstract Sets the request body data of the receiver. + /// @discussion This data is sent as the message body of the request, as + /// in done in an HTTP POST request. + objc.NSData? get HTTPBody { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_HTTPBody); + return _ret.address == 0 + ? null + : objc.NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Sets the request body data of the receiver. + /// @discussion This data is sent as the message body of the request, as + /// in done in an HTTP POST request. + set HTTPBody(objc.NSData? value) { + return _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setHTTPBody_, value?.ref.pointer ?? ffi.nullptr); + } + + /// ! + /// @abstract Sets the request body to be the contents of the given stream. + /// @discussion The provided stream should be unopened; the request will take + /// over the stream's delegate. The entire stream's contents will be + /// transmitted as the HTTP body of the request. Note that the body stream + /// and the body data (set by setHTTPBody:, above) are mutually exclusive + /// - setting one will clear the other. + objc.NSInputStream? get HTTPBodyStream { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_HTTPBodyStream); + return _ret.address == 0 + ? null + : objc.NSInputStream.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Sets the request body to be the contents of the given stream. + /// @discussion The provided stream should be unopened; the request will take + /// over the stream's delegate. The entire stream's contents will be + /// transmitted as the HTTP body of the request. Note that the body stream + /// and the body data (set by setHTTPBody:, above) are mutually exclusive + /// - setting one will clear the other. + set HTTPBodyStream(objc.NSInputStream? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setHTTPBodyStream_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// ! + /// @abstract Decide whether default cookie handling will happen for + /// this request (YES if cookies should be sent with and set for this request; + /// otherwise NO). + /// @discussion The default is YES - in other words, cookies are sent from and + /// stored to the cookie manager by default. + /// NOTE: In releases prior to 10.3, this value is ignored + bool get HTTPShouldHandleCookies { + return _objc_msgSend_91o635(this.ref.pointer, _sel_HTTPShouldHandleCookies); + } + + /// ! + /// @abstract Decide whether default cookie handling will happen for + /// this request (YES if cookies should be sent with and set for this request; + /// otherwise NO). + /// @discussion The default is YES - in other words, cookies are sent from and + /// stored to the cookie manager by default. + /// NOTE: In releases prior to 10.3, this value is ignored + set HTTPShouldHandleCookies(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setHTTPShouldHandleCookies_, value); + } + + /// ! + /// @abstract Sets whether the request should not wait for the previous response + /// before transmitting (YES if the receiver should transmit before the previous response is + /// received. NO to wait for the previous response before transmitting) + /// @discussion Calling this method with a YES value does not guarantee HTTP + /// pipelining behavior. This method may have no effect if an HTTP proxy is + /// configured, or if the HTTP request uses an unsafe request method (e.g., POST + /// requests will not pipeline). Pipelining behavior also may not begin until + /// the second request on a given TCP connection. There may be other situations + /// where pipelining does not occur even though YES was set. + /// HTTP 1.1 allows the client to send multiple requests to the server without + /// waiting for a response. Though HTTP 1.1 requires support for pipelining, + /// some servers report themselves as being HTTP 1.1 but do not support + /// pipelining (disconnecting, sending resources misordered, omitting part of + /// a resource, etc.). + bool get HTTPShouldUsePipelining { + return _objc_msgSend_91o635(this.ref.pointer, _sel_HTTPShouldUsePipelining); + } + + /// ! + /// @abstract Sets whether the request should not wait for the previous response + /// before transmitting (YES if the receiver should transmit before the previous response is + /// received. NO to wait for the previous response before transmitting) + /// @discussion Calling this method with a YES value does not guarantee HTTP + /// pipelining behavior. This method may have no effect if an HTTP proxy is + /// configured, or if the HTTP request uses an unsafe request method (e.g., POST + /// requests will not pipeline). Pipelining behavior also may not begin until + /// the second request on a given TCP connection. There may be other situations + /// where pipelining does not occur even though YES was set. + /// HTTP 1.1 allows the client to send multiple requests to the server without + /// waiting for a response. Though HTTP 1.1 requires support for pipelining, + /// some servers report themselves as being HTTP 1.1 but do not support + /// pipelining (disconnecting, sending resources misordered, omitting part of + /// a resource, etc.). + set HTTPShouldUsePipelining(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setHTTPShouldUsePipelining_, value); + } +} + +late final _sel_setURL_ = objc.registerName("setURL:"); +late final _sel_setCachePolicy_ = objc.registerName("setCachePolicy:"); +final _objc_msgSend_1yjxuv2 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_setTimeoutInterval_ = objc.registerName("setTimeoutInterval:"); +final _objc_msgSend_hwm8nu = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Double)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, double)>(); +late final _sel_setMainDocumentURL_ = objc.registerName("setMainDocumentURL:"); +late final _sel_setNetworkServiceType_ = + objc.registerName("setNetworkServiceType:"); +final _objc_msgSend_1mse4s1 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_setAllowsCellularAccess_ = + objc.registerName("setAllowsCellularAccess:"); +late final _sel_setAllowsExpensiveNetworkAccess_ = + objc.registerName("setAllowsExpensiveNetworkAccess:"); +late final _sel_setAllowsConstrainedNetworkAccess_ = + objc.registerName("setAllowsConstrainedNetworkAccess:"); +late final _sel_setAssumesHTTP3Capable_ = + objc.registerName("setAssumesHTTP3Capable:"); +late final _sel_setAttribution_ = objc.registerName("setAttribution:"); +final _objc_msgSend_1nw1jep = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_setRequiresDNSSECValidation_ = + objc.registerName("setRequiresDNSSECValidation:"); + +/// ! +/// @class NSMutableURLRequest +/// +/// @abstract An NSMutableURLRequest object represents a mutable URL load +/// request in a manner independent of protocol and URL scheme. +/// +/// @discussion This specialization of NSURLRequest is provided to aid +/// developers who may find it more convenient to mutate a single request +/// object for a series of URL loads instead of creating an immutable +/// NSURLRequest for each load. This programming model is supported by +/// the following contract stipulation between NSMutableURLRequest and +/// NSURLConnection: NSURLConnection makes a deep copy of each +/// NSMutableURLRequest object passed to one of its initializers. +///

NSMutableURLRequest is designed to be extended to support +/// protocol-specific data by adding categories to access a property +/// object provided in an interface targeted at protocol implementors. +///

    +///
  • Protocol implementors should direct their attention to the +/// NSMutableURLRequestExtensibility category on +/// NSMutableURLRequest for more information on how to provide +/// extensions on NSMutableURLRequest to support protocol-specific +/// request information. +///
  • Clients of this API who wish to create NSMutableURLRequest +/// objects to load URL content should consult the protocol-specific +/// NSMutableURLRequest categories that are available. The +/// NSMutableHTTPURLRequest category on NSMutableURLRequest is an +/// example. +///
+class NSMutableURLRequest extends NSURLRequest { + NSMutableURLRequest._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSMutableURLRequest] that points to the same underlying object as [other]. + NSMutableURLRequest.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSMutableURLRequest] that wraps the given raw object pointer. + NSMutableURLRequest.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSMutableURLRequest]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSMutableURLRequest); + } + + /// ! + /// @abstract The URL of the receiver. + objc.NSURL? get URL { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_URL); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract The URL of the receiver. + set URL(objc.NSURL? value) { + return _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setURL_, value?.ref.pointer ?? ffi.nullptr); + } + + /// ! + /// @abstract The cache policy of the receiver. + NSURLRequestCachePolicy get cachePolicy { + final _ret = _objc_msgSend_8jm3uo(this.ref.pointer, _sel_cachePolicy); + return NSURLRequestCachePolicy.fromValue(_ret); + } + + /// ! + /// @abstract The cache policy of the receiver. + set cachePolicy(NSURLRequestCachePolicy value) { + return _objc_msgSend_1yjxuv2( + this.ref.pointer, _sel_setCachePolicy_, value.value); + } + + /// ! + /// @abstract Sets the timeout interval of the receiver. + /// @discussion The timeout interval specifies the limit on the idle + /// interval allotted to a request in the process of loading. The "idle + /// interval" is defined as the period of time that has passed since the + /// last instance of load activity occurred for a request that is in the + /// process of loading. Hence, when an instance of load activity occurs + /// (e.g. bytes are received from the network for a request), the idle + /// interval for a request is reset to 0. If the idle interval ever + /// becomes greater than or equal to the timeout interval, the request + /// is considered to have timed out. This timeout interval is measured + /// in seconds. + DartNSTimeInterval get timeoutInterval { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret(this.ref.pointer, _sel_timeoutInterval) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_timeoutInterval); + } + + /// ! + /// @abstract Sets the timeout interval of the receiver. + /// @discussion The timeout interval specifies the limit on the idle + /// interval allotted to a request in the process of loading. The "idle + /// interval" is defined as the period of time that has passed since the + /// last instance of load activity occurred for a request that is in the + /// process of loading. Hence, when an instance of load activity occurs + /// (e.g. bytes are received from the network for a request), the idle + /// interval for a request is reset to 0. If the idle interval ever + /// becomes greater than or equal to the timeout interval, the request + /// is considered to have timed out. This timeout interval is measured + /// in seconds. + set timeoutInterval(DartNSTimeInterval value) { + return _objc_msgSend_hwm8nu( + this.ref.pointer, _sel_setTimeoutInterval_, value); + } + + /// ! + /// @abstract Sets the main document URL + /// @discussion The caller should pass the URL for an appropriate main + /// document, if known. For example, when loading a web page, the URL + /// of the main html document for the top-level frame should be + /// passed. This main document is used to implement the cookie "only + /// from same domain as main document" policy, attributing this request + /// as a sub-resource of a user-specified URL, and possibly other things + /// in the future. + objc.NSURL? get mainDocumentURL { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_mainDocumentURL); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Sets the main document URL + /// @discussion The caller should pass the URL for an appropriate main + /// document, if known. For example, when loading a web page, the URL + /// of the main html document for the top-level frame should be + /// passed. This main document is used to implement the cookie "only + /// from same domain as main document" policy, attributing this request + /// as a sub-resource of a user-specified URL, and possibly other things + /// in the future. + set mainDocumentURL(objc.NSURL? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setMainDocumentURL_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// ! + /// @abstract Sets the NSURLRequestNetworkServiceType to associate with this request + /// @discussion This method is used to provide the network layers with a hint as to the purpose + /// of the request. Most clients should not need to use this method. + NSURLRequestNetworkServiceType get networkServiceType { + final _ret = + _objc_msgSend_t4uaw1(this.ref.pointer, _sel_networkServiceType); + return NSURLRequestNetworkServiceType.fromValue(_ret); + } + + /// ! + /// @abstract Sets the NSURLRequestNetworkServiceType to associate with this request + /// @discussion This method is used to provide the network layers with a hint as to the purpose + /// of the request. Most clients should not need to use this method. + set networkServiceType(NSURLRequestNetworkServiceType value) { + return _objc_msgSend_1mse4s1( + this.ref.pointer, _sel_setNetworkServiceType_, value.value); + } + + /// ! + /// @abstract sets whether a connection created with this request is allowed to use + /// the built in cellular radios (if present). + /// @discussion NO if the receiver should not be allowed to use the built in + /// cellular radios to satisfy the request, YES otherwise. The default is YES. + bool get allowsCellularAccess { + return _objc_msgSend_91o635(this.ref.pointer, _sel_allowsCellularAccess); + } + + /// ! + /// @abstract sets whether a connection created with this request is allowed to use + /// the built in cellular radios (if present). + /// @discussion NO if the receiver should not be allowed to use the built in + /// cellular radios to satisfy the request, YES otherwise. The default is YES. + set allowsCellularAccess(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setAllowsCellularAccess_, value); + } + + /// ! + /// @abstract sets whether a connection created with this request is allowed to use + /// network interfaces which have been marked as expensive. + /// @discussion NO if the receiver should not be allowed to use an interface marked as expensive to + /// satisfy the request, YES otherwise. + bool get allowsExpensiveNetworkAccess { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_allowsExpensiveNetworkAccess); + } + + /// ! + /// @abstract sets whether a connection created with this request is allowed to use + /// network interfaces which have been marked as expensive. + /// @discussion NO if the receiver should not be allowed to use an interface marked as expensive to + /// satisfy the request, YES otherwise. + set allowsExpensiveNetworkAccess(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setAllowsExpensiveNetworkAccess_, value); + } + + /// ! + /// @abstract sets whether a connection created with this request is allowed to use + /// network interfaces which have been marked as constrained. + /// @discussion NO if the receiver should not be allowed to use an interface marked as constrained to + /// satisfy the request, YES otherwise. + bool get allowsConstrainedNetworkAccess { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_allowsConstrainedNetworkAccess); + } + + /// ! + /// @abstract sets whether a connection created with this request is allowed to use + /// network interfaces which have been marked as constrained. + /// @discussion NO if the receiver should not be allowed to use an interface marked as constrained to + /// satisfy the request, YES otherwise. + set allowsConstrainedNetworkAccess(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setAllowsConstrainedNetworkAccess_, value); + } + + /// ! + /// @abstract returns whether we assume that server supports HTTP/3. Enables QUIC + /// racing without HTTP/3 service discovery. + /// @result YES if server endpoint is known to support HTTP/3. Defaults to NO. + /// The default may be YES in a future OS update. + bool get assumesHTTP3Capable { + return _objc_msgSend_91o635(this.ref.pointer, _sel_assumesHTTP3Capable); + } + + /// ! + /// @abstract returns whether we assume that server supports HTTP/3. Enables QUIC + /// racing without HTTP/3 service discovery. + /// @result YES if server endpoint is known to support HTTP/3. Defaults to NO. + /// The default may be YES in a future OS update. + set assumesHTTP3Capable(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setAssumesHTTP3Capable_, value); + } + + /// ! + /// @abstract Sets the NSURLRequestAttribution to associate with this request. + /// @discussion Set to NSURLRequestAttributionUser if the URL was specified by the + /// user. Defaults to NSURLRequestAttributionDeveloper. + NSURLRequestAttribution get attribution { + final _ret = _objc_msgSend_i3avs9(this.ref.pointer, _sel_attribution); + return NSURLRequestAttribution.fromValue(_ret); + } + + /// ! + /// @abstract Sets the NSURLRequestAttribution to associate with this request. + /// @discussion Set to NSURLRequestAttributionUser if the URL was specified by the + /// user. Defaults to NSURLRequestAttributionDeveloper. + set attribution(NSURLRequestAttribution value) { + return _objc_msgSend_1nw1jep( + this.ref.pointer, _sel_setAttribution_, value.value); + } + + /// ! + /// @abstract sets whether a request is required to do DNSSEC validation during DNS lookup. + /// @discussion YES, if the DNS lookup for this request should require DNSSEC validation, + /// No otherwise. Defaults to NO. + bool get requiresDNSSECValidation { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_requiresDNSSECValidation); + } + + /// ! + /// @abstract sets whether a request is required to do DNSSEC validation during DNS lookup. + /// @discussion YES, if the DNS lookup for this request should require DNSSEC validation, + /// No otherwise. Defaults to NO. + set requiresDNSSECValidation(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setRequiresDNSSECValidation_, value); + } + + /// ! + /// @method requestWithURL: + /// @abstract Allocates and initializes an NSURLRequest with the given + /// URL. + /// @discussion Default values are used for cache policy + /// (NSURLRequestUseProtocolCachePolicy) and timeout interval (60 + /// seconds). + /// @param URL The URL for the request. + /// @result A newly-created and autoreleased NSURLRequest instance. + static NSMutableURLRequest requestWithURL_(objc.NSURL URL) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableURLRequest, _sel_requestWithURL_, URL.ref.pointer); + return NSMutableURLRequest.castFromPointer(_ret, + retain: true, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( + _class_NSMutableURLRequest, _sel_supportsSecureCoding); + } + + /// ! + /// @method requestWithURL:cachePolicy:timeoutInterval: + /// @abstract Allocates and initializes a NSURLRequest with the given + /// URL and cache policy. + /// @param URL The URL for the request. + /// @param cachePolicy The cache policy for the request. + /// @param timeoutInterval The timeout interval for the request. See the + /// commentary for the timeoutInterval for more information on + /// timeout intervals. + /// @result A newly-created and autoreleased NSURLRequest instance. + static NSMutableURLRequest requestWithURL_cachePolicy_timeoutInterval_( + objc.NSURL URL, + NSURLRequestCachePolicy cachePolicy, + DartNSTimeInterval timeoutInterval) { + final _ret = _objc_msgSend_3phu9v( + _class_NSMutableURLRequest, + _sel_requestWithURL_cachePolicy_timeoutInterval_, + URL.ref.pointer, + cachePolicy.value, + timeoutInterval); + return NSMutableURLRequest.castFromPointer(_ret, + retain: true, release: true); + } + + /// ! + /// @method initWithURL: + /// @abstract Initializes an NSURLRequest with the given URL. + /// @discussion Default values are used for cache policy + /// (NSURLRequestUseProtocolCachePolicy) and timeout interval (60 + /// seconds). + /// @param URL The URL for the request. + /// @result An initialized NSURLRequest. + NSMutableURLRequest initWithURL_(objc.NSURL URL) { + final _ret = _objc_msgSend_62nh5j( + this.ref.retainAndReturnPointer(), _sel_initWithURL_, URL.ref.pointer); + return NSMutableURLRequest.castFromPointer(_ret, + retain: false, release: true); + } + + /// ! + /// @method initWithURL: + /// @abstract Initializes an NSURLRequest with the given URL and + /// cache policy. + /// @discussion This is the designated initializer for the + /// NSURLRequest class. + /// @param URL The URL for the request. + /// @param cachePolicy The cache policy for the request. + /// @param timeoutInterval The timeout interval for the request. See the + /// commentary for the timeoutInterval for more information on + /// timeout intervals. + /// @result An initialized NSURLRequest. + NSMutableURLRequest initWithURL_cachePolicy_timeoutInterval_(objc.NSURL URL, + NSURLRequestCachePolicy cachePolicy, DartNSTimeInterval timeoutInterval) { + final _ret = _objc_msgSend_3phu9v( + this.ref.retainAndReturnPointer(), + _sel_initWithURL_cachePolicy_timeoutInterval_, + URL.ref.pointer, + cachePolicy.value, + timeoutInterval); + return NSMutableURLRequest.castFromPointer(_ret, + retain: false, release: true); + } + + /// init + NSMutableURLRequest init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSMutableURLRequest.castFromPointer(_ret, + retain: false, release: true); + } + + /// new + static NSMutableURLRequest new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableURLRequest, _sel_new); + return NSMutableURLRequest.castFromPointer(_ret, + retain: false, release: true); + } + + /// allocWithZone: + static NSMutableURLRequest allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = _objc_msgSend_hzlb60( + _class_NSMutableURLRequest, _sel_allocWithZone_, zone); + return NSMutableURLRequest.castFromPointer(_ret, + retain: false, release: true); + } + + /// alloc + static NSMutableURLRequest alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSMutableURLRequest, _sel_alloc); + return NSMutableURLRequest.castFromPointer(_ret, + retain: false, release: true); + } + + /// self + NSMutableURLRequest self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSMutableURLRequest.castFromPointer(_ret, + retain: true, release: true); + } + + /// retain + NSMutableURLRequest retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSMutableURLRequest.castFromPointer(_ret, + retain: true, release: true); + } + + /// autorelease + NSMutableURLRequest autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSMutableURLRequest.castFromPointer(_ret, + retain: true, release: true); + } + + /// initWithCoder: + NSMutableURLRequest? initWithCoder_(objc.NSCoder coder) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithCoder_, coder.ref.pointer); + return _ret.address == 0 + ? null + : NSMutableURLRequest.castFromPointer(_ret, + retain: false, release: true); + } +} + +enum NSHTTPCookieAcceptPolicy { + NSHTTPCookieAcceptPolicyAlways(0), + NSHTTPCookieAcceptPolicyNever(1), + NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain(2); + + final int value; + const NSHTTPCookieAcceptPolicy(this.value); + + static NSHTTPCookieAcceptPolicy fromValue(int value) => switch (value) { + 0 => NSHTTPCookieAcceptPolicyAlways, + 1 => NSHTTPCookieAcceptPolicyNever, + 2 => NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain, + _ => throw ArgumentError( + "Unknown value for NSHTTPCookieAcceptPolicy: $value"), + }; +} + +/// WARNING: NSHTTPCookieStorage is a stub. To generate bindings for this class, include +/// NSHTTPCookieStorage in your config's objc-interfaces list. +/// +/// NSHTTPCookieStorage +class NSHTTPCookieStorage extends objc.NSObject { + NSHTTPCookieStorage._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSHTTPCookieStorage] that points to the same underlying object as [other]. + NSHTTPCookieStorage.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSHTTPCookieStorage] that wraps the given raw object pointer. + NSHTTPCookieStorage.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _class_NSHTTPCookieStorage = objc.getClass("NSHTTPCookieStorage"); +late final _class_NSURLSessionTask = objc.getClass("NSURLSessionTask"); +late final _sel_taskIdentifier = objc.registerName("taskIdentifier"); +late final _sel_originalRequest = objc.registerName("originalRequest"); +late final _sel_currentRequest = objc.registerName("currentRequest"); +late final _class_NSURLResponse = objc.getClass("NSURLResponse"); +late final _sel_initWithURL_MIMEType_expectedContentLength_textEncodingName_ = + objc.registerName( + "initWithURL:MIMEType:expectedContentLength:textEncodingName:"); +final _objc_msgSend_13tl325 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Long, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +late final _sel_MIMEType = objc.registerName("MIMEType"); +late final _sel_expectedContentLength = + objc.registerName("expectedContentLength"); +final _objc_msgSend_1k101e3 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_textEncodingName = objc.registerName("textEncodingName"); +late final _sel_suggestedFilename = objc.registerName("suggestedFilename"); + +/// NSURLResponse +class NSURLResponse extends objc.NSObject { + NSURLResponse._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLResponse] that points to the same underlying object as [other]. + NSURLResponse.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLResponse] that wraps the given raw object pointer. + NSURLResponse.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSURLResponse]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLResponse); + } + + /// ! + /// @method initWithURL:MIMEType:expectedContentLength:textEncodingName: + /// @abstract Initialize an NSURLResponse with the provided values. + /// @param URL the URL + /// @param MIMEType the MIME content type of the response + /// @param length the expected content length of the associated data + /// @param name the name of the text encoding for the associated data, if applicable, else nil + /// @result The initialized NSURLResponse. + /// @discussion This is the designated initializer for NSURLResponse. + NSURLResponse initWithURL_MIMEType_expectedContentLength_textEncodingName_( + objc.NSURL URL, + objc.NSString? MIMEType, + DartNSInteger length, + objc.NSString? name) { + final _ret = _objc_msgSend_13tl325( + this.ref.retainAndReturnPointer(), + _sel_initWithURL_MIMEType_expectedContentLength_textEncodingName_, + URL.ref.pointer, + MIMEType?.ref.pointer ?? ffi.nullptr, + length, + name?.ref.pointer ?? ffi.nullptr); + return NSURLResponse.castFromPointer(_ret, retain: false, release: true); + } + + /// ! + /// @abstract Returns the URL of the receiver. + /// @result The URL of the receiver. + objc.NSURL? get URL { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_URL); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Returns the MIME type of the receiver. + /// @discussion The MIME type is based on the information provided + /// from an origin source. However, that value may be changed or + /// corrected by a protocol implementation if it can be determined + /// that the origin server or source reported the information + /// incorrectly or imprecisely. An attempt to guess the MIME type may + /// be made if the origin source did not report any such information. + /// @result The MIME type of the receiver. + objc.NSString? get MIMEType { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_MIMEType); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Returns the expected content length of the receiver. + /// @discussion Some protocol implementations report a content length + /// as part of delivering load metadata, but not all protocols + /// guarantee the amount of data that will be delivered in actuality. + /// Hence, this method returns an expected amount. Clients should use + /// this value as an advisory, and should be prepared to deal with + /// either more or less data. + /// @result The expected content length of the receiver, or -1 if + /// there is no expectation that can be arrived at regarding expected + /// content length. + int get expectedContentLength { + return _objc_msgSend_1k101e3(this.ref.pointer, _sel_expectedContentLength); + } + + /// ! + /// @abstract Returns the name of the text encoding of the receiver. + /// @discussion This name will be the actual string reported by the + /// origin source during the course of performing a protocol-specific + /// URL load. Clients can inspect this string and convert it to an + /// NSStringEncoding or CFStringEncoding using the methods and + /// functions made available in the appropriate framework. + /// @result The name of the text encoding of the receiver, or nil if no + /// text encoding was specified. + objc.NSString? get textEncodingName { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_textEncodingName); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @abstract Returns a suggested filename if the resource were saved to disk. + /// @discussion The method first checks if the server has specified a filename using the + /// content disposition header. If no valid filename is specified using that mechanism, + /// this method checks the last path component of the URL. If no valid filename can be + /// obtained using the last path component, this method uses the URL's host as the filename. + /// If the URL's host can't be converted to a valid filename, the filename "unknown" is used. + /// In most cases, this method appends the proper file extension based on the MIME type. + /// This method always returns a valid filename. + /// @result A suggested filename to use if saving the resource to disk. + objc.NSString? get suggestedFilename { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_suggestedFilename); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// init + NSURLResponse init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSURLResponse.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static NSURLResponse new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLResponse, _sel_new); + return NSURLResponse.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static NSURLResponse allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = + _objc_msgSend_hzlb60(_class_NSURLResponse, _sel_allocWithZone_, zone); + return NSURLResponse.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static NSURLResponse alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLResponse, _sel_alloc); + return NSURLResponse.castFromPointer(_ret, retain: false, release: true); + } + + /// self + NSURLResponse self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSURLResponse.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + NSURLResponse retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSURLResponse.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + NSURLResponse autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSURLResponse.castFromPointer(_ret, retain: true, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( + _class_NSURLResponse, _sel_supportsSecureCoding); + } + + /// encodeWithCoder: + void encodeWithCoder_(objc.NSCoder coder) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_encodeWithCoder_, coder.ref.pointer); + } + + /// initWithCoder: + NSURLResponse? initWithCoder_(objc.NSCoder coder) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithCoder_, coder.ref.pointer); + return _ret.address == 0 + ? null + : NSURLResponse.castFromPointer(_ret, retain: false, release: true); + } +} + +late final _sel_response = objc.registerName("response"); +late final _sel_delegate = objc.registerName("delegate"); +late final _sel_setDelegate_ = objc.registerName("setDelegate:"); + +/// WARNING: NSProgress is a stub. To generate bindings for this class, include +/// NSProgress in your config's objc-interfaces list. +/// +/// NSProgress +class NSProgress extends objc.NSObject { + NSProgress._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSProgress] that points to the same underlying object as [other]. + NSProgress.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSProgress] that wraps the given raw object pointer. + NSProgress.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _sel_progress = objc.registerName("progress"); +ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer)>()(arg0); +ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_NSProgress_ffiVoid_fnPtrTrampoline) + .cast(); +ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_closureTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + (objc.getBlockClosure(block) as ffi.Pointer Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_NSProgress_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_NSProgress_ffiVoid_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_NSProgress_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_NSProgress_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunction(NSProgress Function(ffi.Pointer) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_NSProgress_ffiVoid_closureCallable, + (ffi.Pointer arg0) => + fn(arg0).ref.retainAndAutorelease()), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_NSProgress_ffiVoid_CallExtension + on objc.ObjCBlock)> { + NSProgress call(ffi.Pointer arg0) => NSProgress.castFromPointer( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0), + retain: true, + release: true); +} + +late final _sel_earliestBeginDate = objc.registerName("earliestBeginDate"); +late final _sel_setEarliestBeginDate_ = + objc.registerName("setEarliestBeginDate:"); +late final _sel_countOfBytesClientExpectsToSend = + objc.registerName("countOfBytesClientExpectsToSend"); +final _objc_msgSend_pysgoz = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Int64 Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setCountOfBytesClientExpectsToSend_ = + objc.registerName("setCountOfBytesClientExpectsToSend:"); +final _objc_msgSend_17gvxvj = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Int64)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_countOfBytesClientExpectsToReceive = + objc.registerName("countOfBytesClientExpectsToReceive"); +late final _sel_setCountOfBytesClientExpectsToReceive_ = + objc.registerName("setCountOfBytesClientExpectsToReceive:"); +late final _sel_countOfBytesSent = objc.registerName("countOfBytesSent"); +late final _sel_countOfBytesReceived = + objc.registerName("countOfBytesReceived"); +late final _sel_countOfBytesExpectedToSend = + objc.registerName("countOfBytesExpectedToSend"); +late final _sel_countOfBytesExpectedToReceive = + objc.registerName("countOfBytesExpectedToReceive"); +late final _sel_taskDescription = objc.registerName("taskDescription"); +late final _sel_setTaskDescription_ = objc.registerName("setTaskDescription:"); +late final _sel_cancel = objc.registerName("cancel"); + +enum NSURLSessionTaskState { + /// The task is currently being serviced by the session + NSURLSessionTaskStateRunning(0), + NSURLSessionTaskStateSuspended(1), + + /// The task has been told to cancel. The session will receive a URLSession:task:didCompleteWithError: message. + NSURLSessionTaskStateCanceling(2), + + /// The task has completed and the session will receive no more delegate notifications + NSURLSessionTaskStateCompleted(3); + + final int value; + const NSURLSessionTaskState(this.value); + + static NSURLSessionTaskState fromValue(int value) => switch (value) { + 0 => NSURLSessionTaskStateRunning, + 1 => NSURLSessionTaskStateSuspended, + 2 => NSURLSessionTaskStateCanceling, + 3 => NSURLSessionTaskStateCompleted, + _ => throw ArgumentError( + "Unknown value for NSURLSessionTaskState: $value"), + }; +} + +late final _sel_state = objc.registerName("state"); +final _objc_msgSend_1vze0g9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_error = objc.registerName("error"); +late final _sel_suspend = objc.registerName("suspend"); +late final _sel_resume = objc.registerName("resume"); +late final _sel_priority = objc.registerName("priority"); +final _objc_msgSend_2cgrxl = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_2cgrxlFpret = objc.msgSendFpretPointer + .cast< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + double Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setPriority_ = objc.registerName("setPriority:"); +final _objc_msgSend_v5hmet = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Float)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, double)>(); +late final _sel_prefersIncrementalDelivery = + objc.registerName("prefersIncrementalDelivery"); +late final _sel_setPrefersIncrementalDelivery_ = + objc.registerName("setPrefersIncrementalDelivery:"); + +/// NSURLSessionTask - a cancelable object that refers to the lifetime +/// of processing a given request. +class NSURLSessionTask extends objc.NSObject { + NSURLSessionTask._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSessionTask] that points to the same underlying object as [other]. + NSURLSessionTask.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSessionTask] that wraps the given raw object pointer. + NSURLSessionTask.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSURLSessionTask]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionTask); + } + + /// an identifier for this task, assigned by and unique to the owning session + DartNSUInteger get taskIdentifier { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_taskIdentifier); + } + + /// may be nil if this is a stream task + NSURLRequest? get originalRequest { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_originalRequest); + return _ret.address == 0 + ? null + : NSURLRequest.castFromPointer(_ret, retain: true, release: true); + } + + /// may differ from originalRequest due to http server redirection + NSURLRequest? get currentRequest { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_currentRequest); + return _ret.address == 0 + ? null + : NSURLRequest.castFromPointer(_ret, retain: true, release: true); + } + + /// may be nil if no response has been received + NSURLResponse? get response { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_response); + return _ret.address == 0 + ? null + : NSURLResponse.castFromPointer(_ret, retain: true, release: true); + } + + /// Sets a task-specific delegate. Methods not implemented on this delegate will + /// still be forwarded to the session delegate. + /// + /// Cannot be modified after task resumes. Not supported on background session. + /// + /// Delegate is strongly referenced until the task completes, after which it is + /// reset to `nil`. + objc.ObjCObjectBase? get delegate { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_delegate); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// Sets a task-specific delegate. Methods not implemented on this delegate will + /// still be forwarded to the session delegate. + /// + /// Cannot be modified after task resumes. Not supported on background session. + /// + /// Delegate is strongly referenced until the task completes, after which it is + /// reset to `nil`. + set delegate(objc.ObjCObjectBase? value) { + return _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setDelegate_, value?.ref.pointer ?? ffi.nullptr); + } + + /// progress + NSProgress get progress { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_progress); + return NSProgress.castFromPointer(_ret, retain: true, release: true); + } + + /// Start the network load for this task no earlier than the specified date. If + /// not specified, no start delay is used. + /// + /// Only applies to tasks created from background NSURLSession instances; has no + /// effect for tasks created from other session types. + objc.NSDate? get earliestBeginDate { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_earliestBeginDate); + return _ret.address == 0 + ? null + : objc.NSDate.castFromPointer(_ret, retain: true, release: true); + } + + /// Start the network load for this task no earlier than the specified date. If + /// not specified, no start delay is used. + /// + /// Only applies to tasks created from background NSURLSession instances; has no + /// effect for tasks created from other session types. + set earliestBeginDate(objc.NSDate? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setEarliestBeginDate_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// The number of bytes that the client expects (a best-guess upper-bound) will + /// be sent and received by this task. These values are used by system scheduling + /// policy. If unspecified, NSURLSessionTransferSizeUnknown is used. + int get countOfBytesClientExpectsToSend { + return _objc_msgSend_pysgoz( + this.ref.pointer, _sel_countOfBytesClientExpectsToSend); + } + + /// The number of bytes that the client expects (a best-guess upper-bound) will + /// be sent and received by this task. These values are used by system scheduling + /// policy. If unspecified, NSURLSessionTransferSizeUnknown is used. + set countOfBytesClientExpectsToSend(int value) { + return _objc_msgSend_17gvxvj( + this.ref.pointer, _sel_setCountOfBytesClientExpectsToSend_, value); + } + + /// countOfBytesClientExpectsToReceive + int get countOfBytesClientExpectsToReceive { + return _objc_msgSend_pysgoz( + this.ref.pointer, _sel_countOfBytesClientExpectsToReceive); + } + + /// setCountOfBytesClientExpectsToReceive: + set countOfBytesClientExpectsToReceive(int value) { + return _objc_msgSend_17gvxvj( + this.ref.pointer, _sel_setCountOfBytesClientExpectsToReceive_, value); + } + + /// number of body bytes already sent + int get countOfBytesSent { + return _objc_msgSend_pysgoz(this.ref.pointer, _sel_countOfBytesSent); + } + + /// number of body bytes already received + int get countOfBytesReceived { + return _objc_msgSend_pysgoz(this.ref.pointer, _sel_countOfBytesReceived); + } + + /// number of body bytes we expect to send, derived from the Content-Length of the HTTP request + int get countOfBytesExpectedToSend { + return _objc_msgSend_pysgoz( + this.ref.pointer, _sel_countOfBytesExpectedToSend); + } + + /// number of byte bytes we expect to receive, usually derived from the Content-Length header of an HTTP response. + int get countOfBytesExpectedToReceive { + return _objc_msgSend_pysgoz( + this.ref.pointer, _sel_countOfBytesExpectedToReceive); + } + + /// The taskDescription property is available for the developer to + /// provide a descriptive label for the task. + objc.NSString? get taskDescription { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_taskDescription); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// The taskDescription property is available for the developer to + /// provide a descriptive label for the task. + set taskDescription(objc.NSString? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setTaskDescription_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// -cancel returns immediately, but marks a task as being canceled. + /// The task will signal -URLSession:task:didCompleteWithError: with an + /// error value of { NSURLErrorDomain, NSURLErrorCancelled }. In some + /// cases, the task may signal other work before it acknowledges the + /// cancelation. -cancel may be sent to a task that has been suspended. + void cancel() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_cancel); + } + + /// The current state of the task within the session. + NSURLSessionTaskState get state { + final _ret = _objc_msgSend_1vze0g9(this.ref.pointer, _sel_state); + return NSURLSessionTaskState.fromValue(_ret); + } + + /// The error, if any, delivered via -URLSession:task:didCompleteWithError: + /// This property will be nil in the event that no error occurred. + objc.NSError? get error { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_error); + return _ret.address == 0 + ? null + : objc.NSError.castFromPointer(_ret, retain: true, release: true); + } + + /// Suspending a task will prevent the NSURLSession from continuing to + /// load data. There may still be delegate calls made on behalf of + /// this task (for instance, to report data received while suspending) + /// but no further transmissions will be made on behalf of the task + /// until -resume is sent. The timeout timer associated with the task + /// will be disabled while a task is suspended. -suspend and -resume are + /// nestable. + void suspend() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_suspend); + } + + /// resume + void resume() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_resume); + } + + /// Sets a scaling factor for the priority of the task. The scaling factor is a + /// value between 0.0 and 1.0 (inclusive), where 0.0 is considered the lowest + /// priority and 1.0 is considered the highest. + /// + /// The priority is a hint and not a hard requirement of task performance. The + /// priority of a task may be changed using this API at any time, but not all + /// protocols support this; in these cases, the last priority that took effect + /// will be used. + /// + /// If no priority is specified, the task will operate with the default priority + /// as defined by the constant NSURLSessionTaskPriorityDefault. Two additional + /// priority levels are provided: NSURLSessionTaskPriorityLow and + /// NSURLSessionTaskPriorityHigh, but use is not restricted to these. + double get priority { + return objc.useMsgSendVariants + ? _objc_msgSend_2cgrxlFpret(this.ref.pointer, _sel_priority) + : _objc_msgSend_2cgrxl(this.ref.pointer, _sel_priority); + } + + /// Sets a scaling factor for the priority of the task. The scaling factor is a + /// value between 0.0 and 1.0 (inclusive), where 0.0 is considered the lowest + /// priority and 1.0 is considered the highest. + /// + /// The priority is a hint and not a hard requirement of task performance. The + /// priority of a task may be changed using this API at any time, but not all + /// protocols support this; in these cases, the last priority that took effect + /// will be used. + /// + /// If no priority is specified, the task will operate with the default priority + /// as defined by the constant NSURLSessionTaskPriorityDefault. Two additional + /// priority levels are provided: NSURLSessionTaskPriorityLow and + /// NSURLSessionTaskPriorityHigh, but use is not restricted to these. + set priority(double value) { + return _objc_msgSend_v5hmet(this.ref.pointer, _sel_setPriority_, value); + } + + /// Provides a hint indicating if incremental delivery of a partial response body + /// would be useful for the application, or if it cannot process the response + /// until it is complete. Indicating that incremental delivery is not desired may + /// improve task performance. For example, if a response cannot be decoded until + /// the entire content is received, set this property to false. + /// + /// Defaults to true unless this task is created with completion-handler based + /// convenience methods, or if it is a download task. + bool get prefersIncrementalDelivery { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_prefersIncrementalDelivery); + } + + /// Provides a hint indicating if incremental delivery of a partial response body + /// would be useful for the application, or if it cannot process the response + /// until it is complete. Indicating that incremental delivery is not desired may + /// improve task performance. For example, if a response cannot be decoded until + /// the entire content is received, set this property to false. + /// + /// Defaults to true unless this task is created with completion-handler based + /// convenience methods, or if it is a download task. + set prefersIncrementalDelivery(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setPrefersIncrementalDelivery_, value); + } + + /// init + NSURLSessionTask init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static NSURLSessionTask new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLSessionTask, _sel_new); + return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static NSURLSessionTask allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = _objc_msgSend_hzlb60( + _class_NSURLSessionTask, _sel_allocWithZone_, zone); + return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static NSURLSessionTask alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLSessionTask, _sel_alloc); + return NSURLSessionTask.castFromPointer(_ret, retain: false, release: true); + } + + /// self + NSURLSessionTask self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + NSURLSessionTask retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + NSURLSessionTask autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSURLSessionTask.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _sel_storeCookies_forTask_ = + objc.registerName("storeCookies:forTask:"); +void _ObjCBlock_ffiVoid_objcObjCObject_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_objcObjCObject_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_objcObjCObject_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject_listenerTrampoline( + ffi.Pointer block, ffi.Pointer arg0) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_objcObjCObject_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_objcObjCObject_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock?)>`. +abstract final class ObjCBlock_ffiVoid_objcObjCObject { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock?)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock?)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock?)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock?)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_objcObjCObject_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock?)> + fromFunction(void Function(objc.ObjCObjectBase?) fn) => + objc.ObjCBlock?)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_closureCallable, + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : objc.ObjCObjectBase(arg0, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock?)> + listener(void Function(objc.ObjCObjectBase?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_listenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : objc.ObjCObjectBase(arg0, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock?)>( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock?)>`. +extension ObjCBlock_ffiVoid_objcObjCObject_CallExtension + on objc.ObjCBlock?)> { + void call(objc.ObjCObjectBase? arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_getCookiesForTask_completionHandler_ = + objc.registerName("getCookiesForTask:completionHandler:"); + +/// NSURLSessionTaskAdditions +extension NSURLSessionTaskAdditions1 on NSHTTPCookieStorage { + /// storeCookies:forTask: + void storeCookies_forTask_( + objc.ObjCObjectBase cookies, NSURLSessionTask task) { + _objc_msgSend_wjvic9(this.ref.pointer, _sel_storeCookies_forTask_, + cookies.ref.pointer, task.ref.pointer); + } + + /// getCookiesForTask:completionHandler: + void getCookiesForTask_completionHandler_( + NSURLSessionTask task, + objc.ObjCBlock?)> + completionHandler) { + _objc_msgSend_14pxqbs( + this.ref.pointer, + _sel_getCookiesForTask_completionHandler_, + task.ref.pointer, + completionHandler.ref.pointer); + } +} + +late final _class_NSEnumerator = objc.getClass("NSEnumerator"); +late final _sel_allObjects = objc.registerName("allObjects"); + +/// NSExtendedEnumerator +extension NSExtendedEnumerator on objc.NSEnumerator { + /// allObjects + objc.ObjCObjectBase get allObjects { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_allObjects); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } +} + +late final _class_NSDictionary = objc.getClass("NSDictionary"); +late final _sel_allKeys = objc.registerName("allKeys"); +late final _sel_allKeysForObject_ = objc.registerName("allKeysForObject:"); +late final _sel_allValues = objc.registerName("allValues"); +late final _sel_descriptionInStringsFileFormat = + objc.registerName("descriptionInStringsFileFormat"); +late final _sel_descriptionWithLocale_indent_ = + objc.registerName("descriptionWithLocale:indent:"); +final _objc_msgSend_dcd68g = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +late final _sel_isEqualToDictionary_ = + objc.registerName("isEqualToDictionary:"); +late final _sel_objectEnumerator = objc.registerName("objectEnumerator"); +late final _sel_objectsForKeys_notFoundMarker_ = + objc.registerName("objectsForKeys:notFoundMarker:"); +late final _sel_writeToURL_error_ = objc.registerName("writeToURL:error:"); +final _objc_msgSend_blqzg8 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +late final _sel_keysSortedByValueUsingSelector_ = + objc.registerName("keysSortedByValueUsingSelector:"); +final _objc_msgSend_19hbqky = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_getObjects_andKeys_count_ = + objc.registerName("getObjects:andKeys:count:"); +final _objc_msgSend_n2svg2 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer>, + ffi.UnsignedLong)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer>, + int)>(); +late final _sel_objectForKeyedSubscript_ = + objc.registerName("objectForKeyedSubscript:"); +void _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) { + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerCallable = ffi + .NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. +abstract final class ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.Pointer, ffi.Pointer)> + fromFunction(void Function(objc.ObjCObjectBase, objc.ObjCObjectBase, ffi.Pointer) fn) => + objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2) => fn( + objc.ObjCObjectBase(arg0, retain: true, release: true), + objc.ObjCObjectBase(arg1, retain: true, release: true), + arg2)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> listener( + void Function( + objc.ObjCObjectBase, objc.ObjCObjectBase, ffi.Pointer) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, ffi.Pointer arg1, + ffi.Pointer arg2) => + fn(objc.ObjCObjectBase(arg0, retain: false, release: true), + objc.ObjCObjectBase(arg1, retain: false, release: true), arg2)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1krhfwz(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. +extension ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> { + void call(objc.ObjCObjectBase arg0, objc.ObjCObjectBase arg1, + ffi.Pointer arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2); +} + +late final _sel_enumerateKeysAndObjectsUsingBlock_ = + objc.registerName("enumerateKeysAndObjectsUsingBlock:"); +final _objc_msgSend_f167m6 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_enumerateKeysAndObjectsWithOptions_usingBlock_ = + objc.registerName("enumerateKeysAndObjectsWithOptions:usingBlock:"); +final _objc_msgSend_yx8yc6 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +late final _sel_keysSortedByValueUsingComparator_ = + objc.registerName("keysSortedByValueUsingComparator:"); +final _objc_msgSend_cy99le = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_keysSortedByValueWithOptions_usingComparator_ = + objc.registerName("keysSortedByValueWithOptions:usingComparator:"); +final _objc_msgSend_1u2b7ut = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +bool _ObjCBlock_bool_objcObjCObject_objcObjCObject_bool_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_bool_objcObjCObject_objcObjCObject_bool_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_bool_objcObjCObject_objcObjCObject_bool_fnPtrTrampoline, + false) + .cast(); +bool _ObjCBlock_bool_objcObjCObject_objcObjCObject_bool_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_bool_objcObjCObject_objcObjCObject_bool_closureCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_bool_objcObjCObject_objcObjCObject_bool_closureTrampoline, + false) + .cast(); + +/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. +abstract final class ObjCBlock_bool_objcObjCObject_objcObjCObject_bool { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + objc.newPointerBlock(_ObjCBlock_bool_objcObjCObject_objcObjCObject_bool_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.Pointer, ffi.Pointer)> + fromFunction(bool Function(objc.ObjCObjectBase, objc.ObjCObjectBase, ffi.Pointer) fn) => + objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_bool_objcObjCObject_objcObjCObject_bool_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2) => fn( + objc.ObjCObjectBase(arg0, retain: true, release: true), + objc.ObjCObjectBase(arg1, retain: true, release: true), + arg2)), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. +extension ObjCBlock_bool_objcObjCObject_objcObjCObject_bool_CallExtension + on objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> { + bool call(objc.ObjCObjectBase arg0, objc.ObjCObjectBase arg1, + ffi.Pointer arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2); +} + +late final _sel_keysOfEntriesPassingTest_ = + objc.registerName("keysOfEntriesPassingTest:"); +late final _sel_keysOfEntriesWithOptions_passingTest_ = + objc.registerName("keysOfEntriesWithOptions:passingTest:"); +final _objc_msgSend_hd4f96 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); + +/// NSExtendedDictionary +extension NSExtendedDictionary on objc.NSDictionary { + /// allKeys + objc.ObjCObjectBase get allKeys { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_allKeys); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// allKeysForObject: + objc.ObjCObjectBase allKeysForObject_(objc.ObjCObjectBase anObject) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_allKeysForObject_, anObject.ref.pointer); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// allValues + objc.ObjCObjectBase get allValues { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_allValues); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// description + objc.NSString get description { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_description); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// descriptionInStringsFileFormat + objc.NSString get descriptionInStringsFileFormat { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_descriptionInStringsFileFormat); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// descriptionWithLocale: + objc.NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// descriptionWithLocale:indent: + objc.NSString descriptionWithLocale_indent_( + objc.ObjCObjectBase? locale, DartNSUInteger level) { + final _ret = _objc_msgSend_dcd68g( + this.ref.pointer, + _sel_descriptionWithLocale_indent_, + locale?.ref.pointer ?? ffi.nullptr, + level); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// isEqualToDictionary: + bool isEqualToDictionary_(objc.NSDictionary otherDictionary) { + return _objc_msgSend_69e0x1(this.ref.pointer, _sel_isEqualToDictionary_, + otherDictionary.ref.pointer); + } + + /// objectEnumerator + objc.NSEnumerator objectEnumerator() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_objectEnumerator); + return objc.NSEnumerator.castFromPointer(_ret, retain: true, release: true); + } + + /// objectsForKeys:notFoundMarker: + objc.ObjCObjectBase objectsForKeys_notFoundMarker_( + objc.ObjCObjectBase keys, objc.ObjCObjectBase marker) { + final _ret = _objc_msgSend_rsfdlh( + this.ref.pointer, + _sel_objectsForKeys_notFoundMarker_, + keys.ref.pointer, + marker.ref.pointer); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// writeToURL:error: + bool writeToURL_error_( + objc.NSURL url, ffi.Pointer> error) { + return _objc_msgSend_blqzg8( + this.ref.pointer, _sel_writeToURL_error_, url.ref.pointer, error); + } + + /// keysSortedByValueUsingSelector: + objc.ObjCObjectBase keysSortedByValueUsingSelector_( + ffi.Pointer comparator) { + final _ret = _objc_msgSend_19hbqky( + this.ref.pointer, _sel_keysSortedByValueUsingSelector_, comparator); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// getObjects:andKeys:count: + void getObjects_andKeys_count_( + ffi.Pointer> objects, + ffi.Pointer> keys, + DartNSUInteger count) { + _objc_msgSend_n2svg2( + this.ref.pointer, _sel_getObjects_andKeys_count_, objects, keys, count); + } + + /// objectForKeyedSubscript: + objc.ObjCObjectBase? objectForKeyedSubscript_(objc.ObjCObjectBase key) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_objectForKeyedSubscript_, key.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// enumerateKeysAndObjectsUsingBlock: + void enumerateKeysAndObjectsUsingBlock_( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + block) { + _objc_msgSend_f167m6(this.ref.pointer, + _sel_enumerateKeysAndObjectsUsingBlock_, block.ref.pointer); + } + + /// enumerateKeysAndObjectsWithOptions:usingBlock: + void enumerateKeysAndObjectsWithOptions_usingBlock_( + objc.NSEnumerationOptions opts, + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + block) { + _objc_msgSend_yx8yc6( + this.ref.pointer, + _sel_enumerateKeysAndObjectsWithOptions_usingBlock_, + opts.value, + block.ref.pointer); + } + + /// keysSortedByValueUsingComparator: + objc.ObjCObjectBase keysSortedByValueUsingComparator_( + DartNSComparator cmptr) { + final _ret = _objc_msgSend_cy99le(this.ref.pointer, + _sel_keysSortedByValueUsingComparator_, cmptr.ref.pointer); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// keysSortedByValueWithOptions:usingComparator: + objc.ObjCObjectBase keysSortedByValueWithOptions_usingComparator_( + objc.NSSortOptions opts, DartNSComparator cmptr) { + final _ret = _objc_msgSend_1u2b7ut( + this.ref.pointer, + _sel_keysSortedByValueWithOptions_usingComparator_, + opts.value, + cmptr.ref.pointer); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// keysOfEntriesPassingTest: + objc.ObjCObjectBase keysOfEntriesPassingTest_( + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + predicate) { + final _ret = _objc_msgSend_cy99le(this.ref.pointer, + _sel_keysOfEntriesPassingTest_, predicate.ref.pointer); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// keysOfEntriesWithOptions:passingTest: + objc.ObjCObjectBase keysOfEntriesWithOptions_passingTest_( + objc.NSEnumerationOptions opts, + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + predicate) { + final _ret = _objc_msgSend_hd4f96( + this.ref.pointer, + _sel_keysOfEntriesWithOptions_passingTest_, + opts.value, + predicate.ref.pointer); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } +} + +late final _sel_getObjects_andKeys_ = objc.registerName("getObjects:andKeys:"); +final _objc_msgSend_hefmm1 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer>)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer>)>(); +late final _sel_dictionaryWithContentsOfFile_ = + objc.registerName("dictionaryWithContentsOfFile:"); +late final _sel_dictionaryWithContentsOfURL_ = + objc.registerName("dictionaryWithContentsOfURL:"); +late final _sel_initWithContentsOfFile_ = + objc.registerName("initWithContentsOfFile:"); +late final _sel_initWithContentsOfURL_ = + objc.registerName("initWithContentsOfURL:"); +late final _sel_writeToFile_atomically_ = + objc.registerName("writeToFile:atomically:"); +final _objc_msgSend_w8pbfh = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Bool)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + bool)>(); +late final _sel_writeToURL_atomically_ = + objc.registerName("writeToURL:atomically:"); + +/// NSDeprecated +extension NSDeprecated on objc.NSDictionary { + /// getObjects:andKeys: + void getObjects_andKeys_(ffi.Pointer> objects, + ffi.Pointer> keys) { + _objc_msgSend_hefmm1( + this.ref.pointer, _sel_getObjects_andKeys_, objects, keys); + } + + /// dictionaryWithContentsOfFile: + static objc.NSDictionary? dictionaryWithContentsOfFile_(objc.NSString path) { + final _ret = _objc_msgSend_62nh5j(_class_NSDictionary, + _sel_dictionaryWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// dictionaryWithContentsOfURL: + static objc.NSDictionary? dictionaryWithContentsOfURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j(_class_NSDictionary, + _sel_dictionaryWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// initWithContentsOfFile: + objc.NSDictionary? initWithContentsOfFile_(objc.NSString path) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithContentsOfURL: + objc.NSDictionary? initWithContentsOfURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: false, release: true); + } + + /// writeToFile:atomically: + bool writeToFile_atomically_(objc.NSString path, bool useAuxiliaryFile) { + return _objc_msgSend_w8pbfh(this.ref.pointer, _sel_writeToFile_atomically_, + path.ref.pointer, useAuxiliaryFile); + } + + /// writeToURL:atomically: + bool writeToURL_atomically_(objc.NSURL url, bool atomically) { + return _objc_msgSend_w8pbfh(this.ref.pointer, _sel_writeToURL_atomically_, + url.ref.pointer, atomically); + } +} + +late final _sel_dictionary = objc.registerName("dictionary"); +late final _sel_dictionaryWithObject_forKey_ = + objc.registerName("dictionaryWithObject:forKey:"); +late final _sel_dictionaryWithObjects_forKeys_count_ = + objc.registerName("dictionaryWithObjects:forKeys:count:"); +final _objc_msgSend_cfqbni = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer>, + ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer>, + int)>(); +late final _sel_dictionaryWithObjectsAndKeys_ = + objc.registerName("dictionaryWithObjectsAndKeys:"); +late final _sel_dictionaryWithDictionary_ = + objc.registerName("dictionaryWithDictionary:"); +late final _sel_dictionaryWithObjects_forKeys_ = + objc.registerName("dictionaryWithObjects:forKeys:"); +late final _sel_initWithObjectsAndKeys_ = + objc.registerName("initWithObjectsAndKeys:"); +late final _sel_initWithDictionary_ = objc.registerName("initWithDictionary:"); +late final _sel_initWithDictionary_copyItems_ = + objc.registerName("initWithDictionary:copyItems:"); +final _objc_msgSend_1bdmr5f = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Bool)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + bool)>(); +late final _sel_initWithObjects_forKeys_ = + objc.registerName("initWithObjects:forKeys:"); +late final _sel_initWithContentsOfURL_error_ = + objc.registerName("initWithContentsOfURL:error:"); +final _objc_msgSend_1705co6 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +late final _sel_dictionaryWithContentsOfURL_error_ = + objc.registerName("dictionaryWithContentsOfURL:error:"); + +/// NSDictionaryCreation +extension NSDictionaryCreation on objc.NSDictionary { + /// dictionary + static objc.NSDictionary dictionary() { + final _ret = _objc_msgSend_1x359cv(_class_NSDictionary, _sel_dictionary); + return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// dictionaryWithObject:forKey: + static objc.NSDictionary dictionaryWithObject_forKey_( + objc.ObjCObjectBase object, objc.ObjCObjectBase key) { + final _ret = _objc_msgSend_rsfdlh(_class_NSDictionary, + _sel_dictionaryWithObject_forKey_, object.ref.pointer, key.ref.pointer); + return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// dictionaryWithObjects:forKeys:count: + static objc.NSDictionary dictionaryWithObjects_forKeys_count_( + ffi.Pointer> objects, + ffi.Pointer> keys, + DartNSUInteger cnt) { + final _ret = _objc_msgSend_cfqbni(_class_NSDictionary, + _sel_dictionaryWithObjects_forKeys_count_, objects, keys, cnt); + return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// dictionaryWithObjectsAndKeys: + static objc.NSDictionary dictionaryWithObjectsAndKeys_( + objc.ObjCObjectBase firstObject) { + final _ret = _objc_msgSend_62nh5j(_class_NSDictionary, + _sel_dictionaryWithObjectsAndKeys_, firstObject.ref.pointer); + return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// dictionaryWithDictionary: + static objc.NSDictionary dictionaryWithDictionary_(objc.NSDictionary dict) { + final _ret = _objc_msgSend_62nh5j( + _class_NSDictionary, _sel_dictionaryWithDictionary_, dict.ref.pointer); + return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// dictionaryWithObjects:forKeys: + static objc.NSDictionary dictionaryWithObjects_forKeys_( + objc.ObjCObjectBase objects, objc.ObjCObjectBase keys) { + final _ret = _objc_msgSend_rsfdlh( + _class_NSDictionary, + _sel_dictionaryWithObjects_forKeys_, + objects.ref.pointer, + keys.ref.pointer); + return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// initWithObjectsAndKeys: + objc.NSDictionary initWithObjectsAndKeys_(objc.ObjCObjectBase firstObject) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithObjectsAndKeys_, firstObject.ref.pointer); + return objc.NSDictionary.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithDictionary: + objc.NSDictionary initWithDictionary_(objc.NSDictionary otherDictionary) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithDictionary_, otherDictionary.ref.pointer); + return objc.NSDictionary.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithDictionary:copyItems: + objc.NSDictionary initWithDictionary_copyItems_( + objc.NSDictionary otherDictionary, bool flag) { + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), + _sel_initWithDictionary_copyItems_, otherDictionary.ref.pointer, flag); + return objc.NSDictionary.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithObjects:forKeys: + objc.NSDictionary initWithObjects_forKeys_( + objc.ObjCObjectBase objects, objc.ObjCObjectBase keys) { + final _ret = _objc_msgSend_rsfdlh(this.ref.retainAndReturnPointer(), + _sel_initWithObjects_forKeys_, objects.ref.pointer, keys.ref.pointer); + return objc.NSDictionary.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithContentsOfURL:error: + objc.NSDictionary? initWithContentsOfURL_error_( + objc.NSURL url, ffi.Pointer> error) { + final _ret = _objc_msgSend_1705co6(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfURL_error_, url.ref.pointer, error); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: false, release: true); + } + + /// dictionaryWithContentsOfURL:error: + static objc.NSDictionary? dictionaryWithContentsOfURL_error_( + objc.NSURL url, ffi.Pointer> error) { + final _ret = _objc_msgSend_1705co6(_class_NSDictionary, + _sel_dictionaryWithContentsOfURL_error_, url.ref.pointer, error); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _class_NSMutableDictionary = objc.getClass("NSMutableDictionary"); +late final _sel_addEntriesFromDictionary_ = + objc.registerName("addEntriesFromDictionary:"); +late final _sel_removeAllObjects = objc.registerName("removeAllObjects"); +late final _sel_removeObjectsForKeys_ = + objc.registerName("removeObjectsForKeys:"); +late final _sel_setDictionary_ = objc.registerName("setDictionary:"); +late final _sel_setObject_forKeyedSubscript_ = + objc.registerName("setObject:forKeyedSubscript:"); + +/// NSExtendedMutableDictionary +extension NSExtendedMutableDictionary on objc.NSMutableDictionary { + /// addEntriesFromDictionary: + void addEntriesFromDictionary_(objc.NSDictionary otherDictionary) { + _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_addEntriesFromDictionary_, + otherDictionary.ref.pointer); + } + + /// removeAllObjects + void removeAllObjects() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_removeAllObjects); + } + + /// removeObjectsForKeys: + void removeObjectsForKeys_(objc.ObjCObjectBase keyArray) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_removeObjectsForKeys_, keyArray.ref.pointer); + } + + /// setDictionary: + void setDictionary_(objc.NSDictionary otherDictionary) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setDictionary_, otherDictionary.ref.pointer); + } + + /// setObject:forKeyedSubscript: + void setObject_forKeyedSubscript_( + objc.ObjCObjectBase? obj, objc.ObjCObjectBase key) { + _objc_msgSend_wjvic9(this.ref.pointer, _sel_setObject_forKeyedSubscript_, + obj?.ref.pointer ?? ffi.nullptr, key.ref.pointer); + } +} + +late final _sel_dictionaryWithCapacity_ = + objc.registerName("dictionaryWithCapacity:"); +final _objc_msgSend_1qrcblu = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); + +/// NSMutableDictionaryCreation +extension NSMutableDictionaryCreation on objc.NSMutableDictionary { + /// dictionaryWithCapacity: + static objc.NSMutableDictionary dictionaryWithCapacity_( + DartNSUInteger numItems) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSMutableDictionary, _sel_dictionaryWithCapacity_, numItems); + return objc.NSMutableDictionary.castFromPointer(_ret, + retain: true, release: true); + } + + /// dictionaryWithContentsOfFile: + static objc.NSMutableDictionary? dictionaryWithContentsOfFile_( + objc.NSString path) { + final _ret = _objc_msgSend_62nh5j(_class_NSMutableDictionary, + _sel_dictionaryWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSMutableDictionary.castFromPointer(_ret, + retain: true, release: true); + } + + /// dictionaryWithContentsOfURL: + static objc.NSMutableDictionary? dictionaryWithContentsOfURL_( + objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j(_class_NSMutableDictionary, + _sel_dictionaryWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSMutableDictionary.castFromPointer(_ret, + retain: true, release: true); + } + + /// initWithContentsOfFile: + objc.NSMutableDictionary? initWithContentsOfFile_(objc.NSString path) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSMutableDictionary.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithContentsOfURL: + objc.NSMutableDictionary? initWithContentsOfURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSMutableDictionary.castFromPointer(_ret, + retain: false, release: true); + } +} + +late final _sel_sharedKeySetForKeys_ = + objc.registerName("sharedKeySetForKeys:"); + +/// NSSharedKeySetDictionary +extension NSSharedKeySetDictionary on objc.NSDictionary { + /// sharedKeySetForKeys: + static objc.ObjCObjectBase sharedKeySetForKeys_(objc.ObjCObjectBase keys) { + final _ret = _objc_msgSend_62nh5j( + _class_NSDictionary, _sel_sharedKeySetForKeys_, keys.ref.pointer); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } +} + +late final _sel_dictionaryWithSharedKeySet_ = + objc.registerName("dictionaryWithSharedKeySet:"); + +/// NSSharedKeySetDictionary +extension NSSharedKeySetDictionary1 on objc.NSMutableDictionary { + /// dictionaryWithSharedKeySet: + static objc.NSMutableDictionary dictionaryWithSharedKeySet_( + objc.ObjCObjectBase keyset) { + final _ret = _objc_msgSend_62nh5j(_class_NSMutableDictionary, + _sel_dictionaryWithSharedKeySet_, keyset.ref.pointer); + return objc.NSMutableDictionary.castFromPointer(_ret, + retain: true, release: true); + } +} + +late final _sel_countByEnumeratingWithState_objects_count_ = + objc.registerName("countByEnumeratingWithState:objects:count:"); +final _objc_msgSend_1b5ysjl = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + int)>(); +int _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + int arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + NSUInteger Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + NSUInteger arg3)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + int)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_fnPtrCallable = + ffi.Pointer.fromFunction< + NSUInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + NSUInteger)>( + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_fnPtrTrampoline, + 0) + .cast(); +int _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + int arg3) => + (objc.getBlockClosure(block) as int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + int))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_closureCallable = + ffi.Pointer.fromFunction< + NSUInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + NSUInteger)>( + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_closureTrampoline, + 0) + .cast(); + +/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. +abstract final class ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, NSUInteger arg3)>> ptr) => + objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)>( + objc.newPointerBlock(_ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)> fromFunction( + DartNSUInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + DartNSUInteger) + fn) => + objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>( + objc.newClosureBlock( + _ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, int arg3) => + fn(arg0, arg1, arg2, arg3)), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer>, ffi.UnsignedLong)>`. +extension ObjCBlock_NSUInteger_ffiVoid_NSFastEnumerationState_objcObjCObject_NSUInteger_CallExtension + on objc.ObjCBlock< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)> { + DartNSUInteger call( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + DartNSUInteger arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + NSUInteger Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + NSUInteger arg3)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + int)>()(ref.pointer, arg0, arg1, arg2, arg3); +} + +/// NSGenericFastEnumeration +extension NSGenericFastEnumeration on objc.NSDictionary { + /// countByEnumeratingWithState:objects:count: + DartNSUInteger countByEnumeratingWithState_objects_count_( + ffi.Pointer state, + ffi.Pointer> buffer, + DartNSUInteger len) { + return _objc_msgSend_1b5ysjl(this.ref.pointer, + _sel_countByEnumeratingWithState_objects_count_, state, buffer, len); + } +} + +typedef NSProgressKind = ffi.Pointer; +typedef DartNSProgressKind = objc.NSString; +typedef NSProgressUserInfoKey = ffi.Pointer; +typedef DartNSProgressUserInfoKey = objc.NSString; +typedef NSProgressFileOperationKind = ffi.Pointer; +typedef DartNSProgressFileOperationKind = objc.NSString; +typedef NSProgressUnpublishingHandler = ffi.Pointer; +typedef DartNSProgressUnpublishingHandler = objc.ObjCBlock; +NSProgressUnpublishingHandler + _ObjCBlock_NSProgressUnpublishingHandler_NSProgress_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + NSProgressUnpublishingHandler Function( + ffi.Pointer arg0)>>() + .asFunction< + NSProgressUnpublishingHandler Function( + ffi.Pointer)>()(arg0); +ffi.Pointer + _ObjCBlock_NSProgressUnpublishingHandler_NSProgress_fnPtrCallable = + ffi.Pointer.fromFunction< + NSProgressUnpublishingHandler Function( + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_NSProgressUnpublishingHandler_NSProgress_fnPtrTrampoline) + .cast(); +NSProgressUnpublishingHandler + _ObjCBlock_NSProgressUnpublishingHandler_NSProgress_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as NSProgressUnpublishingHandler Function( + ffi.Pointer))(arg0); +ffi.Pointer + _ObjCBlock_NSProgressUnpublishingHandler_NSProgress_closureCallable = + ffi.Pointer.fromFunction< + NSProgressUnpublishingHandler Function( + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_NSProgressUnpublishingHandler_NSProgress_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock? Function(NSProgress)>`. +abstract final class ObjCBlock_NSProgressUnpublishingHandler_NSProgress { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock? Function(NSProgress)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + objc.ObjCBlock? Function( + NSProgress)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock? Function(NSProgress)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + NSProgressUnpublishingHandler Function( + ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock? Function(NSProgress)>( + objc.newPointerBlock( + _ObjCBlock_NSProgressUnpublishingHandler_NSProgress_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + objc.ObjCBlock? Function(NSProgress)> fromFunction( + DartNSProgressUnpublishingHandler? Function(NSProgress) fn) => + objc.ObjCBlock? Function(NSProgress)>( + objc.newClosureBlock( + _ObjCBlock_NSProgressUnpublishingHandler_NSProgress_closureCallable, + (ffi.Pointer arg0) => + fn(NSProgress.castFromPointer(arg0, retain: true, release: true)) + ?.ref + .retainAndAutorelease() ?? + ffi.nullptr), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock? Function(NSProgress)>`. +extension ObjCBlock_NSProgressUnpublishingHandler_NSProgress_CallExtension + on objc + .ObjCBlock? Function(NSProgress)> { + DartNSProgressUnpublishingHandler? call(NSProgress arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + NSProgressUnpublishingHandler Function( + ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction, ffi.Pointer)>() + (ref.pointer, arg0.ref.pointer) + .address == + 0 + ? null + : ObjCBlock_ffiVoid.castFromPointer( + ref.pointer.ref.invoke.cast block, ffi.Pointer arg0)>>().asFunction< + NSProgressUnpublishingHandler Function( + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0.ref.pointer), + retain: true, + release: true); +} + +typedef NSProgressPublishingHandler = ffi.Pointer; +typedef DartNSProgressPublishingHandler + = objc.ObjCBlock? Function(NSProgress)>; +typedef CFArrayRetainCallBackFunction = ffi.Pointer Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef CFArrayRetainCallBack + = ffi.Pointer>; +typedef CFArrayReleaseCallBackFunction = ffi.Void Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef DartCFArrayReleaseCallBackFunction = void Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef CFArrayReleaseCallBack + = ffi.Pointer>; +typedef CFArrayCopyDescriptionCallBackFunction = CFStringRef Function( + ffi.Pointer value); +typedef CFArrayCopyDescriptionCallBack + = ffi.Pointer>; +typedef CFArrayEqualCallBackFunction = Boolean Function( + ffi.Pointer value1, ffi.Pointer value2); +typedef DartCFArrayEqualCallBackFunction = DartBoolean Function( + ffi.Pointer value1, ffi.Pointer value2); +typedef CFArrayEqualCallBack + = ffi.Pointer>; + +final class CFArrayCallBacks extends ffi.Struct { + @CFIndex() + external int version; + + external CFArrayRetainCallBack retain; + + external CFArrayReleaseCallBack release; + + external CFArrayCopyDescriptionCallBack copyDescription; + + external CFArrayEqualCallBack equal; +} + +typedef CFArrayApplierFunctionFunction = ffi.Void Function( + ffi.Pointer value, ffi.Pointer context); +typedef DartCFArrayApplierFunctionFunction = void Function( + ffi.Pointer value, ffi.Pointer context); +typedef CFArrayApplierFunction + = ffi.Pointer>; + +final class __CFArray extends ffi.Opaque {} + +typedef CFArrayRef = ffi.Pointer<__CFArray>; +typedef CFMutableArrayRef = ffi.Pointer<__CFArray>; +typedef os_function_tFunction = ffi.Void Function(ffi.Pointer); +typedef Dartos_function_tFunction = void Function(ffi.Pointer); +typedef os_function_t = ffi.Pointer>; +typedef os_block_t = ffi.Pointer; +typedef Dartos_block_t = objc.ObjCBlock; + +/// WARNING: OS_object is a stub. To generate bindings for this class, include +/// OS_object in your config's objc-interfaces list. +/// +/// OS_object +class OS_object extends objc.NSObject { + OS_object._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [OS_object] that points to the same underlying object as [other]. + OS_object.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [OS_object] that wraps the given raw object pointer. + OS_object.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +typedef sec_object_t = ffi.Pointer; +typedef Dartsec_object_t = objc.NSObject; + +final class __SecCertificate extends ffi.Opaque {} + +typedef SecCertificateRef = ffi.Pointer<__SecCertificate>; +typedef OpaqueSecCertificateRef = __SecCertificate; + +final class __SecIdentity extends ffi.Opaque {} + +typedef SecIdentityRef = ffi.Pointer<__SecIdentity>; +typedef OpaqueSecIdentityRef = __SecIdentity; + +final class __SecKey extends ffi.Opaque {} + +typedef SecKeyRef = ffi.Pointer<__SecKey>; +typedef OpaqueSecKeyRef = __SecKey; + +final class __SecPolicy extends ffi.Opaque {} + +typedef SecPolicyRef = ffi.Pointer<__SecPolicy>; + +final class __SecAccessControl extends ffi.Opaque {} + +typedef SecAccessControlRef = ffi.Pointer<__SecAccessControl>; + +final class __SecKeychain extends ffi.Opaque {} + +typedef SecKeychainRef = ffi.Pointer<__SecKeychain>; + +final class __SecKeychainItem extends ffi.Opaque {} + +typedef SecKeychainItemRef = ffi.Pointer<__SecKeychainItem>; + +final class __SecKeychainSearch extends ffi.Opaque {} + +typedef SecKeychainSearchRef = ffi.Pointer<__SecKeychainSearch>; +typedef SecKeychainAttrType = OSType; + +final class SecKeychainAttribute extends ffi.Struct { + @SecKeychainAttrType() + external int tag; + + @UInt32() + external int length; + + external ffi.Pointer data; +} + +typedef SecKeychainAttributePtr = ffi.Pointer; + +final class SecKeychainAttributeList extends ffi.Struct { + @UInt32() + external int count; + + external ffi.Pointer attr; +} + +typedef SecKeychainStatus = UInt32; + +final class __SecTrustedApplication extends ffi.Opaque {} + +typedef SecTrustedApplicationRef = ffi.Pointer<__SecTrustedApplication>; + +final class __SecAccess extends ffi.Opaque {} + +typedef SecAccessRef = ffi.Pointer<__SecAccess>; +typedef OpaqueSecAccessRef = __SecAccess; + +final class __SecACL extends ffi.Opaque {} + +typedef SecACLRef = ffi.Pointer<__SecACL>; + +final class __SecPassword extends ffi.Opaque {} + +typedef SecPasswordRef = ffi.Pointer<__SecPassword>; + +final class SecKeychainAttributeInfo extends ffi.Struct { + @UInt32() + external int count; + + external ffi.Pointer tag; + + external ffi.Pointer format; +} + +typedef wint_t = __darwin_wint_t; + +final class _RuneEntry extends ffi.Struct { + @__darwin_rune_t() + external int __min; + + @__darwin_rune_t() + external int __max; + + @__darwin_rune_t() + external int __map; + + external ffi.Pointer<__uint32_t> __types; +} + +final class _RuneRange extends ffi.Struct { + @ffi.Int() + external int __nranges; + + external ffi.Pointer<_RuneEntry> __ranges; +} + +final class _RuneCharClass extends ffi.Struct { + @ffi.Array.multi([14]) + external ffi.Array __name; + + @__uint32_t() + external int __mask; +} + +final class _RuneLocale extends ffi.Struct { + @ffi.Array.multi([8]) + external ffi.Array __magic; + + @ffi.Array.multi([32]) + external ffi.Array __encoding; + + external ffi.Pointer< + ffi.NativeFunction< + __darwin_rune_t Function(ffi.Pointer, __darwin_size_t, + ffi.Pointer>)>> __sgetrune; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(__darwin_rune_t, ffi.Pointer, + __darwin_size_t, ffi.Pointer>)>> __sputrune; + + @__darwin_rune_t() + external int __invalid_rune; + + @ffi.Array.multi([256]) + external ffi.Array<__uint32_t> __runetype; + + @ffi.Array.multi([256]) + external ffi.Array<__darwin_rune_t> __maplower; + + @ffi.Array.multi([256]) + external ffi.Array<__darwin_rune_t> __mapupper; + + external _RuneRange __runetype_ext; + + external _RuneRange __maplower_ext; + + external _RuneRange __mapupper_ext; + + external ffi.Pointer __variable; + + @ffi.Int() + external int __variable_len; + + @ffi.Int() + external int __ncharclasses; + + external ffi.Pointer<_RuneCharClass> __charclasses; +} + +final class lconv extends ffi.Struct { + external ffi.Pointer decimal_point; + + external ffi.Pointer thousands_sep; + + external ffi.Pointer grouping; + + external ffi.Pointer int_curr_symbol; + + external ffi.Pointer currency_symbol; + + external ffi.Pointer mon_decimal_point; + + external ffi.Pointer mon_thousands_sep; + + external ffi.Pointer mon_grouping; + + external ffi.Pointer positive_sign; + + external ffi.Pointer negative_sign; + + @ffi.Char() + external int int_frac_digits; + + @ffi.Char() + external int frac_digits; + + @ffi.Char() + external int p_cs_precedes; + + @ffi.Char() + external int p_sep_by_space; + + @ffi.Char() + external int n_cs_precedes; + + @ffi.Char() + external int n_sep_by_space; + + @ffi.Char() + external int p_sign_posn; + + @ffi.Char() + external int n_sign_posn; + + @ffi.Char() + external int int_p_cs_precedes; + + @ffi.Char() + external int int_n_cs_precedes; + + @ffi.Char() + external int int_p_sep_by_space; + + @ffi.Char() + external int int_n_sep_by_space; + + @ffi.Char() + external int int_p_sign_posn; + + @ffi.Char() + external int int_n_sign_posn; +} + +typedef float_t = ffi.Float; +typedef Dartfloat_t = double; +typedef double_t = ffi.Double; +typedef Dartdouble_t = double; + +final class __float2 extends ffi.Struct { + @ffi.Float() + external double __sinval; + + @ffi.Float() + external double __cosval; +} + +final class __double2 extends ffi.Struct { + @ffi.Double() + external double __sinval; + + @ffi.Double() + external double __cosval; +} + +final class exception extends ffi.Struct { + @ffi.Int() + external int type; + + external ffi.Pointer name; + + @ffi.Double() + external double arg1; + + @ffi.Double() + external double arg2; + + @ffi.Double() + external double retval; +} + +typedef fpos_t = __darwin_off_t; + +final class __sbuf extends ffi.Struct { + external ffi.Pointer _base; + + @ffi.Int() + external int _size; +} + +final class __sFILEX extends ffi.Opaque {} + +final class __sFILE extends ffi.Struct { + external ffi.Pointer _p; + + @ffi.Int() + external int _r; + + @ffi.Int() + external int _w; + + @ffi.Short() + external int _flags; + + @ffi.Short() + external int _file; + + external __sbuf _bf; + + @ffi.Int() + external int _lbfsize; + + external ffi.Pointer _cookie; + + external ffi + .Pointer)>> + _close; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer, ffi.Int)>> _read; + + external ffi.Pointer< + ffi.NativeFunction< + fpos_t Function(ffi.Pointer, fpos_t, ffi.Int)>> _seek; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer, ffi.Int)>> _write; + + external __sbuf _ub; + + external ffi.Pointer<__sFILEX> _extra; + + @ffi.Int() + external int _ur; + + @ffi.Array.multi([3]) + external ffi.Array _ubuf; + + @ffi.Array.multi([1]) + external ffi.Array _nbuf; + + external __sbuf _lb; + + @ffi.Int() + external int _blksize; + + @fpos_t() + external int _offset; +} + +typedef FILE = __sFILE; + +final class timespec extends ffi.Struct { + @__darwin_time_t() + external int tv_sec; + + @ffi.Long() + external int tv_nsec; +} + +final class tm extends ffi.Struct { + @ffi.Int() + external int tm_sec; + + @ffi.Int() + external int tm_min; + + @ffi.Int() + external int tm_hour; + + @ffi.Int() + external int tm_mday; + + @ffi.Int() + external int tm_mon; + + @ffi.Int() + external int tm_year; + + @ffi.Int() + external int tm_wday; + + @ffi.Int() + external int tm_yday; + + @ffi.Int() + external int tm_isdst; + + @ffi.Long() + external int tm_gmtoff; + + external ffi.Pointer tm_zone; +} + +enum clockid_t { + _CLOCK_REALTIME(0), + _CLOCK_MONOTONIC(6), + _CLOCK_MONOTONIC_RAW(4), + _CLOCK_MONOTONIC_RAW_APPROX(5), + _CLOCK_UPTIME_RAW(8), + _CLOCK_UPTIME_RAW_APPROX(9), + _CLOCK_PROCESS_CPUTIME_ID(12), + _CLOCK_THREAD_CPUTIME_ID(16); + + final int value; + const clockid_t(this.value); + + static clockid_t fromValue(int value) => switch (value) { + 0 => _CLOCK_REALTIME, + 6 => _CLOCK_MONOTONIC, + 4 => _CLOCK_MONOTONIC_RAW, + 5 => _CLOCK_MONOTONIC_RAW_APPROX, + 8 => _CLOCK_UPTIME_RAW, + 9 => _CLOCK_UPTIME_RAW_APPROX, + 12 => _CLOCK_PROCESS_CPUTIME_ID, + 16 => _CLOCK_THREAD_CPUTIME_ID, + _ => throw ArgumentError("Unknown value for clockid_t: $value"), + }; +} + +final class imaxdiv_t extends ffi.Struct { + @intmax_t() + external int quot; + + @intmax_t() + external int rem; +} + +typedef CFBagRetainCallBackFunction = ffi.Pointer Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef CFBagRetainCallBack + = ffi.Pointer>; +typedef CFBagReleaseCallBackFunction = ffi.Void Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef DartCFBagReleaseCallBackFunction = void Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef CFBagReleaseCallBack + = ffi.Pointer>; +typedef CFBagCopyDescriptionCallBackFunction = CFStringRef Function( + ffi.Pointer value); +typedef CFBagCopyDescriptionCallBack + = ffi.Pointer>; +typedef CFBagEqualCallBackFunction = Boolean Function( + ffi.Pointer value1, ffi.Pointer value2); +typedef DartCFBagEqualCallBackFunction = DartBoolean Function( + ffi.Pointer value1, ffi.Pointer value2); +typedef CFBagEqualCallBack + = ffi.Pointer>; +typedef CFBagHashCallBackFunction = CFHashCode Function( + ffi.Pointer value); +typedef DartCFBagHashCallBackFunction = DartCFHashCode Function( + ffi.Pointer value); +typedef CFBagHashCallBack + = ffi.Pointer>; + +final class CFBagCallBacks extends ffi.Struct { + @CFIndex() + external int version; + + external CFBagRetainCallBack retain; + + external CFBagReleaseCallBack release; + + external CFBagCopyDescriptionCallBack copyDescription; + + external CFBagEqualCallBack equal; + + external CFBagHashCallBack hash; +} + +typedef CFBagApplierFunctionFunction = ffi.Void Function( + ffi.Pointer value, ffi.Pointer context); +typedef DartCFBagApplierFunctionFunction = void Function( + ffi.Pointer value, ffi.Pointer context); +typedef CFBagApplierFunction + = ffi.Pointer>; + +final class __CFBag extends ffi.Opaque {} + +typedef CFBagRef = ffi.Pointer<__CFBag>; +typedef CFMutableBagRef = ffi.Pointer<__CFBag>; + +final class CFBinaryHeapCompareContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; +} + +final class CFBinaryHeapCallBacks extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + CFAllocatorRef allocator, ffi.Pointer ptr)>> retain; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + CFAllocatorRef allocator, ffi.Pointer ptr)>> release; + + external ffi.Pointer< + ffi.NativeFunction ptr)>> + copyDescription; + + external ffi.Pointer< + ffi.NativeFunction< + CFIndex Function( + ffi.Pointer ptr1, + ffi.Pointer ptr2, + ffi.Pointer context)>> compare; +} + +typedef CFBinaryHeapApplierFunctionFunction = ffi.Void Function( + ffi.Pointer val, ffi.Pointer context); +typedef DartCFBinaryHeapApplierFunctionFunction = void Function( + ffi.Pointer val, ffi.Pointer context); +typedef CFBinaryHeapApplierFunction + = ffi.Pointer>; + +final class __CFBinaryHeap extends ffi.Opaque {} + +typedef CFBinaryHeapRef = ffi.Pointer<__CFBinaryHeap>; +typedef CFBit = UInt32; + +final class __CFBitVector extends ffi.Opaque {} + +typedef CFBitVectorRef = ffi.Pointer<__CFBitVector>; +typedef CFMutableBitVectorRef = ffi.Pointer<__CFBitVector>; +typedef CFByteOrder = CFIndex; + +final class CFSwappedFloat32 extends ffi.Struct { + @ffi.Uint32() + external int v; +} + +final class CFSwappedFloat64 extends ffi.Struct { + @ffi.Uint64() + external int v; +} + +typedef CFDictionaryRetainCallBackFunction = ffi.Pointer Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef CFDictionaryRetainCallBack + = ffi.Pointer>; +typedef CFDictionaryReleaseCallBackFunction = ffi.Void Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef DartCFDictionaryReleaseCallBackFunction = void Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef CFDictionaryReleaseCallBack + = ffi.Pointer>; +typedef CFDictionaryCopyDescriptionCallBackFunction = CFStringRef Function( + ffi.Pointer value); +typedef CFDictionaryCopyDescriptionCallBack = ffi + .Pointer>; +typedef CFDictionaryEqualCallBackFunction = Boolean Function( + ffi.Pointer value1, ffi.Pointer value2); +typedef DartCFDictionaryEqualCallBackFunction = DartBoolean Function( + ffi.Pointer value1, ffi.Pointer value2); +typedef CFDictionaryEqualCallBack + = ffi.Pointer>; +typedef CFDictionaryHashCallBackFunction = CFHashCode Function( + ffi.Pointer value); +typedef DartCFDictionaryHashCallBackFunction = DartCFHashCode Function( + ffi.Pointer value); +typedef CFDictionaryHashCallBack + = ffi.Pointer>; + +final class CFDictionaryKeyCallBacks extends ffi.Struct { + @CFIndex() + external int version; + + external CFDictionaryRetainCallBack retain; + + external CFDictionaryReleaseCallBack release; + + external CFDictionaryCopyDescriptionCallBack copyDescription; + + external CFDictionaryEqualCallBack equal; + + external CFDictionaryHashCallBack hash; +} + +final class CFDictionaryValueCallBacks extends ffi.Struct { + @CFIndex() + external int version; + + external CFDictionaryRetainCallBack retain; + + external CFDictionaryReleaseCallBack release; + + external CFDictionaryCopyDescriptionCallBack copyDescription; + + external CFDictionaryEqualCallBack equal; +} + +typedef CFDictionaryApplierFunctionFunction = ffi.Void Function( + ffi.Pointer key, + ffi.Pointer value, + ffi.Pointer context); +typedef DartCFDictionaryApplierFunctionFunction = void Function( + ffi.Pointer key, + ffi.Pointer value, + ffi.Pointer context); +typedef CFDictionaryApplierFunction + = ffi.Pointer>; + +final class __CFDictionary extends ffi.Opaque {} + +typedef CFDictionaryRef = ffi.Pointer<__CFDictionary>; +typedef CFMutableDictionaryRef = ffi.Pointer<__CFDictionary>; +typedef CFNotificationName = CFStringRef; + +final class __CFNotificationCenter extends ffi.Opaque {} + +typedef CFNotificationCenterRef = ffi.Pointer<__CFNotificationCenter>; +typedef CFNotificationCallbackFunction = ffi.Void Function( + CFNotificationCenterRef center, + ffi.Pointer observer, + CFNotificationName name, + ffi.Pointer object, + CFDictionaryRef userInfo); +typedef DartCFNotificationCallbackFunction = void Function( + CFNotificationCenterRef center, + ffi.Pointer observer, + CFNotificationName name, + ffi.Pointer object, + CFDictionaryRef userInfo); +typedef CFNotificationCallback + = ffi.Pointer>; + +enum CFNotificationSuspensionBehavior { + CFNotificationSuspensionBehaviorDrop(1), + CFNotificationSuspensionBehaviorCoalesce(2), + CFNotificationSuspensionBehaviorHold(3), + CFNotificationSuspensionBehaviorDeliverImmediately(4); + + final int value; + const CFNotificationSuspensionBehavior(this.value); + + static CFNotificationSuspensionBehavior fromValue(int value) => + switch (value) { + 1 => CFNotificationSuspensionBehaviorDrop, + 2 => CFNotificationSuspensionBehaviorCoalesce, + 3 => CFNotificationSuspensionBehaviorHold, + 4 => CFNotificationSuspensionBehaviorDeliverImmediately, + _ => throw ArgumentError( + "Unknown value for CFNotificationSuspensionBehavior: $value"), + }; +} + +typedef CFLocaleIdentifier = CFStringRef; +typedef CFLocaleKey = CFStringRef; + +final class __CFLocale extends ffi.Opaque {} + +typedef CFLocaleRef = ffi.Pointer<__CFLocale>; + +enum CFLocaleLanguageDirection { + kCFLocaleLanguageDirectionUnknown(0), + kCFLocaleLanguageDirectionLeftToRight(1), + kCFLocaleLanguageDirectionRightToLeft(2), + kCFLocaleLanguageDirectionTopToBottom(3), + kCFLocaleLanguageDirectionBottomToTop(4); + + final int value; + const CFLocaleLanguageDirection(this.value); + + static CFLocaleLanguageDirection fromValue(int value) => switch (value) { + 0 => kCFLocaleLanguageDirectionUnknown, + 1 => kCFLocaleLanguageDirectionLeftToRight, + 2 => kCFLocaleLanguageDirectionRightToLeft, + 3 => kCFLocaleLanguageDirectionTopToBottom, + 4 => kCFLocaleLanguageDirectionBottomToTop, + _ => throw ArgumentError( + "Unknown value for CFLocaleLanguageDirection: $value"), + }; +} + +typedef CFCalendarIdentifier = CFStringRef; +typedef CFTimeInterval = ffi.Double; +typedef DartCFTimeInterval = double; +typedef CFAbsoluteTime = CFTimeInterval; + +final class __CFDate extends ffi.Opaque {} + +typedef CFDateRef = ffi.Pointer<__CFDate>; + +final class __CFTimeZone extends ffi.Opaque {} + +typedef CFTimeZoneRef = ffi.Pointer<__CFTimeZone>; + +final class CFGregorianDate extends ffi.Struct { + @SInt32() + external int year; + + @SInt8() + external int month; + + @SInt8() + external int day; + + @SInt8() + external int hour; + + @SInt8() + external int minute; + + @ffi.Double() + external double second; +} + +final class CFGregorianUnits extends ffi.Struct { + @SInt32() + external int years; + + @SInt32() + external int months; + + @SInt32() + external int days; + + @SInt32() + external int hours; + + @SInt32() + external int minutes; + + @ffi.Double() + external double seconds; +} + +final class __CFData extends ffi.Opaque {} + +typedef CFDataRef = ffi.Pointer<__CFData>; +typedef CFMutableDataRef = ffi.Pointer<__CFData>; + +enum CFDataSearchFlags { + kCFDataSearchBackwards(1), + kCFDataSearchAnchored(2); + + final int value; + const CFDataSearchFlags(this.value); + + static CFDataSearchFlags fromValue(int value) => switch (value) { + 1 => kCFDataSearchBackwards, + 2 => kCFDataSearchAnchored, + _ => throw ArgumentError("Unknown value for CFDataSearchFlags: $value"), + }; +} + +final class __CFCharacterSet extends ffi.Opaque {} + +typedef CFCharacterSetRef = ffi.Pointer<__CFCharacterSet>; +typedef CFMutableCharacterSetRef = ffi.Pointer<__CFCharacterSet>; + +enum CFCharacterSetPredefinedSet { + kCFCharacterSetControl(1), + kCFCharacterSetWhitespace(2), + kCFCharacterSetWhitespaceAndNewline(3), + kCFCharacterSetDecimalDigit(4), + kCFCharacterSetLetter(5), + kCFCharacterSetLowercaseLetter(6), + kCFCharacterSetUppercaseLetter(7), + kCFCharacterSetNonBase(8), + kCFCharacterSetDecomposable(9), + kCFCharacterSetAlphaNumeric(10), + kCFCharacterSetPunctuation(11), + kCFCharacterSetCapitalizedLetter(13), + kCFCharacterSetSymbol(14), + kCFCharacterSetNewline(15), + kCFCharacterSetIllegal(12); + + final int value; + const CFCharacterSetPredefinedSet(this.value); + + static CFCharacterSetPredefinedSet fromValue(int value) => switch (value) { + 1 => kCFCharacterSetControl, + 2 => kCFCharacterSetWhitespace, + 3 => kCFCharacterSetWhitespaceAndNewline, + 4 => kCFCharacterSetDecimalDigit, + 5 => kCFCharacterSetLetter, + 6 => kCFCharacterSetLowercaseLetter, + 7 => kCFCharacterSetUppercaseLetter, + 8 => kCFCharacterSetNonBase, + 9 => kCFCharacterSetDecomposable, + 10 => kCFCharacterSetAlphaNumeric, + 11 => kCFCharacterSetPunctuation, + 13 => kCFCharacterSetCapitalizedLetter, + 14 => kCFCharacterSetSymbol, + 15 => kCFCharacterSetNewline, + 12 => kCFCharacterSetIllegal, + _ => throw ArgumentError( + "Unknown value for CFCharacterSetPredefinedSet: $value"), + }; +} + +typedef CFErrorDomain = CFStringRef; + +final class __CFError extends ffi.Opaque {} + +typedef CFErrorRef = ffi.Pointer<__CFError>; +typedef CFStringEncoding = UInt32; + +enum CFStringCompareFlags { + kCFCompareCaseInsensitive(1), + kCFCompareBackwards(4), + kCFCompareAnchored(8), + kCFCompareNonliteral(16), + kCFCompareLocalized(32), + kCFCompareNumerically(64), + kCFCompareDiacriticInsensitive(128), + kCFCompareWidthInsensitive(256), + kCFCompareForcedOrdering(512); + + final int value; + const CFStringCompareFlags(this.value); + + static CFStringCompareFlags fromValue(int value) => switch (value) { + 1 => kCFCompareCaseInsensitive, + 4 => kCFCompareBackwards, + 8 => kCFCompareAnchored, + 16 => kCFCompareNonliteral, + 32 => kCFCompareLocalized, + 64 => kCFCompareNumerically, + 128 => kCFCompareDiacriticInsensitive, + 256 => kCFCompareWidthInsensitive, + 512 => kCFCompareForcedOrdering, + _ => + throw ArgumentError("Unknown value for CFStringCompareFlags: $value"), + }; +} + +enum CFStringNormalizationForm { + kCFStringNormalizationFormD(0), + kCFStringNormalizationFormKD(1), + kCFStringNormalizationFormC(2), + kCFStringNormalizationFormKC(3); + + final int value; + const CFStringNormalizationForm(this.value); + + static CFStringNormalizationForm fromValue(int value) => switch (value) { + 0 => kCFStringNormalizationFormD, + 1 => kCFStringNormalizationFormKD, + 2 => kCFStringNormalizationFormC, + 3 => kCFStringNormalizationFormKC, + _ => throw ArgumentError( + "Unknown value for CFStringNormalizationForm: $value"), + }; +} + +final class CFStringInlineBuffer extends ffi.Struct { + @ffi.Array.multi([64]) + external ffi.Array buffer; + + external CFStringRef theString; + + external ffi.Pointer directUniCharBuffer; + + external ffi.Pointer directCStringBuffer; + + external CFRange rangeToBuffer; + + @CFIndex() + external int bufferedRangeStart; + + @CFIndex() + external int bufferedRangeEnd; +} + +enum CFTimeZoneNameStyle { + kCFTimeZoneNameStyleStandard(0), + kCFTimeZoneNameStyleShortStandard(1), + kCFTimeZoneNameStyleDaylightSaving(2), + kCFTimeZoneNameStyleShortDaylightSaving(3), + kCFTimeZoneNameStyleGeneric(4), + kCFTimeZoneNameStyleShortGeneric(5); + + final int value; + const CFTimeZoneNameStyle(this.value); + + static CFTimeZoneNameStyle fromValue(int value) => switch (value) { + 0 => kCFTimeZoneNameStyleStandard, + 1 => kCFTimeZoneNameStyleShortStandard, + 2 => kCFTimeZoneNameStyleDaylightSaving, + 3 => kCFTimeZoneNameStyleShortDaylightSaving, + 4 => kCFTimeZoneNameStyleGeneric, + 5 => kCFTimeZoneNameStyleShortGeneric, + _ => + throw ArgumentError("Unknown value for CFTimeZoneNameStyle: $value"), + }; +} + +final class __CFCalendar extends ffi.Opaque {} + +typedef CFCalendarRef = ffi.Pointer<__CFCalendar>; + +enum CFCalendarUnit { + kCFCalendarUnitEra(2), + kCFCalendarUnitYear(4), + kCFCalendarUnitMonth(8), + kCFCalendarUnitDay(16), + kCFCalendarUnitHour(32), + kCFCalendarUnitMinute(64), + kCFCalendarUnitSecond(128), + kCFCalendarUnitWeek(256), + kCFCalendarUnitWeekday(512), + kCFCalendarUnitWeekdayOrdinal(1024), + kCFCalendarUnitQuarter(2048), + kCFCalendarUnitWeekOfMonth(4096), + kCFCalendarUnitWeekOfYear(8192), + kCFCalendarUnitYearForWeekOfYear(16384); + + final int value; + const CFCalendarUnit(this.value); + + static CFCalendarUnit fromValue(int value) => switch (value) { + 2 => kCFCalendarUnitEra, + 4 => kCFCalendarUnitYear, + 8 => kCFCalendarUnitMonth, + 16 => kCFCalendarUnitDay, + 32 => kCFCalendarUnitHour, + 64 => kCFCalendarUnitMinute, + 128 => kCFCalendarUnitSecond, + 256 => kCFCalendarUnitWeek, + 512 => kCFCalendarUnitWeekday, + 1024 => kCFCalendarUnitWeekdayOrdinal, + 2048 => kCFCalendarUnitQuarter, + 4096 => kCFCalendarUnitWeekOfMonth, + 8192 => kCFCalendarUnitWeekOfYear, + 16384 => kCFCalendarUnitYearForWeekOfYear, + _ => throw ArgumentError("Unknown value for CFCalendarUnit: $value"), + }; +} + +typedef CGFloat = ffi.Double; +typedef DartCGFloat = double; + +final class CGPoint extends ffi.Struct { + @CGFloat() + external double x; + + @CGFloat() + external double y; +} + +final class CGSize extends ffi.Struct { + @CGFloat() + external double width; + + @CGFloat() + external double height; +} + +final class CGVector extends ffi.Struct { + @CGFloat() + external double dx; + + @CGFloat() + external double dy; +} + +final class CGRect extends ffi.Struct { + external CGPoint origin; + + external CGSize size; +} + +final class CGAffineTransform extends ffi.Struct { + @CGFloat() + external double a; + + @CGFloat() + external double b; + + @CGFloat() + external double c; + + @CGFloat() + external double d; + + @CGFloat() + external double tx; + + @CGFloat() + external double ty; +} + +final class CGAffineTransformComponents extends ffi.Struct { + external CGSize scale; + + @CGFloat() + external double horizontalShear; + + @CGFloat() + external double rotation; + + external CGVector translation; +} + +typedef CFDateFormatterKey = CFStringRef; + +final class __CFDateFormatter extends ffi.Opaque {} + +typedef CFDateFormatterRef = ffi.Pointer<__CFDateFormatter>; + +enum CFDateFormatterStyle { + kCFDateFormatterNoStyle(0), + kCFDateFormatterShortStyle(1), + kCFDateFormatterMediumStyle(2), + kCFDateFormatterLongStyle(3), + kCFDateFormatterFullStyle(4); + + final int value; + const CFDateFormatterStyle(this.value); + + static CFDateFormatterStyle fromValue(int value) => switch (value) { + 0 => kCFDateFormatterNoStyle, + 1 => kCFDateFormatterShortStyle, + 2 => kCFDateFormatterMediumStyle, + 3 => kCFDateFormatterLongStyle, + 4 => kCFDateFormatterFullStyle, + _ => + throw ArgumentError("Unknown value for CFDateFormatterStyle: $value"), + }; +} + +enum CFISO8601DateFormatOptions { + kCFISO8601DateFormatWithYear(1), + kCFISO8601DateFormatWithMonth(2), + kCFISO8601DateFormatWithWeekOfYear(4), + kCFISO8601DateFormatWithDay(16), + kCFISO8601DateFormatWithTime(32), + kCFISO8601DateFormatWithTimeZone(64), + kCFISO8601DateFormatWithSpaceBetweenDateAndTime(128), + kCFISO8601DateFormatWithDashSeparatorInDate(256), + kCFISO8601DateFormatWithColonSeparatorInTime(512), + kCFISO8601DateFormatWithColonSeparatorInTimeZone(1024), + kCFISO8601DateFormatWithFractionalSeconds(2048), + kCFISO8601DateFormatWithFullDate(275), + kCFISO8601DateFormatWithFullTime(1632), + kCFISO8601DateFormatWithInternetDateTime(1907); + + final int value; + const CFISO8601DateFormatOptions(this.value); + + static CFISO8601DateFormatOptions fromValue(int value) => switch (value) { + 1 => kCFISO8601DateFormatWithYear, + 2 => kCFISO8601DateFormatWithMonth, + 4 => kCFISO8601DateFormatWithWeekOfYear, + 16 => kCFISO8601DateFormatWithDay, + 32 => kCFISO8601DateFormatWithTime, + 64 => kCFISO8601DateFormatWithTimeZone, + 128 => kCFISO8601DateFormatWithSpaceBetweenDateAndTime, + 256 => kCFISO8601DateFormatWithDashSeparatorInDate, + 512 => kCFISO8601DateFormatWithColonSeparatorInTime, + 1024 => kCFISO8601DateFormatWithColonSeparatorInTimeZone, + 2048 => kCFISO8601DateFormatWithFractionalSeconds, + 275 => kCFISO8601DateFormatWithFullDate, + 1632 => kCFISO8601DateFormatWithFullTime, + 1907 => kCFISO8601DateFormatWithInternetDateTime, + _ => throw ArgumentError( + "Unknown value for CFISO8601DateFormatOptions: $value"), + }; +} + +final class __CFBoolean extends ffi.Opaque {} + +typedef CFBooleanRef = ffi.Pointer<__CFBoolean>; + +enum CFNumberType { + kCFNumberSInt8Type(1), + kCFNumberSInt16Type(2), + kCFNumberSInt32Type(3), + kCFNumberSInt64Type(4), + kCFNumberFloat32Type(5), + kCFNumberFloat64Type(6), + kCFNumberCharType(7), + kCFNumberShortType(8), + kCFNumberIntType(9), + kCFNumberLongType(10), + kCFNumberLongLongType(11), + kCFNumberFloatType(12), + kCFNumberDoubleType(13), + kCFNumberCFIndexType(14), + kCFNumberNSIntegerType(15), + kCFNumberCGFloatType(16); + + static const kCFNumberMaxType = kCFNumberCGFloatType; + + final int value; + const CFNumberType(this.value); + + static CFNumberType fromValue(int value) => switch (value) { + 1 => kCFNumberSInt8Type, + 2 => kCFNumberSInt16Type, + 3 => kCFNumberSInt32Type, + 4 => kCFNumberSInt64Type, + 5 => kCFNumberFloat32Type, + 6 => kCFNumberFloat64Type, + 7 => kCFNumberCharType, + 8 => kCFNumberShortType, + 9 => kCFNumberIntType, + 10 => kCFNumberLongType, + 11 => kCFNumberLongLongType, + 12 => kCFNumberFloatType, + 13 => kCFNumberDoubleType, + 14 => kCFNumberCFIndexType, + 15 => kCFNumberNSIntegerType, + 16 => kCFNumberCGFloatType, + _ => throw ArgumentError("Unknown value for CFNumberType: $value"), + }; + + @override + String toString() { + if (this == kCFNumberCGFloatType) + return "CFNumberType.kCFNumberCGFloatType, CFNumberType.kCFNumberMaxType"; + return super.toString(); + } +} + +final class __CFNumber extends ffi.Opaque {} + +typedef CFNumberRef = ffi.Pointer<__CFNumber>; +typedef CFNumberFormatterKey = CFStringRef; + +final class __CFNumberFormatter extends ffi.Opaque {} + +typedef CFNumberFormatterRef = ffi.Pointer<__CFNumberFormatter>; + +enum CFNumberFormatterStyle { + kCFNumberFormatterNoStyle(0), + kCFNumberFormatterDecimalStyle(1), + kCFNumberFormatterCurrencyStyle(2), + kCFNumberFormatterPercentStyle(3), + kCFNumberFormatterScientificStyle(4), + kCFNumberFormatterSpellOutStyle(5), + kCFNumberFormatterOrdinalStyle(6), + kCFNumberFormatterCurrencyISOCodeStyle(8), + kCFNumberFormatterCurrencyPluralStyle(9), + kCFNumberFormatterCurrencyAccountingStyle(10); + + final int value; + const CFNumberFormatterStyle(this.value); + + static CFNumberFormatterStyle fromValue(int value) => switch (value) { + 0 => kCFNumberFormatterNoStyle, + 1 => kCFNumberFormatterDecimalStyle, + 2 => kCFNumberFormatterCurrencyStyle, + 3 => kCFNumberFormatterPercentStyle, + 4 => kCFNumberFormatterScientificStyle, + 5 => kCFNumberFormatterSpellOutStyle, + 6 => kCFNumberFormatterOrdinalStyle, + 8 => kCFNumberFormatterCurrencyISOCodeStyle, + 9 => kCFNumberFormatterCurrencyPluralStyle, + 10 => kCFNumberFormatterCurrencyAccountingStyle, + _ => throw ArgumentError( + "Unknown value for CFNumberFormatterStyle: $value"), + }; +} + +enum CFURLPathStyle { + kCFURLPOSIXPathStyle(0), + kCFURLHFSPathStyle(1), + kCFURLWindowsPathStyle(2); + + final int value; + const CFURLPathStyle(this.value); + + static CFURLPathStyle fromValue(int value) => switch (value) { + 0 => kCFURLPOSIXPathStyle, + 1 => kCFURLHFSPathStyle, + 2 => kCFURLWindowsPathStyle, + _ => throw ArgumentError("Unknown value for CFURLPathStyle: $value"), + }; +} + +final class __CFURL extends ffi.Opaque {} + +typedef CFURLRef = ffi.Pointer<__CFURL>; + +enum CFURLComponentType { + kCFURLComponentScheme(1), + kCFURLComponentNetLocation(2), + kCFURLComponentPath(3), + kCFURLComponentResourceSpecifier(4), + kCFURLComponentUser(5), + kCFURLComponentPassword(6), + kCFURLComponentUserInfo(7), + kCFURLComponentHost(8), + kCFURLComponentPort(9), + kCFURLComponentParameterString(10), + kCFURLComponentQuery(11), + kCFURLComponentFragment(12); + + final int value; + const CFURLComponentType(this.value); + + static CFURLComponentType fromValue(int value) => switch (value) { + 1 => kCFURLComponentScheme, + 2 => kCFURLComponentNetLocation, + 3 => kCFURLComponentPath, + 4 => kCFURLComponentResourceSpecifier, + 5 => kCFURLComponentUser, + 6 => kCFURLComponentPassword, + 7 => kCFURLComponentUserInfo, + 8 => kCFURLComponentHost, + 9 => kCFURLComponentPort, + 10 => kCFURLComponentParameterString, + 11 => kCFURLComponentQuery, + 12 => kCFURLComponentFragment, + _ => + throw ArgumentError("Unknown value for CFURLComponentType: $value"), + }; +} + +final class FSRef extends ffi.Opaque {} + +enum CFURLBookmarkCreationOptions { + kCFURLBookmarkCreationMinimalBookmarkMask(512), + kCFURLBookmarkCreationSuitableForBookmarkFile(1024), + kCFURLBookmarkCreationWithSecurityScope(2048), + kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess(4096), + kCFURLBookmarkCreationWithoutImplicitSecurityScope(536870912), + kCFURLBookmarkCreationPreferFileIDResolutionMask(256); + + final int value; + const CFURLBookmarkCreationOptions(this.value); + + static CFURLBookmarkCreationOptions fromValue(int value) => switch (value) { + 512 => kCFURLBookmarkCreationMinimalBookmarkMask, + 1024 => kCFURLBookmarkCreationSuitableForBookmarkFile, + 2048 => kCFURLBookmarkCreationWithSecurityScope, + 4096 => kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess, + 536870912 => kCFURLBookmarkCreationWithoutImplicitSecurityScope, + 256 => kCFURLBookmarkCreationPreferFileIDResolutionMask, + _ => throw ArgumentError( + "Unknown value for CFURLBookmarkCreationOptions: $value"), + }; +} + +enum CFURLBookmarkResolutionOptions { + kCFURLBookmarkResolutionWithoutUIMask(256), + kCFURLBookmarkResolutionWithoutMountingMask(512), + kCFURLBookmarkResolutionWithSecurityScope(1024), + kCFURLBookmarkResolutionWithoutImplicitStartAccessing(32768); + + static const kCFBookmarkResolutionWithoutUIMask = + kCFURLBookmarkResolutionWithoutUIMask; + static const kCFBookmarkResolutionWithoutMountingMask = + kCFURLBookmarkResolutionWithoutMountingMask; + + final int value; + const CFURLBookmarkResolutionOptions(this.value); + + static CFURLBookmarkResolutionOptions fromValue(int value) => switch (value) { + 256 => kCFURLBookmarkResolutionWithoutUIMask, + 512 => kCFURLBookmarkResolutionWithoutMountingMask, + 1024 => kCFURLBookmarkResolutionWithSecurityScope, + 32768 => kCFURLBookmarkResolutionWithoutImplicitStartAccessing, + _ => throw ArgumentError( + "Unknown value for CFURLBookmarkResolutionOptions: $value"), + }; + + @override + String toString() { + if (this == kCFURLBookmarkResolutionWithoutUIMask) + return "CFURLBookmarkResolutionOptions.kCFURLBookmarkResolutionWithoutUIMask, CFURLBookmarkResolutionOptions.kCFBookmarkResolutionWithoutUIMask"; + if (this == kCFURLBookmarkResolutionWithoutMountingMask) + return "CFURLBookmarkResolutionOptions.kCFURLBookmarkResolutionWithoutMountingMask, CFURLBookmarkResolutionOptions.kCFBookmarkResolutionWithoutMountingMask"; + return super.toString(); + } +} + +typedef CFURLBookmarkFileCreationOptions = CFOptionFlags; +typedef boolean_t = ffi.Int; +typedef Dartboolean_t = int; +typedef natural_t = __darwin_natural_t; +typedef integer_t = ffi.Int; +typedef Dartinteger_t = int; +typedef vm_offset_t = ffi.UintPtr; +typedef Dartvm_offset_t = int; +typedef vm_size_t = ffi.UintPtr; +typedef Dartvm_size_t = int; +typedef mach_vm_address_t = ffi.Uint64; +typedef Dartmach_vm_address_t = int; +typedef mach_vm_offset_t = ffi.Uint64; +typedef Dartmach_vm_offset_t = int; +typedef mach_vm_size_t = ffi.Uint64; +typedef Dartmach_vm_size_t = int; +typedef vm_map_offset_t = ffi.Uint64; +typedef Dartvm_map_offset_t = int; +typedef vm_map_address_t = ffi.Uint64; +typedef Dartvm_map_address_t = int; +typedef vm_map_size_t = ffi.Uint64; +typedef Dartvm_map_size_t = int; +typedef vm32_offset_t = ffi.Uint32; +typedef Dartvm32_offset_t = int; +typedef vm32_address_t = ffi.Uint32; +typedef Dartvm32_address_t = int; +typedef vm32_size_t = ffi.Uint32; +typedef Dartvm32_size_t = int; +typedef mach_port_context_t = vm_offset_t; +typedef mach_port_name_t = natural_t; +typedef mach_port_name_array_t = ffi.Pointer; +typedef mach_port_t = __darwin_mach_port_t; +typedef mach_port_array_t = ffi.Pointer; +typedef mach_port_right_t = natural_t; +typedef mach_port_type_t = natural_t; +typedef mach_port_type_array_t = ffi.Pointer; +typedef mach_port_urefs_t = natural_t; +typedef mach_port_delta_t = integer_t; +typedef mach_port_seqno_t = natural_t; +typedef mach_port_mscount_t = natural_t; +typedef mach_port_msgcount_t = natural_t; +typedef mach_port_rights_t = natural_t; +typedef mach_port_srights_t = ffi.UnsignedInt; +typedef Dartmach_port_srights_t = int; + +final class mach_port_status extends ffi.Struct { + @mach_port_rights_t() + external int mps_pset; + + @mach_port_seqno_t() + external int mps_seqno; + + @mach_port_mscount_t() + external int mps_mscount; + + @mach_port_msgcount_t() + external int mps_qlimit; + + @mach_port_msgcount_t() + external int mps_msgcount; + + @mach_port_rights_t() + external int mps_sorights; + + @boolean_t() + external int mps_srights; + + @boolean_t() + external int mps_pdrequest; + + @boolean_t() + external int mps_nsrequest; + + @natural_t() + external int mps_flags; +} + +typedef mach_port_status_t = mach_port_status; + +final class mach_port_limits extends ffi.Struct { + @mach_port_msgcount_t() + external int mpl_qlimit; +} + +typedef mach_port_limits_t = mach_port_limits; + +final class mach_port_info_ext extends ffi.Struct { + external mach_port_status_t mpie_status; + + @mach_port_msgcount_t() + external int mpie_boost_cnt; + + @ffi.Array.multi([6]) + external ffi.Array reserved; +} + +typedef mach_port_info_ext_t = mach_port_info_ext; + +final class mach_port_guard_info extends ffi.Struct { + @ffi.Uint64() + external int mpgi_guard; +} + +typedef mach_port_guard_info_t = mach_port_guard_info; +typedef mach_port_info_t = ffi.Pointer; +typedef mach_port_flavor_t = ffi.Int; +typedef Dartmach_port_flavor_t = int; + +final class mach_port_qos extends ffi.Opaque {} + +typedef mach_port_qos_t = mach_port_qos; + +final class mach_service_port_info extends ffi.Struct { + @ffi.Array.multi([255]) + external ffi.Array mspi_string_name; + + @ffi.Uint8() + external int mspi_domain_type; +} + +typedef mach_service_port_info_data_t = mach_service_port_info; +typedef mach_service_port_info_t = ffi.Pointer; + +final class UnnamedUnion1 extends ffi.Union { + @ffi.Array.multi([2]) + external ffi.Array reserved; + + @mach_port_name_t() + external int work_interval_port; + + external mach_service_port_info_t service_port_info; + + @mach_port_name_t() + external int service_port_name; +} + +final class mach_port_options extends ffi.Struct { + @ffi.Uint32() + external int flags; + + external mach_port_limits_t mpl; + + external UnnamedUnion1 unnamed; +} + +typedef mach_port_options_t = mach_port_options; +typedef mach_port_options_ptr_t = ffi.Pointer; +typedef CFRunLoopMode = CFStringRef; + +final class __CFRunLoop extends ffi.Opaque {} + +typedef CFRunLoopRef = ffi.Pointer<__CFRunLoop>; + +final class __CFRunLoopSource extends ffi.Opaque {} + +typedef CFRunLoopSourceRef = ffi.Pointer<__CFRunLoopSource>; + +final class __CFRunLoopObserver extends ffi.Opaque {} + +typedef CFRunLoopObserverRef = ffi.Pointer<__CFRunLoopObserver>; + +final class __CFRunLoopTimer extends ffi.Opaque {} + +typedef CFRunLoopTimerRef = ffi.Pointer<__CFRunLoopTimer>; + +enum CFRunLoopRunResult { + kCFRunLoopRunFinished(1), + kCFRunLoopRunStopped(2), + kCFRunLoopRunTimedOut(3), + kCFRunLoopRunHandledSource(4); + + final int value; + const CFRunLoopRunResult(this.value); + + static CFRunLoopRunResult fromValue(int value) => switch (value) { + 1 => kCFRunLoopRunFinished, + 2 => kCFRunLoopRunStopped, + 3 => kCFRunLoopRunTimedOut, + 4 => kCFRunLoopRunHandledSource, + _ => + throw ArgumentError("Unknown value for CFRunLoopRunResult: $value"), + }; +} + +enum CFRunLoopActivity { + kCFRunLoopEntry(1), + kCFRunLoopBeforeTimers(2), + kCFRunLoopBeforeSources(4), + kCFRunLoopBeforeWaiting(32), + kCFRunLoopAfterWaiting(64), + kCFRunLoopExit(128), + kCFRunLoopAllActivities(268435455); + + final int value; + const CFRunLoopActivity(this.value); + + static CFRunLoopActivity fromValue(int value) => switch (value) { + 1 => kCFRunLoopEntry, + 2 => kCFRunLoopBeforeTimers, + 4 => kCFRunLoopBeforeSources, + 32 => kCFRunLoopBeforeWaiting, + 64 => kCFRunLoopAfterWaiting, + 128 => kCFRunLoopExit, + 268435455 => kCFRunLoopAllActivities, + _ => throw ArgumentError("Unknown value for CFRunLoopActivity: $value"), + }; +} + +final class CFRunLoopSourceContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; + + external ffi.Pointer< + ffi.NativeFunction< + Boolean Function( + ffi.Pointer info1, ffi.Pointer info2)>> equal; + + external ffi.Pointer< + ffi.NativeFunction info)>> hash; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer info, CFRunLoopRef rl, + CFRunLoopMode mode)>> schedule; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer info, CFRunLoopRef rl, + CFRunLoopMode mode)>> cancel; + + external ffi.Pointer< + ffi.NativeFunction info)>> + perform; +} + +final class CFRunLoopSourceContext1 extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; + + external ffi.Pointer< + ffi.NativeFunction< + Boolean Function( + ffi.Pointer info1, ffi.Pointer info2)>> equal; + + external ffi.Pointer< + ffi.NativeFunction info)>> hash; + + external ffi.Pointer< + ffi.NativeFunction info)>> + getPort; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer msg, + CFIndex size, + CFAllocatorRef allocator, + ffi.Pointer info)>> perform; +} + +final class CFRunLoopObserverContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; +} + +typedef CFRunLoopObserverCallBackFunction = ffi.Void Function( + CFRunLoopObserverRef observer, + CFOptionFlags activity, + ffi.Pointer info); +typedef DartCFRunLoopObserverCallBackFunction = void Function( + CFRunLoopObserverRef observer, + CFRunLoopActivity activity, + ffi.Pointer info); +typedef CFRunLoopObserverCallBack + = ffi.Pointer>; +void _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_fnPtrTrampoline( + ffi.Pointer block, + CFRunLoopObserverRef arg0, + int arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + CFRunLoopObserverRef arg0, CFOptionFlags arg1)>>() + .asFunction()(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + CFRunLoopObserverRef, CFOptionFlags)>( + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_closureTrampoline( + ffi.Pointer block, + CFRunLoopObserverRef arg0, + int arg1) => + (objc.getBlockClosure(block) as void Function( + CFRunLoopObserverRef, int))(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + CFRunLoopObserverRef, CFOptionFlags)>( + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_listenerTrampoline( + ffi.Pointer block, + CFRunLoopObserverRef arg0, + int arg1) { + (objc.getBlockClosure(block) as void Function(CFRunLoopObserverRef, int))( + arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, CFRunLoopObserverRef, + CFOptionFlags)> + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_listenerCallable = + ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + CFRunLoopObserverRef, CFOptionFlags)>.listener( + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, CFOptionFlags)>`. +abstract final class ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__CFRunLoopObserver>, CFOptionFlags)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__CFRunLoopObserver>, + CFOptionFlags)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__CFRunLoopObserver>, CFOptionFlags)> + fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock, CFOptionFlags)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, CFOptionFlags)> + fromFunction(void Function(CFRunLoopObserverRef, CFRunLoopActivity) fn) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer<__CFRunLoopObserver>, CFOptionFlags)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_closureCallable, + (CFRunLoopObserverRef arg0, int arg1) => + fn(arg0, CFRunLoopActivity.fromValue(arg1))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__CFRunLoopObserver>, CFOptionFlags)> + listener(void Function(CFRunLoopObserverRef, CFRunLoopActivity) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_listenerCallable + .nativeFunction + .cast(), + (CFRunLoopObserverRef arg0, int arg1) => + fn(arg0, CFRunLoopActivity.fromValue(arg1))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_tg5tbv(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__CFRunLoopObserver>, + CFOptionFlags)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, CFOptionFlags)>`. +extension ObjCBlock_ffiVoid_CFRunLoopObserverRef_CFRunLoopActivity_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__CFRunLoopObserver>, CFOptionFlags)> { + void call(CFRunLoopObserverRef arg0, CFRunLoopActivity arg1) => ref + .pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + CFRunLoopObserverRef arg0, CFOptionFlags arg1)>>() + .asFunction< + void Function(ffi.Pointer, CFRunLoopObserverRef, + int)>()(ref.pointer, arg0, arg1.value); +} + +final class CFRunLoopTimerContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; +} + +typedef CFRunLoopTimerCallBackFunction = ffi.Void Function( + CFRunLoopTimerRef timer, ffi.Pointer info); +typedef DartCFRunLoopTimerCallBackFunction = void Function( + CFRunLoopTimerRef timer, ffi.Pointer info); +typedef CFRunLoopTimerCallBack + = ffi.Pointer>; +void _ObjCBlock_ffiVoid_CFRunLoopTimerRef_fnPtrTrampoline( + ffi.Pointer block, CFRunLoopTimerRef arg0) => + block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_CFRunLoopTimerRef_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, CFRunLoopTimerRef)>( + _ObjCBlock_ffiVoid_CFRunLoopTimerRef_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_CFRunLoopTimerRef_closureTrampoline( + ffi.Pointer block, CFRunLoopTimerRef arg0) => + (objc.getBlockClosure(block) as void Function(CFRunLoopTimerRef))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_CFRunLoopTimerRef_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, CFRunLoopTimerRef)>( + _ObjCBlock_ffiVoid_CFRunLoopTimerRef_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_CFRunLoopTimerRef_listenerTrampoline( + ffi.Pointer block, CFRunLoopTimerRef arg0) { + (objc.getBlockClosure(block) as void Function(CFRunLoopTimerRef))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, CFRunLoopTimerRef)> + _ObjCBlock_ffiVoid_CFRunLoopTimerRef_listenerCallable = ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, CFRunLoopTimerRef)>.listener( + _ObjCBlock_ffiVoid_CFRunLoopTimerRef_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_CFRunLoopTimerRef { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__CFRunLoopTimer>)> fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_CFRunLoopTimerRef_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunction(void Function(CFRunLoopTimerRef) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_CFRunLoopTimerRef_closureCallable, + (CFRunLoopTimerRef arg0) => fn(arg0)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock)> + listener(void Function(CFRunLoopTimerRef) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_CFRunLoopTimerRef_listenerCallable.nativeFunction + .cast(), + (CFRunLoopTimerRef arg0) => fn(arg0)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1dqvvol(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock)>( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_CFRunLoopTimerRef_CallExtension + on objc.ObjCBlock)> { + void call(CFRunLoopTimerRef arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + CFRunLoopTimerRef arg0)>>() + .asFunction< + void Function(ffi.Pointer, + CFRunLoopTimerRef)>()(ref.pointer, arg0); +} + +final class __CFSocket extends ffi.Opaque {} + +typedef CFSocketRef = ffi.Pointer<__CFSocket>; + +enum CFSocketError { + kCFSocketSuccess(0), + kCFSocketError(-1), + kCFSocketTimeout(-2); + + final int value; + const CFSocketError(this.value); + + static CFSocketError fromValue(int value) => switch (value) { + 0 => kCFSocketSuccess, + -1 => kCFSocketError, + -2 => kCFSocketTimeout, + _ => throw ArgumentError("Unknown value for CFSocketError: $value"), + }; +} + +final class CFSocketSignature extends ffi.Struct { + @SInt32() + external int protocolFamily; + + @SInt32() + external int socketType; + + @SInt32() + external int protocol; + + external CFDataRef address; +} + +enum CFSocketCallBackType { + kCFSocketNoCallBack(0), + kCFSocketReadCallBack(1), + kCFSocketAcceptCallBack(2), + kCFSocketDataCallBack(3), + kCFSocketConnectCallBack(4), + kCFSocketWriteCallBack(8); + + final int value; + const CFSocketCallBackType(this.value); + + static CFSocketCallBackType fromValue(int value) => switch (value) { + 0 => kCFSocketNoCallBack, + 1 => kCFSocketReadCallBack, + 2 => kCFSocketAcceptCallBack, + 3 => kCFSocketDataCallBack, + 4 => kCFSocketConnectCallBack, + 8 => kCFSocketWriteCallBack, + _ => + throw ArgumentError("Unknown value for CFSocketCallBackType: $value"), + }; +} + +typedef CFSocketCallBackFunction = ffi.Void Function( + CFSocketRef s, + CFOptionFlags type, + CFDataRef address, + ffi.Pointer data, + ffi.Pointer info); +typedef DartCFSocketCallBackFunction = void Function( + CFSocketRef s, + CFSocketCallBackType type, + CFDataRef address, + ffi.Pointer data, + ffi.Pointer info); +typedef CFSocketCallBack + = ffi.Pointer>; + +final class CFSocketContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; +} + +typedef CFSocketNativeHandle = ffi.Int; +typedef DartCFSocketNativeHandle = int; + +final class accessx_descriptor extends ffi.Struct { + @ffi.UnsignedInt() + external int ad_name_offset; + + @ffi.Int() + external int ad_flags; + + @ffi.Array.multi([2]) + external ffi.Array ad_pad; +} + +final class fssearchblock extends ffi.Opaque {} + +final class searchstate extends ffi.Opaque {} + +final class flock extends ffi.Struct { + @off_t() + external int l_start; + + @off_t() + external int l_len; + + @pid_t() + external int l_pid; + + @ffi.Short() + external int l_type; + + @ffi.Short() + external int l_whence; +} + +final class flocktimeout extends ffi.Struct { + external flock fl; + + external timespec timeout; +} + +final class radvisory extends ffi.Struct { + @off_t() + external int ra_offset; + + @ffi.Int() + external int ra_count; +} + +final class fsignatures extends ffi.Struct { + @off_t() + external int fs_file_start; + + external ffi.Pointer fs_blob_start; + + @ffi.Size() + external int fs_blob_size; + + @ffi.Size() + external int fs_fsignatures_size; + + @ffi.Array.multi([20]) + external ffi.Array fs_cdhash; + + @ffi.Int() + external int fs_hash_type; +} + +typedef fsignatures_t = fsignatures; + +final class fsupplement extends ffi.Struct { + @off_t() + external int fs_file_start; + + @off_t() + external int fs_blob_start; + + @ffi.Size() + external int fs_blob_size; + + @ffi.Int() + external int fs_orig_fd; +} + +typedef fsupplement_t = fsupplement; + +final class fchecklv extends ffi.Struct { + @off_t() + external int lv_file_start; + + @ffi.Size() + external int lv_error_message_size; + + external ffi.Pointer lv_error_message; +} + +typedef fchecklv_t = fchecklv; + +final class fgetsigsinfo extends ffi.Struct { + @off_t() + external int fg_file_start; + + @ffi.Int() + external int fg_info_request; + + @ffi.Int() + external int fg_sig_is_platform; +} + +typedef fgetsigsinfo_t = fgetsigsinfo; + +final class fstore extends ffi.Struct { + @ffi.UnsignedInt() + external int fst_flags; + + @ffi.Int() + external int fst_posmode; + + @off_t() + external int fst_offset; + + @off_t() + external int fst_length; + + @off_t() + external int fst_bytesalloc; +} + +typedef fstore_t = fstore; + +final class fpunchhole extends ffi.Struct { + @ffi.UnsignedInt() + external int fp_flags; + + @ffi.UnsignedInt() + external int reserved; + + @off_t() + external int fp_offset; + + @off_t() + external int fp_length; +} + +typedef fpunchhole_t = fpunchhole; + +final class ftrimactivefile extends ffi.Struct { + @off_t() + external int fta_offset; + + @off_t() + external int fta_length; +} + +typedef ftrimactivefile_t = ftrimactivefile; + +final class fspecread extends ffi.Struct { + @ffi.UnsignedInt() + external int fsr_flags; + + @ffi.UnsignedInt() + external int reserved; + + @off_t() + external int fsr_offset; + + @off_t() + external int fsr_length; +} + +typedef fspecread_t = fspecread; + +final class fattributiontag extends ffi.Struct { + @ffi.UnsignedInt() + external int ft_flags; + + @ffi.UnsignedLongLong() + external int ft_hash; + + @ffi.Array.multi([255]) + external ffi.Array ft_attribution_name; +} + +typedef fattributiontag_t = fattributiontag; + +@ffi.Packed(4) +final class log2phys extends ffi.Struct { + @ffi.UnsignedInt() + external int l2p_flags; + + @off_t() + external int l2p_contigbytes; + + @off_t() + external int l2p_devoffset; +} + +final class _filesec extends ffi.Opaque {} + +typedef filesec_t = ffi.Pointer<_filesec>; + +enum filesec_property_t { + FILESEC_OWNER(1), + FILESEC_GROUP(2), + FILESEC_UUID(3), + FILESEC_MODE(4), + FILESEC_ACL(5), + FILESEC_GRPUUID(6), + FILESEC_ACL_RAW(100), + FILESEC_ACL_ALLOCSIZE(101); + + final int value; + const filesec_property_t(this.value); + + static filesec_property_t fromValue(int value) => switch (value) { + 1 => FILESEC_OWNER, + 2 => FILESEC_GROUP, + 3 => FILESEC_UUID, + 4 => FILESEC_MODE, + 5 => FILESEC_ACL, + 6 => FILESEC_GRPUUID, + 100 => FILESEC_ACL_RAW, + 101 => FILESEC_ACL_ALLOCSIZE, + _ => + throw ArgumentError("Unknown value for filesec_property_t: $value"), + }; +} + +final class os_workgroup_attr_opaque_s extends ffi.Struct { + @ffi.Uint32() + external int sig; + + @ffi.Array.multi([60]) + external ffi.Array opaque; +} + +final class os_workgroup_interval_data_opaque_s extends ffi.Struct { + @ffi.Uint32() + external int sig; + + @ffi.Array.multi([56]) + external ffi.Array opaque; +} + +final class os_workgroup_join_token_opaque_s extends ffi.Struct { + @ffi.Uint32() + external int sig; + + @ffi.Array.multi([36]) + external ffi.Array opaque; +} + +/// WARNING: OS_os_workgroup is a stub. To generate bindings for this class, include +/// OS_os_workgroup in your config's objc-interfaces list. +/// +/// OS_os_workgroup +class OS_os_workgroup extends OS_object { + OS_os_workgroup._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [OS_os_workgroup] that points to the same underlying object as [other]. + OS_os_workgroup.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [OS_os_workgroup] that wraps the given raw object pointer. + OS_os_workgroup.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +typedef os_workgroup_t = ffi.Pointer; +typedef Dartos_workgroup_t = OS_os_workgroup; +typedef os_workgroup_attr_s = os_workgroup_attr_opaque_s; +typedef os_workgroup_attr_t = ffi.Pointer; +typedef os_workgroup_join_token_s = os_workgroup_join_token_opaque_s; +typedef os_workgroup_join_token_t + = ffi.Pointer; +typedef os_workgroup_index = ffi.Uint32; +typedef Dartos_workgroup_index = int; +typedef os_workgroup_working_arena_destructor_tFunction = ffi.Void Function( + ffi.Pointer); +typedef Dartos_workgroup_working_arena_destructor_tFunction = void Function( + ffi.Pointer); +typedef os_workgroup_working_arena_destructor_t = ffi.Pointer< + ffi.NativeFunction>; + +final class os_workgroup_max_parallel_threads_attr_s extends ffi.Opaque {} + +typedef os_workgroup_mpt_attr_s = os_workgroup_max_parallel_threads_attr_s; +typedef os_workgroup_mpt_attr_t + = ffi.Pointer; +typedef os_workgroup_interval_t = ffi.Pointer; +typedef Dartos_workgroup_interval_t = OS_os_workgroup; +typedef os_workgroup_interval_data_s = os_workgroup_interval_data_opaque_s; +typedef os_workgroup_interval_data_t + = ffi.Pointer; +typedef os_workgroup_parallel_t = ffi.Pointer; +typedef Dartos_workgroup_parallel_t = OS_os_workgroup; +typedef dispatch_function_tFunction = ffi.Void Function(ffi.Pointer); +typedef Dartdispatch_function_tFunction = void Function(ffi.Pointer); +typedef dispatch_function_t + = ffi.Pointer>; + +final class time_value extends ffi.Struct { + @integer_t() + external int seconds; + + @integer_t() + external int microseconds; +} + +typedef time_value_t = time_value; +typedef alarm_type_t = ffi.Int; +typedef Dartalarm_type_t = int; +typedef sleep_type_t = ffi.Int; +typedef Dartsleep_type_t = int; +typedef clock_id_t = ffi.Int; +typedef Dartclock_id_t = int; +typedef clock_flavor_t = ffi.Int; +typedef Dartclock_flavor_t = int; +typedef clock_attr_t = ffi.Pointer; +typedef clock_res_t = ffi.Int; +typedef Dartclock_res_t = int; + +final class mach_timespec extends ffi.Struct { + @ffi.UnsignedInt() + external int tv_sec; + + @clock_res_t() + external int tv_nsec; +} + +typedef mach_timespec_t = mach_timespec; +typedef dispatch_time_t = ffi.Uint64; +typedef Dartdispatch_time_t = int; + +enum qos_class_t { + QOS_CLASS_USER_INTERACTIVE(33), + QOS_CLASS_USER_INITIATED(25), + QOS_CLASS_DEFAULT(21), + QOS_CLASS_UTILITY(17), + QOS_CLASS_BACKGROUND(9), + QOS_CLASS_UNSPECIFIED(0); + + final int value; + const qos_class_t(this.value); + + static qos_class_t fromValue(int value) => switch (value) { + 33 => QOS_CLASS_USER_INTERACTIVE, + 25 => QOS_CLASS_USER_INITIATED, + 21 => QOS_CLASS_DEFAULT, + 17 => QOS_CLASS_UTILITY, + 9 => QOS_CLASS_BACKGROUND, + 0 => QOS_CLASS_UNSPECIFIED, + _ => throw ArgumentError("Unknown value for qos_class_t: $value"), + }; +} + +typedef dispatch_object_t = ffi.Pointer; +typedef Dartdispatch_object_t = objc.NSObject; +typedef dispatch_block_t = ffi.Pointer; +typedef Dartdispatch_block_t = objc.ObjCBlock; +typedef dispatch_queue_t = ffi.Pointer; +typedef Dartdispatch_queue_t = objc.NSObject; +typedef dispatch_queue_global_t = ffi.Pointer; +typedef Dartdispatch_queue_global_t = objc.NSObject; +typedef dispatch_queue_serial_executor_t = ffi.Pointer; +typedef Dartdispatch_queue_serial_executor_t = objc.NSObject; +typedef dispatch_queue_serial_t = ffi.Pointer; +typedef Dartdispatch_queue_serial_t = objc.NSObject; +typedef dispatch_queue_main_t = ffi.Pointer; +typedef Dartdispatch_queue_main_t = objc.NSObject; +typedef dispatch_queue_concurrent_t = ffi.Pointer; +typedef Dartdispatch_queue_concurrent_t = objc.NSObject; +void _ObjCBlock_ffiVoid_ffiSize_fnPtrTrampoline( + ffi.Pointer block, int arg0) => + block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_ffiSize_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Size)>(_ObjCBlock_ffiVoid_ffiSize_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiSize_closureTrampoline( + ffi.Pointer block, int arg0) => + (objc.getBlockClosure(block) as void Function(int))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_ffiSize_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Size)>(_ObjCBlock_ffiVoid_ffiSize_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiSize_listenerTrampoline( + ffi.Pointer block, int arg0) { + (objc.getBlockClosure(block) as void Function(int))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable, ffi.Size)> + _ObjCBlock_ffiVoid_ffiSize_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Size)>.listener(_ObjCBlock_ffiVoid_ffiSize_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_ffiSize { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_ffiSize_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(int) fn) => + objc.ObjCBlock( + objc.newClosureBlock(_ObjCBlock_ffiVoid_ffiSize_closureCallable, + (int arg0) => fn(arg0)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(int) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiSize_listenerCallable.nativeFunction.cast(), + (int arg0) => fn(arg0)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_6enxqz(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_ffiSize_CallExtension + on objc.ObjCBlock { + void call(int arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, ffi.Size arg0)>>() + .asFunction, int)>()( + ref.pointer, arg0); +} + +final class dispatch_queue_s extends ffi.Opaque {} + +typedef dispatch_queue_priority_t = ffi.Long; +typedef Dartdispatch_queue_priority_t = int; +typedef dispatch_queue_attr_t = ffi.Pointer; +typedef Dartdispatch_queue_attr_t = objc.NSObject; + +final class dispatch_queue_attr_s extends ffi.Opaque {} + +enum dispatch_autorelease_frequency_t { + DISPATCH_AUTORELEASE_FREQUENCY_INHERIT(0), + DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM(1), + DISPATCH_AUTORELEASE_FREQUENCY_NEVER(2); + + final int value; + const dispatch_autorelease_frequency_t(this.value); + + static dispatch_autorelease_frequency_t fromValue(int value) => + switch (value) { + 0 => DISPATCH_AUTORELEASE_FREQUENCY_INHERIT, + 1 => DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM, + 2 => DISPATCH_AUTORELEASE_FREQUENCY_NEVER, + _ => throw ArgumentError( + "Unknown value for dispatch_autorelease_frequency_t: $value"), + }; +} + +enum dispatch_block_flags_t { + DISPATCH_BLOCK_BARRIER(1), + DISPATCH_BLOCK_DETACHED(2), + DISPATCH_BLOCK_ASSIGN_CURRENT(4), + DISPATCH_BLOCK_NO_QOS_CLASS(8), + DISPATCH_BLOCK_INHERIT_QOS_CLASS(16), + DISPATCH_BLOCK_ENFORCE_QOS_CLASS(32); + + final int value; + const dispatch_block_flags_t(this.value); + + static dispatch_block_flags_t fromValue(int value) => switch (value) { + 1 => DISPATCH_BLOCK_BARRIER, + 2 => DISPATCH_BLOCK_DETACHED, + 4 => DISPATCH_BLOCK_ASSIGN_CURRENT, + 8 => DISPATCH_BLOCK_NO_QOS_CLASS, + 16 => DISPATCH_BLOCK_INHERIT_QOS_CLASS, + 32 => DISPATCH_BLOCK_ENFORCE_QOS_CLASS, + _ => throw ArgumentError( + "Unknown value for dispatch_block_flags_t: $value"), + }; +} + +typedef kern_return_t = ffi.Int; +typedef Dartkern_return_t = int; +typedef mach_msg_timeout_t = natural_t; +typedef mach_msg_bits_t = ffi.UnsignedInt; +typedef Dartmach_msg_bits_t = int; +typedef mach_msg_size_t = natural_t; +typedef mach_msg_id_t = integer_t; +typedef mach_msg_priority_t = ffi.UnsignedInt; +typedef Dartmach_msg_priority_t = int; +typedef mach_msg_type_name_t = ffi.UnsignedInt; +typedef Dartmach_msg_type_name_t = int; +typedef mach_msg_copy_options_t = ffi.UnsignedInt; +typedef Dartmach_msg_copy_options_t = int; +typedef mach_msg_guard_flags_t = ffi.UnsignedInt; +typedef Dartmach_msg_guard_flags_t = int; +typedef mach_msg_descriptor_type_t = ffi.UnsignedInt; +typedef Dartmach_msg_descriptor_type_t = int; + +final class mach_msg_type_descriptor_t extends ffi.Opaque {} + +final class mach_msg_port_descriptor_t extends ffi.Opaque {} + +final class mach_msg_ool_descriptor32_t extends ffi.Opaque {} + +final class mach_msg_ool_descriptor64_t extends ffi.Opaque {} + +final class mach_msg_ool_descriptor_t extends ffi.Opaque {} + +final class mach_msg_ool_ports_descriptor32_t extends ffi.Opaque {} + +final class mach_msg_ool_ports_descriptor64_t extends ffi.Opaque {} + +final class mach_msg_ool_ports_descriptor_t extends ffi.Opaque {} + +final class mach_msg_guarded_port_descriptor32_t extends ffi.Opaque {} + +final class mach_msg_guarded_port_descriptor64_t extends ffi.Opaque {} + +final class mach_msg_guarded_port_descriptor_t extends ffi.Opaque {} + +final class mach_msg_descriptor_t extends ffi.Opaque {} + +final class mach_msg_body_t extends ffi.Struct { + @mach_msg_size_t() + external int msgh_descriptor_count; +} + +final class mach_msg_header_t extends ffi.Struct { + @mach_msg_bits_t() + external int msgh_bits; + + @mach_msg_size_t() + external int msgh_size; + + @mach_port_t() + external int msgh_remote_port; + + @mach_port_t() + external int msgh_local_port; + + @mach_port_name_t() + external int msgh_voucher_port; + + @mach_msg_id_t() + external int msgh_id; +} + +final class mach_msg_base_t extends ffi.Struct { + external mach_msg_header_t header; + + external mach_msg_body_t body; +} + +typedef mach_msg_trailer_type_t = ffi.UnsignedInt; +typedef Dartmach_msg_trailer_type_t = int; +typedef mach_msg_trailer_size_t = ffi.UnsignedInt; +typedef Dartmach_msg_trailer_size_t = int; +typedef mach_msg_trailer_info_t = ffi.Pointer; + +final class mach_msg_trailer_t extends ffi.Struct { + @mach_msg_trailer_type_t() + external int msgh_trailer_type; + + @mach_msg_trailer_size_t() + external int msgh_trailer_size; +} + +final class mach_msg_seqno_trailer_t extends ffi.Struct { + @mach_msg_trailer_type_t() + external int msgh_trailer_type; + + @mach_msg_trailer_size_t() + external int msgh_trailer_size; + + @mach_port_seqno_t() + external int msgh_seqno; +} + +final class security_token_t extends ffi.Struct { + @ffi.Array.multi([2]) + external ffi.Array val; +} + +final class mach_msg_security_trailer_t extends ffi.Struct { + @mach_msg_trailer_type_t() + external int msgh_trailer_type; + + @mach_msg_trailer_size_t() + external int msgh_trailer_size; + + @mach_port_seqno_t() + external int msgh_seqno; + + external security_token_t msgh_sender; +} + +final class audit_token_t extends ffi.Struct { + @ffi.Array.multi([8]) + external ffi.Array val; +} + +final class mach_msg_audit_trailer_t extends ffi.Struct { + @mach_msg_trailer_type_t() + external int msgh_trailer_type; + + @mach_msg_trailer_size_t() + external int msgh_trailer_size; + + @mach_port_seqno_t() + external int msgh_seqno; + + external security_token_t msgh_sender; + + external audit_token_t msgh_audit; +} + +@ffi.Packed(4) +final class mach_msg_context_trailer_t extends ffi.Struct { + @mach_msg_trailer_type_t() + external int msgh_trailer_type; + + @mach_msg_trailer_size_t() + external int msgh_trailer_size; + + @mach_port_seqno_t() + external int msgh_seqno; + + external security_token_t msgh_sender; + + external audit_token_t msgh_audit; + + @mach_port_context_t() + external int msgh_context; +} + +final class msg_labels_t extends ffi.Struct { + @mach_port_name_t() + external int sender; +} + +typedef mach_msg_filter_id = ffi.Int; +typedef Dartmach_msg_filter_id = int; + +@ffi.Packed(4) +final class mach_msg_mac_trailer_t extends ffi.Struct { + @mach_msg_trailer_type_t() + external int msgh_trailer_type; + + @mach_msg_trailer_size_t() + external int msgh_trailer_size; + + @mach_port_seqno_t() + external int msgh_seqno; + + external security_token_t msgh_sender; + + external audit_token_t msgh_audit; + + @mach_port_context_t() + external int msgh_context; + + @mach_msg_filter_id() + external int msgh_ad; + + external msg_labels_t msgh_labels; +} + +typedef mach_msg_max_trailer_t = mach_msg_mac_trailer_t; +typedef mach_msg_format_0_trailer_t = mach_msg_security_trailer_t; +typedef mach_msg_options_t = integer_t; + +final class mach_msg_empty_send_t extends ffi.Struct { + external mach_msg_header_t header; +} + +final class mach_msg_empty_rcv_t extends ffi.Struct { + external mach_msg_header_t header; + + external mach_msg_trailer_t trailer; +} + +final class mach_msg_empty_t extends ffi.Union { + external mach_msg_empty_send_t send; + + external mach_msg_empty_rcv_t rcv; +} + +typedef mach_msg_type_size_t = natural_t; +typedef mach_msg_type_number_t = natural_t; +typedef mach_msg_option_t = integer_t; +typedef mach_msg_return_t = kern_return_t; +typedef dispatch_source_t = ffi.Pointer; +typedef Dartdispatch_source_t = objc.NSObject; + +final class dispatch_source_type_s extends ffi.Opaque {} + +typedef dispatch_source_type_t = ffi.Pointer; +typedef dispatch_source_mach_send_flags_t = ffi.UnsignedLong; +typedef Dartdispatch_source_mach_send_flags_t = int; +typedef dispatch_source_mach_recv_flags_t = ffi.UnsignedLong; +typedef Dartdispatch_source_mach_recv_flags_t = int; +typedef dispatch_source_memorypressure_flags_t = ffi.UnsignedLong; +typedef Dartdispatch_source_memorypressure_flags_t = int; +typedef dispatch_source_proc_flags_t = ffi.UnsignedLong; +typedef Dartdispatch_source_proc_flags_t = int; +typedef dispatch_source_vnode_flags_t = ffi.UnsignedLong; +typedef Dartdispatch_source_vnode_flags_t = int; +typedef dispatch_source_timer_flags_t = ffi.UnsignedLong; +typedef Dartdispatch_source_timer_flags_t = int; +typedef dispatch_group_t = ffi.Pointer; +typedef Dartdispatch_group_t = objc.NSObject; +typedef dispatch_semaphore_t = ffi.Pointer; +typedef Dartdispatch_semaphore_t = objc.NSObject; +typedef dispatch_once_t = ffi.IntPtr; +typedef Dartdispatch_once_t = int; +typedef dispatch_data_t = ffi.Pointer; +typedef Dartdispatch_data_t = objc.NSObject; + +final class dispatch_data_s extends ffi.Opaque {} + +bool _ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize_fnPtrTrampoline( + ffi.Pointer block, + dispatch_data_t arg0, + int arg1, + ffi.Pointer arg2, + int arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Bool Function(dispatch_data_t arg0, ffi.Size arg1, + ffi.Pointer arg2, ffi.Size arg3)>>() + .asFunction< + bool Function(dispatch_data_t, int, ffi.Pointer, + int)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, + dispatch_data_t, + ffi.Size, + ffi.Pointer, + ffi.Size)>( + _ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize_fnPtrTrampoline, + false) + .cast(); +bool _ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize_closureTrampoline( + ffi.Pointer block, + dispatch_data_t arg0, + int arg1, + ffi.Pointer arg2, + int arg3) => + (objc.getBlockClosure(block) as bool Function(dispatch_data_t, int, + ffi.Pointer, int))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize_closureCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, + dispatch_data_t, + ffi.Size, + ffi.Pointer, + ffi.Size)>( + _ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize_closureTrampoline, + false) + .cast(); + +/// Construction methods for `objc.ObjCBlock, ffi.Size)>`. +abstract final class ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Bool Function( + objc.NSObject, ffi.Size, ffi.Pointer, ffi.Size)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Bool Function(objc.NSObject, ffi.Size, ffi.Pointer, + ffi.Size)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.Size)> + fromFunctionPointer(ffi.Pointer arg2, ffi.Size arg3)>> ptr) => + objc.ObjCBlock< + ffi.Bool Function( + objc.NSObject, ffi.Size, ffi.Pointer, ffi.Size)>( + objc.newPointerBlock( + _ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, ffi.Size)> fromFunction( + bool Function(Dartdispatch_data_t, int, ffi.Pointer, int) + fn) => + objc.ObjCBlock, ffi.Size)>( + objc.newClosureBlock( + _ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize_closureCallable, + (dispatch_data_t arg0, int arg1, ffi.Pointer arg2, + int arg3) => + fn(objc.NSObject.castFromPointer(arg0, retain: true, release: true), arg1, arg2, arg3)), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, ffi.Size)>`. +extension ObjCBlock_bool_dispatchdatat_ffiSize_ffiVoid_ffiSize_CallExtension + on objc.ObjCBlock< + ffi.Bool Function( + objc.NSObject, ffi.Size, ffi.Pointer, ffi.Size)> { + bool call(Dartdispatch_data_t arg0, int arg1, ffi.Pointer arg2, + int arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer block, + dispatch_data_t arg0, + ffi.Size arg1, + ffi.Pointer arg2, + ffi.Size arg3)>>() + .asFunction< + bool Function( + ffi.Pointer, + dispatch_data_t, + int, + ffi.Pointer, + int)>()(ref.pointer, arg0.ref.pointer, arg1, arg2, arg3); +} + +typedef dispatch_data_applier_t = ffi.Pointer; +typedef Dartdispatch_data_applier_t = objc.ObjCBlock< + ffi.Bool Function( + objc.NSObject, ffi.Size, ffi.Pointer, ffi.Size)>; +typedef dispatch_fd_t = ffi.Int; +typedef Dartdispatch_fd_t = int; +void _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_fnPtrTrampoline( + ffi.Pointer block, + dispatch_data_t arg0, + int arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(dispatch_data_t arg0, ffi.Int arg1)>>() + .asFunction()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, dispatch_data_t, ffi.Int)>( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_closureTrampoline( + ffi.Pointer block, + dispatch_data_t arg0, + int arg1) => + (objc.getBlockClosure(block) as void Function(dispatch_data_t, int))( + arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, dispatch_data_t, ffi.Int)>( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_listenerTrampoline( + ffi.Pointer block, dispatch_data_t arg0, int arg1) { + (objc.getBlockClosure(block) as void Function(dispatch_data_t, int))( + arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, dispatch_data_t, ffi.Int)> + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_listenerCallable = ffi + .NativeCallable< + ffi.Void Function(ffi.Pointer, dispatch_data_t, + ffi.Int)>.listener( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_dispatchdatat_ffiInt { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject, ffi.Int)> fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(Dartdispatch_data_t, int) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_closureCallable, + (dispatch_data_t arg0, int arg1) => fn( + objc.NSObject.castFromPointer(arg0, + retain: true, release: true), + arg1)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(Dartdispatch_data_t, int) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt_listenerCallable.nativeFunction + .cast(), + (dispatch_data_t arg0, int arg1) => fn( + objc.NSObject.castFromPointer(arg0, retain: false, release: true), + arg1)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_qxvyq2(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_dispatchdatat_ffiInt_CallExtension + on objc.ObjCBlock { + void call(Dartdispatch_data_t arg0, int arg1) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + dispatch_data_t arg0, ffi.Int arg1)>>() + .asFunction< + void Function(ffi.Pointer, dispatch_data_t, + int)>()(ref.pointer, arg0.ref.pointer, arg1); +} + +void _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_fnPtrTrampoline( + ffi.Pointer block, + dispatch_data_t arg0, + int arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(dispatch_data_t arg0, ffi.Int arg1)>>() + .asFunction()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, dispatch_data_t, ffi.Int)>( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_closureTrampoline( + ffi.Pointer block, + dispatch_data_t arg0, + int arg1) => + (objc.getBlockClosure(block) as void Function(dispatch_data_t, int))( + arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, dispatch_data_t, ffi.Int)>( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_listenerTrampoline( + ffi.Pointer block, dispatch_data_t arg0, int arg1) { + (objc.getBlockClosure(block) as void Function(dispatch_data_t, int))( + arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, dispatch_data_t, ffi.Int)> + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_listenerCallable = ffi + .NativeCallable< + ffi.Void Function(ffi.Pointer, dispatch_data_t, + ffi.Int)>.listener( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_dispatchdatat_ffiInt1 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject?, ffi.Int)> fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(Dartdispatch_data_t?, int) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_closureCallable, + (dispatch_data_t arg0, int arg1) => fn( + arg0.address == 0 + ? null + : objc.NSObject.castFromPointer(arg0, + retain: true, release: true), + arg1)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(Dartdispatch_data_t?, int) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_listenerCallable.nativeFunction + .cast(), + (dispatch_data_t arg0, int arg1) => fn( + arg0.address == 0 + ? null + : objc.NSObject.castFromPointer(arg0, + retain: false, release: true), + arg1)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_qxvyq2(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_dispatchdatat_ffiInt1_CallExtension + on objc.ObjCBlock { + void call(Dartdispatch_data_t? arg0, int arg1) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + dispatch_data_t arg0, ffi.Int arg1)>>() + .asFunction< + void Function(ffi.Pointer, dispatch_data_t, + int)>()(ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1); +} + +typedef dispatch_io_t = ffi.Pointer; +typedef Dartdispatch_io_t = objc.NSObject; +typedef dispatch_io_type_t = ffi.UnsignedLong; +typedef Dartdispatch_io_type_t = int; +void _ObjCBlock_ffiVoid_ffiInt_fnPtrTrampoline( + ffi.Pointer block, int arg0) => + block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_ffiInt_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Int)>(_ObjCBlock_ffiVoid_ffiInt_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiInt_closureTrampoline( + ffi.Pointer block, int arg0) => + (objc.getBlockClosure(block) as void Function(int))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_ffiInt_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Int)>(_ObjCBlock_ffiVoid_ffiInt_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiInt_listenerTrampoline( + ffi.Pointer block, int arg0) { + (objc.getBlockClosure(block) as void Function(int))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable, ffi.Int)> + _ObjCBlock_ffiVoid_ffiInt_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Int)>.listener(_ObjCBlock_ffiVoid_ffiInt_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_ffiInt { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_ffiInt_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(int) fn) => + objc.ObjCBlock( + objc.newClosureBlock(_ObjCBlock_ffiVoid_ffiInt_closureCallable, + (int arg0) => fn(arg0)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(int) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiInt_listenerCallable.nativeFunction.cast(), + (int arg0) => fn(arg0)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_9o8504(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_ffiInt_CallExtension + on objc.ObjCBlock { + void call(int arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, ffi.Int arg0)>>() + .asFunction, int)>()( + ref.pointer, arg0); +} + +void _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_fnPtrTrampoline( + ffi.Pointer block, + bool arg0, + dispatch_data_t arg1, + int arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Bool arg0, dispatch_data_t arg1, ffi.Int arg2)>>() + .asFunction()( + arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, ffi.Bool, + dispatch_data_t, ffi.Int)>( + _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_closureTrampoline( + ffi.Pointer block, + bool arg0, + dispatch_data_t arg1, + int arg2) => + (objc.getBlockClosure(block) as void Function(bool, dispatch_data_t, int))( + arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, ffi.Bool, + dispatch_data_t, ffi.Int)>( + _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_listenerTrampoline( + ffi.Pointer block, + bool arg0, + dispatch_data_t arg1, + int arg2) { + (objc.getBlockClosure(block) as void Function(bool, dispatch_data_t, int))( + arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, ffi.Bool, + dispatch_data_t, ffi.Int)> + _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_listenerCallable = ffi + .NativeCallable< + ffi.Void Function(ffi.Pointer, ffi.Bool, + dispatch_data_t, ffi.Int)>.listener( + _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Bool, objc.NSObject?, ffi.Int)> fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock + fromFunction(void Function(bool, Dartdispatch_data_t?, int) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_closureCallable, + (bool arg0, dispatch_data_t arg1, int arg2) => fn( + arg0, + arg1.address == 0 + ? null + : objc.NSObject.castFromPointer(arg1, retain: true, release: true), + arg2)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock + listener(void Function(bool, Dartdispatch_data_t?, int) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_listenerCallable + .nativeFunction + .cast(), + (bool arg0, dispatch_data_t arg1, int arg2) => fn( + arg0, + arg1.address == 0 + ? null + : objc.NSObject.castFromPointer(arg1, + retain: false, release: true), + arg2)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_12a4qua(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_bool_dispatchdatat_ffiInt_CallExtension + on objc.ObjCBlock { + void call(bool arg0, Dartdispatch_data_t? arg1, int arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Bool arg0, dispatch_data_t arg1, ffi.Int arg2)>>() + .asFunction< + void Function(ffi.Pointer, bool, + dispatch_data_t, int)>()( + ref.pointer, arg0, arg1?.ref.pointer ?? ffi.nullptr, arg2); +} + +typedef dispatch_io_handler_t = ffi.Pointer; +typedef Dartdispatch_io_handler_t + = objc.ObjCBlock; +typedef dispatch_io_close_flags_t = ffi.UnsignedLong; +typedef Dartdispatch_io_close_flags_t = int; +typedef dispatch_io_interval_flags_t = ffi.UnsignedLong; +typedef Dartdispatch_io_interval_flags_t = int; +typedef dispatch_workloop_t = ffi.Pointer; +typedef Dartdispatch_workloop_t = objc.NSObject; + +final class CFStreamError extends ffi.Struct { + @CFIndex() + external int domain; + + @SInt32() + external int error; +} + +typedef CFStreamPropertyKey = CFStringRef; + +enum CFStreamStatus { + kCFStreamStatusNotOpen(0), + kCFStreamStatusOpening(1), + kCFStreamStatusOpen(2), + kCFStreamStatusReading(3), + kCFStreamStatusWriting(4), + kCFStreamStatusAtEnd(5), + kCFStreamStatusClosed(6), + kCFStreamStatusError(7); + + final int value; + const CFStreamStatus(this.value); + + static CFStreamStatus fromValue(int value) => switch (value) { + 0 => kCFStreamStatusNotOpen, + 1 => kCFStreamStatusOpening, + 2 => kCFStreamStatusOpen, + 3 => kCFStreamStatusReading, + 4 => kCFStreamStatusWriting, + 5 => kCFStreamStatusAtEnd, + 6 => kCFStreamStatusClosed, + 7 => kCFStreamStatusError, + _ => throw ArgumentError("Unknown value for CFStreamStatus: $value"), + }; +} + +enum CFStreamEventType { + kCFStreamEventNone(0), + kCFStreamEventOpenCompleted(1), + kCFStreamEventHasBytesAvailable(2), + kCFStreamEventCanAcceptBytes(4), + kCFStreamEventErrorOccurred(8), + kCFStreamEventEndEncountered(16); + + final int value; + const CFStreamEventType(this.value); + + static CFStreamEventType fromValue(int value) => switch (value) { + 0 => kCFStreamEventNone, + 1 => kCFStreamEventOpenCompleted, + 2 => kCFStreamEventHasBytesAvailable, + 4 => kCFStreamEventCanAcceptBytes, + 8 => kCFStreamEventErrorOccurred, + 16 => kCFStreamEventEndEncountered, + _ => throw ArgumentError("Unknown value for CFStreamEventType: $value"), + }; +} + +final class CFStreamClientContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; +} + +final class __CFReadStream extends ffi.Opaque {} + +typedef CFReadStreamRef = ffi.Pointer<__CFReadStream>; + +final class __CFWriteStream extends ffi.Opaque {} + +typedef CFWriteStreamRef = ffi.Pointer<__CFWriteStream>; +typedef CFReadStreamClientCallBackFunction = ffi.Void Function( + CFReadStreamRef stream, + CFOptionFlags type, + ffi.Pointer clientCallBackInfo); +typedef DartCFReadStreamClientCallBackFunction = void Function( + CFReadStreamRef stream, + CFStreamEventType type, + ffi.Pointer clientCallBackInfo); +typedef CFReadStreamClientCallBack + = ffi.Pointer>; +typedef CFWriteStreamClientCallBackFunction = ffi.Void Function( + CFWriteStreamRef stream, + CFOptionFlags type, + ffi.Pointer clientCallBackInfo); +typedef DartCFWriteStreamClientCallBackFunction = void Function( + CFWriteStreamRef stream, + CFStreamEventType type, + ffi.Pointer clientCallBackInfo); +typedef CFWriteStreamClientCallBack + = ffi.Pointer>; + +enum CFPropertyListFormat { + kCFPropertyListOpenStepFormat(1), + kCFPropertyListXMLFormat_v1_0(100), + kCFPropertyListBinaryFormat_v1_0(200); + + final int value; + const CFPropertyListFormat(this.value); + + static CFPropertyListFormat fromValue(int value) => switch (value) { + 1 => kCFPropertyListOpenStepFormat, + 100 => kCFPropertyListXMLFormat_v1_0, + 200 => kCFPropertyListBinaryFormat_v1_0, + _ => + throw ArgumentError("Unknown value for CFPropertyListFormat: $value"), + }; +} + +typedef CFSetRetainCallBackFunction = ffi.Pointer Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef CFSetRetainCallBack + = ffi.Pointer>; +typedef CFSetReleaseCallBackFunction = ffi.Void Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef DartCFSetReleaseCallBackFunction = void Function( + CFAllocatorRef allocator, ffi.Pointer value); +typedef CFSetReleaseCallBack + = ffi.Pointer>; +typedef CFSetCopyDescriptionCallBackFunction = CFStringRef Function( + ffi.Pointer value); +typedef CFSetCopyDescriptionCallBack + = ffi.Pointer>; +typedef CFSetEqualCallBackFunction = Boolean Function( + ffi.Pointer value1, ffi.Pointer value2); +typedef DartCFSetEqualCallBackFunction = DartBoolean Function( + ffi.Pointer value1, ffi.Pointer value2); +typedef CFSetEqualCallBack + = ffi.Pointer>; +typedef CFSetHashCallBackFunction = CFHashCode Function( + ffi.Pointer value); +typedef DartCFSetHashCallBackFunction = DartCFHashCode Function( + ffi.Pointer value); +typedef CFSetHashCallBack + = ffi.Pointer>; + +final class CFSetCallBacks extends ffi.Struct { + @CFIndex() + external int version; + + external CFSetRetainCallBack retain; + + external CFSetReleaseCallBack release; + + external CFSetCopyDescriptionCallBack copyDescription; + + external CFSetEqualCallBack equal; + + external CFSetHashCallBack hash; +} + +typedef CFSetApplierFunctionFunction = ffi.Void Function( + ffi.Pointer value, ffi.Pointer context); +typedef DartCFSetApplierFunctionFunction = void Function( + ffi.Pointer value, ffi.Pointer context); +typedef CFSetApplierFunction + = ffi.Pointer>; + +final class __CFSet extends ffi.Opaque {} + +typedef CFSetRef = ffi.Pointer<__CFSet>; +typedef CFMutableSetRef = ffi.Pointer<__CFSet>; +typedef CFTreeRetainCallBackFunction = ffi.Pointer Function( + ffi.Pointer info); +typedef CFTreeRetainCallBack + = ffi.Pointer>; +typedef CFTreeReleaseCallBackFunction = ffi.Void Function( + ffi.Pointer info); +typedef DartCFTreeReleaseCallBackFunction = void Function( + ffi.Pointer info); +typedef CFTreeReleaseCallBack + = ffi.Pointer>; +typedef CFTreeCopyDescriptionCallBackFunction = CFStringRef Function( + ffi.Pointer info); +typedef CFTreeCopyDescriptionCallBack + = ffi.Pointer>; + +final class CFTreeContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external CFTreeRetainCallBack retain; + + external CFTreeReleaseCallBack release; + + external CFTreeCopyDescriptionCallBack copyDescription; +} + +typedef CFTreeApplierFunctionFunction = ffi.Void Function( + ffi.Pointer value, ffi.Pointer context); +typedef DartCFTreeApplierFunctionFunction = void Function( + ffi.Pointer value, ffi.Pointer context); +typedef CFTreeApplierFunction + = ffi.Pointer>; + +final class __CFTree extends ffi.Opaque {} + +typedef CFTreeRef = ffi.Pointer<__CFTree>; + +final class __CFUUID extends ffi.Opaque {} + +typedef CFUUIDRef = ffi.Pointer<__CFUUID>; + +final class CFUUIDBytes extends ffi.Struct { + @UInt8() + external int byte0; + + @UInt8() + external int byte1; + + @UInt8() + external int byte2; + + @UInt8() + external int byte3; + + @UInt8() + external int byte4; + + @UInt8() + external int byte5; + + @UInt8() + external int byte6; + + @UInt8() + external int byte7; + + @UInt8() + external int byte8; + + @UInt8() + external int byte9; + + @UInt8() + external int byte10; + + @UInt8() + external int byte11; + + @UInt8() + external int byte12; + + @UInt8() + external int byte13; + + @UInt8() + external int byte14; + + @UInt8() + external int byte15; +} + +typedef cpu_type_t = integer_t; +typedef cpu_subtype_t = integer_t; +typedef cpu_threadtype_t = integer_t; + +final class __CFBundle extends ffi.Opaque {} + +typedef CFBundleRef = ffi.Pointer<__CFBundle>; +typedef CFPlugInRef = ffi.Pointer<__CFBundle>; +typedef CFBundleRefNum = ffi.Int; +typedef DartCFBundleRefNum = int; + +final class __CFMessagePort extends ffi.Opaque {} + +typedef CFMessagePortRef = ffi.Pointer<__CFMessagePort>; + +final class CFMessagePortContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; +} + +typedef CFMessagePortCallBackFunction = CFDataRef Function( + CFMessagePortRef local, + SInt32 msgid, + CFDataRef data, + ffi.Pointer info); +typedef DartCFMessagePortCallBackFunction = CFDataRef Function( + CFMessagePortRef local, + DartSInt32 msgid, + CFDataRef data, + ffi.Pointer info); +typedef CFMessagePortCallBack + = ffi.Pointer>; +typedef CFMessagePortInvalidationCallBackFunction = ffi.Void Function( + CFMessagePortRef ms, ffi.Pointer info); +typedef DartCFMessagePortInvalidationCallBackFunction = void Function( + CFMessagePortRef ms, ffi.Pointer info); +typedef CFMessagePortInvalidationCallBack = ffi + .Pointer>; +typedef CFPlugInDynamicRegisterFunctionFunction = ffi.Void Function( + CFPlugInRef plugIn); +typedef DartCFPlugInDynamicRegisterFunctionFunction = void Function( + CFPlugInRef plugIn); +typedef CFPlugInDynamicRegisterFunction + = ffi.Pointer>; +typedef CFPlugInUnloadFunctionFunction = ffi.Void Function(CFPlugInRef plugIn); +typedef DartCFPlugInUnloadFunctionFunction = void Function(CFPlugInRef plugIn); +typedef CFPlugInUnloadFunction + = ffi.Pointer>; +typedef CFPlugInFactoryFunctionFunction = ffi.Pointer Function( + CFAllocatorRef allocator, CFUUIDRef typeUUID); +typedef CFPlugInFactoryFunction + = ffi.Pointer>; + +final class __CFPlugInInstance extends ffi.Opaque {} + +typedef CFPlugInInstanceRef = ffi.Pointer<__CFPlugInInstance>; +typedef CFPlugInInstanceGetInterfaceFunctionFunction = Boolean Function( + CFPlugInInstanceRef instance, + CFStringRef interfaceName, + ffi.Pointer> ftbl); +typedef DartCFPlugInInstanceGetInterfaceFunctionFunction = DartBoolean Function( + CFPlugInInstanceRef instance, + CFStringRef interfaceName, + ffi.Pointer> ftbl); +typedef CFPlugInInstanceGetInterfaceFunction = ffi + .Pointer>; +typedef CFPlugInInstanceDeallocateInstanceDataFunctionFunction = ffi.Void + Function(ffi.Pointer instanceData); +typedef DartCFPlugInInstanceDeallocateInstanceDataFunctionFunction = void + Function(ffi.Pointer instanceData); +typedef CFPlugInInstanceDeallocateInstanceDataFunction = ffi.Pointer< + ffi.NativeFunction>; + +final class __CFMachPort extends ffi.Opaque {} + +typedef CFMachPortRef = ffi.Pointer<__CFMachPort>; + +final class CFMachPortContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; +} + +typedef CFMachPortCallBackFunction = ffi.Void Function(CFMachPortRef port, + ffi.Pointer msg, CFIndex size, ffi.Pointer info); +typedef DartCFMachPortCallBackFunction = void Function(CFMachPortRef port, + ffi.Pointer msg, DartCFIndex size, ffi.Pointer info); +typedef CFMachPortCallBack + = ffi.Pointer>; +typedef CFMachPortInvalidationCallBackFunction = ffi.Void Function( + CFMachPortRef port, ffi.Pointer info); +typedef DartCFMachPortInvalidationCallBackFunction = void Function( + CFMachPortRef port, ffi.Pointer info); +typedef CFMachPortInvalidationCallBack + = ffi.Pointer>; + +final class __CFAttributedString extends ffi.Opaque {} + +typedef CFAttributedStringRef = ffi.Pointer<__CFAttributedString>; +typedef CFMutableAttributedStringRef = ffi.Pointer<__CFAttributedString>; + +final class __CFURLEnumerator extends ffi.Opaque {} + +typedef CFURLEnumeratorRef = ffi.Pointer<__CFURLEnumerator>; + +enum CFURLEnumeratorOptions { + kCFURLEnumeratorDefaultBehavior(0), + kCFURLEnumeratorDescendRecursively(1), + kCFURLEnumeratorSkipInvisibles(2), + kCFURLEnumeratorGenerateFileReferenceURLs(4), + kCFURLEnumeratorSkipPackageContents(8), + kCFURLEnumeratorIncludeDirectoriesPreOrder(16), + kCFURLEnumeratorIncludeDirectoriesPostOrder(32), + kCFURLEnumeratorGenerateRelativePathURLs(64); + + final int value; + const CFURLEnumeratorOptions(this.value); + + static CFURLEnumeratorOptions fromValue(int value) => switch (value) { + 0 => kCFURLEnumeratorDefaultBehavior, + 1 => kCFURLEnumeratorDescendRecursively, + 2 => kCFURLEnumeratorSkipInvisibles, + 4 => kCFURLEnumeratorGenerateFileReferenceURLs, + 8 => kCFURLEnumeratorSkipPackageContents, + 16 => kCFURLEnumeratorIncludeDirectoriesPreOrder, + 32 => kCFURLEnumeratorIncludeDirectoriesPostOrder, + 64 => kCFURLEnumeratorGenerateRelativePathURLs, + _ => throw ArgumentError( + "Unknown value for CFURLEnumeratorOptions: $value"), + }; +} + +enum CFURLEnumeratorResult { + kCFURLEnumeratorSuccess(1), + kCFURLEnumeratorEnd(2), + kCFURLEnumeratorError(3), + kCFURLEnumeratorDirectoryPostOrderSuccess(4); + + final int value; + const CFURLEnumeratorResult(this.value); + + static CFURLEnumeratorResult fromValue(int value) => switch (value) { + 1 => kCFURLEnumeratorSuccess, + 2 => kCFURLEnumeratorEnd, + 3 => kCFURLEnumeratorError, + 4 => kCFURLEnumeratorDirectoryPostOrderSuccess, + _ => throw ArgumentError( + "Unknown value for CFURLEnumeratorResult: $value"), + }; +} + +final class guid_t extends ffi.Union { + @ffi.Array.multi([16]) + external ffi.Array g_guid; + + @ffi.Array.multi([4]) + external ffi.Array g_guid_asint; +} + +@ffi.Packed(1) +final class ntsid_t extends ffi.Struct { + @u_int8_t() + external int sid_kind; + + @u_int8_t() + external int sid_authcount; + + @ffi.Array.multi([6]) + external ffi.Array sid_authority; + + @ffi.Array.multi([16]) + external ffi.Array sid_authorities; +} + +final class kauth_identity_extlookup extends ffi.Struct { + @u_int32_t() + external int el_seqno; + + @u_int32_t() + external int el_result; + + @u_int32_t() + external int el_flags; + + @__darwin_pid_t() + external int el_info_pid; + + @u_int64_t() + external int el_extend; + + @u_int32_t() + external int el_info_reserved_1; + + @uid_t() + external int el_uid; + + external guid_t el_uguid; + + @u_int32_t() + external int el_uguid_valid; + + external ntsid_t el_usid; + + @u_int32_t() + external int el_usid_valid; + + @gid_t() + external int el_gid; + + external guid_t el_gguid; + + @u_int32_t() + external int el_gguid_valid; + + external ntsid_t el_gsid; + + @u_int32_t() + external int el_gsid_valid; + + @u_int32_t() + external int el_member_valid; + + @u_int32_t() + external int el_sup_grp_cnt; + + @ffi.Array.multi([16]) + external ffi.Array el_sup_groups; +} + +final class kauth_cache_sizes extends ffi.Struct { + @u_int32_t() + external int kcs_group_size; + + @u_int32_t() + external int kcs_id_size; +} + +typedef kauth_ace_rights_t = u_int32_t; + +final class kauth_ace extends ffi.Struct { + external guid_t ace_applicable; + + @u_int32_t() + external int ace_flags; + + @kauth_ace_rights_t() + external int ace_rights; +} + +typedef kauth_ace_t = ffi.Pointer; + +final class kauth_acl extends ffi.Struct { + @u_int32_t() + external int acl_entrycount; + + @u_int32_t() + external int acl_flags; + + @ffi.Array.multi([1]) + external ffi.Array acl_ace; +} + +typedef kauth_acl_t = ffi.Pointer; + +final class kauth_filesec extends ffi.Struct { + @u_int32_t() + external int fsec_magic; + + external guid_t fsec_owner; + + external guid_t fsec_group; + + external kauth_acl fsec_acl; +} + +typedef kauth_filesec_t = ffi.Pointer; + +enum acl_perm_t { + ACL_READ_DATA(2), + ACL_WRITE_DATA(4), + ACL_EXECUTE(8), + ACL_DELETE(16), + ACL_APPEND_DATA(32), + ACL_DELETE_CHILD(64), + ACL_READ_ATTRIBUTES(128), + ACL_WRITE_ATTRIBUTES(256), + ACL_READ_EXTATTRIBUTES(512), + ACL_WRITE_EXTATTRIBUTES(1024), + ACL_READ_SECURITY(2048), + ACL_WRITE_SECURITY(4096), + ACL_CHANGE_OWNER(8192), + ACL_SYNCHRONIZE(1048576); + + static const ACL_LIST_DIRECTORY = ACL_READ_DATA; + static const ACL_ADD_FILE = ACL_WRITE_DATA; + static const ACL_SEARCH = ACL_EXECUTE; + static const ACL_ADD_SUBDIRECTORY = ACL_APPEND_DATA; + + final int value; + const acl_perm_t(this.value); + + static acl_perm_t fromValue(int value) => switch (value) { + 2 => ACL_READ_DATA, + 4 => ACL_WRITE_DATA, + 8 => ACL_EXECUTE, + 16 => ACL_DELETE, + 32 => ACL_APPEND_DATA, + 64 => ACL_DELETE_CHILD, + 128 => ACL_READ_ATTRIBUTES, + 256 => ACL_WRITE_ATTRIBUTES, + 512 => ACL_READ_EXTATTRIBUTES, + 1024 => ACL_WRITE_EXTATTRIBUTES, + 2048 => ACL_READ_SECURITY, + 4096 => ACL_WRITE_SECURITY, + 8192 => ACL_CHANGE_OWNER, + 1048576 => ACL_SYNCHRONIZE, + _ => throw ArgumentError("Unknown value for acl_perm_t: $value"), + }; + + @override + String toString() { + if (this == ACL_READ_DATA) + return "acl_perm_t.ACL_READ_DATA, acl_perm_t.ACL_LIST_DIRECTORY"; + if (this == ACL_WRITE_DATA) + return "acl_perm_t.ACL_WRITE_DATA, acl_perm_t.ACL_ADD_FILE"; + if (this == ACL_EXECUTE) + return "acl_perm_t.ACL_EXECUTE, acl_perm_t.ACL_SEARCH"; + if (this == ACL_APPEND_DATA) + return "acl_perm_t.ACL_APPEND_DATA, acl_perm_t.ACL_ADD_SUBDIRECTORY"; + return super.toString(); + } +} + +enum acl_tag_t { + ACL_UNDEFINED_TAG(0), + ACL_EXTENDED_ALLOW(1), + ACL_EXTENDED_DENY(2); + + final int value; + const acl_tag_t(this.value); + + static acl_tag_t fromValue(int value) => switch (value) { + 0 => ACL_UNDEFINED_TAG, + 1 => ACL_EXTENDED_ALLOW, + 2 => ACL_EXTENDED_DENY, + _ => throw ArgumentError("Unknown value for acl_tag_t: $value"), + }; +} + +enum acl_type_t { + ACL_TYPE_EXTENDED(256), + ACL_TYPE_ACCESS(0), + ACL_TYPE_DEFAULT(1), + ACL_TYPE_AFS(2), + ACL_TYPE_CODA(3), + ACL_TYPE_NTFS(4), + ACL_TYPE_NWFS(5); + + final int value; + const acl_type_t(this.value); + + static acl_type_t fromValue(int value) => switch (value) { + 256 => ACL_TYPE_EXTENDED, + 0 => ACL_TYPE_ACCESS, + 1 => ACL_TYPE_DEFAULT, + 2 => ACL_TYPE_AFS, + 3 => ACL_TYPE_CODA, + 4 => ACL_TYPE_NTFS, + 5 => ACL_TYPE_NWFS, + _ => throw ArgumentError("Unknown value for acl_type_t: $value"), + }; +} + +enum acl_flag_t { + ACL_FLAG_DEFER_INHERIT(1), + ACL_FLAG_NO_INHERIT(131072), + ACL_ENTRY_INHERITED(16), + ACL_ENTRY_FILE_INHERIT(32), + ACL_ENTRY_DIRECTORY_INHERIT(64), + ACL_ENTRY_LIMIT_INHERIT(128), + ACL_ENTRY_ONLY_INHERIT(256); + + final int value; + const acl_flag_t(this.value); + + static acl_flag_t fromValue(int value) => switch (value) { + 1 => ACL_FLAG_DEFER_INHERIT, + 131072 => ACL_FLAG_NO_INHERIT, + 16 => ACL_ENTRY_INHERITED, + 32 => ACL_ENTRY_FILE_INHERIT, + 64 => ACL_ENTRY_DIRECTORY_INHERIT, + 128 => ACL_ENTRY_LIMIT_INHERIT, + 256 => ACL_ENTRY_ONLY_INHERIT, + _ => throw ArgumentError("Unknown value for acl_flag_t: $value"), + }; +} + +final class _acl extends ffi.Opaque {} + +final class _acl_entry extends ffi.Opaque {} + +final class _acl_permset extends ffi.Opaque {} + +final class _acl_flagset extends ffi.Opaque {} + +typedef acl_t = ffi.Pointer<_acl>; +typedef acl_entry_t = ffi.Pointer<_acl_entry>; +typedef acl_permset_t = ffi.Pointer<_acl_permset>; +typedef acl_flagset_t = ffi.Pointer<_acl_flagset>; +typedef acl_permset_mask_t = u_int64_t; + +final class __CFFileSecurity extends ffi.Opaque {} + +typedef CFFileSecurityRef = ffi.Pointer<__CFFileSecurity>; + +enum CFFileSecurityClearOptions { + kCFFileSecurityClearOwner(1), + kCFFileSecurityClearGroup(2), + kCFFileSecurityClearMode(4), + kCFFileSecurityClearOwnerUUID(8), + kCFFileSecurityClearGroupUUID(16), + kCFFileSecurityClearAccessControlList(32); + + final int value; + const CFFileSecurityClearOptions(this.value); + + static CFFileSecurityClearOptions fromValue(int value) => switch (value) { + 1 => kCFFileSecurityClearOwner, + 2 => kCFFileSecurityClearGroup, + 4 => kCFFileSecurityClearMode, + 8 => kCFFileSecurityClearOwnerUUID, + 16 => kCFFileSecurityClearGroupUUID, + 32 => kCFFileSecurityClearAccessControlList, + _ => throw ArgumentError( + "Unknown value for CFFileSecurityClearOptions: $value"), + }; +} + +final class __CFStringTokenizer extends ffi.Opaque {} + +typedef CFStringTokenizerRef = ffi.Pointer<__CFStringTokenizer>; + +enum CFStringTokenizerTokenType { + kCFStringTokenizerTokenNone(0), + kCFStringTokenizerTokenNormal(1), + kCFStringTokenizerTokenHasSubTokensMask(2), + kCFStringTokenizerTokenHasDerivedSubTokensMask(4), + kCFStringTokenizerTokenHasHasNumbersMask(8), + kCFStringTokenizerTokenHasNonLettersMask(16), + kCFStringTokenizerTokenIsCJWordMask(32); + + final int value; + const CFStringTokenizerTokenType(this.value); + + static CFStringTokenizerTokenType fromValue(int value) => switch (value) { + 0 => kCFStringTokenizerTokenNone, + 1 => kCFStringTokenizerTokenNormal, + 2 => kCFStringTokenizerTokenHasSubTokensMask, + 4 => kCFStringTokenizerTokenHasDerivedSubTokensMask, + 8 => kCFStringTokenizerTokenHasHasNumbersMask, + 16 => kCFStringTokenizerTokenHasNonLettersMask, + 32 => kCFStringTokenizerTokenIsCJWordMask, + _ => throw ArgumentError( + "Unknown value for CFStringTokenizerTokenType: $value"), + }; +} + +typedef CFFileDescriptorNativeDescriptor = ffi.Int; +typedef DartCFFileDescriptorNativeDescriptor = int; + +final class __CFFileDescriptor extends ffi.Opaque {} + +typedef CFFileDescriptorRef = ffi.Pointer<__CFFileDescriptor>; +typedef CFFileDescriptorCallBackFunction = ffi.Void Function( + CFFileDescriptorRef f, + CFOptionFlags callBackTypes, + ffi.Pointer info); +typedef DartCFFileDescriptorCallBackFunction = void Function( + CFFileDescriptorRef f, + DartCFOptionFlags callBackTypes, + ffi.Pointer info); +typedef CFFileDescriptorCallBack + = ffi.Pointer>; + +final class CFFileDescriptorContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer info)>> retain; + + external ffi.Pointer< + ffi.NativeFunction info)>> + release; + + external ffi.Pointer< + ffi.NativeFunction info)>> + copyDescription; +} + +final class __CFUserNotification extends ffi.Opaque {} + +typedef CFUserNotificationRef = ffi.Pointer<__CFUserNotification>; +typedef CFUserNotificationCallBackFunction = ffi.Void Function( + CFUserNotificationRef userNotification, CFOptionFlags responseFlags); +typedef DartCFUserNotificationCallBackFunction = void Function( + CFUserNotificationRef userNotification, DartCFOptionFlags responseFlags); +typedef CFUserNotificationCallBack + = ffi.Pointer>; + +final class __CFXMLNode extends ffi.Opaque {} + +typedef CFXMLNodeRef = ffi.Pointer<__CFXMLNode>; +typedef CFXMLTreeRef = CFTreeRef; + +enum CFXMLNodeTypeCode { + kCFXMLNodeTypeDocument(1), + kCFXMLNodeTypeElement(2), + kCFXMLNodeTypeAttribute(3), + kCFXMLNodeTypeProcessingInstruction(4), + kCFXMLNodeTypeComment(5), + kCFXMLNodeTypeText(6), + kCFXMLNodeTypeCDATASection(7), + kCFXMLNodeTypeDocumentFragment(8), + kCFXMLNodeTypeEntity(9), + kCFXMLNodeTypeEntityReference(10), + kCFXMLNodeTypeDocumentType(11), + kCFXMLNodeTypeWhitespace(12), + kCFXMLNodeTypeNotation(13), + kCFXMLNodeTypeElementTypeDeclaration(14), + kCFXMLNodeTypeAttributeListDeclaration(15); + + final int value; + const CFXMLNodeTypeCode(this.value); + + static CFXMLNodeTypeCode fromValue(int value) => switch (value) { + 1 => kCFXMLNodeTypeDocument, + 2 => kCFXMLNodeTypeElement, + 3 => kCFXMLNodeTypeAttribute, + 4 => kCFXMLNodeTypeProcessingInstruction, + 5 => kCFXMLNodeTypeComment, + 6 => kCFXMLNodeTypeText, + 7 => kCFXMLNodeTypeCDATASection, + 8 => kCFXMLNodeTypeDocumentFragment, + 9 => kCFXMLNodeTypeEntity, + 10 => kCFXMLNodeTypeEntityReference, + 11 => kCFXMLNodeTypeDocumentType, + 12 => kCFXMLNodeTypeWhitespace, + 13 => kCFXMLNodeTypeNotation, + 14 => kCFXMLNodeTypeElementTypeDeclaration, + 15 => kCFXMLNodeTypeAttributeListDeclaration, + _ => throw ArgumentError("Unknown value for CFXMLNodeTypeCode: $value"), + }; +} + +final class CFXMLElementInfo extends ffi.Struct { + external CFDictionaryRef attributes; + + external CFArrayRef attributeOrder; + + @Boolean() + external int isEmpty; + + @ffi.Array.multi([3]) + external ffi.Array _reserved; +} + +final class CFXMLProcessingInstructionInfo extends ffi.Struct { + external CFStringRef dataString; +} + +final class CFXMLDocumentInfo extends ffi.Struct { + external CFURLRef sourceURL; + + @CFStringEncoding() + external int encoding; +} + +final class CFXMLExternalID extends ffi.Struct { + external CFURLRef systemID; + + external CFStringRef publicID; +} + +final class CFXMLDocumentTypeInfo extends ffi.Struct { + external CFXMLExternalID externalID; +} + +final class CFXMLNotationInfo extends ffi.Struct { + external CFXMLExternalID externalID; +} + +final class CFXMLElementTypeDeclarationInfo extends ffi.Struct { + external CFStringRef contentDescription; +} + +final class CFXMLAttributeDeclarationInfo extends ffi.Struct { + external CFStringRef attributeName; + + external CFStringRef typeString; + + external CFStringRef defaultString; +} + +final class CFXMLAttributeListDeclarationInfo extends ffi.Struct { + @CFIndex() + external int numberOfAttributes; + + external ffi.Pointer attributes; +} + +enum CFXMLEntityTypeCode { + kCFXMLEntityTypeParameter(0), + kCFXMLEntityTypeParsedInternal(1), + kCFXMLEntityTypeParsedExternal(2), + kCFXMLEntityTypeUnparsed(3), + kCFXMLEntityTypeCharacter(4); + + final int value; + const CFXMLEntityTypeCode(this.value); + + static CFXMLEntityTypeCode fromValue(int value) => switch (value) { + 0 => kCFXMLEntityTypeParameter, + 1 => kCFXMLEntityTypeParsedInternal, + 2 => kCFXMLEntityTypeParsedExternal, + 3 => kCFXMLEntityTypeUnparsed, + 4 => kCFXMLEntityTypeCharacter, + _ => + throw ArgumentError("Unknown value for CFXMLEntityTypeCode: $value"), + }; +} + +final class CFXMLEntityInfo extends ffi.Struct { + @CFIndex() + external int entityTypeAsInt; + + CFXMLEntityTypeCode get entityType => + CFXMLEntityTypeCode.fromValue(entityTypeAsInt); + + external CFStringRef replacementText; + + external CFXMLExternalID entityID; + + external CFStringRef notationName; +} + +final class CFXMLEntityReferenceInfo extends ffi.Struct { + @CFIndex() + external int entityTypeAsInt; + + CFXMLEntityTypeCode get entityType => + CFXMLEntityTypeCode.fromValue(entityTypeAsInt); +} + +final class __CFXMLParser extends ffi.Opaque {} + +typedef CFXMLParserRef = ffi.Pointer<__CFXMLParser>; + +enum CFXMLParserStatusCode { + kCFXMLStatusParseNotBegun(-2), + kCFXMLStatusParseInProgress(-1), + kCFXMLStatusParseSuccessful(0), + kCFXMLErrorUnexpectedEOF(1), + kCFXMLErrorUnknownEncoding(2), + kCFXMLErrorEncodingConversionFailure(3), + kCFXMLErrorMalformedProcessingInstruction(4), + kCFXMLErrorMalformedDTD(5), + kCFXMLErrorMalformedName(6), + kCFXMLErrorMalformedCDSect(7), + kCFXMLErrorMalformedCloseTag(8), + kCFXMLErrorMalformedStartTag(9), + kCFXMLErrorMalformedDocument(10), + kCFXMLErrorElementlessDocument(11), + kCFXMLErrorMalformedComment(12), + kCFXMLErrorMalformedCharacterReference(13), + kCFXMLErrorMalformedParsedCharacterData(14), + kCFXMLErrorNoData(15); + + final int value; + const CFXMLParserStatusCode(this.value); + + static CFXMLParserStatusCode fromValue(int value) => switch (value) { + -2 => kCFXMLStatusParseNotBegun, + -1 => kCFXMLStatusParseInProgress, + 0 => kCFXMLStatusParseSuccessful, + 1 => kCFXMLErrorUnexpectedEOF, + 2 => kCFXMLErrorUnknownEncoding, + 3 => kCFXMLErrorEncodingConversionFailure, + 4 => kCFXMLErrorMalformedProcessingInstruction, + 5 => kCFXMLErrorMalformedDTD, + 6 => kCFXMLErrorMalformedName, + 7 => kCFXMLErrorMalformedCDSect, + 8 => kCFXMLErrorMalformedCloseTag, + 9 => kCFXMLErrorMalformedStartTag, + 10 => kCFXMLErrorMalformedDocument, + 11 => kCFXMLErrorElementlessDocument, + 12 => kCFXMLErrorMalformedComment, + 13 => kCFXMLErrorMalformedCharacterReference, + 14 => kCFXMLErrorMalformedParsedCharacterData, + 15 => kCFXMLErrorNoData, + _ => throw ArgumentError( + "Unknown value for CFXMLParserStatusCode: $value"), + }; +} + +typedef CFXMLParserCreateXMLStructureCallBackFunction + = ffi.Pointer Function(CFXMLParserRef parser, + CFXMLNodeRef nodeDesc, ffi.Pointer info); +typedef CFXMLParserCreateXMLStructureCallBack = ffi + .Pointer>; +typedef CFXMLParserAddChildCallBackFunction = ffi.Void Function( + CFXMLParserRef parser, + ffi.Pointer parent, + ffi.Pointer child, + ffi.Pointer info); +typedef DartCFXMLParserAddChildCallBackFunction = void Function( + CFXMLParserRef parser, + ffi.Pointer parent, + ffi.Pointer child, + ffi.Pointer info); +typedef CFXMLParserAddChildCallBack + = ffi.Pointer>; +typedef CFXMLParserEndXMLStructureCallBackFunction = ffi.Void Function( + CFXMLParserRef parser, + ffi.Pointer xmlType, + ffi.Pointer info); +typedef DartCFXMLParserEndXMLStructureCallBackFunction = void Function( + CFXMLParserRef parser, + ffi.Pointer xmlType, + ffi.Pointer info); +typedef CFXMLParserEndXMLStructureCallBack = ffi + .Pointer>; +typedef CFXMLParserResolveExternalEntityCallBackFunction = CFDataRef Function( + CFXMLParserRef parser, + ffi.Pointer extID, + ffi.Pointer info); +typedef CFXMLParserResolveExternalEntityCallBack = ffi.Pointer< + ffi.NativeFunction>; +typedef CFXMLParserHandleErrorCallBackFunction = Boolean Function( + CFXMLParserRef parser, CFIndex error, ffi.Pointer info); +typedef DartCFXMLParserHandleErrorCallBackFunction = DartBoolean Function( + CFXMLParserRef parser, + CFXMLParserStatusCode error, + ffi.Pointer info); +typedef CFXMLParserHandleErrorCallBack + = ffi.Pointer>; + +final class CFXMLParserCallBacks extends ffi.Struct { + @CFIndex() + external int version; + + external CFXMLParserCreateXMLStructureCallBack createXMLStructure; + + external CFXMLParserAddChildCallBack addChild; + + external CFXMLParserEndXMLStructureCallBack endXMLStructure; + + external CFXMLParserResolveExternalEntityCallBack resolveExternalEntity; + + external CFXMLParserHandleErrorCallBack handleError; +} + +typedef CFXMLParserRetainCallBackFunction = ffi.Pointer Function( + ffi.Pointer info); +typedef CFXMLParserRetainCallBack + = ffi.Pointer>; +typedef CFXMLParserReleaseCallBackFunction = ffi.Void Function( + ffi.Pointer info); +typedef DartCFXMLParserReleaseCallBackFunction = void Function( + ffi.Pointer info); +typedef CFXMLParserReleaseCallBack + = ffi.Pointer>; +typedef CFXMLParserCopyDescriptionCallBackFunction = CFStringRef Function( + ffi.Pointer info); +typedef CFXMLParserCopyDescriptionCallBack = ffi + .Pointer>; + +final class CFXMLParserContext extends ffi.Struct { + @CFIndex() + external int version; + + external ffi.Pointer info; + + external CFXMLParserRetainCallBack retain; + + external CFXMLParserReleaseCallBack release; + + external CFXMLParserCopyDescriptionCallBack copyDescription; +} + +typedef sint64 = ffi.Int64; +typedef Dartsint64 = int; +typedef uint64 = ffi.Uint64; +typedef Dartuint64 = int; +typedef sint32 = ffi.Int32; +typedef Dartsint32 = int; +typedef sint16 = ffi.Int16; +typedef Dartsint16 = int; +typedef sint8 = ffi.Int8; +typedef Dartsint8 = int; +typedef uint32 = ffi.Uint32; +typedef Dartuint32 = int; +typedef uint16 = ffi.Uint16; +typedef Dartuint16 = int; +typedef uint8 = ffi.Uint8; +typedef Dartuint8 = int; +typedef CSSM_INTPTR = ffi.IntPtr; +typedef DartCSSM_INTPTR = int; +typedef CSSM_SIZE = ffi.Size; +typedef DartCSSM_SIZE = int; + +final class cssm_data extends ffi.Struct { + @ffi.Size() + external int Length; + + external ffi.Pointer Data; +} + +typedef SecAsn1Item = cssm_data; +typedef SecAsn1Oid = cssm_data; + +final class SecAsn1AlgId extends ffi.Struct { + external SecAsn1Oid algorithm; + + external SecAsn1Item parameters; +} + +final class SecAsn1PubKeyInfo extends ffi.Struct { + external SecAsn1AlgId algorithm; + + external SecAsn1Item subjectPublicKey; +} + +final class SecAsn1Template_struct extends ffi.Struct { + @ffi.Uint32() + external int kind; + + @ffi.Uint32() + external int offset; + + external ffi.Pointer sub; + + @ffi.Uint32() + external int size; +} + +typedef SecAsn1Template = SecAsn1Template_struct; +typedef SecAsn1TemplateChooser = ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg, + Boolean enc, + ffi.Pointer buf, + ffi.Size len, + ffi.Pointer dest)>; +typedef SecAsn1TemplateChooserPtr = ffi.Pointer; +typedef CSSM_HANDLE = CSSM_INTPTR; +typedef CSSM_HANDLE_PTR = ffi.Pointer; +typedef CSSM_LONG_HANDLE = uint64; +typedef CSSM_LONG_HANDLE_PTR = ffi.Pointer; +typedef CSSM_MODULE_HANDLE = CSSM_HANDLE; +typedef CSSM_MODULE_HANDLE_PTR = ffi.Pointer; +typedef CSSM_CC_HANDLE = CSSM_LONG_HANDLE; +typedef CSSM_CSP_HANDLE = CSSM_MODULE_HANDLE; +typedef CSSM_TP_HANDLE = CSSM_MODULE_HANDLE; +typedef CSSM_AC_HANDLE = CSSM_MODULE_HANDLE; +typedef CSSM_CL_HANDLE = CSSM_MODULE_HANDLE; +typedef CSSM_DL_HANDLE = CSSM_MODULE_HANDLE; +typedef CSSM_DB_HANDLE = CSSM_MODULE_HANDLE; +typedef CSSM_BOOL = sint32; +typedef CSSM_RETURN = sint32; +typedef CSSM_DATA_PTR = ffi.Pointer; + +final class cssm_guid extends ffi.Struct { + @uint32() + external int Data1; + + @uint16() + external int Data2; + + @uint16() + external int Data3; + + @ffi.Array.multi([8]) + external ffi.Array Data4; +} + +typedef CSSM_GUID = cssm_guid; +typedef CSSM_GUID_PTR = ffi.Pointer; +typedef CSSM_BITMASK = uint32; +typedef CSSM_KEY_HIERARCHY = CSSM_BITMASK; +typedef CSSM_PVC_MODE = CSSM_BITMASK; +typedef CSSM_PRIVILEGE_SCOPE = uint32; + +final class cssm_version extends ffi.Struct { + @uint32() + external int Major; + + @uint32() + external int Minor; +} + +typedef CSSM_VERSION = cssm_version; +typedef CSSM_VERSION_PTR = ffi.Pointer; +typedef CSSM_SERVICE_MASK = uint32; +typedef CSSM_SERVICE_TYPE = CSSM_SERVICE_MASK; + +final class cssm_subservice_uid extends ffi.Struct { + external CSSM_GUID Guid; + + external CSSM_VERSION Version; + + @uint32() + external int SubserviceId; + + @CSSM_SERVICE_TYPE() + external int SubserviceType; +} + +typedef CSSM_SUBSERVICE_UID = cssm_subservice_uid; +typedef CSSM_SUBSERVICE_UID_PTR = ffi.Pointer; +typedef CSSM_MODULE_EVENT = uint32; +typedef CSSM_MODULE_EVENT_PTR = ffi.Pointer; +typedef CSSM_API_ModuleEventHandlerFunction = CSSM_RETURN Function( + ffi.Pointer ModuleGuid, + ffi.Pointer AppNotifyCallbackCtx, + uint32 SubserviceId, + CSSM_SERVICE_TYPE ServiceType, + CSSM_MODULE_EVENT EventType); +typedef DartCSSM_API_ModuleEventHandlerFunction = Dartsint32 Function( + ffi.Pointer ModuleGuid, + ffi.Pointer AppNotifyCallbackCtx, + Dartuint32 SubserviceId, + Dartuint32 ServiceType, + Dartuint32 EventType); +typedef CSSM_API_ModuleEventHandler + = ffi.Pointer>; +typedef CSSM_ATTACH_FLAGS = uint32; +typedef CSSM_PRIVILEGE = uint64; +typedef CSSM_USEE_TAG = CSSM_PRIVILEGE; +typedef CSSM_NET_ADDRESS_TYPE = uint32; + +final class cssm_net_address extends ffi.Struct { + @CSSM_NET_ADDRESS_TYPE() + external int AddressType; + + external SecAsn1Item Address; +} + +typedef CSSM_NET_ADDRESS = cssm_net_address; +typedef CSSM_NET_ADDRESS_PTR = ffi.Pointer; +typedef CSSM_NET_PROTOCOL = uint32; +typedef CSSM_CALLBACKFunction = CSSM_RETURN Function( + CSSM_DATA_PTR OutData, ffi.Pointer CallerCtx); +typedef DartCSSM_CALLBACKFunction = Dartsint32 Function( + CSSM_DATA_PTR OutData, ffi.Pointer CallerCtx); +typedef CSSM_CALLBACK = ffi.Pointer>; + +final class cssm_crypto_data extends ffi.Struct { + external SecAsn1Item Param; + + external CSSM_CALLBACK Callback; + + external ffi.Pointer CallerCtx; +} + +typedef CSSM_CRYPTO_DATA = cssm_crypto_data; +typedef CSSM_CRYPTO_DATA_PTR = ffi.Pointer; +typedef CSSM_WORDID_TYPE = sint32; +typedef CSSM_LIST_ELEMENT_TYPE = uint32; +typedef CSSM_LIST_ELEMENT_TYPE_PTR = ffi.Pointer; +typedef CSSM_LIST_TYPE = uint32; +typedef CSSM_LIST_TYPE_PTR = ffi.Pointer; +typedef CSSM_LIST_ELEMENT_PTR = ffi.Pointer; + +final class cssm_list extends ffi.Struct { + @CSSM_LIST_TYPE() + external int ListType; + + external CSSM_LIST_ELEMENT_PTR Head; + + external CSSM_LIST_ELEMENT_PTR Tail; +} + +typedef CSSM_LIST = cssm_list; + +final class UnnamedUnion2 extends ffi.Union { + external CSSM_LIST Sublist; + + external SecAsn1Item Word; +} + +final class cssm_list_element extends ffi.Struct { + external ffi.Pointer NextElement; + + @CSSM_WORDID_TYPE() + external int WordID; + + @CSSM_LIST_ELEMENT_TYPE() + external int ElementType; + + external UnnamedUnion2 Element; +} + +typedef CSSM_LIST_PTR = ffi.Pointer; +typedef CSSM_LIST_ELEMENT = cssm_list_element; + +final class CSSM_TUPLE extends ffi.Struct { + external CSSM_LIST Issuer; + + external CSSM_LIST Subject; + + @CSSM_BOOL() + external int Delegate; + + external CSSM_LIST AuthorizationTag; + + external CSSM_LIST ValidityPeriod; +} + +typedef CSSM_TUPLE_PTR = ffi.Pointer; + +final class cssm_tuplegroup extends ffi.Struct { + @uint32() + external int NumberOfTuples; + + external CSSM_TUPLE_PTR Tuples; +} + +typedef CSSM_TUPLEGROUP = cssm_tuplegroup; +typedef CSSM_TUPLEGROUP_PTR = ffi.Pointer; +typedef CSSM_SAMPLE_TYPE = CSSM_WORDID_TYPE; + +final class cssm_sample extends ffi.Struct { + external CSSM_LIST TypedSample; + + external ffi.Pointer Verifier; +} + +typedef CSSM_SAMPLE = cssm_sample; +typedef CSSM_SAMPLE_PTR = ffi.Pointer; + +final class cssm_samplegroup extends ffi.Struct { + @uint32() + external int NumberOfSamples; + + external ffi.Pointer Samples; +} + +typedef CSSM_SAMPLEGROUP = cssm_samplegroup; +typedef CSSM_SAMPLEGROUP_PTR = ffi.Pointer; +typedef CSSM_MALLOCFunction = ffi.Pointer Function( + CSSM_SIZE size, ffi.Pointer allocref); +typedef DartCSSM_MALLOCFunction = ffi.Pointer Function( + DartCSSM_SIZE size, ffi.Pointer allocref); +typedef CSSM_MALLOC = ffi.Pointer>; +typedef CSSM_FREEFunction = ffi.Void Function( + ffi.Pointer memblock, ffi.Pointer allocref); +typedef DartCSSM_FREEFunction = void Function( + ffi.Pointer memblock, ffi.Pointer allocref); +typedef CSSM_FREE = ffi.Pointer>; +typedef CSSM_REALLOCFunction = ffi.Pointer Function( + ffi.Pointer memblock, + CSSM_SIZE size, + ffi.Pointer allocref); +typedef DartCSSM_REALLOCFunction = ffi.Pointer Function( + ffi.Pointer memblock, + DartCSSM_SIZE size, + ffi.Pointer allocref); +typedef CSSM_REALLOC = ffi.Pointer>; +typedef CSSM_CALLOCFunction = ffi.Pointer Function( + uint32 num, CSSM_SIZE size, ffi.Pointer allocref); +typedef DartCSSM_CALLOCFunction = ffi.Pointer Function( + Dartuint32 num, DartCSSM_SIZE size, ffi.Pointer allocref); +typedef CSSM_CALLOC = ffi.Pointer>; + +final class cssm_memory_funcs extends ffi.Struct { + external CSSM_MALLOC malloc_func; + + external CSSM_FREE free_func; + + external CSSM_REALLOC realloc_func; + + external CSSM_CALLOC calloc_func; + + external ffi.Pointer AllocRef; +} + +typedef CSSM_MEMORY_FUNCS = cssm_memory_funcs; +typedef CSSM_MEMORY_FUNCS_PTR = ffi.Pointer; +typedef CSSM_API_MEMORY_FUNCS = CSSM_MEMORY_FUNCS; +typedef CSSM_API_MEMORY_FUNCS_PTR = ffi.Pointer; +typedef CSSM_CHALLENGE_CALLBACKFunction = CSSM_RETURN Function( + ffi.Pointer Challenge, + CSSM_SAMPLEGROUP_PTR Response, + ffi.Pointer CallerCtx, + ffi.Pointer MemFuncs); +typedef DartCSSM_CHALLENGE_CALLBACKFunction = Dartsint32 Function( + ffi.Pointer Challenge, + CSSM_SAMPLEGROUP_PTR Response, + ffi.Pointer CallerCtx, + ffi.Pointer MemFuncs); +typedef CSSM_CHALLENGE_CALLBACK + = ffi.Pointer>; +typedef CSSM_CERT_TYPE = uint32; +typedef CSSM_CERT_TYPE_PTR = ffi.Pointer; +typedef CSSM_CERT_ENCODING = uint32; +typedef CSSM_CERT_ENCODING_PTR = ffi.Pointer; + +final class cssm_encoded_cert extends ffi.Struct { + @CSSM_CERT_TYPE() + external int CertType; + + @CSSM_CERT_ENCODING() + external int CertEncoding; + + external SecAsn1Item CertBlob; +} + +typedef CSSM_ENCODED_CERT = cssm_encoded_cert; +typedef CSSM_ENCODED_CERT_PTR = ffi.Pointer; +typedef CSSM_CERT_PARSE_FORMAT = uint32; +typedef CSSM_CERT_PARSE_FORMAT_PTR = ffi.Pointer; + +final class cssm_parsed_cert extends ffi.Struct { + @CSSM_CERT_TYPE() + external int CertType; + + @CSSM_CERT_PARSE_FORMAT() + external int ParsedCertFormat; + + external ffi.Pointer ParsedCert; +} + +typedef CSSM_PARSED_CERT = cssm_parsed_cert; +typedef CSSM_PARSED_CERT_PTR = ffi.Pointer; + +final class cssm_cert_pair extends ffi.Struct { + external CSSM_ENCODED_CERT EncodedCert; + + external CSSM_PARSED_CERT ParsedCert; +} + +typedef CSSM_CERT_PAIR = cssm_cert_pair; +typedef CSSM_CERT_PAIR_PTR = ffi.Pointer; +typedef CSSM_CERTGROUP_TYPE = uint32; +typedef CSSM_CERTGROUP_TYPE_PTR = ffi.Pointer; + +final class UnnamedUnion3 extends ffi.Union { + external CSSM_DATA_PTR CertList; + + external CSSM_ENCODED_CERT_PTR EncodedCertList; + + external CSSM_PARSED_CERT_PTR ParsedCertList; + + external CSSM_CERT_PAIR_PTR PairCertList; +} + +final class cssm_certgroup extends ffi.Struct { + @CSSM_CERT_TYPE() + external int CertType; + + @CSSM_CERT_ENCODING() + external int CertEncoding; + + @uint32() + external int NumCerts; + + external UnnamedUnion3 GroupList; + + @CSSM_CERTGROUP_TYPE() + external int CertGroupType; + + external ffi.Pointer Reserved; +} + +typedef CSSM_CERTGROUP = cssm_certgroup; +typedef CSSM_CERTGROUP_PTR = ffi.Pointer; + +final class cssm_base_certs extends ffi.Struct { + @CSSM_TP_HANDLE() + external int TPHandle; + + @CSSM_CL_HANDLE() + external int CLHandle; + + external CSSM_CERTGROUP Certs; +} + +typedef CSSM_BASE_CERTS = cssm_base_certs; +typedef CSSM_BASE_CERTS_PTR = ffi.Pointer; + +final class cssm_access_credentials extends ffi.Struct { + @ffi.Array.multi([68]) + external ffi.Array EntryTag; + + external CSSM_BASE_CERTS BaseCerts; + + external CSSM_SAMPLEGROUP Samples; + + external CSSM_CHALLENGE_CALLBACK Callback; + + external ffi.Pointer CallerCtx; +} + +typedef CSSM_ACCESS_CREDENTIALS = cssm_access_credentials; +typedef CSSM_ACCESS_CREDENTIALS_PTR = ffi.Pointer; +typedef CSSM_ACL_SUBJECT_TYPE = sint32; +typedef CSSM_ACL_AUTHORIZATION_TAG = sint32; + +final class cssm_authorizationgroup extends ffi.Struct { + @uint32() + external int NumberOfAuthTags; + + external ffi.Pointer AuthTags; +} + +typedef CSSM_AUTHORIZATIONGROUP = cssm_authorizationgroup; +typedef CSSM_AUTHORIZATIONGROUP_PTR = ffi.Pointer; + +final class cssm_acl_validity_period extends ffi.Struct { + external SecAsn1Item StartDate; + + external SecAsn1Item EndDate; +} + +typedef CSSM_ACL_VALIDITY_PERIOD = cssm_acl_validity_period; +typedef CSSM_ACL_VALIDITY_PERIOD_PTR = ffi.Pointer; + +final class cssm_acl_entry_prototype extends ffi.Struct { + external CSSM_LIST TypedSubject; + + @CSSM_BOOL() + external int Delegate; + + external CSSM_AUTHORIZATIONGROUP Authorization; + + external CSSM_ACL_VALIDITY_PERIOD TimeRange; + + @ffi.Array.multi([68]) + external ffi.Array EntryTag; +} + +typedef CSSM_ACL_ENTRY_PROTOTYPE = cssm_acl_entry_prototype; +typedef CSSM_ACL_ENTRY_PROTOTYPE_PTR = ffi.Pointer; + +final class cssm_acl_owner_prototype extends ffi.Struct { + external CSSM_LIST TypedSubject; + + @CSSM_BOOL() + external int Delegate; +} + +typedef CSSM_ACL_OWNER_PROTOTYPE = cssm_acl_owner_prototype; +typedef CSSM_ACL_OWNER_PROTOTYPE_PTR = ffi.Pointer; +typedef CSSM_ACL_SUBJECT_CALLBACKFunction = CSSM_RETURN Function( + ffi.Pointer SubjectRequest, + CSSM_LIST_PTR SubjectResponse, + ffi.Pointer CallerContext, + ffi.Pointer MemFuncs); +typedef DartCSSM_ACL_SUBJECT_CALLBACKFunction = Dartsint32 Function( + ffi.Pointer SubjectRequest, + CSSM_LIST_PTR SubjectResponse, + ffi.Pointer CallerContext, + ffi.Pointer MemFuncs); +typedef CSSM_ACL_SUBJECT_CALLBACK + = ffi.Pointer>; + +final class cssm_acl_entry_input extends ffi.Struct { + external CSSM_ACL_ENTRY_PROTOTYPE Prototype; + + external CSSM_ACL_SUBJECT_CALLBACK Callback; + + external ffi.Pointer CallerContext; +} + +typedef CSSM_ACL_ENTRY_INPUT = cssm_acl_entry_input; +typedef CSSM_ACL_ENTRY_INPUT_PTR = ffi.Pointer; + +final class cssm_resource_control_context extends ffi.Struct { + external CSSM_ACCESS_CREDENTIALS_PTR AccessCred; + + external CSSM_ACL_ENTRY_INPUT InitialAclEntry; +} + +typedef CSSM_RESOURCE_CONTROL_CONTEXT = cssm_resource_control_context; +typedef CSSM_RESOURCE_CONTROL_CONTEXT_PTR + = ffi.Pointer; +typedef CSSM_ACL_HANDLE = CSSM_HANDLE; + +final class cssm_acl_entry_info extends ffi.Struct { + external CSSM_ACL_ENTRY_PROTOTYPE EntryPublicInfo; + + @CSSM_ACL_HANDLE() + external int EntryHandle; +} + +typedef CSSM_ACL_ENTRY_INFO = cssm_acl_entry_info; +typedef CSSM_ACL_ENTRY_INFO_PTR = ffi.Pointer; +typedef CSSM_ACL_EDIT_MODE = uint32; + +final class cssm_acl_edit extends ffi.Struct { + @CSSM_ACL_EDIT_MODE() + external int EditMode; + + @CSSM_ACL_HANDLE() + external int OldEntryHandle; + + external ffi.Pointer NewEntry; +} + +typedef CSSM_ACL_EDIT = cssm_acl_edit; +typedef CSSM_ACL_EDIT_PTR = ffi.Pointer; +typedef CSSM_PROC_ADDRFunction = ffi.Void Function(); +typedef DartCSSM_PROC_ADDRFunction = void Function(); +typedef CSSM_PROC_ADDR + = ffi.Pointer>; +typedef CSSM_PROC_ADDR_PTR = ffi.Pointer; + +final class cssm_func_name_addr extends ffi.Struct { + @ffi.Array.multi([68]) + external ffi.Array Name; + + external CSSM_PROC_ADDR Address; +} + +typedef CSSM_FUNC_NAME_ADDR = cssm_func_name_addr; +typedef CSSM_FUNC_NAME_ADDR_PTR = ffi.Pointer; + +final class cssm_date extends ffi.Struct { + @ffi.Array.multi([4]) + external ffi.Array Year; + + @ffi.Array.multi([2]) + external ffi.Array Month; + + @ffi.Array.multi([2]) + external ffi.Array Day; +} + +typedef CSSM_DATE = cssm_date; +typedef CSSM_DATE_PTR = ffi.Pointer; + +final class cssm_range extends ffi.Struct { + @uint32() + external int Min; + + @uint32() + external int Max; +} + +typedef CSSM_RANGE = cssm_range; +typedef CSSM_RANGE_PTR = ffi.Pointer; + +final class cssm_query_size_data extends ffi.Struct { + @uint32() + external int SizeInputBlock; + + @uint32() + external int SizeOutputBlock; +} + +typedef CSSM_QUERY_SIZE_DATA = cssm_query_size_data; +typedef CSSM_QUERY_SIZE_DATA_PTR = ffi.Pointer; +typedef CSSM_HEADERVERSION = uint32; + +final class cssm_key_size extends ffi.Struct { + @uint32() + external int LogicalKeySizeInBits; + + @uint32() + external int EffectiveKeySizeInBits; +} + +typedef CSSM_KEY_SIZE = cssm_key_size; +typedef CSSM_KEY_SIZE_PTR = ffi.Pointer; +typedef CSSM_KEYBLOB_TYPE = uint32; +typedef CSSM_KEYBLOB_FORMAT = uint32; +typedef CSSM_KEYCLASS = uint32; +typedef CSSM_KEYATTR_FLAGS = uint32; +typedef CSSM_KEYUSE = uint32; +typedef CSSM_ALGORITHMS = uint32; +typedef CSSM_ENCRYPT_MODE = uint32; + +final class cssm_keyheader extends ffi.Struct { + @CSSM_HEADERVERSION() + external int HeaderVersion; + + external CSSM_GUID CspId; + + @CSSM_KEYBLOB_TYPE() + external int BlobType; + + @CSSM_KEYBLOB_FORMAT() + external int Format; + + @CSSM_ALGORITHMS() + external int AlgorithmId; + + @CSSM_KEYCLASS() + external int KeyClass; + + @uint32() + external int LogicalKeySizeInBits; + + @CSSM_KEYATTR_FLAGS() + external int KeyAttr; + + @CSSM_KEYUSE() + external int KeyUsage; + + external CSSM_DATE StartDate; + + external CSSM_DATE EndDate; + + @CSSM_ALGORITHMS() + external int WrapAlgorithmId; + + @CSSM_ENCRYPT_MODE() + external int WrapMode; + + @uint32() + external int Reserved; +} + +typedef CSSM_KEYHEADER = cssm_keyheader; +typedef CSSM_KEYHEADER_PTR = ffi.Pointer; + +final class cssm_key extends ffi.Struct { + external CSSM_KEYHEADER KeyHeader; + + external SecAsn1Item KeyData; +} + +typedef CSSM_KEY = cssm_key; +typedef CSSM_KEY_PTR = ffi.Pointer; +typedef CSSM_WRAP_KEY = CSSM_KEY; +typedef CSSM_WRAP_KEY_PTR = ffi.Pointer; +typedef CSSM_CSPTYPE = uint32; + +final class cssm_dl_db_handle extends ffi.Struct { + @CSSM_DL_HANDLE() + external int DLHandle; + + @CSSM_DB_HANDLE() + external int DBHandle; +} + +typedef CSSM_DL_DB_HANDLE = cssm_dl_db_handle; +typedef CSSM_DL_DB_HANDLE_PTR = ffi.Pointer; +typedef CSSM_CONTEXT_TYPE = uint32; +typedef CSSM_ATTRIBUTE_TYPE = uint32; +typedef CSSM_PADDING = uint32; +typedef CSSM_KEY_TYPE = CSSM_ALGORITHMS; + +final class cssm_kr_profile extends ffi.Opaque {} + +final class cssm_context_attribute_value extends ffi.Union { + external ffi.Pointer String; + + @uint32() + external int Uint32; + + external CSSM_ACCESS_CREDENTIALS_PTR AccessCredentials; + + external CSSM_KEY_PTR Key; + + external CSSM_DATA_PTR Data; + + @CSSM_PADDING() + external int Padding; + + external CSSM_DATE_PTR Date; + + external CSSM_RANGE_PTR Range; + + external CSSM_CRYPTO_DATA_PTR CryptoData; + + external CSSM_VERSION_PTR Version; + + external CSSM_DL_DB_HANDLE_PTR DLDBHandle; + + external ffi.Pointer KRProfile; +} + +final class cssm_context_attribute extends ffi.Struct { + @CSSM_ATTRIBUTE_TYPE() + external int AttributeType; + + @uint32() + external int AttributeLength; + + external cssm_context_attribute_value Attribute; +} + +typedef CSSM_CONTEXT_ATTRIBUTE = cssm_context_attribute; +typedef CSSM_CONTEXT_ATTRIBUTE_PTR = ffi.Pointer; + +final class cssm_context extends ffi.Struct { + @CSSM_CONTEXT_TYPE() + external int ContextType; + + @CSSM_ALGORITHMS() + external int AlgorithmType; + + @uint32() + external int NumberOfAttributes; + + external CSSM_CONTEXT_ATTRIBUTE_PTR ContextAttributes; + + @CSSM_CSP_HANDLE() + external int CSPHandle; + + @CSSM_BOOL() + external int Privileged; + + @uint32() + external int EncryptionProhibited; + + @uint32() + external int WorkFactor; + + @uint32() + external int Reserved; +} + +typedef CSSM_CONTEXT = cssm_context; +typedef CSSM_CONTEXT_PTR = ffi.Pointer; +typedef CSSM_SC_FLAGS = uint32; +typedef CSSM_CSP_READER_FLAGS = uint32; +typedef CSSM_CSP_FLAGS = uint32; +typedef CSSM_PKCS_OAEP_MGF = uint32; +typedef CSSM_PKCS_OAEP_PSOURCE = uint32; + +final class cssm_pkcs1_oaep_params extends ffi.Struct { + @uint32() + external int HashAlgorithm; + + external SecAsn1Item HashParams; + + @CSSM_PKCS_OAEP_MGF() + external int MGF; + + external SecAsn1Item MGFParams; + + @CSSM_PKCS_OAEP_PSOURCE() + external int PSource; + + external SecAsn1Item PSourceParams; +} + +typedef CSSM_PKCS1_OAEP_PARAMS = cssm_pkcs1_oaep_params; +typedef CSSM_PKCS1_OAEP_PARAMS_PTR = ffi.Pointer; + +final class cssm_csp_operational_statistics extends ffi.Struct { + @CSSM_BOOL() + external int UserAuthenticated; + + @CSSM_CSP_FLAGS() + external int DeviceFlags; + + @uint32() + external int TokenMaxSessionCount; + + @uint32() + external int TokenOpenedSessionCount; + + @uint32() + external int TokenMaxRWSessionCount; + + @uint32() + external int TokenOpenedRWSessionCount; + + @uint32() + external int TokenTotalPublicMem; + + @uint32() + external int TokenFreePublicMem; + + @uint32() + external int TokenTotalPrivateMem; + + @uint32() + external int TokenFreePrivateMem; +} + +typedef CSSM_CSP_OPERATIONAL_STATISTICS = cssm_csp_operational_statistics; +typedef CSSM_CSP_OPERATIONAL_STATISTICS_PTR + = ffi.Pointer; + +final class cssm_pkcs5_pbkdf1_params extends ffi.Struct { + external SecAsn1Item Passphrase; + + external SecAsn1Item InitVector; +} + +typedef CSSM_PKCS5_PBKDF1_PARAMS = cssm_pkcs5_pbkdf1_params; +typedef CSSM_PKCS5_PBKDF1_PARAMS_PTR = ffi.Pointer; +typedef CSSM_PKCS5_PBKDF2_PRF = uint32; + +final class cssm_pkcs5_pbkdf2_params extends ffi.Struct { + external SecAsn1Item Passphrase; + + @CSSM_PKCS5_PBKDF2_PRF() + external int PseudoRandomFunction; +} + +typedef CSSM_PKCS5_PBKDF2_PARAMS = cssm_pkcs5_pbkdf2_params; +typedef CSSM_PKCS5_PBKDF2_PARAMS_PTR = ffi.Pointer; + +final class cssm_kea_derive_params extends ffi.Struct { + external SecAsn1Item Rb; + + external SecAsn1Item Yb; +} + +typedef CSSM_KEA_DERIVE_PARAMS = cssm_kea_derive_params; +typedef CSSM_KEA_DERIVE_PARAMS_PTR = ffi.Pointer; + +final class cssm_tp_authority_id extends ffi.Struct { + external ffi.Pointer AuthorityCert; + + external CSSM_NET_ADDRESS_PTR AuthorityLocation; +} + +typedef CSSM_TP_AUTHORITY_ID = cssm_tp_authority_id; +typedef CSSM_TP_AUTHORITY_ID_PTR = ffi.Pointer; +typedef CSSM_TP_AUTHORITY_REQUEST_TYPE = uint32; +typedef CSSM_TP_AUTHORITY_REQUEST_TYPE_PTR = ffi.Pointer; +typedef CSSM_TP_VERIFICATION_RESULTS_CALLBACKFunction = CSSM_RETURN Function( + CSSM_MODULE_HANDLE ModuleHandle, + ffi.Pointer CallerCtx, + CSSM_DATA_PTR VerifiedCert); +typedef DartCSSM_TP_VERIFICATION_RESULTS_CALLBACKFunction = Dartsint32 Function( + DartCSSM_INTPTR ModuleHandle, + ffi.Pointer CallerCtx, + CSSM_DATA_PTR VerifiedCert); +typedef CSSM_TP_VERIFICATION_RESULTS_CALLBACK = ffi + .Pointer>; +typedef CSSM_OID_PTR = ffi.Pointer; + +final class cssm_field extends ffi.Struct { + external SecAsn1Oid FieldOid; + + external SecAsn1Item FieldValue; +} + +typedef CSSM_FIELD = cssm_field; +typedef CSSM_FIELD_PTR = ffi.Pointer; + +final class cssm_tp_policyinfo extends ffi.Struct { + @uint32() + external int NumberOfPolicyIds; + + external CSSM_FIELD_PTR PolicyIds; + + external ffi.Pointer PolicyControl; +} + +typedef CSSM_TP_POLICYINFO = cssm_tp_policyinfo; +typedef CSSM_TP_POLICYINFO_PTR = ffi.Pointer; +typedef CSSM_TP_SERVICES = uint32; +typedef CSSM_TP_ACTION = uint32; +typedef CSSM_TP_STOP_ON = uint32; +typedef CSSM_TIMESTRING = ffi.Pointer; + +final class cssm_dl_db_list extends ffi.Struct { + @uint32() + external int NumHandles; + + external CSSM_DL_DB_HANDLE_PTR DLDBHandle; +} + +typedef CSSM_DL_DB_LIST = cssm_dl_db_list; +typedef CSSM_DL_DB_LIST_PTR = ffi.Pointer; + +final class cssm_tp_callerauth_context extends ffi.Struct { + external CSSM_TP_POLICYINFO Policy; + + external CSSM_TIMESTRING VerifyTime; + + @CSSM_TP_STOP_ON() + external int VerificationAbortOn; + + external CSSM_TP_VERIFICATION_RESULTS_CALLBACK CallbackWithVerifiedCert; + + @uint32() + external int NumberOfAnchorCerts; + + external CSSM_DATA_PTR AnchorCerts; + + external CSSM_DL_DB_LIST_PTR DBList; + + external CSSM_ACCESS_CREDENTIALS_PTR CallerCredentials; +} + +typedef CSSM_TP_CALLERAUTH_CONTEXT = cssm_tp_callerauth_context; +typedef CSSM_TP_CALLERAUTH_CONTEXT_PTR + = ffi.Pointer; +typedef CSSM_CRL_PARSE_FORMAT = uint32; +typedef CSSM_CRL_PARSE_FORMAT_PTR = ffi.Pointer; +typedef CSSM_CRL_TYPE = uint32; +typedef CSSM_CRL_TYPE_PTR = ffi.Pointer; +typedef CSSM_CRL_ENCODING = uint32; +typedef CSSM_CRL_ENCODING_PTR = ffi.Pointer; + +final class cssm_encoded_crl extends ffi.Struct { + @CSSM_CRL_TYPE() + external int CrlType; + + @CSSM_CRL_ENCODING() + external int CrlEncoding; + + external SecAsn1Item CrlBlob; +} + +typedef CSSM_ENCODED_CRL = cssm_encoded_crl; +typedef CSSM_ENCODED_CRL_PTR = ffi.Pointer; + +final class cssm_parsed_crl extends ffi.Struct { + @CSSM_CRL_TYPE() + external int CrlType; + + @CSSM_CRL_PARSE_FORMAT() + external int ParsedCrlFormat; + + external ffi.Pointer ParsedCrl; +} + +typedef CSSM_PARSED_CRL = cssm_parsed_crl; +typedef CSSM_PARSED_CRL_PTR = ffi.Pointer; + +final class cssm_crl_pair extends ffi.Struct { + external CSSM_ENCODED_CRL EncodedCrl; + + external CSSM_PARSED_CRL ParsedCrl; +} + +typedef CSSM_CRL_PAIR = cssm_crl_pair; +typedef CSSM_CRL_PAIR_PTR = ffi.Pointer; +typedef CSSM_CRLGROUP_TYPE = uint32; +typedef CSSM_CRLGROUP_TYPE_PTR = ffi.Pointer; + +final class UnnamedUnion4 extends ffi.Union { + external CSSM_DATA_PTR CrlList; + + external CSSM_ENCODED_CRL_PTR EncodedCrlList; + + external CSSM_PARSED_CRL_PTR ParsedCrlList; + + external CSSM_CRL_PAIR_PTR PairCrlList; +} + +final class cssm_crlgroup extends ffi.Struct { + @CSSM_CRL_TYPE() + external int CrlType; + + @CSSM_CRL_ENCODING() + external int CrlEncoding; + + @uint32() + external int NumberOfCrls; + + external UnnamedUnion4 GroupCrlList; + + @CSSM_CRLGROUP_TYPE() + external int CrlGroupType; +} + +typedef CSSM_CRLGROUP = cssm_crlgroup; +typedef CSSM_CRLGROUP_PTR = ffi.Pointer; + +final class cssm_fieldgroup extends ffi.Struct { + @ffi.Int() + external int NumberOfFields; + + external CSSM_FIELD_PTR Fields; +} + +typedef CSSM_FIELDGROUP = cssm_fieldgroup; +typedef CSSM_FIELDGROUP_PTR = ffi.Pointer; +typedef CSSM_EVIDENCE_FORM = uint32; + +final class cssm_evidence extends ffi.Struct { + @CSSM_EVIDENCE_FORM() + external int EvidenceForm; + + external ffi.Pointer Evidence; +} + +typedef CSSM_EVIDENCE = cssm_evidence; +typedef CSSM_EVIDENCE_PTR = ffi.Pointer; + +final class cssm_tp_verify_context extends ffi.Struct { + @CSSM_TP_ACTION() + external int Action; + + external SecAsn1Item ActionData; + + external CSSM_CRLGROUP Crls; + + external CSSM_TP_CALLERAUTH_CONTEXT_PTR Cred; +} + +typedef CSSM_TP_VERIFY_CONTEXT = cssm_tp_verify_context; +typedef CSSM_TP_VERIFY_CONTEXT_PTR = ffi.Pointer; + +final class cssm_tp_verify_context_result extends ffi.Struct { + @uint32() + external int NumberOfEvidences; + + external CSSM_EVIDENCE_PTR Evidence; +} + +typedef CSSM_TP_VERIFY_CONTEXT_RESULT = cssm_tp_verify_context_result; +typedef CSSM_TP_VERIFY_CONTEXT_RESULT_PTR + = ffi.Pointer; + +final class cssm_tp_request_set extends ffi.Struct { + @uint32() + external int NumberOfRequests; + + external ffi.Pointer Requests; +} + +typedef CSSM_TP_REQUEST_SET = cssm_tp_request_set; +typedef CSSM_TP_REQUEST_SET_PTR = ffi.Pointer; + +final class cssm_tp_result_set extends ffi.Struct { + @uint32() + external int NumberOfResults; + + external ffi.Pointer Results; +} + +typedef CSSM_TP_RESULT_SET = cssm_tp_result_set; +typedef CSSM_TP_RESULT_SET_PTR = ffi.Pointer; +typedef CSSM_TP_CONFIRM_STATUS = uint32; +typedef CSSM_TP_CONFIRM_STATUS_PTR = ffi.Pointer; + +final class cssm_tp_confirm_response extends ffi.Struct { + @uint32() + external int NumberOfResponses; + + external CSSM_TP_CONFIRM_STATUS_PTR Responses; +} + +typedef CSSM_TP_CONFIRM_RESPONSE = cssm_tp_confirm_response; +typedef CSSM_TP_CONFIRM_RESPONSE_PTR = ffi.Pointer; + +final class cssm_tp_certissue_input extends ffi.Struct { + external CSSM_SUBSERVICE_UID CSPSubserviceUid; + + @CSSM_CL_HANDLE() + external int CLHandle; + + @uint32() + external int NumberOfTemplateFields; + + external CSSM_FIELD_PTR SubjectCertFields; + + @CSSM_TP_SERVICES() + external int MoreServiceRequests; + + @uint32() + external int NumberOfServiceControls; + + external CSSM_FIELD_PTR ServiceControls; + + external CSSM_ACCESS_CREDENTIALS_PTR UserCredentials; +} + +typedef CSSM_TP_CERTISSUE_INPUT = cssm_tp_certissue_input; +typedef CSSM_TP_CERTISSUE_INPUT_PTR = ffi.Pointer; +typedef CSSM_TP_CERTISSUE_STATUS = uint32; + +final class cssm_tp_certissue_output extends ffi.Struct { + @CSSM_TP_CERTISSUE_STATUS() + external int IssueStatus; + + external CSSM_CERTGROUP_PTR CertGroup; + + @CSSM_TP_SERVICES() + external int PerformedServiceRequests; +} + +typedef CSSM_TP_CERTISSUE_OUTPUT = cssm_tp_certissue_output; +typedef CSSM_TP_CERTISSUE_OUTPUT_PTR = ffi.Pointer; +typedef CSSM_TP_CERTCHANGE_ACTION = uint32; +typedef CSSM_TP_CERTCHANGE_REASON = uint32; + +final class cssm_tp_certchange_input extends ffi.Struct { + @CSSM_TP_CERTCHANGE_ACTION() + external int Action; + + @CSSM_TP_CERTCHANGE_REASON() + external int Reason; + + @CSSM_CL_HANDLE() + external int CLHandle; + + external CSSM_DATA_PTR Cert; + + external CSSM_FIELD_PTR ChangeInfo; + + external CSSM_TIMESTRING StartTime; + + external CSSM_ACCESS_CREDENTIALS_PTR CallerCredentials; +} + +typedef CSSM_TP_CERTCHANGE_INPUT = cssm_tp_certchange_input; +typedef CSSM_TP_CERTCHANGE_INPUT_PTR = ffi.Pointer; +typedef CSSM_TP_CERTCHANGE_STATUS = uint32; + +final class cssm_tp_certchange_output extends ffi.Struct { + @CSSM_TP_CERTCHANGE_STATUS() + external int ActionStatus; + + external CSSM_FIELD RevokeInfo; +} + +typedef CSSM_TP_CERTCHANGE_OUTPUT = cssm_tp_certchange_output; +typedef CSSM_TP_CERTCHANGE_OUTPUT_PTR = ffi.Pointer; + +final class cssm_tp_certverify_input extends ffi.Struct { + @CSSM_CL_HANDLE() + external int CLHandle; + + external CSSM_DATA_PTR Cert; + + external CSSM_TP_VERIFY_CONTEXT_PTR VerifyContext; +} + +typedef CSSM_TP_CERTVERIFY_INPUT = cssm_tp_certverify_input; +typedef CSSM_TP_CERTVERIFY_INPUT_PTR = ffi.Pointer; +typedef CSSM_TP_CERTVERIFY_STATUS = uint32; + +final class cssm_tp_certverify_output extends ffi.Struct { + @CSSM_TP_CERTVERIFY_STATUS() + external int VerifyStatus; + + @uint32() + external int NumberOfEvidence; + + external CSSM_EVIDENCE_PTR Evidence; +} + +typedef CSSM_TP_CERTVERIFY_OUTPUT = cssm_tp_certverify_output; +typedef CSSM_TP_CERTVERIFY_OUTPUT_PTR = ffi.Pointer; + +final class cssm_tp_certnotarize_input extends ffi.Struct { + @CSSM_CL_HANDLE() + external int CLHandle; + + @uint32() + external int NumberOfFields; + + external CSSM_FIELD_PTR MoreFields; + + external CSSM_FIELD_PTR SignScope; + + @uint32() + external int ScopeSize; + + @CSSM_TP_SERVICES() + external int MoreServiceRequests; + + @uint32() + external int NumberOfServiceControls; + + external CSSM_FIELD_PTR ServiceControls; + + external CSSM_ACCESS_CREDENTIALS_PTR UserCredentials; +} + +typedef CSSM_TP_CERTNOTARIZE_INPUT = cssm_tp_certnotarize_input; +typedef CSSM_TP_CERTNOTARIZE_INPUT_PTR + = ffi.Pointer; +typedef CSSM_TP_CERTNOTARIZE_STATUS = uint32; + +final class cssm_tp_certnotarize_output extends ffi.Struct { + @CSSM_TP_CERTNOTARIZE_STATUS() + external int NotarizeStatus; + + external CSSM_CERTGROUP_PTR NotarizedCertGroup; + + @CSSM_TP_SERVICES() + external int PerformedServiceRequests; +} + +typedef CSSM_TP_CERTNOTARIZE_OUTPUT = cssm_tp_certnotarize_output; +typedef CSSM_TP_CERTNOTARIZE_OUTPUT_PTR + = ffi.Pointer; + +final class cssm_tp_certreclaim_input extends ffi.Struct { + @CSSM_CL_HANDLE() + external int CLHandle; + + @uint32() + external int NumberOfSelectionFields; + + external CSSM_FIELD_PTR SelectionFields; + + external CSSM_ACCESS_CREDENTIALS_PTR UserCredentials; +} + +typedef CSSM_TP_CERTRECLAIM_INPUT = cssm_tp_certreclaim_input; +typedef CSSM_TP_CERTRECLAIM_INPUT_PTR = ffi.Pointer; +typedef CSSM_TP_CERTRECLAIM_STATUS = uint32; + +final class cssm_tp_certreclaim_output extends ffi.Struct { + @CSSM_TP_CERTRECLAIM_STATUS() + external int ReclaimStatus; + + external CSSM_CERTGROUP_PTR ReclaimedCertGroup; + + @CSSM_LONG_HANDLE() + external int KeyCacheHandle; +} + +typedef CSSM_TP_CERTRECLAIM_OUTPUT = cssm_tp_certreclaim_output; +typedef CSSM_TP_CERTRECLAIM_OUTPUT_PTR + = ffi.Pointer; + +final class cssm_tp_crlissue_input extends ffi.Struct { + @CSSM_CL_HANDLE() + external int CLHandle; + + @uint32() + external int CrlIdentifier; + + external CSSM_TIMESTRING CrlThisTime; + + external CSSM_FIELD_PTR PolicyIdentifier; + + external CSSM_ACCESS_CREDENTIALS_PTR CallerCredentials; +} + +typedef CSSM_TP_CRLISSUE_INPUT = cssm_tp_crlissue_input; +typedef CSSM_TP_CRLISSUE_INPUT_PTR = ffi.Pointer; +typedef CSSM_TP_CRLISSUE_STATUS = uint32; + +final class cssm_tp_crlissue_output extends ffi.Struct { + @CSSM_TP_CRLISSUE_STATUS() + external int IssueStatus; + + external CSSM_ENCODED_CRL_PTR Crl; + + external CSSM_TIMESTRING CrlNextTime; +} + +typedef CSSM_TP_CRLISSUE_OUTPUT = cssm_tp_crlissue_output; +typedef CSSM_TP_CRLISSUE_OUTPUT_PTR = ffi.Pointer; +typedef CSSM_TP_FORM_TYPE = uint32; +typedef CSSM_CL_TEMPLATE_TYPE = uint32; +typedef CSSM_CERT_BUNDLE_TYPE = uint32; +typedef CSSM_CERT_BUNDLE_ENCODING = uint32; + +final class cssm_cert_bundle_header extends ffi.Struct { + @CSSM_CERT_BUNDLE_TYPE() + external int BundleType; + + @CSSM_CERT_BUNDLE_ENCODING() + external int BundleEncoding; +} + +typedef CSSM_CERT_BUNDLE_HEADER = cssm_cert_bundle_header; +typedef CSSM_CERT_BUNDLE_HEADER_PTR = ffi.Pointer; + +final class cssm_cert_bundle extends ffi.Struct { + external CSSM_CERT_BUNDLE_HEADER BundleHeader; + + external SecAsn1Item Bundle; +} + +typedef CSSM_CERT_BUNDLE = cssm_cert_bundle; +typedef CSSM_CERT_BUNDLE_PTR = ffi.Pointer; +typedef CSSM_DB_ATTRIBUTE_NAME_FORMAT = uint32; +typedef CSSM_DB_ATTRIBUTE_NAME_FORMAT_PTR = ffi.Pointer; +typedef CSSM_DB_ATTRIBUTE_FORMAT = uint32; +typedef CSSM_DB_ATTRIBUTE_FORMAT_PTR = ffi.Pointer; + +final class cssm_db_attribute_label extends ffi.Union { + external ffi.Pointer AttributeName; + + external SecAsn1Oid AttributeOID; + + @uint32() + external int AttributeID; +} + +final class cssm_db_attribute_info extends ffi.Struct { + @CSSM_DB_ATTRIBUTE_NAME_FORMAT() + external int AttributeNameFormat; + + external cssm_db_attribute_label Label; + + @CSSM_DB_ATTRIBUTE_FORMAT() + external int AttributeFormat; +} + +typedef CSSM_DB_ATTRIBUTE_INFO = cssm_db_attribute_info; +typedef CSSM_DB_ATTRIBUTE_INFO_PTR = ffi.Pointer; + +final class cssm_db_attribute_data extends ffi.Struct { + external CSSM_DB_ATTRIBUTE_INFO Info; + + @uint32() + external int NumberOfValues; + + external CSSM_DATA_PTR Value; +} + +typedef CSSM_DB_ATTRIBUTE_DATA = cssm_db_attribute_data; +typedef CSSM_DB_ATTRIBUTE_DATA_PTR = ffi.Pointer; +typedef CSSM_DB_RECORDTYPE = uint32; + +final class cssm_db_record_attribute_info extends ffi.Struct { + @CSSM_DB_RECORDTYPE() + external int DataRecordType; + + @uint32() + external int NumberOfAttributes; + + external CSSM_DB_ATTRIBUTE_INFO_PTR AttributeInfo; +} + +typedef CSSM_DB_RECORD_ATTRIBUTE_INFO = cssm_db_record_attribute_info; +typedef CSSM_DB_RECORD_ATTRIBUTE_INFO_PTR + = ffi.Pointer; + +final class cssm_db_record_attribute_data extends ffi.Struct { + @CSSM_DB_RECORDTYPE() + external int DataRecordType; + + @uint32() + external int SemanticInformation; + + @uint32() + external int NumberOfAttributes; + + external CSSM_DB_ATTRIBUTE_DATA_PTR AttributeData; +} + +typedef CSSM_DB_RECORD_ATTRIBUTE_DATA = cssm_db_record_attribute_data; +typedef CSSM_DB_RECORD_ATTRIBUTE_DATA_PTR + = ffi.Pointer; + +final class cssm_db_parsing_module_info extends ffi.Struct { + @CSSM_DB_RECORDTYPE() + external int RecordType; + + external CSSM_SUBSERVICE_UID ModuleSubserviceUid; +} + +typedef CSSM_DB_PARSING_MODULE_INFO = cssm_db_parsing_module_info; +typedef CSSM_DB_PARSING_MODULE_INFO_PTR + = ffi.Pointer; +typedef CSSM_DB_INDEX_TYPE = uint32; +typedef CSSM_DB_INDEXED_DATA_LOCATION = uint32; + +final class cssm_db_index_info extends ffi.Struct { + @CSSM_DB_INDEX_TYPE() + external int IndexType; + + @CSSM_DB_INDEXED_DATA_LOCATION() + external int IndexedDataLocation; + + external CSSM_DB_ATTRIBUTE_INFO Info; +} + +typedef CSSM_DB_INDEX_INFO = cssm_db_index_info; +typedef CSSM_DB_INDEX_INFO_PTR = ffi.Pointer; + +final class cssm_db_unique_record extends ffi.Struct { + external CSSM_DB_INDEX_INFO RecordLocator; + + external SecAsn1Item RecordIdentifier; +} + +typedef CSSM_DB_UNIQUE_RECORD = cssm_db_unique_record; +typedef CSSM_DB_UNIQUE_RECORD_PTR = ffi.Pointer; + +final class cssm_db_record_index_info extends ffi.Struct { + @CSSM_DB_RECORDTYPE() + external int DataRecordType; + + @uint32() + external int NumberOfIndexes; + + external CSSM_DB_INDEX_INFO_PTR IndexInfo; +} + +typedef CSSM_DB_RECORD_INDEX_INFO = cssm_db_record_index_info; +typedef CSSM_DB_RECORD_INDEX_INFO_PTR = ffi.Pointer; +typedef CSSM_DB_ACCESS_TYPE = uint32; +typedef CSSM_DB_ACCESS_TYPE_PTR = ffi.Pointer; +typedef CSSM_DB_MODIFY_MODE = uint32; + +final class cssm_dbinfo extends ffi.Struct { + @uint32() + external int NumberOfRecordTypes; + + external CSSM_DB_PARSING_MODULE_INFO_PTR DefaultParsingModules; + + external CSSM_DB_RECORD_ATTRIBUTE_INFO_PTR RecordAttributeNames; + + external CSSM_DB_RECORD_INDEX_INFO_PTR RecordIndexes; + + @CSSM_BOOL() + external int IsLocal; + + external ffi.Pointer AccessPath; + + external ffi.Pointer Reserved; +} + +typedef CSSM_DBINFO = cssm_dbinfo; +typedef CSSM_DBINFO_PTR = ffi.Pointer; +typedef CSSM_DB_OPERATOR = uint32; +typedef CSSM_DB_OPERATOR_PTR = ffi.Pointer; +typedef CSSM_DB_CONJUNCTIVE = uint32; +typedef CSSM_DB_CONJUNCTIVE_PTR = ffi.Pointer; + +final class cssm_selection_predicate extends ffi.Struct { + @CSSM_DB_OPERATOR() + external int DbOperator; + + external CSSM_DB_ATTRIBUTE_DATA Attribute; +} + +typedef CSSM_SELECTION_PREDICATE = cssm_selection_predicate; +typedef CSSM_SELECTION_PREDICATE_PTR = ffi.Pointer; + +final class cssm_query_limits extends ffi.Struct { + @uint32() + external int TimeLimit; + + @uint32() + external int SizeLimit; +} + +typedef CSSM_QUERY_LIMITS = cssm_query_limits; +typedef CSSM_QUERY_LIMITS_PTR = ffi.Pointer; +typedef CSSM_QUERY_FLAGS = uint32; + +final class cssm_query extends ffi.Struct { + @CSSM_DB_RECORDTYPE() + external int RecordType; + + @CSSM_DB_CONJUNCTIVE() + external int Conjunctive; + + @uint32() + external int NumSelectionPredicates; + + external CSSM_SELECTION_PREDICATE_PTR SelectionPredicate; + + external CSSM_QUERY_LIMITS QueryLimits; + + @CSSM_QUERY_FLAGS() + external int QueryFlags; +} + +typedef CSSM_QUERY = cssm_query; +typedef CSSM_QUERY_PTR = ffi.Pointer; +typedef CSSM_DLTYPE = uint32; +typedef CSSM_DLTYPE_PTR = ffi.Pointer; +typedef CSSM_DL_CUSTOM_ATTRIBUTES = ffi.Pointer; +typedef CSSM_DL_LDAP_ATTRIBUTES = ffi.Pointer; +typedef CSSM_DL_ODBC_ATTRIBUTES = ffi.Pointer; +typedef CSSM_DL_FFS_ATTRIBUTES = ffi.Pointer; + +final class cssm_dl_pkcs11_attributes extends ffi.Struct { + @uint32() + external int DeviceAccessFlags; +} + +typedef CSSM_DL_PKCS11_ATTRIBUTE = ffi.Pointer; +typedef CSSM_DL_PKCS11_ATTRIBUTE_PTR = ffi.Pointer; + +final class cssm_name_list extends ffi.Struct { + @uint32() + external int NumStrings; + + external ffi.Pointer> String; +} + +typedef CSSM_NAME_LIST = cssm_name_list; +typedef CSSM_NAME_LIST_PTR = ffi.Pointer; +typedef CSSM_DB_RETRIEVAL_MODES = uint32; + +final class cssm_db_schema_attribute_info extends ffi.Struct { + @uint32() + external int AttributeId; + + external ffi.Pointer AttributeName; + + external SecAsn1Oid AttributeNameID; + + @CSSM_DB_ATTRIBUTE_FORMAT() + external int DataType; +} + +typedef CSSM_DB_SCHEMA_ATTRIBUTE_INFO = cssm_db_schema_attribute_info; +typedef CSSM_DB_SCHEMA_ATTRIBUTE_INFO_PTR + = ffi.Pointer; + +final class cssm_db_schema_index_info extends ffi.Struct { + @uint32() + external int AttributeId; + + @uint32() + external int IndexId; + + @CSSM_DB_INDEX_TYPE() + external int IndexType; + + @CSSM_DB_INDEXED_DATA_LOCATION() + external int IndexedDataLocation; +} + +typedef CSSM_DB_SCHEMA_INDEX_INFO = cssm_db_schema_index_info; +typedef CSSM_DB_SCHEMA_INDEX_INFO_PTR = ffi.Pointer; +typedef CSSM_BER_TAG = uint8; +typedef CSSM_X509_ALGORITHM_IDENTIFIER_PTR = ffi.Pointer; + +final class cssm_x509_type_value_pair extends ffi.Struct { + external SecAsn1Oid type; + + @CSSM_BER_TAG() + external int valueType; + + external SecAsn1Item value; +} + +typedef CSSM_X509_TYPE_VALUE_PAIR = cssm_x509_type_value_pair; +typedef CSSM_X509_TYPE_VALUE_PAIR_PTR = ffi.Pointer; + +final class cssm_x509_rdn extends ffi.Struct { + @uint32() + external int numberOfPairs; + + external CSSM_X509_TYPE_VALUE_PAIR_PTR AttributeTypeAndValue; +} + +typedef CSSM_X509_RDN = cssm_x509_rdn; +typedef CSSM_X509_RDN_PTR = ffi.Pointer; + +final class cssm_x509_name extends ffi.Struct { + @uint32() + external int numberOfRDNs; + + external CSSM_X509_RDN_PTR RelativeDistinguishedName; +} + +typedef CSSM_X509_NAME = cssm_x509_name; +typedef CSSM_X509_NAME_PTR = ffi.Pointer; +typedef CSSM_X509_SUBJECT_PUBLIC_KEY_INFO_PTR = ffi.Pointer; + +final class cssm_x509_time extends ffi.Struct { + @CSSM_BER_TAG() + external int timeType; + + external SecAsn1Item time; +} + +typedef CSSM_X509_TIME = cssm_x509_time; +typedef CSSM_X509_TIME_PTR = ffi.Pointer; + +final class x509_validity extends ffi.Struct { + external CSSM_X509_TIME notBefore; + + external CSSM_X509_TIME notAfter; +} + +typedef CSSM_X509_VALIDITY = x509_validity; +typedef CSSM_X509_VALIDITY_PTR = ffi.Pointer; +typedef CSSM_X509_OPTION = CSSM_BOOL; + +final class cssm_x509ext_basicConstraints extends ffi.Struct { + @CSSM_BOOL() + external int cA; + + @CSSM_X509_OPTION() + external int pathLenConstraintPresent; + + @uint32() + external int pathLenConstraint; +} + +typedef CSSM_X509EXT_BASICCONSTRAINTS = cssm_x509ext_basicConstraints; +typedef CSSM_X509EXT_BASICCONSTRAINTS_PTR + = ffi.Pointer; + +enum extension_data_format { + CSSM_X509_DATAFORMAT_ENCODED(0), + CSSM_X509_DATAFORMAT_PARSED(1), + CSSM_X509_DATAFORMAT_PAIR(2); + + final int value; + const extension_data_format(this.value); + + static extension_data_format fromValue(int value) => switch (value) { + 0 => CSSM_X509_DATAFORMAT_ENCODED, + 1 => CSSM_X509_DATAFORMAT_PARSED, + 2 => CSSM_X509_DATAFORMAT_PAIR, + _ => throw ArgumentError( + "Unknown value for extension_data_format: $value"), + }; +} + +final class cssm_x509_extensionTagAndValue extends ffi.Struct { + @CSSM_BER_TAG() + external int type; + + external SecAsn1Item value; +} + +typedef CSSM_X509EXT_TAGandVALUE = cssm_x509_extensionTagAndValue; +typedef CSSM_X509EXT_TAGandVALUE_PTR + = ffi.Pointer; + +final class cssm_x509ext_pair extends ffi.Struct { + external CSSM_X509EXT_TAGandVALUE tagAndValue; + + external ffi.Pointer parsedValue; +} + +typedef CSSM_X509EXT_PAIR = cssm_x509ext_pair; +typedef CSSM_X509EXT_PAIR_PTR = ffi.Pointer; + +final class cssm_x509ext_value extends ffi.Union { + external ffi.Pointer tagAndValue; + + external ffi.Pointer parsedValue; + + external ffi.Pointer valuePair; +} + +final class cssm_x509_extension extends ffi.Struct { + external SecAsn1Oid extnId; + + @CSSM_BOOL() + external int critical; + + @ffi.UnsignedInt() + external int formatAsInt; + + extension_data_format get format => + extension_data_format.fromValue(formatAsInt); + + external cssm_x509ext_value value; + + external SecAsn1Item BERvalue; +} + +typedef CSSM_X509_EXTENSION = cssm_x509_extension; +typedef CSSM_X509_EXTENSION_PTR = ffi.Pointer; + +final class cssm_x509_extensions extends ffi.Struct { + @uint32() + external int numberOfExtensions; + + external CSSM_X509_EXTENSION_PTR extensions; +} + +typedef CSSM_X509_EXTENSIONS = cssm_x509_extensions; +typedef CSSM_X509_EXTENSIONS_PTR = ffi.Pointer; + +final class cssm_x509_tbs_certificate extends ffi.Struct { + external SecAsn1Item version; + + external SecAsn1Item serialNumber; + + external SecAsn1AlgId signature; + + external CSSM_X509_NAME issuer; + + external CSSM_X509_VALIDITY validity; + + external CSSM_X509_NAME subject; + + external SecAsn1PubKeyInfo subjectPublicKeyInfo; + + external SecAsn1Item issuerUniqueIdentifier; + + external SecAsn1Item subjectUniqueIdentifier; + + external CSSM_X509_EXTENSIONS extensions; +} + +typedef CSSM_X509_TBS_CERTIFICATE = cssm_x509_tbs_certificate; +typedef CSSM_X509_TBS_CERTIFICATE_PTR = ffi.Pointer; + +final class cssm_x509_signature extends ffi.Struct { + external SecAsn1AlgId algorithmIdentifier; + + external SecAsn1Item encrypted; +} + +typedef CSSM_X509_SIGNATURE = cssm_x509_signature; +typedef CSSM_X509_SIGNATURE_PTR = ffi.Pointer; + +final class cssm_x509_signed_certificate extends ffi.Struct { + external CSSM_X509_TBS_CERTIFICATE certificate; + + external CSSM_X509_SIGNATURE signature; +} + +typedef CSSM_X509_SIGNED_CERTIFICATE = cssm_x509_signed_certificate; +typedef CSSM_X509_SIGNED_CERTIFICATE_PTR + = ffi.Pointer; + +final class cssm_x509ext_policyQualifierInfo extends ffi.Struct { + external SecAsn1Oid policyQualifierId; + + external SecAsn1Item value; +} + +typedef CSSM_X509EXT_POLICYQUALIFIERINFO = cssm_x509ext_policyQualifierInfo; +typedef CSSM_X509EXT_POLICYQUALIFIERINFO_PTR + = ffi.Pointer; + +final class cssm_x509ext_policyQualifiers extends ffi.Struct { + @uint32() + external int numberOfPolicyQualifiers; + + external ffi.Pointer policyQualifier; +} + +typedef CSSM_X509EXT_POLICYQUALIFIERS = cssm_x509ext_policyQualifiers; +typedef CSSM_X509EXT_POLICYQUALIFIERS_PTR + = ffi.Pointer; + +final class cssm_x509ext_policyInfo extends ffi.Struct { + external SecAsn1Oid policyIdentifier; + + external CSSM_X509EXT_POLICYQUALIFIERS policyQualifiers; +} + +typedef CSSM_X509EXT_POLICYINFO = cssm_x509ext_policyInfo; +typedef CSSM_X509EXT_POLICYINFO_PTR = ffi.Pointer; + +final class cssm_x509_revoked_cert_entry extends ffi.Struct { + external SecAsn1Item certificateSerialNumber; + + external CSSM_X509_TIME revocationDate; + + external CSSM_X509_EXTENSIONS extensions; +} + +typedef CSSM_X509_REVOKED_CERT_ENTRY = cssm_x509_revoked_cert_entry; +typedef CSSM_X509_REVOKED_CERT_ENTRY_PTR + = ffi.Pointer; + +final class cssm_x509_revoked_cert_list extends ffi.Struct { + @uint32() + external int numberOfRevokedCertEntries; + + external CSSM_X509_REVOKED_CERT_ENTRY_PTR revokedCertEntry; +} + +typedef CSSM_X509_REVOKED_CERT_LIST = cssm_x509_revoked_cert_list; +typedef CSSM_X509_REVOKED_CERT_LIST_PTR + = ffi.Pointer; + +final class cssm_x509_tbs_certlist extends ffi.Struct { + external SecAsn1Item version; + + external SecAsn1AlgId signature; + + external CSSM_X509_NAME issuer; + + external CSSM_X509_TIME thisUpdate; + + external CSSM_X509_TIME nextUpdate; + + external CSSM_X509_REVOKED_CERT_LIST_PTR revokedCertificates; + + external CSSM_X509_EXTENSIONS extensions; +} + +typedef CSSM_X509_TBS_CERTLIST = cssm_x509_tbs_certlist; +typedef CSSM_X509_TBS_CERTLIST_PTR = ffi.Pointer; + +final class cssm_x509_signed_crl extends ffi.Struct { + external CSSM_X509_TBS_CERTLIST tbsCertList; + + external CSSM_X509_SIGNATURE signature; +} + +typedef CSSM_X509_SIGNED_CRL = cssm_x509_signed_crl; +typedef CSSM_X509_SIGNED_CRL_PTR = ffi.Pointer; + +enum __CE_GeneralNameType { + GNT_OtherName(0), + GNT_RFC822Name(1), + GNT_DNSName(2), + GNT_X400Address(3), + GNT_DirectoryName(4), + GNT_EdiPartyName(5), + GNT_URI(6), + GNT_IPAddress(7), + GNT_RegisteredID(8); + + final int value; + const __CE_GeneralNameType(this.value); + + static __CE_GeneralNameType fromValue(int value) => switch (value) { + 0 => GNT_OtherName, + 1 => GNT_RFC822Name, + 2 => GNT_DNSName, + 3 => GNT_X400Address, + 4 => GNT_DirectoryName, + 5 => GNT_EdiPartyName, + 6 => GNT_URI, + 7 => GNT_IPAddress, + 8 => GNT_RegisteredID, + _ => + throw ArgumentError("Unknown value for __CE_GeneralNameType: $value"), + }; +} + +final class __CE_OtherName extends ffi.Struct { + external SecAsn1Oid typeId; + + external SecAsn1Item value; +} + +typedef CE_OtherName = __CE_OtherName; + +final class __CE_GeneralName extends ffi.Struct { + @ffi.UnsignedInt() + external int nameTypeAsInt; + + __CE_GeneralNameType get nameType => + __CE_GeneralNameType.fromValue(nameTypeAsInt); + + @CSSM_BOOL() + external int berEncoded; + + external SecAsn1Item name; +} + +typedef CE_GeneralName = __CE_GeneralName; + +final class __CE_GeneralNames extends ffi.Struct { + @uint32() + external int numNames; + + external ffi.Pointer generalName; +} + +typedef CE_GeneralNames = __CE_GeneralNames; + +final class __CE_AuthorityKeyID extends ffi.Struct { + @CSSM_BOOL() + external int keyIdentifierPresent; + + external SecAsn1Item keyIdentifier; + + @CSSM_BOOL() + external int generalNamesPresent; + + external ffi.Pointer generalNames; + + @CSSM_BOOL() + external int serialNumberPresent; + + external SecAsn1Item serialNumber; +} + +typedef CE_AuthorityKeyID = __CE_AuthorityKeyID; +typedef CE_SubjectKeyID = SecAsn1Item; +typedef CE_KeyUsage = uint16; +typedef CE_CrlReason = uint32; + +final class __CE_ExtendedKeyUsage extends ffi.Struct { + @uint32() + external int numPurposes; + + external CSSM_OID_PTR purposes; +} + +typedef CE_ExtendedKeyUsage = __CE_ExtendedKeyUsage; + +final class __CE_BasicConstraints extends ffi.Struct { + @CSSM_BOOL() + external int cA; + + @CSSM_BOOL() + external int pathLenConstraintPresent; + + @uint32() + external int pathLenConstraint; +} + +typedef CE_BasicConstraints = __CE_BasicConstraints; + +final class __CE_PolicyQualifierInfo extends ffi.Struct { + external SecAsn1Oid policyQualifierId; + + external SecAsn1Item qualifier; +} + +typedef CE_PolicyQualifierInfo = __CE_PolicyQualifierInfo; + +final class __CE_PolicyInformation extends ffi.Struct { + external SecAsn1Oid certPolicyId; + + @uint32() + external int numPolicyQualifiers; + + external ffi.Pointer policyQualifiers; +} + +typedef CE_PolicyInformation = __CE_PolicyInformation; + +final class __CE_CertPolicies extends ffi.Struct { + @uint32() + external int numPolicies; + + external ffi.Pointer policies; +} + +typedef CE_CertPolicies = __CE_CertPolicies; +typedef CE_NetscapeCertType = uint16; +typedef CE_CrlDistReasonFlags = uint8; + +enum __CE_CrlDistributionPointNameType { + CE_CDNT_FullName(0), + CE_CDNT_NameRelativeToCrlIssuer(1); + + final int value; + const __CE_CrlDistributionPointNameType(this.value); + + static __CE_CrlDistributionPointNameType fromValue(int value) => + switch (value) { + 0 => CE_CDNT_FullName, + 1 => CE_CDNT_NameRelativeToCrlIssuer, + _ => throw ArgumentError( + "Unknown value for __CE_CrlDistributionPointNameType: $value"), + }; +} + +final class UnnamedUnion5 extends ffi.Union { + external ffi.Pointer fullName; + + external CSSM_X509_RDN_PTR rdn; +} + +final class __CE_DistributionPointName extends ffi.Struct { + @ffi.UnsignedInt() + external int nameTypeAsInt; + + __CE_CrlDistributionPointNameType get nameType => + __CE_CrlDistributionPointNameType.fromValue(nameTypeAsInt); + + external UnnamedUnion5 dpn; +} + +typedef CE_DistributionPointName = __CE_DistributionPointName; + +final class __CE_CRLDistributionPoint extends ffi.Struct { + external ffi.Pointer distPointName; + + @CSSM_BOOL() + external int reasonsPresent; + + @CE_CrlDistReasonFlags() + external int reasons; + + external ffi.Pointer crlIssuer; +} + +typedef CE_CRLDistributionPoint = __CE_CRLDistributionPoint; + +final class __CE_CRLDistPointsSyntax extends ffi.Struct { + @uint32() + external int numDistPoints; + + external ffi.Pointer distPoints; +} + +typedef CE_CRLDistPointsSyntax = __CE_CRLDistPointsSyntax; + +final class __CE_AccessDescription extends ffi.Struct { + external SecAsn1Oid accessMethod; + + external CE_GeneralName accessLocation; +} + +typedef CE_AccessDescription = __CE_AccessDescription; + +final class __CE_AuthorityInfoAccess extends ffi.Struct { + @uint32() + external int numAccessDescriptions; + + external ffi.Pointer accessDescriptions; +} + +typedef CE_AuthorityInfoAccess = __CE_AuthorityInfoAccess; +typedef CE_NameRegistrationAuthorities = CE_GeneralNames; + +final class __CE_SemanticsInformation extends ffi.Struct { + external ffi.Pointer semanticsIdentifier; + + external ffi.Pointer + nameRegistrationAuthorities; +} + +typedef CE_SemanticsInformation = __CE_SemanticsInformation; + +final class __CE_QC_Statement extends ffi.Struct { + external SecAsn1Oid statementId; + + external ffi.Pointer semanticsInfo; + + external ffi.Pointer otherInfo; +} + +typedef CE_QC_Statement = __CE_QC_Statement; + +final class __CE_QC_Statements extends ffi.Struct { + @uint32() + external int numQCStatements; + + external ffi.Pointer qcStatements; +} + +typedef CE_QC_Statements = __CE_QC_Statements; +typedef CE_CrlNumber = uint32; +typedef CE_DeltaCrl = uint32; + +final class __CE_IssuingDistributionPoint extends ffi.Struct { + external ffi.Pointer distPointName; + + @CSSM_BOOL() + external int onlyUserCertsPresent; + + @CSSM_BOOL() + external int onlyUserCerts; + + @CSSM_BOOL() + external int onlyCACertsPresent; + + @CSSM_BOOL() + external int onlyCACerts; + + @CSSM_BOOL() + external int onlySomeReasonsPresent; + + @CE_CrlDistReasonFlags() + external int onlySomeReasons; + + @CSSM_BOOL() + external int indirectCrlPresent; + + @CSSM_BOOL() + external int indirectCrl; +} + +typedef CE_IssuingDistributionPoint = __CE_IssuingDistributionPoint; + +final class __CE_GeneralSubtree extends ffi.Struct { + external ffi.Pointer base; + + @uint32() + external int minimum; + + @CSSM_BOOL() + external int maximumPresent; + + @uint32() + external int maximum; +} + +typedef CE_GeneralSubtree = __CE_GeneralSubtree; + +final class __CE_GeneralSubtrees extends ffi.Struct { + @uint32() + external int numSubtrees; + + external ffi.Pointer subtrees; +} + +typedef CE_GeneralSubtrees = __CE_GeneralSubtrees; + +final class __CE_NameConstraints extends ffi.Struct { + external ffi.Pointer permitted; + + external ffi.Pointer excluded; +} + +typedef CE_NameConstraints = __CE_NameConstraints; + +final class __CE_PolicyMapping extends ffi.Struct { + external SecAsn1Oid issuerDomainPolicy; + + external SecAsn1Oid subjectDomainPolicy; +} + +typedef CE_PolicyMapping = __CE_PolicyMapping; + +final class __CE_PolicyMappings extends ffi.Struct { + @uint32() + external int numPolicyMappings; + + external ffi.Pointer policyMappings; +} + +typedef CE_PolicyMappings = __CE_PolicyMappings; + +final class __CE_PolicyConstraints extends ffi.Struct { + @CSSM_BOOL() + external int requireExplicitPolicyPresent; + + @uint32() + external int requireExplicitPolicy; + + @CSSM_BOOL() + external int inhibitPolicyMappingPresent; + + @uint32() + external int inhibitPolicyMapping; +} + +typedef CE_PolicyConstraints = __CE_PolicyConstraints; +typedef CE_InhibitAnyPolicy = uint32; + +enum __CE_DataType { + DT_AuthorityKeyID(0), + DT_SubjectKeyID(1), + DT_KeyUsage(2), + DT_SubjectAltName(3), + DT_IssuerAltName(4), + DT_ExtendedKeyUsage(5), + DT_BasicConstraints(6), + DT_CertPolicies(7), + DT_NetscapeCertType(8), + DT_CrlNumber(9), + DT_DeltaCrl(10), + DT_CrlReason(11), + DT_CrlDistributionPoints(12), + DT_IssuingDistributionPoint(13), + DT_AuthorityInfoAccess(14), + DT_Other(15), + DT_QC_Statements(16), + DT_NameConstraints(17), + DT_PolicyMappings(18), + DT_PolicyConstraints(19), + DT_InhibitAnyPolicy(20); + + final int value; + const __CE_DataType(this.value); + + static __CE_DataType fromValue(int value) => switch (value) { + 0 => DT_AuthorityKeyID, + 1 => DT_SubjectKeyID, + 2 => DT_KeyUsage, + 3 => DT_SubjectAltName, + 4 => DT_IssuerAltName, + 5 => DT_ExtendedKeyUsage, + 6 => DT_BasicConstraints, + 7 => DT_CertPolicies, + 8 => DT_NetscapeCertType, + 9 => DT_CrlNumber, + 10 => DT_DeltaCrl, + 11 => DT_CrlReason, + 12 => DT_CrlDistributionPoints, + 13 => DT_IssuingDistributionPoint, + 14 => DT_AuthorityInfoAccess, + 15 => DT_Other, + 16 => DT_QC_Statements, + 17 => DT_NameConstraints, + 18 => DT_PolicyMappings, + 19 => DT_PolicyConstraints, + 20 => DT_InhibitAnyPolicy, + _ => throw ArgumentError("Unknown value for __CE_DataType: $value"), + }; +} + +final class CE_Data extends ffi.Union { + external CE_AuthorityKeyID authorityKeyID; + + external CE_SubjectKeyID subjectKeyID; + + @CE_KeyUsage() + external int keyUsage; + + external CE_GeneralNames subjectAltName; + + external CE_GeneralNames issuerAltName; + + external CE_ExtendedKeyUsage extendedKeyUsage; + + external CE_BasicConstraints basicConstraints; + + external CE_CertPolicies certPolicies; + + @CE_NetscapeCertType() + external int netscapeCertType; + + @CE_CrlNumber() + external int crlNumber; + + @CE_DeltaCrl() + external int deltaCrl; + + @CE_CrlReason() + external int crlReason; + + external CE_CRLDistPointsSyntax crlDistPoints; + + external CE_IssuingDistributionPoint issuingDistPoint; + + external CE_AuthorityInfoAccess authorityInfoAccess; + + external CE_QC_Statements qualifiedCertStatements; + + external CE_NameConstraints nameConstraints; + + external CE_PolicyMappings policyMappings; + + external CE_PolicyConstraints policyConstraints; + + @CE_InhibitAnyPolicy() + external int inhibitAnyPolicy; + + external SecAsn1Item rawData; +} + +final class __CE_DataAndType extends ffi.Struct { + @ffi.UnsignedInt() + external int typeAsInt; + + __CE_DataType get type => __CE_DataType.fromValue(typeAsInt); + + external CE_Data extension1; + + @CSSM_BOOL() + external int critical; +} + +typedef CE_DataAndType = __CE_DataAndType; + +final class cssm_acl_process_subject_selector extends ffi.Struct { + @uint16() + external int version; + + @uint16() + external int mask; + + @uint32() + external int uid; + + @uint32() + external int gid; +} + +typedef CSSM_ACL_PROCESS_SUBJECT_SELECTOR = cssm_acl_process_subject_selector; + +final class cssm_acl_keychain_prompt_selector extends ffi.Struct { + @uint16() + external int version; + + @uint16() + external int flags; +} + +typedef CSSM_ACL_KEYCHAIN_PROMPT_SELECTOR = cssm_acl_keychain_prompt_selector; +typedef CSSM_ACL_PREAUTH_TRACKING_STATE = uint32; + +final class cssm_appledl_open_parameters extends ffi.Struct { + @uint32() + external int length; + + @uint32() + external int version; + + @CSSM_BOOL() + external int autoCommit; + + @uint32() + external int mask; + + @mode_t() + external int mode; +} + +typedef CSSM_APPLEDL_OPEN_PARAMETERS = cssm_appledl_open_parameters; +typedef CSSM_APPLEDL_OPEN_PARAMETERS_PTR + = ffi.Pointer; + +final class cssm_applecspdl_db_settings_parameters extends ffi.Struct { + @uint32() + external int idleTimeout; + + @uint8() + external int lockOnSleep; +} + +typedef CSSM_APPLECSPDL_DB_SETTINGS_PARAMETERS + = cssm_applecspdl_db_settings_parameters; +typedef CSSM_APPLECSPDL_DB_SETTINGS_PARAMETERS_PTR + = ffi.Pointer; + +final class cssm_applecspdl_db_is_locked_parameters extends ffi.Struct { + @uint8() + external int isLocked; +} + +typedef CSSM_APPLECSPDL_DB_IS_LOCKED_PARAMETERS + = cssm_applecspdl_db_is_locked_parameters; +typedef CSSM_APPLECSPDL_DB_IS_LOCKED_PARAMETERS_PTR + = ffi.Pointer; + +final class cssm_applecspdl_db_change_password_parameters extends ffi.Struct { + external ffi.Pointer accessCredentials; +} + +typedef CSSM_APPLECSPDL_DB_CHANGE_PASSWORD_PARAMETERS + = cssm_applecspdl_db_change_password_parameters; +typedef CSSM_APPLECSPDL_DB_CHANGE_PASSWORD_PARAMETERS_PTR + = ffi.Pointer; + +final class CSSM_APPLE_TP_NAME_OID extends ffi.Struct { + external ffi.Pointer string; + + external ffi.Pointer oid; +} + +final class CSSM_APPLE_TP_CERT_REQUEST extends ffi.Struct { + @CSSM_CSP_HANDLE() + external int cspHand; + + @CSSM_CL_HANDLE() + external int clHand; + + @uint32() + external int serialNumber; + + @uint32() + external int numSubjectNames; + + external ffi.Pointer subjectNames; + + @uint32() + external int numIssuerNames; + + external ffi.Pointer issuerNames; + + external CSSM_X509_NAME_PTR issuerNameX509; + + external ffi.Pointer certPublicKey; + + external ffi.Pointer issuerPrivateKey; + + @CSSM_ALGORITHMS() + external int signatureAlg; + + external SecAsn1Oid signatureOid; + + @uint32() + external int notBefore; + + @uint32() + external int notAfter; + + @uint32() + external int numExtensions; + + external ffi.Pointer extensions; + + external ffi.Pointer challengeString; +} + +final class CSSM_APPLE_TP_SSL_OPTIONS extends ffi.Struct { + @uint32() + external int Version; + + @uint32() + external int ServerNameLen; + + external ffi.Pointer ServerName; + + @uint32() + external int Flags; +} + +typedef CSSM_APPLE_TP_CRL_OPT_FLAGS = uint32; + +final class CSSM_APPLE_TP_CRL_OPTIONS extends ffi.Struct { + @uint32() + external int Version; + + @CSSM_APPLE_TP_CRL_OPT_FLAGS() + external int CrlFlags; + + external CSSM_DL_DB_HANDLE_PTR crlStore; +} + +final class CSSM_APPLE_TP_SMIME_OPTIONS extends ffi.Struct { + @uint32() + external int Version; + + @CE_KeyUsage() + external int IntendedUsage; + + @uint32() + external int SenderEmailLen; + + external ffi.Pointer SenderEmail; +} + +typedef CSSM_APPLE_TP_ACTION_FLAGS = uint32; + +final class CSSM_APPLE_TP_ACTION_DATA extends ffi.Struct { + @uint32() + external int Version; + + @CSSM_APPLE_TP_ACTION_FLAGS() + external int ActionFlags; +} + +typedef CSSM_TP_APPLE_CERT_STATUS = uint32; + +final class CSSM_TP_APPLE_EVIDENCE_INFO extends ffi.Struct { + @CSSM_TP_APPLE_CERT_STATUS() + external int StatusBits; + + @uint32() + external int NumStatusCodes; + + external ffi.Pointer StatusCodes; + + @uint32() + external int Index; + + external CSSM_DL_DB_HANDLE DlDbHandle; + + external CSSM_DB_UNIQUE_RECORD_PTR UniqueRecord; +} + +final class CSSM_TP_APPLE_EVIDENCE_HEADER extends ffi.Struct { + @uint32() + external int Version; +} + +final class CSSM_APPLE_CL_CSR_REQUEST extends ffi.Struct { + external CSSM_X509_NAME_PTR subjectNameX509; + + @CSSM_ALGORITHMS() + external int signatureAlg; + + external SecAsn1Oid signatureOid; + + @CSSM_CSP_HANDLE() + external int cspHand; + + external ffi.Pointer subjectPublicKey; + + external ffi.Pointer subjectPrivateKey; + + external ffi.Pointer challengeString; +} + +enum SecTrustResultType { + kSecTrustResultInvalid(0), + kSecTrustResultProceed(1), + kSecTrustResultConfirm(2), + kSecTrustResultDeny(3), + kSecTrustResultUnspecified(4), + kSecTrustResultRecoverableTrustFailure(5), + kSecTrustResultFatalTrustFailure(6), + kSecTrustResultOtherError(7); + + final int value; + const SecTrustResultType(this.value); + + static SecTrustResultType fromValue(int value) => switch (value) { + 0 => kSecTrustResultInvalid, + 1 => kSecTrustResultProceed, + 2 => kSecTrustResultConfirm, + 3 => kSecTrustResultDeny, + 4 => kSecTrustResultUnspecified, + 5 => kSecTrustResultRecoverableTrustFailure, + 6 => kSecTrustResultFatalTrustFailure, + 7 => kSecTrustResultOtherError, + _ => + throw ArgumentError("Unknown value for SecTrustResultType: $value"), + }; +} + +final class __SecTrust extends ffi.Opaque {} + +typedef SecTrustRef = ffi.Pointer<__SecTrust>; +void _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_fnPtrTrampoline( + ffi.Pointer block, SecTrustRef arg0, int arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(SecTrustRef arg0, ffi.Uint32 arg1)>>() + .asFunction()(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, SecTrustRef, ffi.Uint32)>( + _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_closureTrampoline( + ffi.Pointer block, SecTrustRef arg0, int arg1) => + (objc.getBlockClosure(block) as void Function(SecTrustRef, int))( + arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, SecTrustRef, ffi.Uint32)>( + _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_listenerTrampoline( + ffi.Pointer block, SecTrustRef arg0, int arg1) { + (objc.getBlockClosure(block) as void Function(SecTrustRef, int))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, SecTrustRef, ffi.Uint32)> + _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_listenerCallable = ffi + .NativeCallable< + ffi.Void Function(ffi.Pointer, SecTrustRef, + ffi.Uint32)>.listener( + _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, ffi.Uint32)>`. +abstract final class ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock, ffi.Uint32)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__SecTrust>, + ffi.Uint32)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__SecTrust>, ffi.Uint32)> fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock, ffi.Uint32)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__SecTrust>, ffi.Uint32)> fromFunction( + void Function(SecTrustRef, SecTrustResultType) fn) => + objc.ObjCBlock, ffi.Uint32)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_closureCallable, + (SecTrustRef arg0, int arg1) => + fn(arg0, SecTrustResultType.fromValue(arg1))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock, ffi.Uint32)> + listener(void Function(SecTrustRef, SecTrustResultType) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_listenerCallable + .nativeFunction + .cast(), + (SecTrustRef arg0, int arg1) => + fn(arg0, SecTrustResultType.fromValue(arg1))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_gwxhxt(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__SecTrust>, ffi.Uint32)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, ffi.Uint32)>`. +extension ObjCBlock_ffiVoid_SecTrustRef_SecTrustResultType_CallExtension + on objc.ObjCBlock, ffi.Uint32)> { + void call(SecTrustRef arg0, SecTrustResultType arg1) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + SecTrustRef arg0, ffi.Uint32 arg1)>>() + .asFunction< + void Function(ffi.Pointer, SecTrustRef, + int)>()(ref.pointer, arg0, arg1.value); +} + +typedef SecTrustCallback = ffi.Pointer; +typedef DartSecTrustCallback + = objc.ObjCBlock, ffi.Uint32)>; +void _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_fnPtrTrampoline( + ffi.Pointer block, + SecTrustRef arg0, + bool arg1, + CFErrorRef arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + SecTrustRef arg0, ffi.Bool arg1, CFErrorRef arg2)>>() + .asFunction()( + arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, SecTrustRef, + ffi.Bool, CFErrorRef)>( + _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_closureTrampoline( + ffi.Pointer block, + SecTrustRef arg0, + bool arg1, + CFErrorRef arg2) => + (objc.getBlockClosure(block) as void Function( + SecTrustRef, bool, CFErrorRef))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, SecTrustRef, + ffi.Bool, CFErrorRef)>( + _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_listenerTrampoline( + ffi.Pointer block, + SecTrustRef arg0, + bool arg1, + CFErrorRef arg2) { + (objc.getBlockClosure(block) as void Function(SecTrustRef, bool, CFErrorRef))( + arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, SecTrustRef, ffi.Bool, CFErrorRef)> + _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_listenerCallable = ffi + .NativeCallable< + ffi.Void Function(ffi.Pointer, SecTrustRef, + ffi.Bool, CFErrorRef)>.listener( + _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, ffi.Bool, ffi.Pointer<__CFError>)>`. +abstract final class ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer<__SecTrust>, ffi.Bool, ffi.Pointer<__CFError>)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__SecTrust>, ffi.Bool, + ffi.Pointer<__CFError>)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.Bool, ffi.Pointer<__CFError>)> + fromFunctionPointer(ffi.Pointer> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__SecTrust>, ffi.Bool, + ffi.Pointer<__CFError>)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, ffi.Bool, ffi.Pointer<__CFError>)> + fromFunction(void Function(SecTrustRef, bool, CFErrorRef) fn) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__SecTrust>, ffi.Bool, + ffi.Pointer<__CFError>)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_closureCallable, + (SecTrustRef arg0, bool arg1, CFErrorRef arg2) => + fn(arg0, arg1, arg2)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer<__SecTrust>, ffi.Bool, ffi.Pointer<__CFError>)> listener( + void Function(SecTrustRef, bool, CFErrorRef) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_listenerCallable + .nativeFunction + .cast(), + (SecTrustRef arg0, bool arg1, CFErrorRef arg2) => fn(arg0, arg1, arg2)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_k73ff5(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer<__SecTrust>, ffi.Bool, + ffi.Pointer<__CFError>)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, ffi.Bool, ffi.Pointer<__CFError>)>`. +extension ObjCBlock_ffiVoid_SecTrustRef_bool_CFErrorRef_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer<__SecTrust>, ffi.Bool, ffi.Pointer<__CFError>)> { + void call(SecTrustRef arg0, bool arg1, CFErrorRef arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + SecTrustRef arg0, ffi.Bool arg1, CFErrorRef arg2)>>() + .asFunction< + void Function(ffi.Pointer, SecTrustRef, bool, + CFErrorRef)>()(ref.pointer, arg0, arg1, arg2); +} + +typedef SecTrustWithErrorCallback = ffi.Pointer; +typedef DartSecTrustWithErrorCallback = objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer<__SecTrust>, ffi.Bool, ffi.Pointer<__CFError>)>; + +enum SecTrustOptionFlags { + kSecTrustOptionAllowExpired(1), + kSecTrustOptionLeafIsCA(2), + kSecTrustOptionFetchIssuerFromNet(4), + kSecTrustOptionAllowExpiredRoot(8), + kSecTrustOptionRequireRevPerCert(16), + kSecTrustOptionUseTrustSettings(32), + kSecTrustOptionImplicitAnchors(64); + + final int value; + const SecTrustOptionFlags(this.value); + + static SecTrustOptionFlags fromValue(int value) => switch (value) { + 1 => kSecTrustOptionAllowExpired, + 2 => kSecTrustOptionLeafIsCA, + 4 => kSecTrustOptionFetchIssuerFromNet, + 8 => kSecTrustOptionAllowExpiredRoot, + 16 => kSecTrustOptionRequireRevPerCert, + 32 => kSecTrustOptionUseTrustSettings, + 64 => kSecTrustOptionImplicitAnchors, + _ => + throw ArgumentError("Unknown value for SecTrustOptionFlags: $value"), + }; +} + +typedef SSLCipherSuite = ffi.Uint16; +typedef DartSSLCipherSuite = int; + +enum SSLCiphersuiteGroup { + kSSLCiphersuiteGroupDefault(0), + kSSLCiphersuiteGroupCompatibility(1), + kSSLCiphersuiteGroupLegacy(2), + kSSLCiphersuiteGroupATS(3), + kSSLCiphersuiteGroupATSCompatibility(4); + + final int value; + const SSLCiphersuiteGroup(this.value); + + static SSLCiphersuiteGroup fromValue(int value) => switch (value) { + 0 => kSSLCiphersuiteGroupDefault, + 1 => kSSLCiphersuiteGroupCompatibility, + 2 => kSSLCiphersuiteGroupLegacy, + 3 => kSSLCiphersuiteGroupATS, + 4 => kSSLCiphersuiteGroupATSCompatibility, + _ => + throw ArgumentError("Unknown value for SSLCiphersuiteGroup: $value"), + }; +} + +typedef sec_trust_t = ffi.Pointer; +typedef Dartsec_trust_t = objc.NSObject; +typedef sec_identity_t = ffi.Pointer; +typedef Dartsec_identity_t = objc.NSObject; +typedef sec_certificate_t = ffi.Pointer; +typedef Dartsec_certificate_t = objc.NSObject; + +enum tls_protocol_version_t { + tls_protocol_version_TLSv10(769), + tls_protocol_version_TLSv11(770), + tls_protocol_version_TLSv12(771), + tls_protocol_version_TLSv13(772), + tls_protocol_version_DTLSv10(-257), + tls_protocol_version_DTLSv12(-259); + + final int value; + const tls_protocol_version_t(this.value); + + static tls_protocol_version_t fromValue(int value) => switch (value) { + 769 => tls_protocol_version_TLSv10, + 770 => tls_protocol_version_TLSv11, + 771 => tls_protocol_version_TLSv12, + 772 => tls_protocol_version_TLSv13, + -257 => tls_protocol_version_DTLSv10, + -259 => tls_protocol_version_DTLSv12, + _ => throw ArgumentError( + "Unknown value for tls_protocol_version_t: $value"), + }; +} + +enum tls_ciphersuite_t { + tls_ciphersuite_RSA_WITH_3DES_EDE_CBC_SHA(10), + tls_ciphersuite_RSA_WITH_AES_128_CBC_SHA(47), + tls_ciphersuite_RSA_WITH_AES_256_CBC_SHA(53), + tls_ciphersuite_RSA_WITH_AES_128_GCM_SHA256(156), + tls_ciphersuite_RSA_WITH_AES_256_GCM_SHA384(157), + tls_ciphersuite_RSA_WITH_AES_128_CBC_SHA256(60), + tls_ciphersuite_RSA_WITH_AES_256_CBC_SHA256(61), + tls_ciphersuite_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA(-16376), + tls_ciphersuite_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(-16375), + tls_ciphersuite_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(-16374), + tls_ciphersuite_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA(-16366), + tls_ciphersuite_ECDHE_RSA_WITH_AES_128_CBC_SHA(-16365), + tls_ciphersuite_ECDHE_RSA_WITH_AES_256_CBC_SHA(-16364), + tls_ciphersuite_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256(-16349), + tls_ciphersuite_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384(-16348), + tls_ciphersuite_ECDHE_RSA_WITH_AES_128_CBC_SHA256(-16345), + tls_ciphersuite_ECDHE_RSA_WITH_AES_256_CBC_SHA384(-16344), + tls_ciphersuite_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256(-16341), + tls_ciphersuite_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384(-16340), + tls_ciphersuite_ECDHE_RSA_WITH_AES_128_GCM_SHA256(-16337), + tls_ciphersuite_ECDHE_RSA_WITH_AES_256_GCM_SHA384(-16336), + tls_ciphersuite_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256(-13144), + tls_ciphersuite_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256(-13143), + tls_ciphersuite_AES_128_GCM_SHA256(4865), + tls_ciphersuite_AES_256_GCM_SHA384(4866), + tls_ciphersuite_CHACHA20_POLY1305_SHA256(4867); + + final int value; + const tls_ciphersuite_t(this.value); + + static tls_ciphersuite_t fromValue(int value) => switch (value) { + 10 => tls_ciphersuite_RSA_WITH_3DES_EDE_CBC_SHA, + 47 => tls_ciphersuite_RSA_WITH_AES_128_CBC_SHA, + 53 => tls_ciphersuite_RSA_WITH_AES_256_CBC_SHA, + 156 => tls_ciphersuite_RSA_WITH_AES_128_GCM_SHA256, + 157 => tls_ciphersuite_RSA_WITH_AES_256_GCM_SHA384, + 60 => tls_ciphersuite_RSA_WITH_AES_128_CBC_SHA256, + 61 => tls_ciphersuite_RSA_WITH_AES_256_CBC_SHA256, + -16376 => tls_ciphersuite_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, + -16375 => tls_ciphersuite_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + -16374 => tls_ciphersuite_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, + -16366 => tls_ciphersuite_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, + -16365 => tls_ciphersuite_ECDHE_RSA_WITH_AES_128_CBC_SHA, + -16364 => tls_ciphersuite_ECDHE_RSA_WITH_AES_256_CBC_SHA, + -16349 => tls_ciphersuite_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, + -16348 => tls_ciphersuite_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, + -16345 => tls_ciphersuite_ECDHE_RSA_WITH_AES_128_CBC_SHA256, + -16344 => tls_ciphersuite_ECDHE_RSA_WITH_AES_256_CBC_SHA384, + -16341 => tls_ciphersuite_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, + -16340 => tls_ciphersuite_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, + -16337 => tls_ciphersuite_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + -16336 => tls_ciphersuite_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + -13144 => tls_ciphersuite_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + -13143 => tls_ciphersuite_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, + 4865 => tls_ciphersuite_AES_128_GCM_SHA256, + 4866 => tls_ciphersuite_AES_256_GCM_SHA384, + 4867 => tls_ciphersuite_CHACHA20_POLY1305_SHA256, + _ => throw ArgumentError("Unknown value for tls_ciphersuite_t: $value"), + }; +} + +enum tls_ciphersuite_group_t { + tls_ciphersuite_group_default(0), + tls_ciphersuite_group_compatibility(1), + tls_ciphersuite_group_legacy(2), + tls_ciphersuite_group_ats(3), + tls_ciphersuite_group_ats_compatibility(4); + + final int value; + const tls_ciphersuite_group_t(this.value); + + static tls_ciphersuite_group_t fromValue(int value) => switch (value) { + 0 => tls_ciphersuite_group_default, + 1 => tls_ciphersuite_group_compatibility, + 2 => tls_ciphersuite_group_legacy, + 3 => tls_ciphersuite_group_ats, + 4 => tls_ciphersuite_group_ats_compatibility, + _ => throw ArgumentError( + "Unknown value for tls_ciphersuite_group_t: $value"), + }; +} + +enum SSLProtocol { + kSSLProtocolUnknown(0), + kTLSProtocol1(4), + kTLSProtocol11(7), + kTLSProtocol12(8), + kDTLSProtocol1(9), + kTLSProtocol13(10), + kDTLSProtocol12(11), + kTLSProtocolMaxSupported(999), + kSSLProtocol2(1), + kSSLProtocol3(2), + kSSLProtocol3Only(3), + kTLSProtocol1Only(5), + kSSLProtocolAll(6); + + final int value; + const SSLProtocol(this.value); + + static SSLProtocol fromValue(int value) => switch (value) { + 0 => kSSLProtocolUnknown, + 4 => kTLSProtocol1, + 7 => kTLSProtocol11, + 8 => kTLSProtocol12, + 9 => kDTLSProtocol1, + 10 => kTLSProtocol13, + 11 => kDTLSProtocol12, + 999 => kTLSProtocolMaxSupported, + 1 => kSSLProtocol2, + 2 => kSSLProtocol3, + 3 => kSSLProtocol3Only, + 5 => kTLSProtocol1Only, + 6 => kSSLProtocolAll, + _ => throw ArgumentError("Unknown value for SSLProtocol: $value"), + }; +} + +void _ObjCBlock_ffiVoid_seccertificatet_fnPtrTrampoline( + ffi.Pointer block, sec_certificate_t arg0) => + block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_seccertificatet_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, sec_certificate_t)>( + _ObjCBlock_ffiVoid_seccertificatet_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_seccertificatet_closureTrampoline( + ffi.Pointer block, sec_certificate_t arg0) => + (objc.getBlockClosure(block) as void Function(sec_certificate_t))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_seccertificatet_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, sec_certificate_t)>( + _ObjCBlock_ffiVoid_seccertificatet_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_seccertificatet_listenerTrampoline( + ffi.Pointer block, sec_certificate_t arg0) { + (objc.getBlockClosure(block) as void Function(sec_certificate_t))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, sec_certificate_t)> + _ObjCBlock_ffiVoid_seccertificatet_listenerCallable = ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, sec_certificate_t)>.listener( + _ObjCBlock_ffiVoid_seccertificatet_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_seccertificatet { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_seccertificatet_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(Dartsec_certificate_t) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_seccertificatet_closureCallable, + (sec_certificate_t arg0) => fn(objc.NSObject.castFromPointer(arg0, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(Dartsec_certificate_t) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_seccertificatet_listenerCallable.nativeFunction + .cast(), + (sec_certificate_t arg0) => fn( + objc.NSObject.castFromPointer(arg0, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_seccertificatet_CallExtension + on objc.ObjCBlock { + void call(Dartsec_certificate_t arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + sec_certificate_t arg0)>>() + .asFunction< + void Function(ffi.Pointer, + sec_certificate_t)>()(ref.pointer, arg0.ref.pointer); +} + +typedef sec_protocol_metadata_t = ffi.Pointer; +typedef Dartsec_protocol_metadata_t = objc.NSObject; +void _ObjCBlock_ffiVoid_Uint16_fnPtrTrampoline( + ffi.Pointer block, int arg0) => + block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_Uint16_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Uint16)>(_ObjCBlock_ffiVoid_Uint16_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Uint16_closureTrampoline( + ffi.Pointer block, int arg0) => + (objc.getBlockClosure(block) as void Function(int))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_Uint16_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Uint16)>(_ObjCBlock_ffiVoid_Uint16_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_Uint16_listenerTrampoline( + ffi.Pointer block, int arg0) { + (objc.getBlockClosure(block) as void Function(int))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, ffi.Uint16)> + _ObjCBlock_ffiVoid_Uint16_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Uint16)>.listener(_ObjCBlock_ffiVoid_Uint16_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_Uint16 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_Uint16_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(int) fn) => + objc.ObjCBlock( + objc.newClosureBlock(_ObjCBlock_ffiVoid_Uint16_closureCallable, + (int arg0) => fn(arg0)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(int) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_Uint16_listenerCallable.nativeFunction.cast(), + (int arg0) => fn(arg0)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_15f11yh(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_Uint16_CallExtension + on objc.ObjCBlock { + void call(int arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Uint16 arg0)>>() + .asFunction, int)>()( + ref.pointer, arg0); +} + +void _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_fnPtrTrampoline( + ffi.Pointer block, + dispatch_data_t arg0, + dispatch_data_t arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + dispatch_data_t arg0, dispatch_data_t arg1)>>() + .asFunction()( + arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + dispatch_data_t, dispatch_data_t)>( + _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_closureTrampoline( + ffi.Pointer block, + dispatch_data_t arg0, + dispatch_data_t arg1) => + (objc.getBlockClosure(block) as void Function( + dispatch_data_t, dispatch_data_t))(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + dispatch_data_t, dispatch_data_t)>( + _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_listenerTrampoline( + ffi.Pointer block, + dispatch_data_t arg0, + dispatch_data_t arg1) { + (objc.getBlockClosure(block) as void Function( + dispatch_data_t, dispatch_data_t))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, dispatch_data_t, dispatch_data_t)> + _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_listenerCallable = ffi + .NativeCallable< + ffi.Void Function(ffi.Pointer, dispatch_data_t, + dispatch_data_t)>.listener( + _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject)> fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(Dartdispatch_data_t, Dartdispatch_data_t) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_closureCallable, + (dispatch_data_t arg0, dispatch_data_t arg1) => fn( + objc.NSObject.castFromPointer(arg0, + retain: true, release: true), + objc.NSObject.castFromPointer(arg1, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock + listener(void Function(Dartdispatch_data_t, Dartdispatch_data_t) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_listenerCallable + .nativeFunction + .cast(), + (dispatch_data_t arg0, dispatch_data_t arg1) => fn( + objc.NSObject.castFromPointer(arg0, retain: false, release: true), + objc.NSObject.castFromPointer(arg1, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_wjvic9(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_dispatchdatat_dispatchdatat_CallExtension + on objc.ObjCBlock { + void call(Dartdispatch_data_t arg0, Dartdispatch_data_t arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + dispatch_data_t arg0, dispatch_data_t arg1)>>() + .asFunction< + void Function(ffi.Pointer, + dispatch_data_t, dispatch_data_t)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer); +} + +typedef sec_protocol_options_t = ffi.Pointer; +typedef Dartsec_protocol_options_t = objc.NSObject; +void _ObjCBlock_ffiVoid_dispatchdatat_fnPtrTrampoline( + ffi.Pointer block, dispatch_data_t arg0) => + block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_dispatchdatat_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, dispatch_data_t)>( + _ObjCBlock_ffiVoid_dispatchdatat_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_dispatchdatat_closureTrampoline( + ffi.Pointer block, dispatch_data_t arg0) => + (objc.getBlockClosure(block) as void Function(dispatch_data_t))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_dispatchdatat_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, dispatch_data_t)>( + _ObjCBlock_ffiVoid_dispatchdatat_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_dispatchdatat_listenerTrampoline( + ffi.Pointer block, dispatch_data_t arg0) { + (objc.getBlockClosure(block) as void Function(dispatch_data_t))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, dispatch_data_t)> + _ObjCBlock_ffiVoid_dispatchdatat_listenerCallable = ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, dispatch_data_t)>.listener( + _ObjCBlock_ffiVoid_dispatchdatat_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_dispatchdatat { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_dispatchdatat_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(Dartdispatch_data_t?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_dispatchdatat_closureCallable, + (dispatch_data_t arg0) => fn(arg0.address == 0 + ? null + : objc.NSObject.castFromPointer(arg0, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(Dartdispatch_data_t?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_dispatchdatat_listenerCallable.nativeFunction.cast(), + (dispatch_data_t arg0) => fn(arg0.address == 0 + ? null + : objc.NSObject.castFromPointer(arg0, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_dispatchdatat_CallExtension + on objc.ObjCBlock { + void call(Dartdispatch_data_t? arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + dispatch_data_t arg0)>>() + .asFunction< + void Function( + ffi.Pointer, dispatch_data_t)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); +} + +typedef sec_protocol_pre_shared_key_selection_complete_t + = ffi.Pointer; +typedef Dartsec_protocol_pre_shared_key_selection_complete_t + = objc.ObjCBlock; +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_fnPtrTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + dispatch_data_t arg1, + sec_protocol_pre_shared_key_selection_complete_t arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + sec_protocol_metadata_t arg0, + dispatch_data_t arg1, + sec_protocol_pre_shared_key_selection_complete_t + arg2)>>() + .asFunction< + void Function(sec_protocol_metadata_t, dispatch_data_t, + sec_protocol_pre_shared_key_selection_complete_t)>()( + arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + dispatch_data_t, + sec_protocol_pre_shared_key_selection_complete_t)>( + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_closureTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + dispatch_data_t arg1, + sec_protocol_pre_shared_key_selection_complete_t arg2) => + (objc.getBlockClosure(block) as void Function( + sec_protocol_metadata_t, + dispatch_data_t, + sec_protocol_pre_shared_key_selection_complete_t))( + arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + dispatch_data_t, + sec_protocol_pre_shared_key_selection_complete_t)>( + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_listenerTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + dispatch_data_t arg1, + sec_protocol_pre_shared_key_selection_complete_t arg2) { + (objc.getBlockClosure(block) as void Function( + sec_protocol_metadata_t, + dispatch_data_t, + sec_protocol_pre_shared_key_selection_complete_t))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + dispatch_data_t, + sec_protocol_pre_shared_key_selection_complete_t)> + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + dispatch_data_t, + sec_protocol_pre_shared_key_selection_complete_t)>.listener( + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + objc.NSObject, objc.NSObject?, objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject?, + objc.ObjCBlock)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject?, + objc.ObjCBlock)> + fromFunctionPointer(ffi.Pointer> ptr) => + objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject?, + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunction(void Function(Dartsec_protocol_metadata_t, Dartdispatch_data_t?, Dartsec_protocol_pre_shared_key_selection_complete_t) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_closureCallable, + (sec_protocol_metadata_t arg0, dispatch_data_t arg1, sec_protocol_pre_shared_key_selection_complete_t arg2) => fn( + objc.NSObject.castFromPointer(arg0, retain: true, release: true), + arg1.address == 0 ? null : objc.NSObject.castFromPointer(arg1, retain: true, release: true), + ObjCBlock_ffiVoid_dispatchdatat.castFromPointer(arg2, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject?, + objc.ObjCBlock)> listener( + void Function(Dartsec_protocol_metadata_t, Dartdispatch_data_t?, + Dartsec_protocol_pre_shared_key_selection_complete_t) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_listenerCallable + .nativeFunction + .cast(), + (sec_protocol_metadata_t arg0, dispatch_data_t arg1, + sec_protocol_pre_shared_key_selection_complete_t arg2) => + fn( + objc.NSObject.castFromPointer(arg0, + retain: false, release: true), + arg1.address == 0 + ? null + : objc.NSObject.castFromPointer(arg1, + retain: false, release: true), + ObjCBlock_ffiVoid_dispatchdatat.castFromPointer(arg2, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_91c9gi(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject?, + objc.ObjCBlock)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_secprotocolmetadatat_dispatchdatat_secprotocolpresharedkeyselectioncompletet_CallExtension + on objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject?, + objc.ObjCBlock)> { + void + call(Dartsec_protocol_metadata_t arg0, Dartdispatch_data_t? arg1, + Dartsec_protocol_pre_shared_key_selection_complete_t arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + dispatch_data_t arg1, + sec_protocol_pre_shared_key_selection_complete_t + arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + sec_protocol_metadata_t, + dispatch_data_t, + sec_protocol_pre_shared_key_selection_complete_t)>()( + ref.pointer, + arg0.ref.pointer, + arg1?.ref.pointer ?? ffi.nullptr, + arg2.ref.pointer); +} + +typedef sec_protocol_pre_shared_key_selection_t + = ffi.Pointer; +typedef Dartsec_protocol_pre_shared_key_selection_t = objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject?, + objc.ObjCBlock)>; +typedef sec_protocol_key_update_complete_t = ffi.Pointer; +typedef Dartsec_protocol_key_update_complete_t + = objc.ObjCBlock; +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_fnPtrTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_protocol_key_update_complete_t arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_metadata_t arg0, + sec_protocol_key_update_complete_t arg1)>>() + .asFunction< + void Function(sec_protocol_metadata_t, + sec_protocol_key_update_complete_t)>()(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_protocol_key_update_complete_t)>( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_closureTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_protocol_key_update_complete_t arg1) => + (objc.getBlockClosure(block) as void Function(sec_protocol_metadata_t, + sec_protocol_key_update_complete_t))(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_protocol_key_update_complete_t)>( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_listenerTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_protocol_key_update_complete_t arg1) { + (objc.getBlockClosure(block) as void Function( + sec_protocol_metadata_t, sec_protocol_key_update_complete_t))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + sec_protocol_metadata_t, sec_protocol_key_update_complete_t)> + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_protocol_key_update_complete_t)>.listener( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + objc.NSObject, objc.ObjCBlock)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_metadata_t arg0, + sec_protocol_key_update_complete_t arg1)>> + ptr) => + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunction(void Function(Dartsec_protocol_metadata_t, Dartsec_protocol_key_update_complete_t) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_closureCallable, + (sec_protocol_metadata_t arg0, + sec_protocol_key_update_complete_t arg1) => + fn(objc.NSObject.castFromPointer(arg0, retain: true, release: true), + ObjCBlock_ffiVoid.castFromPointer(arg1, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.ObjCBlock)> + listener( + void Function(Dartsec_protocol_metadata_t, + Dartsec_protocol_key_update_complete_t) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_listenerCallable + .nativeFunction + .cast(), + (sec_protocol_metadata_t arg0, + sec_protocol_key_update_complete_t arg1) => + fn( + objc.NSObject.castFromPointer(arg0, + retain: false, release: true), + ObjCBlock_ffiVoid.castFromPointer(arg1, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_14pxqbs(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + objc.NSObject, objc.ObjCBlock)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolkeyupdatecompletet_CallExtension + on objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.ObjCBlock)> { + void call(Dartsec_protocol_metadata_t arg0, + Dartsec_protocol_key_update_complete_t arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_protocol_key_update_complete_t arg1)>>() + .asFunction< + void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_protocol_key_update_complete_t)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer); +} + +typedef sec_protocol_key_update_t = ffi.Pointer; +typedef Dartsec_protocol_key_update_t = objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.ObjCBlock)>; +typedef sec_protocol_challenge_complete_t = ffi.Pointer; +typedef Dartsec_protocol_challenge_complete_t + = objc.ObjCBlock; +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_fnPtrTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_protocol_challenge_complete_t arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(sec_protocol_metadata_t arg0, + sec_protocol_challenge_complete_t arg1)>>() + .asFunction< + void Function(sec_protocol_metadata_t, + sec_protocol_challenge_complete_t)>()(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_protocol_challenge_complete_t)>( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_closureTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_protocol_challenge_complete_t arg1) => + (objc.getBlockClosure(block) as void Function(sec_protocol_metadata_t, + sec_protocol_challenge_complete_t))(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_protocol_challenge_complete_t)>( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_listenerTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_protocol_challenge_complete_t arg1) { + (objc.getBlockClosure(block) as void Function( + sec_protocol_metadata_t, sec_protocol_challenge_complete_t))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + sec_protocol_metadata_t, sec_protocol_challenge_complete_t)> + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_protocol_challenge_complete_t)>.listener( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + objc.NSObject, objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(objc.NSObject, + objc.ObjCBlock)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock)> + fromFunctionPointer(ffi.Pointer> ptr) => + objc.ObjCBlock< + ffi.Void Function(objc.NSObject, + objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock)> + fromFunction(void Function(Dartsec_protocol_metadata_t, Dartsec_protocol_challenge_complete_t) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_closureCallable, + (sec_protocol_metadata_t arg0, sec_protocol_challenge_complete_t arg1) => fn( + objc.NSObject.castFromPointer(arg0, retain: true, release: true), + ObjCBlock_ffiVoid_dispatchdatat.castFromPointer(arg1, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + objc.NSObject, objc.ObjCBlock)> + listener( + void Function(Dartsec_protocol_metadata_t, + Dartsec_protocol_challenge_complete_t) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_listenerCallable + .nativeFunction + .cast(), + (sec_protocol_metadata_t arg0, + sec_protocol_challenge_complete_t arg1) => + fn( + objc.NSObject.castFromPointer(arg0, + retain: false, release: true), + ObjCBlock_ffiVoid_dispatchdatat.castFromPointer(arg1, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_14pxqbs(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(objc.NSObject, + objc.ObjCBlock)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_secprotocolmetadatat_secprotocolchallengecompletet_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + objc.NSObject, objc.ObjCBlock)> { + void call(Dartsec_protocol_metadata_t arg0, + Dartsec_protocol_challenge_complete_t arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_protocol_challenge_complete_t arg1)>>() + .asFunction< + void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_protocol_challenge_complete_t)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer); +} + +typedef sec_protocol_challenge_t = ffi.Pointer; +typedef Dartsec_protocol_challenge_t = objc.ObjCBlock< + ffi.Void Function( + objc.NSObject, objc.ObjCBlock)>; +void _ObjCBlock_ffiVoid_bool_fnPtrTrampoline( + ffi.Pointer block, bool arg0) => + block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_bool_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Bool)>(_ObjCBlock_ffiVoid_bool_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_bool_closureTrampoline( + ffi.Pointer block, bool arg0) => + (objc.getBlockClosure(block) as void Function(bool))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_bool_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Bool)>(_ObjCBlock_ffiVoid_bool_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_bool_listenerTrampoline( + ffi.Pointer block, bool arg0) { + (objc.getBlockClosure(block) as void Function(bool))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable, ffi.Bool)> + _ObjCBlock_ffiVoid_bool_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Bool)>.listener(_ObjCBlock_ffiVoid_bool_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_bool { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_bool_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(bool) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_bool_closureCallable, (bool arg0) => fn(arg0)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(bool) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_bool_listenerCallable.nativeFunction.cast(), + (bool arg0) => fn(arg0)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1s56lr9(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_bool_CallExtension + on objc.ObjCBlock { + void call(bool arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, ffi.Bool arg0)>>() + .asFunction, bool)>()( + ref.pointer, arg0); +} + +typedef sec_protocol_verify_complete_t = ffi.Pointer; +typedef Dartsec_protocol_verify_complete_t + = objc.ObjCBlock; +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_fnPtrTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_trust_t arg1, + sec_protocol_verify_complete_t arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + sec_protocol_metadata_t arg0, + sec_trust_t arg1, + sec_protocol_verify_complete_t arg2)>>() + .asFunction< + void Function(sec_protocol_metadata_t, sec_trust_t, + sec_protocol_verify_complete_t)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_trust_t, + sec_protocol_verify_complete_t)>( + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_closureTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_trust_t arg1, + sec_protocol_verify_complete_t arg2) => + (objc.getBlockClosure(block) as void Function(sec_protocol_metadata_t, + sec_trust_t, sec_protocol_verify_complete_t))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_trust_t, + sec_protocol_verify_complete_t)>( + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_listenerTrampoline( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_trust_t arg1, + sec_protocol_verify_complete_t arg2) { + (objc.getBlockClosure(block) as void Function(sec_protocol_metadata_t, + sec_trust_t, sec_protocol_verify_complete_t))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_trust_t, + sec_protocol_verify_complete_t)> + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_trust_t, + sec_protocol_verify_complete_t)>.listener( + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject, + objc.ObjCBlock)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject, + objc.ObjCBlock)> + fromFunctionPointer(ffi.Pointer> ptr) => + objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject, + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock)> + fromFunction(void Function(Dartsec_protocol_metadata_t, Dartsec_trust_t, Dartsec_protocol_verify_complete_t) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_closureCallable, + (sec_protocol_metadata_t arg0, sec_trust_t arg1, sec_protocol_verify_complete_t arg2) => fn( + objc.NSObject.castFromPointer(arg0, retain: true, release: true), + objc.NSObject.castFromPointer(arg1, retain: true, release: true), + ObjCBlock_ffiVoid_bool.castFromPointer(arg2, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject, + objc.ObjCBlock)> listener( + void Function(Dartsec_protocol_metadata_t, Dartsec_trust_t, + Dartsec_protocol_verify_complete_t) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_listenerCallable + .nativeFunction + .cast(), + (sec_protocol_metadata_t arg0, sec_trust_t arg1, + sec_protocol_verify_complete_t arg2) => + fn( + objc.NSObject.castFromPointer(arg0, + retain: false, release: true), + objc.NSObject.castFromPointer(arg1, + retain: false, release: true), + ObjCBlock_ffiVoid_bool.castFromPointer(arg2, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_91c9gi(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject, + objc.ObjCBlock)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_secprotocolmetadatat_sectrustt_secprotocolverifycompletet_CallExtension + on objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject, + objc.ObjCBlock)> { + void call(Dartsec_protocol_metadata_t arg0, Dartsec_trust_t arg1, + Dartsec_protocol_verify_complete_t arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + sec_protocol_metadata_t arg0, + sec_trust_t arg1, + sec_protocol_verify_complete_t arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + sec_protocol_metadata_t, + sec_trust_t, + sec_protocol_verify_complete_t)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2.ref.pointer); +} + +typedef sec_protocol_verify_t = ffi.Pointer; +typedef Dartsec_protocol_verify_t = objc.ObjCBlock< + ffi.Void Function(objc.NSObject, objc.NSObject, + objc.ObjCBlock)>; + +final class SSLContext extends ffi.Opaque {} + +typedef SSLContextRef = ffi.Pointer; +typedef SSLConnectionRef = ffi.Pointer; + +enum SSLSessionOption { + kSSLSessionOptionBreakOnServerAuth(0), + kSSLSessionOptionBreakOnCertRequested(1), + kSSLSessionOptionBreakOnClientAuth(2), + kSSLSessionOptionFalseStart(3), + kSSLSessionOptionSendOneByteRecord(4), + kSSLSessionOptionAllowServerIdentityChange(5), + kSSLSessionOptionFallback(6), + kSSLSessionOptionBreakOnClientHello(7), + kSSLSessionOptionAllowRenegotiation(8), + kSSLSessionOptionEnableSessionTickets(9); + + final int value; + const SSLSessionOption(this.value); + + static SSLSessionOption fromValue(int value) => switch (value) { + 0 => kSSLSessionOptionBreakOnServerAuth, + 1 => kSSLSessionOptionBreakOnCertRequested, + 2 => kSSLSessionOptionBreakOnClientAuth, + 3 => kSSLSessionOptionFalseStart, + 4 => kSSLSessionOptionSendOneByteRecord, + 5 => kSSLSessionOptionAllowServerIdentityChange, + 6 => kSSLSessionOptionFallback, + 7 => kSSLSessionOptionBreakOnClientHello, + 8 => kSSLSessionOptionAllowRenegotiation, + 9 => kSSLSessionOptionEnableSessionTickets, + _ => throw ArgumentError("Unknown value for SSLSessionOption: $value"), + }; +} + +enum SSLSessionState { + kSSLIdle(0), + kSSLHandshake(1), + kSSLConnected(2), + kSSLClosed(3), + kSSLAborted(4); + + final int value; + const SSLSessionState(this.value); + + static SSLSessionState fromValue(int value) => switch (value) { + 0 => kSSLIdle, + 1 => kSSLHandshake, + 2 => kSSLConnected, + 3 => kSSLClosed, + 4 => kSSLAborted, + _ => throw ArgumentError("Unknown value for SSLSessionState: $value"), + }; +} + +enum SSLClientCertificateState { + kSSLClientCertNone(0), + kSSLClientCertRequested(1), + kSSLClientCertSent(2), + kSSLClientCertRejected(3); + + final int value; + const SSLClientCertificateState(this.value); + + static SSLClientCertificateState fromValue(int value) => switch (value) { + 0 => kSSLClientCertNone, + 1 => kSSLClientCertRequested, + 2 => kSSLClientCertSent, + 3 => kSSLClientCertRejected, + _ => throw ArgumentError( + "Unknown value for SSLClientCertificateState: $value"), + }; +} + +typedef SSLReadFuncFunction = OSStatus Function(SSLConnectionRef connection, + ffi.Pointer data, ffi.Pointer dataLength); +typedef DartSSLReadFuncFunction = DartSInt32 Function( + SSLConnectionRef connection, + ffi.Pointer data, + ffi.Pointer dataLength); +typedef SSLReadFunc = ffi.Pointer>; +typedef SSLWriteFuncFunction = OSStatus Function(SSLConnectionRef connection, + ffi.Pointer data, ffi.Pointer dataLength); +typedef DartSSLWriteFuncFunction = DartSInt32 Function( + SSLConnectionRef connection, + ffi.Pointer data, + ffi.Pointer dataLength); +typedef SSLWriteFunc = ffi.Pointer>; + +enum SSLProtocolSide { + kSSLServerSide(0), + kSSLClientSide(1); + + final int value; + const SSLProtocolSide(this.value); + + static SSLProtocolSide fromValue(int value) => switch (value) { + 0 => kSSLServerSide, + 1 => kSSLClientSide, + _ => throw ArgumentError("Unknown value for SSLProtocolSide: $value"), + }; +} + +enum SSLConnectionType { + kSSLStreamType(0), + kSSLDatagramType(1); + + final int value; + const SSLConnectionType(this.value); + + static SSLConnectionType fromValue(int value) => switch (value) { + 0 => kSSLStreamType, + 1 => kSSLDatagramType, + _ => throw ArgumentError("Unknown value for SSLConnectionType: $value"), + }; +} + +enum SSLAuthenticate { + kNeverAuthenticate(0), + kAlwaysAuthenticate(1), + kTryAuthenticate(2); + + final int value; + const SSLAuthenticate(this.value); + + static SSLAuthenticate fromValue(int value) => switch (value) { + 0 => kNeverAuthenticate, + 1 => kAlwaysAuthenticate, + 2 => kTryAuthenticate, + _ => throw ArgumentError("Unknown value for SSLAuthenticate: $value"), + }; +} + +late final _class_NSURLSession = objc.getClass("NSURLSession"); +void _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerCallable = ffi + .NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(objc.NSData?, NSURLResponse?, + objc.NSError?)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(objc.NSData?, NSURLResponse?, objc.NSError?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + arg0.address == 0 ? null : objc.NSData.castFromPointer(arg0, retain: true, release: true), + arg1.address == 0 ? null : NSURLResponse.castFromPointer(arg1, retain: true, release: true), + arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc + .ObjCBlock + listener(void Function(objc.NSData?, NSURLResponse?, objc.NSError?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + arg0.address == 0 + ? null + : objc.NSData.castFromPointer(arg0, + retain: false, release: true), + arg1.address == 0 + ? null + : NSURLResponse.castFromPointer(arg1, + retain: false, release: true), + arg2.address == 0 + ? null + : objc.NSError.castFromPointer(arg2, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1hcfngn(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(objc.NSData?, NSURLResponse?, + objc.NSError?)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError_CallExtension on objc + .ObjCBlock { + void call(objc.NSData? arg0, NSURLResponse? arg1, objc.NSError? arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, + arg0?.ref.pointer ?? ffi.nullptr, + arg1?.ref.pointer ?? ffi.nullptr, + arg2?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_dataTaskWithRequest_completionHandler_ = + objc.registerName("dataTaskWithRequest:completionHandler:"); +final _objc_msgSend_o4sqyk = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_dataTaskWithURL_completionHandler_ = + objc.registerName("dataTaskWithURL:completionHandler:"); + +/// WARNING: NSURLSessionUploadTask is a stub. To generate bindings for this class, include +/// NSURLSessionUploadTask in your config's objc-interfaces list. +/// +/// An NSURLSessionUploadTask does not currently provide any additional +/// functionality over an NSURLSessionDataTask. All delegate messages +/// that may be sent referencing an NSURLSessionDataTask equally apply +/// to NSURLSessionUploadTasks. +class NSURLSessionUploadTask extends NSURLSessionDataTask { + NSURLSessionUploadTask._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSessionUploadTask] that points to the same underlying object as [other]. + NSURLSessionUploadTask.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSessionUploadTask] that wraps the given raw object pointer. + NSURLSessionUploadTask.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _sel_uploadTaskWithRequest_fromFile_completionHandler_ = + objc.registerName("uploadTaskWithRequest:fromFile:completionHandler:"); +final _objc_msgSend_but05y = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_uploadTaskWithRequest_fromData_completionHandler_ = + objc.registerName("uploadTaskWithRequest:fromData:completionHandler:"); +late final _sel_uploadTaskWithResumeData_completionHandler_ = + objc.registerName("uploadTaskWithResumeData:completionHandler:"); +late final _class_NSURLSessionDownloadTask = + objc.getClass("NSURLSessionDownloadTask"); +void _ObjCBlock_ffiVoid_NSData_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSData_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSData_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSData_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSData_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSData_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSData_listenerTrampoline( + ffi.Pointer block, ffi.Pointer arg0) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_NSData_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSData_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSData { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSData_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(objc.NSData?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSData_closureCallable, + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : objc.NSData.castFromPointer(arg0, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(objc.NSData?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSData_listenerCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : objc.NSData.castFromPointer(arg0, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSData_CallExtension + on objc.ObjCBlock { + void call(objc.NSData? arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_cancelByProducingResumeData_ = + objc.registerName("cancelByProducingResumeData:"); + +/// NSURLSessionDownloadTask is a task that represents a download to +/// local storage. +class NSURLSessionDownloadTask extends NSURLSessionTask { + NSURLSessionDownloadTask._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSessionDownloadTask] that points to the same underlying object as [other]. + NSURLSessionDownloadTask.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSessionDownloadTask] that wraps the given raw object pointer. + NSURLSessionDownloadTask.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSURLSessionDownloadTask]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionDownloadTask); + } + + /// Cancel the download (and calls the superclass -cancel). If + /// conditions will allow for resuming the download in the future, the + /// callback will be called with an opaque data blob, which may be used + /// with -downloadTaskWithResumeData: to attempt to resume the download. + /// If resume data cannot be created, the completion handler will be + /// called with nil resumeData. + void cancelByProducingResumeData_( + objc.ObjCBlock completionHandler) { + _objc_msgSend_f167m6(this.ref.pointer, _sel_cancelByProducingResumeData_, + completionHandler.ref.pointer); + } + + /// init + NSURLSessionDownloadTask init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: false, release: true); + } + + /// new + static NSURLSessionDownloadTask new1() { + final _ret = + _objc_msgSend_1x359cv(_class_NSURLSessionDownloadTask, _sel_new); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: false, release: true); + } + + /// allocWithZone: + static NSURLSessionDownloadTask allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = _objc_msgSend_hzlb60( + _class_NSURLSessionDownloadTask, _sel_allocWithZone_, zone); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: false, release: true); + } + + /// alloc + static NSURLSessionDownloadTask alloc() { + final _ret = + _objc_msgSend_1x359cv(_class_NSURLSessionDownloadTask, _sel_alloc); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: false, release: true); + } + + /// self + NSURLSessionDownloadTask self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// retain + NSURLSessionDownloadTask retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// autorelease + NSURLSessionDownloadTask autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: true, release: true); + } +} + +void _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerCallable = ffi + .NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(objc.NSURL?, NSURLResponse?, + objc.NSError?)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(objc.NSURL?, NSURLResponse?, objc.NSError?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + arg0.address == 0 ? null : objc.NSURL.castFromPointer(arg0, retain: true, release: true), + arg1.address == 0 ? null : NSURLResponse.castFromPointer(arg1, retain: true, release: true), + arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc + .ObjCBlock + listener(void Function(objc.NSURL?, NSURLResponse?, objc.NSError?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + arg0.address == 0 + ? null + : objc.NSURL + .castFromPointer(arg0, retain: false, release: true), + arg1.address == 0 + ? null + : NSURLResponse.castFromPointer(arg1, + retain: false, release: true), + arg2.address == 0 + ? null + : objc.NSError.castFromPointer(arg2, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1hcfngn(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(objc.NSURL?, NSURLResponse?, + objc.NSError?)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError_CallExtension on objc + .ObjCBlock { + void call(objc.NSURL? arg0, NSURLResponse? arg1, objc.NSError? arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, + arg0?.ref.pointer ?? ffi.nullptr, + arg1?.ref.pointer ?? ffi.nullptr, + arg2?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_downloadTaskWithRequest_completionHandler_ = + objc.registerName("downloadTaskWithRequest:completionHandler:"); +late final _sel_downloadTaskWithURL_completionHandler_ = + objc.registerName("downloadTaskWithURL:completionHandler:"); +late final _sel_downloadTaskWithResumeData_completionHandler_ = + objc.registerName("downloadTaskWithResumeData:completionHandler:"); + +/// NSURLSession convenience routines deliver results to +/// a completion handler block. These convenience routines +/// are not available to NSURLSessions that are configured +/// as background sessions. +/// +/// Task objects are always created in a suspended state and +/// must be sent the -resume message before they will execute. +extension NSURLSessionAsynchronousConvenience on NSURLSession { + /// data task convenience methods. These methods create tasks that + /// bypass the normal delegate calls for response and data delivery, + /// and provide a simple cancelable asynchronous interface to receiving + /// data. Errors will be returned in the NSURLErrorDomain, + /// see . The delegate, if any, will still be + /// called for authentication challenges. + NSURLSessionDataTask dataTaskWithRequest_completionHandler_( + NSURLRequest request, + objc.ObjCBlock< + ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> + completionHandler) { + final _ret = _objc_msgSend_o4sqyk( + this.ref.pointer, + _sel_dataTaskWithRequest_completionHandler_, + request.ref.pointer, + completionHandler.ref.pointer); + return NSURLSessionDataTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// dataTaskWithURL:completionHandler: + NSURLSessionDataTask dataTaskWithURL_completionHandler_( + objc.NSURL url, + objc.ObjCBlock< + ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> + completionHandler) { + final _ret = _objc_msgSend_o4sqyk( + this.ref.pointer, + _sel_dataTaskWithURL_completionHandler_, + url.ref.pointer, + completionHandler.ref.pointer); + return NSURLSessionDataTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// upload convenience method. + NSURLSessionUploadTask uploadTaskWithRequest_fromFile_completionHandler_( + NSURLRequest request, + objc.NSURL fileURL, + objc.ObjCBlock< + ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> + completionHandler) { + final _ret = _objc_msgSend_but05y( + this.ref.pointer, + _sel_uploadTaskWithRequest_fromFile_completionHandler_, + request.ref.pointer, + fileURL.ref.pointer, + completionHandler.ref.pointer); + return NSURLSessionUploadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// uploadTaskWithRequest:fromData:completionHandler: + NSURLSessionUploadTask uploadTaskWithRequest_fromData_completionHandler_( + NSURLRequest request, + objc.NSData? bodyData, + objc.ObjCBlock< + ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> + completionHandler) { + final _ret = _objc_msgSend_but05y( + this.ref.pointer, + _sel_uploadTaskWithRequest_fromData_completionHandler_, + request.ref.pointer, + bodyData?.ref.pointer ?? ffi.nullptr, + completionHandler.ref.pointer); + return NSURLSessionUploadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a URLSessionUploadTask from a resume data blob. If resuming from an upload + /// file, the file must still exist and be unmodified. + /// + /// - Parameter resumeData: Resume data blob from an incomplete upload, such as data returned by the cancelByProducingResumeData: method. + /// - Parameter completionHandler: The completion handler to call when the load request is complete. + /// - Returns: A new session upload task, or nil if the resumeData is invalid. + NSURLSessionUploadTask uploadTaskWithResumeData_completionHandler_( + objc.NSData resumeData, + objc.ObjCBlock< + ffi.Void Function(objc.NSData?, NSURLResponse?, objc.NSError?)> + completionHandler) { + final _ret = _objc_msgSend_o4sqyk( + this.ref.pointer, + _sel_uploadTaskWithResumeData_completionHandler_, + resumeData.ref.pointer, + completionHandler.ref.pointer); + return NSURLSessionUploadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// download task convenience methods. When a download successfully + /// completes, the NSURL will point to a file that must be read or + /// copied during the invocation of the completion routine. The file + /// will be removed automatically. + NSURLSessionDownloadTask downloadTaskWithRequest_completionHandler_( + NSURLRequest request, + objc.ObjCBlock< + ffi.Void Function(objc.NSURL?, NSURLResponse?, objc.NSError?)> + completionHandler) { + final _ret = _objc_msgSend_o4sqyk( + this.ref.pointer, + _sel_downloadTaskWithRequest_completionHandler_, + request.ref.pointer, + completionHandler.ref.pointer); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// downloadTaskWithURL:completionHandler: + NSURLSessionDownloadTask downloadTaskWithURL_completionHandler_( + objc.NSURL url, + objc.ObjCBlock< + ffi.Void Function(objc.NSURL?, NSURLResponse?, objc.NSError?)> + completionHandler) { + final _ret = _objc_msgSend_o4sqyk( + this.ref.pointer, + _sel_downloadTaskWithURL_completionHandler_, + url.ref.pointer, + completionHandler.ref.pointer); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// downloadTaskWithResumeData:completionHandler: + NSURLSessionDownloadTask downloadTaskWithResumeData_completionHandler_( + objc.NSData resumeData, + objc.ObjCBlock< + ffi.Void Function(objc.NSURL?, NSURLResponse?, objc.NSError?)> + completionHandler) { + final _ret = _objc_msgSend_o4sqyk( + this.ref.pointer, + _sel_downloadTaskWithResumeData_completionHandler_, + resumeData.ref.pointer, + completionHandler.ref.pointer); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: true, release: true); + } +} + +late final _sel_sharedSession = objc.registerName("sharedSession"); +late final _class_NSURLSessionConfiguration = + objc.getClass("NSURLSessionConfiguration"); +late final _sel_backgroundSessionConfiguration_ = + objc.registerName("backgroundSessionConfiguration:"); + +/// NSURLSessionDeprecated +extension NSURLSessionDeprecated on NSURLSessionConfiguration { + /// backgroundSessionConfiguration: + static NSURLSessionConfiguration backgroundSessionConfiguration_( + objc.NSString identifier) { + final _ret = _objc_msgSend_62nh5j(_class_NSURLSessionConfiguration, + _sel_backgroundSessionConfiguration_, identifier.ref.pointer); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: true, release: true); + } +} + +late final _sel_defaultSessionConfiguration = + objc.registerName("defaultSessionConfiguration"); +late final _sel_ephemeralSessionConfiguration = + objc.registerName("ephemeralSessionConfiguration"); +late final _sel_backgroundSessionConfigurationWithIdentifier_ = + objc.registerName("backgroundSessionConfigurationWithIdentifier:"); +late final _sel_identifier = objc.registerName("identifier"); +late final _sel_requestCachePolicy = objc.registerName("requestCachePolicy"); +late final _sel_setRequestCachePolicy_ = + objc.registerName("setRequestCachePolicy:"); +late final _sel_timeoutIntervalForRequest = + objc.registerName("timeoutIntervalForRequest"); +late final _sel_setTimeoutIntervalForRequest_ = + objc.registerName("setTimeoutIntervalForRequest:"); +late final _sel_timeoutIntervalForResource = + objc.registerName("timeoutIntervalForResource"); +late final _sel_setTimeoutIntervalForResource_ = + objc.registerName("setTimeoutIntervalForResource:"); +late final _sel_waitsForConnectivity = + objc.registerName("waitsForConnectivity"); +late final _sel_setWaitsForConnectivity_ = + objc.registerName("setWaitsForConnectivity:"); +late final _sel_isDiscretionary = objc.registerName("isDiscretionary"); +late final _sel_setDiscretionary_ = objc.registerName("setDiscretionary:"); +late final _sel_sharedContainerIdentifier = + objc.registerName("sharedContainerIdentifier"); +late final _sel_setSharedContainerIdentifier_ = + objc.registerName("setSharedContainerIdentifier:"); +late final _sel_sessionSendsLaunchEvents = + objc.registerName("sessionSendsLaunchEvents"); +late final _sel_setSessionSendsLaunchEvents_ = + objc.registerName("setSessionSendsLaunchEvents:"); +late final _sel_connectionProxyDictionary = + objc.registerName("connectionProxyDictionary"); +late final _sel_setConnectionProxyDictionary_ = + objc.registerName("setConnectionProxyDictionary:"); +late final _sel_TLSMinimumSupportedProtocol = + objc.registerName("TLSMinimumSupportedProtocol"); +final _objc_msgSend_cbopi9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedInt Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setTLSMinimumSupportedProtocol_ = + objc.registerName("setTLSMinimumSupportedProtocol:"); +final _objc_msgSend_268k8x = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedInt)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_TLSMaximumSupportedProtocol = + objc.registerName("TLSMaximumSupportedProtocol"); +late final _sel_setTLSMaximumSupportedProtocol_ = + objc.registerName("setTLSMaximumSupportedProtocol:"); +late final _sel_TLSMinimumSupportedProtocolVersion = + objc.registerName("TLSMinimumSupportedProtocolVersion"); +final _objc_msgSend_9jpwfb = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Uint16 Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setTLSMinimumSupportedProtocolVersion_ = + objc.registerName("setTLSMinimumSupportedProtocolVersion:"); +final _objc_msgSend_1mvuct7 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Uint16)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_TLSMaximumSupportedProtocolVersion = + objc.registerName("TLSMaximumSupportedProtocolVersion"); +late final _sel_setTLSMaximumSupportedProtocolVersion_ = + objc.registerName("setTLSMaximumSupportedProtocolVersion:"); +late final _sel_HTTPShouldSetCookies = + objc.registerName("HTTPShouldSetCookies"); +late final _sel_setHTTPShouldSetCookies_ = + objc.registerName("setHTTPShouldSetCookies:"); +late final _sel_HTTPCookieAcceptPolicy = + objc.registerName("HTTPCookieAcceptPolicy"); +final _objc_msgSend_104dkoq = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSUInteger Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setHTTPCookieAcceptPolicy_ = + objc.registerName("setHTTPCookieAcceptPolicy:"); +final _objc_msgSend_3q55ys = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_HTTPAdditionalHeaders = + objc.registerName("HTTPAdditionalHeaders"); +late final _sel_setHTTPAdditionalHeaders_ = + objc.registerName("setHTTPAdditionalHeaders:"); +late final _sel_HTTPMaximumConnectionsPerHost = + objc.registerName("HTTPMaximumConnectionsPerHost"); +late final _sel_setHTTPMaximumConnectionsPerHost_ = + objc.registerName("setHTTPMaximumConnectionsPerHost:"); +late final _sel_HTTPCookieStorage = objc.registerName("HTTPCookieStorage"); +late final _sel_setHTTPCookieStorage_ = + objc.registerName("setHTTPCookieStorage:"); + +/// WARNING: NSURLCredentialStorage is a stub. To generate bindings for this class, include +/// NSURLCredentialStorage in your config's objc-interfaces list. +/// +/// NSURLCredentialStorage +class NSURLCredentialStorage extends objc.ObjCObjectBase { + NSURLCredentialStorage._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super(pointer, retain: retain, release: release); + + /// Constructs a [NSURLCredentialStorage] that points to the same underlying object as [other]. + NSURLCredentialStorage.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLCredentialStorage] that wraps the given raw object pointer. + NSURLCredentialStorage.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _sel_URLCredentialStorage = + objc.registerName("URLCredentialStorage"); +late final _sel_setURLCredentialStorage_ = + objc.registerName("setURLCredentialStorage:"); +late final _sel_URLCache = objc.registerName("URLCache"); +late final _sel_setURLCache_ = objc.registerName("setURLCache:"); +late final _sel_shouldUseExtendedBackgroundIdleMode = + objc.registerName("shouldUseExtendedBackgroundIdleMode"); +late final _sel_setShouldUseExtendedBackgroundIdleMode_ = + objc.registerName("setShouldUseExtendedBackgroundIdleMode:"); +late final _sel_protocolClasses = objc.registerName("protocolClasses"); +late final _sel_setProtocolClasses_ = objc.registerName("setProtocolClasses:"); + +/// ! +/// @enum NSURLSessionMultipathServiceType +/// +/// @discussion The NSURLSessionMultipathServiceType enum defines constants that +/// can be used to specify the multipath service type to associate an NSURLSession. The +/// multipath service type determines whether multipath TCP should be attempted and the conditions +/// for creating and switching between subflows. Using these service types requires the appropriate entitlement. Any connection attempt will fail if the process does not have the required entitlement. +/// A primary interface is a generally less expensive interface in terms of both cost and power (such as WiFi or ethernet). A secondary interface is more expensive (such as 3G or LTE). +/// +/// @constant NSURLSessionMultipathServiceTypeNone Specifies that multipath tcp should not be used. Connections will use a single flow. +/// This is the default value. No entitlement is required to set this value. +/// +/// @constant NSURLSessionMultipathServiceTypeHandover Specifies that a secondary subflow should only be used +/// when the primary subflow is not performing adequately. Requires the com.apple.developer.networking.multipath entitlement. +/// +/// @constant NSURLSessionMultipathServiceTypeInteractive Specifies that a secondary subflow should be used if the +/// primary subflow is not performing adequately (packet loss, high round trip times, bandwidth issues). The secondary +/// subflow will be created more aggressively than with NSURLSessionMultipathServiceTypeHandover. Requires the com.apple.developer.networking.multipath entitlement. +/// +/// @constant NSURLSessionMultipathServiceTypeAggregate Specifies that multiple subflows across multiple interfaces should be +/// used for better bandwidth. This mode is only available for experimentation on devices configured for development use. +/// It can be enabled in the Developer section of the Settings app. +enum NSURLSessionMultipathServiceType { + /// None - no multipath (default) + NSURLSessionMultipathServiceTypeNone(0), + + /// Handover - secondary flows brought up when primary flow is not performing adequately. + NSURLSessionMultipathServiceTypeHandover(1), + + /// Interactive - secondary flows created more aggressively. + NSURLSessionMultipathServiceTypeInteractive(2), + + /// Aggregate - multiple subflows used for greater bandwidth. + NSURLSessionMultipathServiceTypeAggregate(3); + + final int value; + const NSURLSessionMultipathServiceType(this.value); + + static NSURLSessionMultipathServiceType fromValue(int value) => + switch (value) { + 0 => NSURLSessionMultipathServiceTypeNone, + 1 => NSURLSessionMultipathServiceTypeHandover, + 2 => NSURLSessionMultipathServiceTypeInteractive, + 3 => NSURLSessionMultipathServiceTypeAggregate, + _ => throw ArgumentError( + "Unknown value for NSURLSessionMultipathServiceType: $value"), + }; +} + +late final _sel_multipathServiceType = + objc.registerName("multipathServiceType"); +final _objc_msgSend_1wxwnc0 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setMultipathServiceType_ = + objc.registerName("setMultipathServiceType:"); +final _objc_msgSend_1hx005a = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSInteger)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); + +/// Configuration options for an NSURLSession. When a session is +/// created, a copy of the configuration object is made - you cannot +/// modify the configuration of a session after it has been created. +/// +/// The shared session uses the global singleton credential, cache +/// and cookie storage objects. +/// +/// An ephemeral session has no persistent disk storage for cookies, +/// cache or credentials. +/// +/// A background session can be used to perform networking operations +/// on behalf of a suspended application, within certain constraints. +class NSURLSessionConfiguration extends objc.NSObject { + NSURLSessionConfiguration._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSessionConfiguration] that points to the same underlying object as [other]. + NSURLSessionConfiguration.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSessionConfiguration] that wraps the given raw object pointer. + NSURLSessionConfiguration.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSURLSessionConfiguration]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionConfiguration); + } + + /// defaultSessionConfiguration + static NSURLSessionConfiguration getDefaultSessionConfiguration() { + final _ret = _objc_msgSend_1x359cv( + _class_NSURLSessionConfiguration, _sel_defaultSessionConfiguration); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: true, release: true); + } + + /// ephemeralSessionConfiguration + static NSURLSessionConfiguration getEphemeralSessionConfiguration() { + final _ret = _objc_msgSend_1x359cv( + _class_NSURLSessionConfiguration, _sel_ephemeralSessionConfiguration); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: true, release: true); + } + + /// backgroundSessionConfigurationWithIdentifier: + static NSURLSessionConfiguration + backgroundSessionConfigurationWithIdentifier_(objc.NSString identifier) { + final _ret = _objc_msgSend_62nh5j( + _class_NSURLSessionConfiguration, + _sel_backgroundSessionConfigurationWithIdentifier_, + identifier.ref.pointer); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: true, release: true); + } + + /// identifier for the background session configuration + objc.NSString? get identifier { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_identifier); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// default cache policy for requests + NSURLRequestCachePolicy get requestCachePolicy { + final _ret = + _objc_msgSend_8jm3uo(this.ref.pointer, _sel_requestCachePolicy); + return NSURLRequestCachePolicy.fromValue(_ret); + } + + /// default cache policy for requests + set requestCachePolicy(NSURLRequestCachePolicy value) { + return _objc_msgSend_1yjxuv2( + this.ref.pointer, _sel_setRequestCachePolicy_, value.value); + } + + /// default timeout for requests. This will cause a timeout if no data is transmitted for the given timeout value, and is reset whenever data is transmitted. + DartNSTimeInterval get timeoutIntervalForRequest { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret( + this.ref.pointer, _sel_timeoutIntervalForRequest) + : _objc_msgSend_1ukqyt8( + this.ref.pointer, _sel_timeoutIntervalForRequest); + } + + /// default timeout for requests. This will cause a timeout if no data is transmitted for the given timeout value, and is reset whenever data is transmitted. + set timeoutIntervalForRequest(DartNSTimeInterval value) { + return _objc_msgSend_hwm8nu( + this.ref.pointer, _sel_setTimeoutIntervalForRequest_, value); + } + + /// default timeout for requests. This will cause a timeout if a resource is not able to be retrieved within a given timeout. + DartNSTimeInterval get timeoutIntervalForResource { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret( + this.ref.pointer, _sel_timeoutIntervalForResource) + : _objc_msgSend_1ukqyt8( + this.ref.pointer, _sel_timeoutIntervalForResource); + } + + /// default timeout for requests. This will cause a timeout if a resource is not able to be retrieved within a given timeout. + set timeoutIntervalForResource(DartNSTimeInterval value) { + return _objc_msgSend_hwm8nu( + this.ref.pointer, _sel_setTimeoutIntervalForResource_, value); + } + + /// type of service for requests. + NSURLRequestNetworkServiceType get networkServiceType { + final _ret = + _objc_msgSend_t4uaw1(this.ref.pointer, _sel_networkServiceType); + return NSURLRequestNetworkServiceType.fromValue(_ret); + } + + /// type of service for requests. + set networkServiceType(NSURLRequestNetworkServiceType value) { + return _objc_msgSend_1mse4s1( + this.ref.pointer, _sel_setNetworkServiceType_, value.value); + } + + /// allow request to route over cellular. + bool get allowsCellularAccess { + return _objc_msgSend_91o635(this.ref.pointer, _sel_allowsCellularAccess); + } + + /// allow request to route over cellular. + set allowsCellularAccess(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setAllowsCellularAccess_, value); + } + + /// allow request to route over expensive networks. Defaults to YES. + bool get allowsExpensiveNetworkAccess { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_allowsExpensiveNetworkAccess); + } + + /// allow request to route over expensive networks. Defaults to YES. + set allowsExpensiveNetworkAccess(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setAllowsExpensiveNetworkAccess_, value); + } + + /// allow request to route over networks in constrained mode. Defaults to YES. + bool get allowsConstrainedNetworkAccess { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_allowsConstrainedNetworkAccess); + } + + /// allow request to route over networks in constrained mode. Defaults to YES. + set allowsConstrainedNetworkAccess(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setAllowsConstrainedNetworkAccess_, value); + } + + /// requires requests from the session to be made with DNSSEC validation enabled. Defaults to NO. + bool get requiresDNSSECValidation { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_requiresDNSSECValidation); + } + + /// requires requests from the session to be made with DNSSEC validation enabled. Defaults to NO. + set requiresDNSSECValidation(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setRequiresDNSSECValidation_, value); + } + + /// Causes tasks to wait for network connectivity to become available, rather + /// than immediately failing with an error (such as NSURLErrorNotConnectedToInternet) + /// when it is not. When waiting for connectivity, the timeoutIntervalForRequest + /// property does not apply, but the timeoutIntervalForResource property does. + /// + /// Unsatisfactory connectivity (that requires waiting) includes cases where the + /// device has limited or insufficient connectivity for a task (e.g., only has a + /// cellular connection but the allowsCellularAccess property is NO, or requires + /// a VPN connection in order to reach the desired host). + /// + /// Default value is NO. Ignored by background sessions, as background sessions + /// always wait for connectivity. + bool get waitsForConnectivity { + return _objc_msgSend_91o635(this.ref.pointer, _sel_waitsForConnectivity); + } + + /// Causes tasks to wait for network connectivity to become available, rather + /// than immediately failing with an error (such as NSURLErrorNotConnectedToInternet) + /// when it is not. When waiting for connectivity, the timeoutIntervalForRequest + /// property does not apply, but the timeoutIntervalForResource property does. + /// + /// Unsatisfactory connectivity (that requires waiting) includes cases where the + /// device has limited or insufficient connectivity for a task (e.g., only has a + /// cellular connection but the allowsCellularAccess property is NO, or requires + /// a VPN connection in order to reach the desired host). + /// + /// Default value is NO. Ignored by background sessions, as background sessions + /// always wait for connectivity. + set waitsForConnectivity(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setWaitsForConnectivity_, value); + } + + /// allows background tasks to be scheduled at the discretion of the system for optimal performance. + bool get discretionary { + return _objc_msgSend_91o635(this.ref.pointer, _sel_isDiscretionary); + } + + /// allows background tasks to be scheduled at the discretion of the system for optimal performance. + set discretionary(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setDiscretionary_, value); + } + + /// The identifier of the shared data container into which files in background sessions should be downloaded. + /// App extensions wishing to use background sessions *must* set this property to a valid container identifier, or + /// all transfers in that session will fail with NSURLErrorBackgroundSessionRequiresSharedContainer. + objc.NSString? get sharedContainerIdentifier { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_sharedContainerIdentifier); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// The identifier of the shared data container into which files in background sessions should be downloaded. + /// App extensions wishing to use background sessions *must* set this property to a valid container identifier, or + /// all transfers in that session will fail with NSURLErrorBackgroundSessionRequiresSharedContainer. + set sharedContainerIdentifier(objc.NSString? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, + _sel_setSharedContainerIdentifier_, value?.ref.pointer ?? ffi.nullptr); + } + + /// Allows the app to be resumed or launched in the background when tasks in background sessions complete + /// or when auth is required. This only applies to configurations created with +backgroundSessionConfigurationWithIdentifier: + /// and the default value is YES. + /// + /// NOTE: macOS apps based on AppKit do not support background launch. + bool get sessionSendsLaunchEvents { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_sessionSendsLaunchEvents); + } + + /// Allows the app to be resumed or launched in the background when tasks in background sessions complete + /// or when auth is required. This only applies to configurations created with +backgroundSessionConfigurationWithIdentifier: + /// and the default value is YES. + /// + /// NOTE: macOS apps based on AppKit do not support background launch. + set sessionSendsLaunchEvents(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setSessionSendsLaunchEvents_, value); + } + + /// The proxy dictionary, as described by + objc.NSDictionary? get connectionProxyDictionary { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_connectionProxyDictionary); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// The proxy dictionary, as described by + set connectionProxyDictionary(objc.NSDictionary? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, + _sel_setConnectionProxyDictionary_, value?.ref.pointer ?? ffi.nullptr); + } + + /// The minimum allowable versions of the TLS protocol, from + SSLProtocol get TLSMinimumSupportedProtocol { + final _ret = _objc_msgSend_cbopi9( + this.ref.pointer, _sel_TLSMinimumSupportedProtocol); + return SSLProtocol.fromValue(_ret); + } + + /// The minimum allowable versions of the TLS protocol, from + set TLSMinimumSupportedProtocol(SSLProtocol value) { + return _objc_msgSend_268k8x( + this.ref.pointer, _sel_setTLSMinimumSupportedProtocol_, value.value); + } + + /// The maximum allowable versions of the TLS protocol, from + SSLProtocol get TLSMaximumSupportedProtocol { + final _ret = _objc_msgSend_cbopi9( + this.ref.pointer, _sel_TLSMaximumSupportedProtocol); + return SSLProtocol.fromValue(_ret); + } + + /// The maximum allowable versions of the TLS protocol, from + set TLSMaximumSupportedProtocol(SSLProtocol value) { + return _objc_msgSend_268k8x( + this.ref.pointer, _sel_setTLSMaximumSupportedProtocol_, value.value); + } + + /// The minimum allowable versions of the TLS protocol, from + tls_protocol_version_t get TLSMinimumSupportedProtocolVersion { + final _ret = _objc_msgSend_9jpwfb( + this.ref.pointer, _sel_TLSMinimumSupportedProtocolVersion); + return tls_protocol_version_t.fromValue(_ret); + } + + /// The minimum allowable versions of the TLS protocol, from + set TLSMinimumSupportedProtocolVersion(tls_protocol_version_t value) { + return _objc_msgSend_1mvuct7(this.ref.pointer, + _sel_setTLSMinimumSupportedProtocolVersion_, value.value); + } + + /// The maximum allowable versions of the TLS protocol, from + tls_protocol_version_t get TLSMaximumSupportedProtocolVersion { + final _ret = _objc_msgSend_9jpwfb( + this.ref.pointer, _sel_TLSMaximumSupportedProtocolVersion); + return tls_protocol_version_t.fromValue(_ret); + } + + /// The maximum allowable versions of the TLS protocol, from + set TLSMaximumSupportedProtocolVersion(tls_protocol_version_t value) { + return _objc_msgSend_1mvuct7(this.ref.pointer, + _sel_setTLSMaximumSupportedProtocolVersion_, value.value); + } + + /// Allow the use of HTTP pipelining + bool get HTTPShouldUsePipelining { + return _objc_msgSend_91o635(this.ref.pointer, _sel_HTTPShouldUsePipelining); + } + + /// Allow the use of HTTP pipelining + set HTTPShouldUsePipelining(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setHTTPShouldUsePipelining_, value); + } + + /// Allow the session to set cookies on requests + bool get HTTPShouldSetCookies { + return _objc_msgSend_91o635(this.ref.pointer, _sel_HTTPShouldSetCookies); + } + + /// Allow the session to set cookies on requests + set HTTPShouldSetCookies(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setHTTPShouldSetCookies_, value); + } + + /// Policy for accepting cookies. This overrides the policy otherwise specified by the cookie storage. + NSHTTPCookieAcceptPolicy get HTTPCookieAcceptPolicy { + final _ret = + _objc_msgSend_104dkoq(this.ref.pointer, _sel_HTTPCookieAcceptPolicy); + return NSHTTPCookieAcceptPolicy.fromValue(_ret); + } + + /// Policy for accepting cookies. This overrides the policy otherwise specified by the cookie storage. + set HTTPCookieAcceptPolicy(NSHTTPCookieAcceptPolicy value) { + return _objc_msgSend_3q55ys( + this.ref.pointer, _sel_setHTTPCookieAcceptPolicy_, value.value); + } + + /// Specifies additional headers which will be set on outgoing requests. + /// Note that these headers are added to the request only if not already present. + objc.NSDictionary? get HTTPAdditionalHeaders { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_HTTPAdditionalHeaders); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// Specifies additional headers which will be set on outgoing requests. + /// Note that these headers are added to the request only if not already present. + set HTTPAdditionalHeaders(objc.NSDictionary? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, + _sel_setHTTPAdditionalHeaders_, value?.ref.pointer ?? ffi.nullptr); + } + + /// The maximum number of simultaneous persistent connections per host + DartNSInteger get HTTPMaximumConnectionsPerHost { + return _objc_msgSend_1hz7y9r( + this.ref.pointer, _sel_HTTPMaximumConnectionsPerHost); + } + + /// The maximum number of simultaneous persistent connections per host + set HTTPMaximumConnectionsPerHost(DartNSInteger value) { + return _objc_msgSend_4sp4xj( + this.ref.pointer, _sel_setHTTPMaximumConnectionsPerHost_, value); + } + + /// The cookie storage object to use, or nil to indicate that no cookies should be handled + NSHTTPCookieStorage? get HTTPCookieStorage { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_HTTPCookieStorage); + return _ret.address == 0 + ? null + : NSHTTPCookieStorage.castFromPointer(_ret, + retain: true, release: true); + } + + /// The cookie storage object to use, or nil to indicate that no cookies should be handled + set HTTPCookieStorage(NSHTTPCookieStorage? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setHTTPCookieStorage_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// The credential storage object, or nil to indicate that no credential storage is to be used + NSURLCredentialStorage? get URLCredentialStorage { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_URLCredentialStorage); + return _ret.address == 0 + ? null + : NSURLCredentialStorage.castFromPointer(_ret, + retain: true, release: true); + } + + /// The credential storage object, or nil to indicate that no credential storage is to be used + set URLCredentialStorage(NSURLCredentialStorage? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, + _sel_setURLCredentialStorage_, value?.ref.pointer ?? ffi.nullptr); + } + + /// The URL resource cache, or nil to indicate that no caching is to be performed + NSURLCache? get URLCache { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_URLCache); + return _ret.address == 0 + ? null + : NSURLCache.castFromPointer(_ret, retain: true, release: true); + } + + /// The URL resource cache, or nil to indicate that no caching is to be performed + set URLCache(NSURLCache? value) { + return _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setURLCache_, value?.ref.pointer ?? ffi.nullptr); + } + + /// Enable extended background idle mode for any tcp sockets created. Enabling this mode asks the system to keep the socket open + /// and delay reclaiming it when the process moves to the background (see https://developer.apple.com/library/ios/technotes/tn2277/_index.html) + bool get shouldUseExtendedBackgroundIdleMode { + return _objc_msgSend_91o635( + this.ref.pointer, _sel_shouldUseExtendedBackgroundIdleMode); + } + + /// Enable extended background idle mode for any tcp sockets created. Enabling this mode asks the system to keep the socket open + /// and delay reclaiming it when the process moves to the background (see https://developer.apple.com/library/ios/technotes/tn2277/_index.html) + set shouldUseExtendedBackgroundIdleMode(bool value) { + return _objc_msgSend_1s56lr9( + this.ref.pointer, _sel_setShouldUseExtendedBackgroundIdleMode_, value); + } + + /// An optional array of Class objects which subclass NSURLProtocol. + /// The Class will be sent +canInitWithRequest: when determining if + /// an instance of the class can be used for a given URL scheme. + /// You should not use +[NSURLProtocol registerClass:], as that + /// method will register your class with the default session rather + /// than with an instance of NSURLSession. + /// Custom NSURLProtocol subclasses are not available to background + /// sessions. + objc.ObjCObjectBase? get protocolClasses { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_protocolClasses); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// An optional array of Class objects which subclass NSURLProtocol. + /// The Class will be sent +canInitWithRequest: when determining if + /// an instance of the class can be used for a given URL scheme. + /// You should not use +[NSURLProtocol registerClass:], as that + /// method will register your class with the default session rather + /// than with an instance of NSURLSession. + /// Custom NSURLProtocol subclasses are not available to background + /// sessions. + set protocolClasses(objc.ObjCObjectBase? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setProtocolClasses_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// multipath service type to use for connections. The default is NSURLSessionMultipathServiceTypeNone + NSURLSessionMultipathServiceType get multipathServiceType { + final _ret = + _objc_msgSend_1wxwnc0(this.ref.pointer, _sel_multipathServiceType); + return NSURLSessionMultipathServiceType.fromValue(_ret); + } + + /// multipath service type to use for connections. The default is NSURLSessionMultipathServiceTypeNone + set multipathServiceType(NSURLSessionMultipathServiceType value) { + return _objc_msgSend_1hx005a( + this.ref.pointer, _sel_setMultipathServiceType_, value.value); + } + + /// init + NSURLSessionConfiguration init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: false, release: true); + } + + /// new + static NSURLSessionConfiguration new1() { + final _ret = + _objc_msgSend_1x359cv(_class_NSURLSessionConfiguration, _sel_new); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: false, release: true); + } + + /// allocWithZone: + static NSURLSessionConfiguration allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = _objc_msgSend_hzlb60( + _class_NSURLSessionConfiguration, _sel_allocWithZone_, zone); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: false, release: true); + } + + /// alloc + static NSURLSessionConfiguration alloc() { + final _ret = + _objc_msgSend_1x359cv(_class_NSURLSessionConfiguration, _sel_alloc); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: false, release: true); + } + + /// self + NSURLSessionConfiguration self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: true, release: true); + } + + /// retain + NSURLSessionConfiguration retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: true, release: true); + } + + /// autorelease + NSURLSessionConfiguration autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: true, release: true); + } +} + +late final _sel_sessionWithConfiguration_ = + objc.registerName("sessionWithConfiguration:"); +late final _class_NSOperationQueue = objc.getClass("NSOperationQueue"); +late final _sel_operations = objc.registerName("operations"); +late final _sel_operationCount = objc.registerName("operationCount"); + +/// NSDeprecated +extension NSDeprecated1 on NSOperationQueue { + /// These two functions are inherently a race condition and should be avoided if possible + objc.NSArray get operations { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_operations); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// operationCount + DartNSUInteger get operationCount { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_operationCount); + } +} + +/// WARNING: NSOperation is a stub. To generate bindings for this class, include +/// NSOperation in your config's objc-interfaces list. +/// +/// NSOperation +class NSOperation extends objc.NSObject { + NSOperation._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSOperation] that points to the same underlying object as [other]. + NSOperation.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSOperation] that wraps the given raw object pointer. + NSOperation.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _sel_addOperation_ = objc.registerName("addOperation:"); +late final _sel_addOperations_waitUntilFinished_ = + objc.registerName("addOperations:waitUntilFinished:"); +final _objc_msgSend_gk45w7 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Bool)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + bool)>(); +late final _sel_addOperationWithBlock_ = + objc.registerName("addOperationWithBlock:"); +late final _sel_addBarrierBlock_ = objc.registerName("addBarrierBlock:"); +late final _sel_maxConcurrentOperationCount = + objc.registerName("maxConcurrentOperationCount"); +late final _sel_setMaxConcurrentOperationCount_ = + objc.registerName("setMaxConcurrentOperationCount:"); +late final _sel_isSuspended = objc.registerName("isSuspended"); +late final _sel_setSuspended_ = objc.registerName("setSuspended:"); +late final _sel_name = objc.registerName("name"); +late final _sel_setName_ = objc.registerName("setName:"); +late final _sel_qualityOfService = objc.registerName("qualityOfService"); +final _objc_msgSend_oi8iq9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setQualityOfService_ = + objc.registerName("setQualityOfService:"); +final _objc_msgSend_n2da1l = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSInteger)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_underlyingQueue = objc.registerName("underlyingQueue"); +late final _sel_setUnderlyingQueue_ = objc.registerName("setUnderlyingQueue:"); +late final _sel_cancelAllOperations = objc.registerName("cancelAllOperations"); +late final _sel_waitUntilAllOperationsAreFinished = + objc.registerName("waitUntilAllOperationsAreFinished"); +late final _sel_currentQueue = objc.registerName("currentQueue"); +late final _sel_mainQueue = objc.registerName("mainQueue"); + +/// NSOperationQueue +class NSOperationQueue extends objc.NSObject { + NSOperationQueue._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSOperationQueue] that points to the same underlying object as [other]. + NSOperationQueue.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSOperationQueue] that wraps the given raw object pointer. + NSOperationQueue.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSOperationQueue]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSOperationQueue); + } + + /// progress + NSProgress get progress { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_progress); + return NSProgress.castFromPointer(_ret, retain: true, release: true); + } + + /// addOperation: + void addOperation_(NSOperation op) { + _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_addOperation_, op.ref.pointer); + } + + /// addOperations:waitUntilFinished: + void addOperations_waitUntilFinished_(objc.NSArray ops, bool wait) { + _objc_msgSend_gk45w7(this.ref.pointer, + _sel_addOperations_waitUntilFinished_, ops.ref.pointer, wait); + } + + /// addOperationWithBlock: + void addOperationWithBlock_(objc.ObjCBlock block) { + _objc_msgSend_f167m6( + this.ref.pointer, _sel_addOperationWithBlock_, block.ref.pointer); + } + + /// @method addBarrierBlock: + /// @param barrier A block to execute + /// @discussion The `addBarrierBlock:` method executes the block when the NSOperationQueue has finished all enqueued operations and + /// prevents any subsequent operations to be executed until the barrier has been completed. This acts similarly to the + /// `dispatch_barrier_async` function. + void addBarrierBlock_(objc.ObjCBlock barrier) { + _objc_msgSend_f167m6( + this.ref.pointer, _sel_addBarrierBlock_, barrier.ref.pointer); + } + + /// maxConcurrentOperationCount + DartNSInteger get maxConcurrentOperationCount { + return _objc_msgSend_1hz7y9r( + this.ref.pointer, _sel_maxConcurrentOperationCount); + } + + /// setMaxConcurrentOperationCount: + set maxConcurrentOperationCount(DartNSInteger value) { + return _objc_msgSend_4sp4xj( + this.ref.pointer, _sel_setMaxConcurrentOperationCount_, value); + } + + /// isSuspended + bool get suspended { + return _objc_msgSend_91o635(this.ref.pointer, _sel_isSuspended); + } + + /// setSuspended: + set suspended(bool value) { + return _objc_msgSend_1s56lr9(this.ref.pointer, _sel_setSuspended_, value); + } + + /// name + objc.NSString? get name { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_name); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// setName: + set name(objc.NSString? value) { + return _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setName_, value?.ref.pointer ?? ffi.nullptr); + } + + /// qualityOfService + NSQualityOfService get qualityOfService { + final _ret = _objc_msgSend_oi8iq9(this.ref.pointer, _sel_qualityOfService); + return NSQualityOfService.fromValue(_ret); + } + + /// setQualityOfService: + set qualityOfService(NSQualityOfService value) { + return _objc_msgSend_n2da1l( + this.ref.pointer, _sel_setQualityOfService_, value.value); + } + + /// actually retain + Dartdispatch_queue_t? get underlyingQueue { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_underlyingQueue); + return _ret.address == 0 + ? null + : objc.NSObject.castFromPointer(_ret, retain: true, release: true); + } + + /// actually retain + set underlyingQueue(Dartdispatch_queue_t? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setUnderlyingQueue_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// cancelAllOperations + void cancelAllOperations() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_cancelAllOperations); + } + + /// waitUntilAllOperationsAreFinished + void waitUntilAllOperationsAreFinished() { + _objc_msgSend_1pl9qdv( + this.ref.pointer, _sel_waitUntilAllOperationsAreFinished); + } + + /// currentQueue + static NSOperationQueue? getCurrentQueue() { + final _ret = + _objc_msgSend_1x359cv(_class_NSOperationQueue, _sel_currentQueue); + return _ret.address == 0 + ? null + : NSOperationQueue.castFromPointer(_ret, retain: true, release: true); + } + + /// mainQueue + static NSOperationQueue getMainQueue() { + final _ret = _objc_msgSend_1x359cv(_class_NSOperationQueue, _sel_mainQueue); + return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); + } + + /// init + NSOperationQueue init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static NSOperationQueue new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSOperationQueue, _sel_new); + return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static NSOperationQueue allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = _objc_msgSend_hzlb60( + _class_NSOperationQueue, _sel_allocWithZone_, zone); + return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static NSOperationQueue alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSOperationQueue, _sel_alloc); + return NSOperationQueue.castFromPointer(_ret, retain: false, release: true); + } + + /// self + NSOperationQueue self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + NSOperationQueue retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + NSOperationQueue autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _sel_sessionWithConfiguration_delegate_delegateQueue_ = + objc.registerName("sessionWithConfiguration:delegate:delegateQueue:"); +late final _sel_delegateQueue = objc.registerName("delegateQueue"); +late final _sel_configuration = objc.registerName("configuration"); +late final _sel_sessionDescription = objc.registerName("sessionDescription"); +late final _sel_setSessionDescription_ = + objc.registerName("setSessionDescription:"); +late final _sel_finishTasksAndInvalidate = + objc.registerName("finishTasksAndInvalidate"); +late final _sel_invalidateAndCancel = objc.registerName("invalidateAndCancel"); +late final _sel_resetWithCompletionHandler_ = + objc.registerName("resetWithCompletionHandler:"); +late final _sel_flushWithCompletionHandler_ = + objc.registerName("flushWithCompletionHandler:"); +void + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. +abstract final class ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.Pointer, ffi.Pointer)> + fromFunction(void Function(objc.ObjCObjectBase, objc.ObjCObjectBase, objc.ObjCObjectBase) fn) => + objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2) => fn( + objc.ObjCObjectBase(arg0, retain: true, release: true), + objc.ObjCObjectBase(arg1, retain: true, release: true), + objc.ObjCObjectBase(arg2, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> listener( + void Function( + objc.ObjCObjectBase, objc.ObjCObjectBase, objc.ObjCObjectBase) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + objc.ObjCObjectBase(arg0, retain: false, release: true), + objc.ObjCObjectBase(arg1, retain: false, release: true), + objc.ObjCObjectBase(arg2, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1hcfngn(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, ffi.Pointer, ffi.Pointer)>`. +extension ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_objcObjCObject_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> { + void call(objc.ObjCObjectBase arg0, objc.ObjCObjectBase arg1, + objc.ObjCObjectBase arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2.ref.pointer); +} + +late final _sel_getTasksWithCompletionHandler_ = + objc.registerName("getTasksWithCompletionHandler:"); +void _ObjCBlock_ffiVoid_objcObjCObject1_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_objcObjCObject1_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject1_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject1_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_objcObjCObject1_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject1_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject1_listenerTrampoline( + ffi.Pointer block, ffi.Pointer arg0) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_objcObjCObject1_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_objcObjCObject1_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_objcObjCObject1 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_objcObjCObject1_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunction(void Function(objc.ObjCObjectBase) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject1_closureCallable, + (ffi.Pointer arg0) => fn( + objc.ObjCObjectBase(arg0, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock)> + listener(void Function(objc.ObjCObjectBase) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject1_listenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0) => + fn(objc.ObjCObjectBase(arg0, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock)>( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_objcObjCObject1_CallExtension + on objc.ObjCBlock)> { + void call(objc.ObjCObjectBase arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0.ref.pointer); +} + +late final _sel_getAllTasksWithCompletionHandler_ = + objc.registerName("getAllTasksWithCompletionHandler:"); +late final _sel_dataTaskWithRequest_ = + objc.registerName("dataTaskWithRequest:"); +late final _sel_dataTaskWithURL_ = objc.registerName("dataTaskWithURL:"); +late final _sel_uploadTaskWithRequest_fromFile_ = + objc.registerName("uploadTaskWithRequest:fromFile:"); +late final _sel_uploadTaskWithRequest_fromData_ = + objc.registerName("uploadTaskWithRequest:fromData:"); +late final _sel_uploadTaskWithResumeData_ = + objc.registerName("uploadTaskWithResumeData:"); +late final _sel_uploadTaskWithStreamedRequest_ = + objc.registerName("uploadTaskWithStreamedRequest:"); +late final _sel_downloadTaskWithRequest_ = + objc.registerName("downloadTaskWithRequest:"); +late final _sel_downloadTaskWithURL_ = + objc.registerName("downloadTaskWithURL:"); +late final _sel_downloadTaskWithResumeData_ = + objc.registerName("downloadTaskWithResumeData:"); + +/// WARNING: NSURLSessionStreamTask is a stub. To generate bindings for this class, include +/// NSURLSessionStreamTask in your config's objc-interfaces list. +/// +/// An NSURLSessionStreamTask provides an interface to perform reads +/// and writes to a TCP/IP stream created via NSURLSession. This task +/// may be explicitly created from an NSURLSession, or created as a +/// result of the appropriate disposition response to a +/// -URLSession:dataTask:didReceiveResponse: delegate message. +/// +/// NSURLSessionStreamTask can be used to perform asynchronous reads +/// and writes. Reads and writes are enqueued and executed serially, +/// with the completion handler being invoked on the sessions delegate +/// queue. If an error occurs, or the task is canceled, all +/// outstanding read and write calls will have their completion +/// handlers invoked with an appropriate error. +/// +/// It is also possible to create NSInputStream and NSOutputStream +/// instances from an NSURLSessionTask by sending +/// -captureStreams to the task. All outstanding reads and writes are +/// completed before the streams are created. Once the streams are +/// delivered to the session delegate, the task is considered complete +/// and will receive no more messages. These streams are +/// disassociated from the underlying session. +class NSURLSessionStreamTask extends NSURLSessionTask { + NSURLSessionStreamTask._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSessionStreamTask] that points to the same underlying object as [other]. + NSURLSessionStreamTask.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSessionStreamTask] that wraps the given raw object pointer. + NSURLSessionStreamTask.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _sel_streamTaskWithHostName_port_ = + objc.registerName("streamTaskWithHostName:port:"); +final _objc_msgSend_1i26p99 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Long)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); + +/// WARNING: NSNetService is a stub. To generate bindings for this class, include +/// NSNetService in your config's objc-interfaces list. +/// +/// NSNetService +class NSNetService extends objc.ObjCObjectBase { + NSNetService._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super(pointer, retain: retain, release: release); + + /// Constructs a [NSNetService] that points to the same underlying object as [other]. + NSNetService.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSNetService] that wraps the given raw object pointer. + NSNetService.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _sel_streamTaskWithNetService_ = + objc.registerName("streamTaskWithNetService:"); +late final _class_NSURLSessionWebSocketTask = + objc.getClass("NSURLSessionWebSocketTask"); +late final _class_NSURLSessionWebSocketMessage = + objc.getClass("NSURLSessionWebSocketMessage"); +late final _sel_initWithData_ = objc.registerName("initWithData:"); +late final _sel_initWithString_ = objc.registerName("initWithString:"); + +enum NSURLSessionWebSocketMessageType { + NSURLSessionWebSocketMessageTypeData(0), + NSURLSessionWebSocketMessageTypeString(1); + + final int value; + const NSURLSessionWebSocketMessageType(this.value); + + static NSURLSessionWebSocketMessageType fromValue(int value) => + switch (value) { + 0 => NSURLSessionWebSocketMessageTypeData, + 1 => NSURLSessionWebSocketMessageTypeString, + _ => throw ArgumentError( + "Unknown value for NSURLSessionWebSocketMessageType: $value"), + }; +} + +late final _sel_type = objc.registerName("type"); +final _objc_msgSend_1qouven = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_data = objc.registerName("data"); +late final _sel_string = objc.registerName("string"); + +/// The client can create a WebSocket message object that will be passed to the send calls +/// and will be delivered from the receive calls. The message can be initialized with data or string. +/// If initialized with data, the string property will be nil and vice versa. +class NSURLSessionWebSocketMessage extends objc.NSObject { + NSURLSessionWebSocketMessage._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSessionWebSocketMessage] that points to the same underlying object as [other]. + NSURLSessionWebSocketMessage.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSessionWebSocketMessage] that wraps the given raw object pointer. + NSURLSessionWebSocketMessage.castFromPointer( + ffi.Pointer other, + {bool retain = false, + bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSURLSessionWebSocketMessage]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1(obj.ref.pointer, _sel_isKindOfClass_, + _class_NSURLSessionWebSocketMessage); + } + + /// Create a message with data type + NSURLSessionWebSocketMessage initWithData_(objc.NSData data) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithData_, data.ref.pointer); + return NSURLSessionWebSocketMessage.castFromPointer(_ret, + retain: false, release: true); + } + + /// Create a message with string type + NSURLSessionWebSocketMessage initWithString_(objc.NSString string) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithString_, string.ref.pointer); + return NSURLSessionWebSocketMessage.castFromPointer(_ret, + retain: false, release: true); + } + + /// type + NSURLSessionWebSocketMessageType get type { + final _ret = _objc_msgSend_1qouven(this.ref.pointer, _sel_type); + return NSURLSessionWebSocketMessageType.fromValue(_ret); + } + + /// data + objc.NSData? get data { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_data); + return _ret.address == 0 + ? null + : objc.NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// string + objc.NSString? get string { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_string); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// init + NSURLSessionWebSocketMessage init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSURLSessionWebSocketMessage.castFromPointer(_ret, + retain: false, release: true); + } + + /// new + static NSURLSessionWebSocketMessage new1() { + final _ret = + _objc_msgSend_1x359cv(_class_NSURLSessionWebSocketMessage, _sel_new); + return NSURLSessionWebSocketMessage.castFromPointer(_ret, + retain: false, release: true); + } + + /// allocWithZone: + static NSURLSessionWebSocketMessage allocWithZone_( + ffi.Pointer<_NSZone> zone) { + final _ret = _objc_msgSend_hzlb60( + _class_NSURLSessionWebSocketMessage, _sel_allocWithZone_, zone); + return NSURLSessionWebSocketMessage.castFromPointer(_ret, + retain: false, release: true); + } + + /// alloc + static NSURLSessionWebSocketMessage alloc() { + final _ret = + _objc_msgSend_1x359cv(_class_NSURLSessionWebSocketMessage, _sel_alloc); + return NSURLSessionWebSocketMessage.castFromPointer(_ret, + retain: false, release: true); + } + + /// self + NSURLSessionWebSocketMessage self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSURLSessionWebSocketMessage.castFromPointer(_ret, + retain: true, release: true); + } + + /// retain + NSURLSessionWebSocketMessage retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSURLSessionWebSocketMessage.castFromPointer(_ret, + retain: true, release: true); + } + + /// autorelease + NSURLSessionWebSocketMessage autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSURLSessionWebSocketMessage.castFromPointer(_ret, + retain: true, release: true); + } +} + +void _ObjCBlock_ffiVoid_NSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSError_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSError_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSError_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSError_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSError_listenerTrampoline( + ffi.Pointer block, ffi.Pointer arg0) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_NSError_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSError_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(objc.NSError?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSError_closureCallable, + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : objc.NSError.castFromPointer(arg0, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(objc.NSError?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSError_listenerCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : objc.NSError.castFromPointer(arg0, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSError_CallExtension + on objc.ObjCBlock { + void call(objc.NSError? arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_sendMessage_completionHandler_ = + objc.registerName("sendMessage:completionHandler:"); +void _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + ffi.Pointer))(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(NSURLSessionWebSocketMessage?, + objc.NSError?)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(NSURLSessionWebSocketMessage?, objc.NSError?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => fn( + arg0.address == 0 + ? null + : NSURLSessionWebSocketMessage.castFromPointer(arg0, retain: true, release: true), + arg1.address == 0 ? null : objc.NSError.castFromPointer(arg1, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> + listener(void Function(NSURLSessionWebSocketMessage?, objc.NSError?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1) => + fn( + arg0.address == 0 + ? null + : NSURLSessionWebSocketMessage.castFromPointer(arg0, + retain: false, release: true), + arg1.address == 0 + ? null + : objc.NSError.castFromPointer(arg1, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_wjvic9(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(NSURLSessionWebSocketMessage?, + objc.NSError?)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError_CallExtension + on objc.ObjCBlock< + ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> { + void call(NSURLSessionWebSocketMessage? arg0, objc.NSError? arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, + arg0?.ref.pointer ?? ffi.nullptr, arg1?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_receiveMessageWithCompletionHandler_ = + objc.registerName("receiveMessageWithCompletionHandler:"); +late final _sel_sendPingWithPongReceiveHandler_ = + objc.registerName("sendPingWithPongReceiveHandler:"); + +/// The WebSocket close codes follow the close codes given in the RFC +sealed class NSURLSessionWebSocketCloseCode { + static const NSURLSessionWebSocketCloseCodeInvalid = 0; + static const NSURLSessionWebSocketCloseCodeNormalClosure = 1000; + static const NSURLSessionWebSocketCloseCodeGoingAway = 1001; + static const NSURLSessionWebSocketCloseCodeProtocolError = 1002; + static const NSURLSessionWebSocketCloseCodeUnsupportedData = 1003; + static const NSURLSessionWebSocketCloseCodeNoStatusReceived = 1005; + static const NSURLSessionWebSocketCloseCodeAbnormalClosure = 1006; + static const NSURLSessionWebSocketCloseCodeInvalidFramePayloadData = 1007; + static const NSURLSessionWebSocketCloseCodePolicyViolation = 1008; + static const NSURLSessionWebSocketCloseCodeMessageTooBig = 1009; + static const NSURLSessionWebSocketCloseCodeMandatoryExtensionMissing = 1010; + static const NSURLSessionWebSocketCloseCodeInternalServerError = 1011; + static const NSURLSessionWebSocketCloseCodeTLSHandshakeFailure = 1015; +} + +late final _sel_cancelWithCloseCode_reason_ = + objc.registerName("cancelWithCloseCode:reason:"); +final _objc_msgSend_xb0psz = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSInteger, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +late final _sel_maximumMessageSize = objc.registerName("maximumMessageSize"); +late final _sel_setMaximumMessageSize_ = + objc.registerName("setMaximumMessageSize:"); +late final _sel_closeCode = objc.registerName("closeCode"); +final _objc_msgSend_1rhk8uh = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_closeReason = objc.registerName("closeReason"); + +/// A WebSocket task can be created with a ws or wss url. A client can also provide +/// a list of protocols it wishes to advertise during the WebSocket handshake phase. +/// Once the handshake is successfully completed the client will be notified through an optional delegate. +/// All reads and writes enqueued before the completion of the handshake will be queued up and +/// executed once the handshake succeeds. Before the handshake completes, the client can be called to handle +/// redirection or authentication using the same delegates as NSURLSessionTask. WebSocket task will also provide +/// support for cookies and will store cookies to the cookie storage on the session and will attach cookies to +/// outgoing HTTP handshake requests. +class NSURLSessionWebSocketTask extends NSURLSessionTask { + NSURLSessionWebSocketTask._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSessionWebSocketTask] that points to the same underlying object as [other]. + NSURLSessionWebSocketTask.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSessionWebSocketTask] that wraps the given raw object pointer. + NSURLSessionWebSocketTask.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSURLSessionWebSocketTask]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSessionWebSocketTask); + } + + /// Sends a WebSocket message. If an error occurs, any outstanding work will also fail. + /// Note that invocation of the completion handler does not + /// guarantee that the remote side has received all the bytes, only + /// that they have been written to the kernel. + void sendMessage_completionHandler_(NSURLSessionWebSocketMessage message, + objc.ObjCBlock completionHandler) { + _objc_msgSend_14pxqbs(this.ref.pointer, _sel_sendMessage_completionHandler_, + message.ref.pointer, completionHandler.ref.pointer); + } + + /// Reads a WebSocket message once all the frames of the message are available. + /// If the maximumMessage size is hit while buffering the frames, the receiveMessage call will error out + /// and all outstanding work will also fail resulting in the end of the task. + void receiveMessageWithCompletionHandler_( + objc.ObjCBlock< + ffi.Void Function(NSURLSessionWebSocketMessage?, objc.NSError?)> + completionHandler) { + _objc_msgSend_f167m6( + this.ref.pointer, + _sel_receiveMessageWithCompletionHandler_, + completionHandler.ref.pointer); + } + + /// Sends a ping frame from the client side. The pongReceiveHandler is invoked when the client + /// receives a pong from the server endpoint. If a connection is lost or an error occurs before receiving + /// the pong from the endpoint, the pongReceiveHandler block will be invoked with an error. + /// Note - the pongReceiveHandler will always be called in the order in which the pings were sent. + void sendPingWithPongReceiveHandler_( + objc.ObjCBlock pongReceiveHandler) { + _objc_msgSend_f167m6(this.ref.pointer, _sel_sendPingWithPongReceiveHandler_, + pongReceiveHandler.ref.pointer); + } + + /// Sends a close frame with the given closeCode. An optional reason can be provided while sending the close frame. + /// Simply calling cancel on the task will result in a cancellation frame being sent without any reason. + void cancelWithCloseCode_reason_( + DartNSInteger closeCode, objc.NSData? reason) { + _objc_msgSend_xb0psz(this.ref.pointer, _sel_cancelWithCloseCode_reason_, + closeCode, reason?.ref.pointer ?? ffi.nullptr); + } + + /// The maximum number of bytes to be buffered before erroring out. This includes the sum of all bytes from continuation frames. Receive calls will error out if this value is reached + DartNSInteger get maximumMessageSize { + return _objc_msgSend_1hz7y9r(this.ref.pointer, _sel_maximumMessageSize); + } + + /// The maximum number of bytes to be buffered before erroring out. This includes the sum of all bytes from continuation frames. Receive calls will error out if this value is reached + set maximumMessageSize(DartNSInteger value) { + return _objc_msgSend_4sp4xj( + this.ref.pointer, _sel_setMaximumMessageSize_, value); + } + + /// A task can be queried for it's close code at any point. When the task is not closed, it will be set to NSURLSessionWebSocketCloseCodeInvalid + DartNSInteger get closeCode { + return _objc_msgSend_1rhk8uh(this.ref.pointer, _sel_closeCode); + } + + /// A task can be queried for it's close reason at any point. A nil value indicates no closeReason or that the task is still running + objc.NSData? get closeReason { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_closeReason); + return _ret.address == 0 + ? null + : objc.NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// init + NSURLSessionWebSocketTask init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: false, release: true); + } + + /// new + static NSURLSessionWebSocketTask new1() { + final _ret = + _objc_msgSend_1x359cv(_class_NSURLSessionWebSocketTask, _sel_new); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: false, release: true); + } + + /// allocWithZone: + static NSURLSessionWebSocketTask allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = _objc_msgSend_hzlb60( + _class_NSURLSessionWebSocketTask, _sel_allocWithZone_, zone); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: false, release: true); + } + + /// alloc + static NSURLSessionWebSocketTask alloc() { + final _ret = + _objc_msgSend_1x359cv(_class_NSURLSessionWebSocketTask, _sel_alloc); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: false, release: true); + } + + /// self + NSURLSessionWebSocketTask self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// retain + NSURLSessionWebSocketTask retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// autorelease + NSURLSessionWebSocketTask autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: true, release: true); + } +} + +late final _sel_webSocketTaskWithURL_ = + objc.registerName("webSocketTaskWithURL:"); +late final _sel_webSocketTaskWithURL_protocols_ = + objc.registerName("webSocketTaskWithURL:protocols:"); +late final _sel_webSocketTaskWithRequest_ = + objc.registerName("webSocketTaskWithRequest:"); + +/// NSURLSession is a replacement API for NSURLConnection. It provides +/// options that affect the policy of, and various aspects of the +/// mechanism by which NSURLRequest objects are retrieved from the +/// network. +/// +/// An NSURLSession may be bound to a delegate object. The delegate is +/// invoked for certain events during the lifetime of a session, such as +/// server authentication or determining whether a resource to be loaded +/// should be converted into a download. +/// +/// NSURLSession instances are thread-safe. +/// +/// The default NSURLSession uses a system provided delegate and is +/// appropriate to use in place of existing code that uses +/// +[NSURLConnection sendAsynchronousRequest:queue:completionHandler:] +/// +/// An NSURLSession creates NSURLSessionTask objects which represent the +/// action of a resource being loaded. These are analogous to +/// NSURLConnection objects but provide for more control and a unified +/// delegate model. +/// +/// NSURLSessionTask objects are always created in a suspended state and +/// must be sent the -resume message before they will execute. +/// +/// Subclasses of NSURLSessionTask are used to syntactically +/// differentiate between data and file downloads. +/// +/// An NSURLSessionDataTask receives the resource as a series of calls to +/// the URLSession:dataTask:didReceiveData: delegate method. This is type of +/// task most commonly associated with retrieving objects for immediate parsing +/// by the consumer. +/// +/// An NSURLSessionUploadTask differs from an NSURLSessionDataTask +/// in how its instance is constructed. Upload tasks are explicitly created +/// by referencing a file or data object to upload, or by utilizing the +/// -URLSession:task:needNewBodyStream: delegate message to supply an upload +/// body. +/// +/// An NSURLSessionDownloadTask will directly write the response data to +/// a temporary file. When completed, the delegate is sent +/// URLSession:downloadTask:didFinishDownloadingToURL: and given an opportunity +/// to move this file to a permanent location in its sandboxed container, or to +/// otherwise read the file. If canceled, an NSURLSessionDownloadTask can +/// produce a data blob that can be used to resume a download at a later +/// time. +/// +/// Beginning with iOS 9 and Mac OS X 10.11, NSURLSessionStream is +/// available as a task type. This allows for direct TCP/IP connection +/// to a given host and port with optional secure handshaking and +/// navigation of proxies. Data tasks may also be upgraded to a +/// NSURLSessionStream task via the HTTP Upgrade: header and appropriate +/// use of the pipelining option of NSURLSessionConfiguration. See RFC +/// 2817 and RFC 6455 for information about the Upgrade: header, and +/// comments below on turning data tasks into stream tasks. +/// +/// An NSURLSessionWebSocketTask is a task that allows clients to connect to servers supporting +/// WebSocket. The task will perform the HTTP handshake to upgrade the connection +/// and once the WebSocket handshake is successful, the client can read and write +/// messages that will be framed using the WebSocket protocol by the framework. +class NSURLSession extends objc.NSObject { + NSURLSession._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSession] that points to the same underlying object as [other]. + NSURLSession.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSession] that wraps the given raw object pointer. + NSURLSession.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSURLSession]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSURLSession); + } + + /// The shared session uses the currently set global NSURLCache, + /// NSHTTPCookieStorage and NSURLCredentialStorage objects. + static NSURLSession getSharedSession() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLSession, _sel_sharedSession); + return NSURLSession.castFromPointer(_ret, retain: true, release: true); + } + + /// Customization of NSURLSession occurs during creation of a new session. + /// If you only need to use the convenience routines with custom + /// configuration options it is not necessary to specify a delegate. + /// If you do specify a delegate, the delegate will be retained until after + /// the delegate has been sent the URLSession:didBecomeInvalidWithError: message. + static NSURLSession sessionWithConfiguration_( + NSURLSessionConfiguration configuration) { + final _ret = _objc_msgSend_62nh5j(_class_NSURLSession, + _sel_sessionWithConfiguration_, configuration.ref.pointer); + return NSURLSession.castFromPointer(_ret, retain: true, release: true); + } + + /// sessionWithConfiguration:delegate:delegateQueue: + static NSURLSession sessionWithConfiguration_delegate_delegateQueue_( + NSURLSessionConfiguration configuration, + objc.ObjCObjectBase? delegate, + NSOperationQueue? queue) { + final _ret = _objc_msgSend_582s3n( + _class_NSURLSession, + _sel_sessionWithConfiguration_delegate_delegateQueue_, + configuration.ref.pointer, + delegate?.ref.pointer ?? ffi.nullptr, + queue?.ref.pointer ?? ffi.nullptr); + return NSURLSession.castFromPointer(_ret, retain: true, release: true); + } + + /// delegateQueue + NSOperationQueue get delegateQueue { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_delegateQueue); + return NSOperationQueue.castFromPointer(_ret, retain: true, release: true); + } + + /// delegate + objc.ObjCObjectBase? get delegate { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_delegate); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// configuration + NSURLSessionConfiguration get configuration { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_configuration); + return NSURLSessionConfiguration.castFromPointer(_ret, + retain: true, release: true); + } + + /// The sessionDescription property is available for the developer to + /// provide a descriptive label for the session. + objc.NSString? get sessionDescription { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_sessionDescription); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// The sessionDescription property is available for the developer to + /// provide a descriptive label for the session. + set sessionDescription(objc.NSString? value) { + return _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_setSessionDescription_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// -finishTasksAndInvalidate returns immediately and existing tasks will be allowed + /// to run to completion. New tasks may not be created. The session + /// will continue to make delegate callbacks until URLSession:didBecomeInvalidWithError: + /// has been issued. + /// + /// -finishTasksAndInvalidate and -invalidateAndCancel do not + /// have any effect on the shared session singleton. + /// + /// When invalidating a background session, it is not safe to create another background + /// session with the same identifier until URLSession:didBecomeInvalidWithError: has + /// been issued. + void finishTasksAndInvalidate() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_finishTasksAndInvalidate); + } + + /// -invalidateAndCancel acts as -finishTasksAndInvalidate, but issues + /// -cancel to all outstanding tasks for this session. Note task + /// cancellation is subject to the state of the task, and some tasks may + /// have already have completed at the time they are sent -cancel. + void invalidateAndCancel() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_invalidateAndCancel); + } + + /// empty all cookies, cache and credential stores, removes disk files, issues -flushWithCompletionHandler:. Invokes completionHandler() on the delegate queue. + void resetWithCompletionHandler_( + objc.ObjCBlock completionHandler) { + _objc_msgSend_f167m6(this.ref.pointer, _sel_resetWithCompletionHandler_, + completionHandler.ref.pointer); + } + + /// flush storage to disk and clear transient network caches. Invokes completionHandler() on the delegate queue. + void flushWithCompletionHandler_( + objc.ObjCBlock completionHandler) { + _objc_msgSend_f167m6(this.ref.pointer, _sel_flushWithCompletionHandler_, + completionHandler.ref.pointer); + } + + /// invokes completionHandler with outstanding data, upload and download tasks. + void getTasksWithCompletionHandler_( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + completionHandler) { + _objc_msgSend_f167m6(this.ref.pointer, _sel_getTasksWithCompletionHandler_, + completionHandler.ref.pointer); + } + + /// invokes completionHandler with all outstanding tasks. + void getAllTasksWithCompletionHandler_( + objc.ObjCBlock)> + completionHandler) { + _objc_msgSend_f167m6(this.ref.pointer, + _sel_getAllTasksWithCompletionHandler_, completionHandler.ref.pointer); + } + + /// Creates a data task with the given request. The request may have a body stream. + NSURLSessionDataTask dataTaskWithRequest_(NSURLRequest request) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_dataTaskWithRequest_, request.ref.pointer); + return NSURLSessionDataTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a data task to retrieve the contents of the given URL. + NSURLSessionDataTask dataTaskWithURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_dataTaskWithURL_, url.ref.pointer); + return NSURLSessionDataTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates an upload task with the given request. The body of the request will be created from the file referenced by fileURL + NSURLSessionUploadTask uploadTaskWithRequest_fromFile_( + NSURLRequest request, objc.NSURL fileURL) { + final _ret = _objc_msgSend_rsfdlh( + this.ref.pointer, + _sel_uploadTaskWithRequest_fromFile_, + request.ref.pointer, + fileURL.ref.pointer); + return NSURLSessionUploadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates an upload task with the given request. The body of the request is provided from the bodyData. + NSURLSessionUploadTask uploadTaskWithRequest_fromData_( + NSURLRequest request, objc.NSData bodyData) { + final _ret = _objc_msgSend_rsfdlh( + this.ref.pointer, + _sel_uploadTaskWithRequest_fromData_, + request.ref.pointer, + bodyData.ref.pointer); + return NSURLSessionUploadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates an upload task from a resume data blob. Requires the server to support the latest resumable uploads + /// Internet-Draft from the HTTP Working Group, found at + /// https://datatracker.ietf.org/doc/draft-ietf-httpbis-resumable-upload/ + /// If resuming from an upload file, the file must still exist and be unmodified. If the upload cannot be successfully + /// resumed, URLSession:task:didCompleteWithError: will be called. + /// + /// - Parameter resumeData: Resume data blob from an incomplete upload, such as data returned by the cancelByProducingResumeData: method. + /// - Returns: A new session upload task, or nil if the resumeData is invalid. + NSURLSessionUploadTask uploadTaskWithResumeData_(objc.NSData resumeData) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_uploadTaskWithResumeData_, resumeData.ref.pointer); + return NSURLSessionUploadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates an upload task with the given request. The previously set body stream of the request (if any) is ignored and the URLSession:task:needNewBodyStream: delegate will be called when the body payload is required. + NSURLSessionUploadTask uploadTaskWithStreamedRequest_(NSURLRequest request) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_uploadTaskWithStreamedRequest_, request.ref.pointer); + return NSURLSessionUploadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a download task with the given request. + NSURLSessionDownloadTask downloadTaskWithRequest_(NSURLRequest request) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_downloadTaskWithRequest_, request.ref.pointer); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a download task to download the contents of the given URL. + NSURLSessionDownloadTask downloadTaskWithURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_downloadTaskWithURL_, url.ref.pointer); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a download task with the resume data. If the download cannot be successfully resumed, URLSession:task:didCompleteWithError: will be called. + NSURLSessionDownloadTask downloadTaskWithResumeData_(objc.NSData resumeData) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_downloadTaskWithResumeData_, resumeData.ref.pointer); + return NSURLSessionDownloadTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a bidirectional stream task to a given host and port. + NSURLSessionStreamTask streamTaskWithHostName_port_( + objc.NSString hostname, DartNSInteger port) { + final _ret = _objc_msgSend_1i26p99(this.ref.pointer, + _sel_streamTaskWithHostName_port_, hostname.ref.pointer, port); + return NSURLSessionStreamTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a bidirectional stream task with an NSNetService to identify the endpoint. + /// The NSNetService will be resolved before any IO completes. + NSURLSessionStreamTask streamTaskWithNetService_(NSNetService service) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_streamTaskWithNetService_, service.ref.pointer); + return NSURLSessionStreamTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a WebSocket task given the url. The given url must have a ws or wss scheme. + NSURLSessionWebSocketTask webSocketTaskWithURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_webSocketTaskWithURL_, url.ref.pointer); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a WebSocket task given the url and an array of protocols. The protocols will be used in the WebSocket handshake to + /// negotiate a preferred protocol with the server + /// Note - The protocol will not affect the WebSocket framing. More details on the protocol can be found by reading the WebSocket RFC + NSURLSessionWebSocketTask webSocketTaskWithURL_protocols_( + objc.NSURL url, objc.ObjCObjectBase protocols) { + final _ret = _objc_msgSend_rsfdlh( + this.ref.pointer, + _sel_webSocketTaskWithURL_protocols_, + url.ref.pointer, + protocols.ref.pointer); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// Creates a WebSocket task given the request. The request properties can be modified and will be used by the task during the HTTP handshake phase. + /// Clients who want to add custom protocols can do so by directly adding headers with the key Sec-WebSocket-Protocol + /// and a comma separated list of protocols they wish to negotiate with the server. The custom HTTP headers provided by the client will remain unchanged for the handshake with the server. + NSURLSessionWebSocketTask webSocketTaskWithRequest_(NSURLRequest request) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_webSocketTaskWithRequest_, request.ref.pointer); + return NSURLSessionWebSocketTask.castFromPointer(_ret, + retain: true, release: true); + } + + /// init + NSURLSession init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSURLSession.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static NSURLSession new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLSession, _sel_new); + return NSURLSession.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static NSURLSession allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = + _objc_msgSend_hzlb60(_class_NSURLSession, _sel_allocWithZone_, zone); + return NSURLSession.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static NSURLSession alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSURLSession, _sel_alloc); + return NSURLSession.castFromPointer(_ret, retain: false, release: true); + } + + /// self + NSURLSession self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSURLSession.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + NSURLSession retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSURLSession.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + NSURLSession autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSURLSession.castFromPointer(_ret, retain: true, release: true); + } +} + +/// Disposition options for various delegate messages +enum NSURLSessionDelayedRequestDisposition { + /// Use the original request provided when the task was created; the request parameter is ignored. + NSURLSessionDelayedRequestContinueLoading(0), + + /// Use the specified request, which may not be nil. + NSURLSessionDelayedRequestUseNewRequest(1), + + /// Cancel the task; the request parameter is ignored. + NSURLSessionDelayedRequestCancel(2); + + final int value; + const NSURLSessionDelayedRequestDisposition(this.value); + + static NSURLSessionDelayedRequestDisposition fromValue(int value) => + switch (value) { + 0 => NSURLSessionDelayedRequestContinueLoading, + 1 => NSURLSessionDelayedRequestUseNewRequest, + 2 => NSURLSessionDelayedRequestCancel, + _ => throw ArgumentError( + "Unknown value for NSURLSessionDelayedRequestDisposition: $value"), + }; +} + +enum NSURLSessionAuthChallengeDisposition { + /// Use the specified credential, which may be nil + NSURLSessionAuthChallengeUseCredential(0), + + /// Default handling for the challenge - as if this delegate were not implemented; the credential parameter is ignored. + NSURLSessionAuthChallengePerformDefaultHandling(1), + + /// The entire request will be canceled; the credential parameter is ignored. + NSURLSessionAuthChallengeCancelAuthenticationChallenge(2), + + /// This challenge is rejected and the next authentication protection space should be tried; the credential parameter is ignored. + NSURLSessionAuthChallengeRejectProtectionSpace(3); + + final int value; + const NSURLSessionAuthChallengeDisposition(this.value); + + static NSURLSessionAuthChallengeDisposition fromValue(int value) => + switch (value) { + 0 => NSURLSessionAuthChallengeUseCredential, + 1 => NSURLSessionAuthChallengePerformDefaultHandling, + 2 => NSURLSessionAuthChallengeCancelAuthenticationChallenge, + 3 => NSURLSessionAuthChallengeRejectProtectionSpace, + _ => throw ArgumentError( + "Unknown value for NSURLSessionAuthChallengeDisposition: $value"), + }; +} + +enum NSURLSessionResponseDisposition { + /// Cancel the load, this is the same as -[task cancel] + NSURLSessionResponseCancel(0), + + /// Allow the load to continue + NSURLSessionResponseAllow(1), + + /// Turn this request into a download + NSURLSessionResponseBecomeDownload(2), + + /// Turn this task into a stream task + NSURLSessionResponseBecomeStream(3); + + final int value; + const NSURLSessionResponseDisposition(this.value); + + static NSURLSessionResponseDisposition fromValue(int value) => + switch (value) { + 0 => NSURLSessionResponseCancel, + 1 => NSURLSessionResponseAllow, + 2 => NSURLSessionResponseBecomeDownload, + 3 => NSURLSessionResponseBecomeStream, + _ => throw ArgumentError( + "Unknown value for NSURLSessionResponseDisposition: $value"), + }; +} + +late final _protocol_NSURLSessionDataDelegate = + objc.getProtocol("NSURLSessionDataDelegate"); +void _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_fnPtrTrampoline( + ffi.Pointer block, int arg0) => + block.ref.target + .cast>() + .asFunction()(arg0); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, NSInteger)>( + _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_closureTrampoline( + ffi.Pointer block, int arg0) => + (objc.getBlockClosure(block) as void Function(int))(arg0); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, NSInteger)>( + _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_listenerTrampoline( + ffi.Pointer block, int arg0) { + (objc.getBlockClosure(block) as void Function(int))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, NSInteger)> + _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_listenerCallable = ffi + .NativeCallable< + ffi.Void Function( + ffi.Pointer, NSInteger)>.listener( + _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSURLSessionResponseDisposition { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(NSURLSessionResponseDisposition) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_closureCallable, + (int arg0) => + fn(NSURLSessionResponseDisposition.fromValue(arg0))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(NSURLSessionResponseDisposition) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_listenerCallable + .nativeFunction + .cast(), + (int arg0) => fn(NSURLSessionResponseDisposition.fromValue(arg0))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_16sve1d(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSURLSessionResponseDisposition_CallExtension + on objc.ObjCBlock { + void call(NSURLSessionResponseDisposition arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, NSInteger arg0)>>() + .asFunction, int)>()( + ref.pointer, arg0.value); +} + +late final _sel_URLSession_dataTask_didReceiveResponse_completionHandler_ = objc + .registerName("URLSession:dataTask:didReceiveResponse:completionHandler:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLResponse, objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSURLResponse, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSURLResponse, + objc.ObjCBlock)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSURLResponse, + objc.ObjCBlock)> fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4)>> ptr) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSURLResponse, + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLResponse, objc.ObjCBlock)> + fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionDataTask, NSURLResponse, objc.ObjCBlock) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLResponse, objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4) => fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionDataTask.castFromPointer(arg2, retain: true, release: true), + NSURLResponse.castFromPointer(arg3, retain: true, release: true), + ObjCBlock_ffiVoid_NSURLSessionResponseDisposition.castFromPointer(arg4, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSURLResponse, + objc.ObjCBlock)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionDataTask, + NSURLResponse, objc.ObjCBlock) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionDataTask.castFromPointer(arg2, + retain: false, release: true), + NSURLResponse.castFromPointer(arg3, + retain: false, release: true), + ObjCBlock_ffiVoid_NSURLSessionResponseDisposition + .castFromPointer(arg4, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1f43wec(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSURLResponse, + objc.ObjCBlock)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLResponse, objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSURLResponse, + objc.ObjCBlock)> { + void call( + ffi.Pointer arg0, + NSURLSession arg1, + NSURLSessionDataTask arg2, + NSURLResponse arg3, + objc.ObjCBlock arg4) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, + arg0, + arg1.ref.pointer, + arg2.ref.pointer, + arg3.ref.pointer, + arg4.ref.pointer); +} + +late final _sel_URLSession_dataTask_didBecomeDownloadTask_ = + objc.registerName("URLSession:dataTask:didBecomeDownloadTask:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionDownloadTask)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionDownloadTask)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionDownloadTask)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionDownloadTask)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionDataTask.castFromPointer(arg2, retain: true, release: true), + NSURLSessionDownloadTask.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionDownloadTask)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionDataTask, + NSURLSessionDownloadTask) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionDataTask.castFromPointer(arg2, + retain: false, release: true), + NSURLSessionDownloadTask.castFromPointer(arg3, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSURLSessionDownloadTask)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionDownloadTask)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionDataTask arg2, NSURLSessionDownloadTask arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3.ref.pointer); +} + +late final _sel_URLSession_dataTask_didBecomeStreamTask_ = + objc.registerName("URLSession:dataTask:didBecomeStreamTask:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionStreamTask)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionStreamTask)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionStreamTask)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionStreamTask)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionDataTask.castFromPointer(arg2, retain: true, release: true), + NSURLSessionStreamTask.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionStreamTask)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionDataTask, + NSURLSessionStreamTask) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionDataTask.castFromPointer(arg2, + retain: false, release: true), + NSURLSessionStreamTask.castFromPointer(arg3, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSURLSessionStreamTask)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, NSURLSessionStreamTask)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionDataTask arg2, NSURLSessionStreamTask arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3.ref.pointer); +} + +late final _sel_URLSession_dataTask_didReceiveData_ = + objc.registerName("URLSession:dataTask:didReceiveData:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, objc.NSData)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, objc.NSData)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + objc.NSData)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, objc.NSData)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, objc.NSData)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, objc.NSData)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionDataTask, objc.NSData) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, objc.NSData)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionDataTask.castFromPointer(arg2, retain: true, release: true), + objc.NSData.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, objc.NSData)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionDataTask, + objc.NSData) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionDataTask.castFromPointer(arg2, + retain: false, release: true), + objc.NSData.castFromPointer(arg3, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + objc.NSData)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, objc.NSData)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDataTask, objc.NSData)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionDataTask arg2, objc.NSData arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3.ref.pointer); +} + +late final _sel_URLSession_dataTask_willCacheResponse_completionHandler_ = objc + .registerName("URLSession:dataTask:willCacheResponse:completionHandler:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSCachedURLResponse, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSCachedURLResponse, + objc.ObjCBlock)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSCachedURLResponse, + objc.ObjCBlock)> fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4)>> ptr) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSCachedURLResponse, + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, objc.ObjCBlock)> + fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, objc.ObjCBlock) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4) => fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionDataTask.castFromPointer(arg2, retain: true, release: true), + NSCachedURLResponse.castFromPointer(arg3, retain: true, release: true), + ObjCBlock_ffiVoid_NSCachedURLResponse.castFromPointer(arg4, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSCachedURLResponse, + objc.ObjCBlock)> listener( + void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSCachedURLResponse, + objc.ObjCBlock) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionDataTask.castFromPointer(arg2, + retain: false, release: true), + NSCachedURLResponse.castFromPointer(arg3, + retain: false, release: true), + ObjCBlock_ffiVoid_NSCachedURLResponse.castFromPointer(arg4, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1f43wec(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSCachedURLResponse, + objc.ObjCBlock)>( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDataTask, + NSCachedURLResponse, + objc.ObjCBlock)> { + void call( + ffi.Pointer arg0, + NSURLSession arg1, + NSURLSessionDataTask arg2, + NSCachedURLResponse arg3, + objc.ObjCBlock arg4) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, + arg0, + arg1.ref.pointer, + arg2.ref.pointer, + arg3.ref.pointer, + arg4.ref.pointer); +} + +late final _sel_URLSession_didCreateTask_ = + objc.registerName("URLSession:didCreateTask:"); +void _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, NSURLSession, NSURLSessionTask)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>> + ptr) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask)> + fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, NSURLSession, NSURLSessionTask)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionTask) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_ao4xm9(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, NSURLSession, NSURLSessionTask)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionTask arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0, arg1.ref.pointer, arg2.ref.pointer); +} + +void + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_fnPtrTrampoline( + ffi.Pointer block, + int arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(NSInteger arg0, + ffi.Pointer arg1)>>() + .asFunction)>()( + arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, NSInteger, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_closureTrampoline( + ffi.Pointer block, + int arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as void Function( + int, ffi.Pointer))(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, NSInteger, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_listenerTrampoline( + ffi.Pointer block, + int arg0, + ffi.Pointer arg1) { + (objc.getBlockClosure(block) as void Function( + int, ffi.Pointer))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, NSInteger, + ffi.Pointer)> + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_listenerCallable = + ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, NSInteger, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLRequest?)> fromFunctionPointer( + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock + fromFunction(void Function(NSURLSessionDelayedRequestDisposition, NSURLRequest?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_closureCallable, + (int arg0, ffi.Pointer arg1) => fn( + NSURLSessionDelayedRequestDisposition.fromValue(arg0), + arg1.address == 0 + ? null + : NSURLRequest.castFromPointer(arg1, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(NSURLSessionDelayedRequestDisposition, NSURLRequest?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_listenerCallable + .nativeFunction + .cast(), + (int arg0, ffi.Pointer arg1) => fn( + NSURLSessionDelayedRequestDisposition.fromValue(arg0), + arg1.address == 0 + ? null + : NSURLRequest.castFromPointer(arg1, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_mn1xu3(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest_CallExtension + on objc.ObjCBlock { + void call(NSURLSessionDelayedRequestDisposition arg0, NSURLRequest? arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + NSInteger arg0, ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, int, + ffi.Pointer)>()( + ref.pointer, arg0.value, arg1?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_URLSession_task_willBeginDelayedRequest_completionHandler_ = + objc.registerName( + "URLSession:task:willBeginDelayedRequest:completionHandler:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLRequest, objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLRequest, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLRequest, + objc.ObjCBlock)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLRequest, + objc.ObjCBlock)> fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4)>> ptr) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLRequest, + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLRequest, objc.ObjCBlock)> + fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, NSURLRequest, objc.ObjCBlock) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLRequest, objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4) => fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true), + NSURLRequest.castFromPointer(arg3, retain: true, release: true), + ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest.castFromPointer(arg4, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLRequest, + objc.ObjCBlock)> + listener( + void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLRequest, + objc.ObjCBlock) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true), + NSURLRequest.castFromPointer(arg3, + retain: false, release: true), + ObjCBlock_ffiVoid_NSURLSessionDelayedRequestDisposition_NSURLRequest + .castFromPointer(arg4, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1f43wec(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLRequest, + objc.ObjCBlock)>( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLRequest, objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLRequest, + objc.ObjCBlock)> { + void call( + ffi.Pointer arg0, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLRequest arg3, + objc.ObjCBlock arg4) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, + arg0, + arg1.ref.pointer, + arg2.ref.pointer, + arg3.ref.pointer, + arg4.ref.pointer); +} + +late final _sel_URLSession_taskIsWaitingForConnectivity_ = + objc.registerName("URLSession:taskIsWaitingForConnectivity:"); +late final _class_NSHTTPURLResponse = objc.getClass("NSHTTPURLResponse"); +late final _sel_initWithURL_statusCode_HTTPVersion_headerFields_ = + objc.registerName("initWithURL:statusCode:HTTPVersion:headerFields:"); +final _objc_msgSend_1pmy6mh = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Long, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_statusCode = objc.registerName("statusCode"); +late final _sel_allHeaderFields = objc.registerName("allHeaderFields"); +late final _sel_localizedStringForStatusCode_ = + objc.registerName("localizedStringForStatusCode:"); +final _objc_msgSend_8o14b = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Long)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); + +/// NSHTTPURLResponse +class NSHTTPURLResponse extends NSURLResponse { + NSHTTPURLResponse._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSHTTPURLResponse] that points to the same underlying object as [other]. + NSHTTPURLResponse.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSHTTPURLResponse] that wraps the given raw object pointer. + NSHTTPURLResponse.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSHTTPURLResponse]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSHTTPURLResponse); + } + + /// ! + /// @method initWithURL:statusCode:HTTPVersion:headerFields: + /// @abstract initializer for NSHTTPURLResponse objects. + /// @param url the URL from which the response was generated. + /// @param statusCode an HTTP status code. + /// @param HTTPVersion The version of the HTTP response as represented by the server. This is typically represented as "HTTP/1.1". + /// @param headerFields A dictionary representing the header keys and values of the server response. + /// @result the instance of the object, or NULL if an error occurred during initialization. + /// @discussion This API was introduced in Mac OS X 10.7.2 and iOS 5.0 and is not available prior to those releases. + NSHTTPURLResponse? initWithURL_statusCode_HTTPVersion_headerFields_( + objc.NSURL url, + DartNSInteger statusCode, + objc.NSString? HTTPVersion, + objc.NSDictionary? headerFields) { + final _ret = _objc_msgSend_1pmy6mh( + this.ref.retainAndReturnPointer(), + _sel_initWithURL_statusCode_HTTPVersion_headerFields_, + url.ref.pointer, + statusCode, + HTTPVersion?.ref.pointer ?? ffi.nullptr, + headerFields?.ref.pointer ?? ffi.nullptr); + return _ret.address == 0 + ? null + : NSHTTPURLResponse.castFromPointer(_ret, retain: false, release: true); + } + + /// ! + /// @abstract Returns the HTTP status code of the receiver. + /// @result The HTTP status code of the receiver. + DartNSInteger get statusCode { + return _objc_msgSend_1hz7y9r(this.ref.pointer, _sel_statusCode); + } + + /// ! + /// @abstract Returns a dictionary containing all the HTTP header fields + /// of the receiver. + /// @discussion By examining this header dictionary, clients can see + /// the "raw" header information which was reported to the protocol + /// implementation by the HTTP server. This may be of use to + /// sophisticated or special-purpose HTTP clients. + /// @result A dictionary containing all the HTTP header fields of the + /// receiver. + objc.NSDictionary get allHeaderFields { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_allHeaderFields); + return objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @method valueForHTTPHeaderField: + /// @abstract Returns the value which corresponds to the given header + /// field. Note that, in keeping with the HTTP RFC, HTTP header field + /// names are case-insensitive. + /// @param field the header field name to use for the lookup + /// (case-insensitive). + /// @result the value associated with the given header field, or nil if + /// there is no value associated with the given header field. + objc.NSString? valueForHTTPHeaderField_(objc.NSString field) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_valueForHTTPHeaderField_, field.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @method localizedStringForStatusCode: + /// @abstract Convenience method which returns a localized string + /// corresponding to the status code for this response. + /// @param statusCode the status code to use to produce a localized string. + /// @result A localized string corresponding to the given status code. + static objc.NSString localizedStringForStatusCode_(DartNSInteger statusCode) { + final _ret = _objc_msgSend_8o14b(_class_NSHTTPURLResponse, + _sel_localizedStringForStatusCode_, statusCode); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// ! + /// @method initWithURL:MIMEType:expectedContentLength:textEncodingName: + /// @abstract Initialize an NSURLResponse with the provided values. + /// @param URL the URL + /// @param MIMEType the MIME content type of the response + /// @param length the expected content length of the associated data + /// @param name the name of the text encoding for the associated data, if applicable, else nil + /// @result The initialized NSURLResponse. + /// @discussion This is the designated initializer for NSURLResponse. + NSHTTPURLResponse + initWithURL_MIMEType_expectedContentLength_textEncodingName_( + objc.NSURL URL, + objc.NSString? MIMEType, + DartNSInteger length, + objc.NSString? name) { + final _ret = _objc_msgSend_13tl325( + this.ref.retainAndReturnPointer(), + _sel_initWithURL_MIMEType_expectedContentLength_textEncodingName_, + URL.ref.pointer, + MIMEType?.ref.pointer ?? ffi.nullptr, + length, + name?.ref.pointer ?? ffi.nullptr); + return NSHTTPURLResponse.castFromPointer(_ret, + retain: false, release: true); + } + + /// init + NSHTTPURLResponse init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSHTTPURLResponse.castFromPointer(_ret, + retain: false, release: true); + } + + /// new + static NSHTTPURLResponse new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSHTTPURLResponse, _sel_new); + return NSHTTPURLResponse.castFromPointer(_ret, + retain: false, release: true); + } + + /// allocWithZone: + static NSHTTPURLResponse allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = _objc_msgSend_hzlb60( + _class_NSHTTPURLResponse, _sel_allocWithZone_, zone); + return NSHTTPURLResponse.castFromPointer(_ret, + retain: false, release: true); + } + + /// alloc + static NSHTTPURLResponse alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSHTTPURLResponse, _sel_alloc); + return NSHTTPURLResponse.castFromPointer(_ret, + retain: false, release: true); + } + + /// self + NSHTTPURLResponse self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSHTTPURLResponse.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + NSHTTPURLResponse retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSHTTPURLResponse.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + NSHTTPURLResponse autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSHTTPURLResponse.castFromPointer(_ret, retain: true, release: true); + } + + /// supportsSecureCoding + static bool getSupportsSecureCoding() { + return _objc_msgSend_91o635( + _class_NSHTTPURLResponse, _sel_supportsSecureCoding); + } + + /// initWithCoder: + NSHTTPURLResponse? initWithCoder_(objc.NSCoder coder) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithCoder_, coder.ref.pointer); + return _ret.address == 0 + ? null + : NSHTTPURLResponse.castFromPointer(_ret, retain: false, release: true); + } +} + +void _ObjCBlock_ffiVoid_NSURLRequest_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSURLRequest_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURLRequest_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSURLRequest_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSURLRequest_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURLRequest_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSURLRequest_listenerTrampoline( + ffi.Pointer block, ffi.Pointer arg0) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_NSURLRequest_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSURLRequest_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSURLRequest { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSURLRequest_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(NSURLRequest?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLRequest_closureCallable, + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : NSURLRequest.castFromPointer(arg0, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(NSURLRequest?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLRequest_listenerCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : NSURLRequest.castFromPointer(arg0, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSURLRequest_CallExtension + on objc.ObjCBlock { + void call(NSURLRequest? arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ = + objc.registerName( + "URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ffi.Pointer arg5) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ffi.Pointer arg5)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + arg0, arg1, arg2, arg3, arg4, arg5); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ffi.Pointer arg5) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))( + arg0, arg1, arg2, arg3, arg4, arg5); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ffi.Pointer arg5) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4, arg5); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSHTTPURLResponse, NSURLRequest, objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSHTTPURLResponse, + NSURLRequest, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSHTTPURLResponse, + NSURLRequest, + objc.ObjCBlock)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSHTTPURLResponse, + NSURLRequest, + objc.ObjCBlock)> fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4, ffi.Pointer arg5)>> ptr) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSHTTPURLResponse, + NSURLRequest, + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSHTTPURLResponse, NSURLRequest, objc.ObjCBlock)> + fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, NSHTTPURLResponse, NSURLRequest, objc.ObjCBlock) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSHTTPURLResponse, NSURLRequest, objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4, ffi.Pointer arg5) => fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true), + NSHTTPURLResponse.castFromPointer(arg3, retain: true, release: true), + NSURLRequest.castFromPointer(arg4, retain: true, release: true), + ObjCBlock_ffiVoid_NSURLRequest.castFromPointer(arg5, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSHTTPURLResponse, + NSURLRequest, + objc.ObjCBlock)> listener( + void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSHTTPURLResponse, + NSURLRequest, + objc.ObjCBlock) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ffi.Pointer arg5) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true), + NSHTTPURLResponse.castFromPointer(arg3, + retain: false, release: true), + NSURLRequest.castFromPointer(arg4, + retain: false, release: true), + ObjCBlock_ffiVoid_NSURLRequest.castFromPointer(arg5, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_13vswqm(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSHTTPURLResponse, + NSURLRequest, + objc.ObjCBlock)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSHTTPURLResponse, NSURLRequest, objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSHTTPURLResponse, + NSURLRequest, + objc.ObjCBlock)> { + void call( + ffi.Pointer arg0, + NSURLSession arg1, + NSURLSessionTask arg2, + NSHTTPURLResponse arg3, + NSURLRequest arg4, + objc.ObjCBlock arg5) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4, + ffi.Pointer arg5)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, + arg0, + arg1.ref.pointer, + arg2.ref.pointer, + arg3.ref.pointer, + arg4.ref.pointer, + arg5.ref.pointer); +} + +/// WARNING: NSURLAuthenticationChallenge is a stub. To generate bindings for this class, include +/// NSURLAuthenticationChallenge in your config's objc-interfaces list. +/// +/// NSURLAuthenticationChallenge +class NSURLAuthenticationChallenge extends objc.ObjCObjectBase { + NSURLAuthenticationChallenge._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super(pointer, retain: retain, release: release); + + /// Constructs a [NSURLAuthenticationChallenge] that points to the same underlying object as [other]. + NSURLAuthenticationChallenge.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLAuthenticationChallenge] that wraps the given raw object pointer. + NSURLAuthenticationChallenge.castFromPointer( + ffi.Pointer other, + {bool retain = false, + bool release = false}) + : this._(other, retain: retain, release: release); +} + +/// WARNING: NSURLCredential is a stub. To generate bindings for this class, include +/// NSURLCredential in your config's objc-interfaces list. +/// +/// NSURLCredential +class NSURLCredential extends objc.ObjCObjectBase { + NSURLCredential._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super(pointer, retain: retain, release: release); + + /// Constructs a [NSURLCredential] that points to the same underlying object as [other]. + NSURLCredential.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLCredential] that wraps the given raw object pointer. + NSURLCredential.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +void + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_fnPtrTrampoline( + ffi.Pointer block, + int arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(NSInteger arg0, + ffi.Pointer arg1)>>() + .asFunction)>()( + arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, NSInteger, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_closureTrampoline( + ffi.Pointer block, + int arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as void Function( + int, ffi.Pointer))(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, NSInteger, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_listenerTrampoline( + ffi.Pointer block, + int arg0, + ffi.Pointer arg1) { + (objc.getBlockClosure(block) as void Function( + int, ffi.Pointer))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, NSInteger, + ffi.Pointer)> + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_listenerCallable = + ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, NSInteger, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> fromFunctionPointer( + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock + fromFunction(void Function(NSURLSessionAuthChallengeDisposition, NSURLCredential?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_closureCallable, + (int arg0, ffi.Pointer arg1) => fn( + NSURLSessionAuthChallengeDisposition.fromValue(arg0), + arg1.address == 0 + ? null + : NSURLCredential.castFromPointer(arg1, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock + listener( + void Function(NSURLSessionAuthChallengeDisposition, NSURLCredential?) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_listenerCallable + .nativeFunction + .cast(), + (int arg0, ffi.Pointer arg1) => fn( + NSURLSessionAuthChallengeDisposition.fromValue(arg0), + arg1.address == 0 + ? null + : NSURLCredential.castFromPointer(arg1, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_37btrl(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential_CallExtension + on objc.ObjCBlock { + void call(NSURLSessionAuthChallengeDisposition arg0, NSURLCredential? arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + NSInteger arg0, ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, int, + ffi.Pointer)>()( + ref.pointer, arg0.value, arg1?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_URLSession_task_didReceiveChallenge_completionHandler_ = + objc.registerName("URLSession:task:didReceiveChallenge:completionHandler:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)> fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4)>> ptr) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, objc.ObjCBlock)> + fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, objc.ObjCBlock) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3, ffi.Pointer arg4) => fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true), + NSURLAuthenticationChallenge.castFromPointer(arg3, retain: true, release: true), + ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential.castFromPointer(arg4, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)>)> listener( + void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true), + NSURLAuthenticationChallenge.castFromPointer(arg3, + retain: false, release: true), + ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential + .castFromPointer(arg4, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1f43wec(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)>)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)> { + void call( + ffi.Pointer arg0, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLAuthenticationChallenge arg3, + objc.ObjCBlock + arg4) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0, arg1.ref.pointer, arg2.ref.pointer, arg3.ref.pointer, arg4.ref.pointer); +} + +void _ObjCBlock_ffiVoid_NSInputStream_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSInputStream_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSInputStream_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSInputStream_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_NSInputStream_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSInputStream_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSInputStream_listenerTrampoline( + ffi.Pointer block, ffi.Pointer arg0) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_NSInputStream_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSInputStream_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSInputStream { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSInputStream_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(objc.NSInputStream?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSInputStream_closureCallable, + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : objc.NSInputStream.castFromPointer(arg0, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock listener( + void Function(objc.NSInputStream?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSInputStream_listenerCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn(arg0.address == 0 + ? null + : objc.NSInputStream.castFromPointer(arg0, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1jdvcbf(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSInputStream_CallExtension + on objc.ObjCBlock { + void call(objc.NSInputStream? arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_URLSession_task_needNewBodyStream_ = + objc.registerName("URLSession:task:needNewBodyStream:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + objc.ObjCBlock)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, objc.ObjCBlock)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, objc.ObjCBlock)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, objc.ObjCBlock) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask, objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true), + ObjCBlock_ffiVoid_NSInputStream.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + objc.ObjCBlock)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + objc.ObjCBlock) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true), + ObjCBlock_ffiVoid_NSInputStream.castFromPointer(arg3, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_12nszru(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + objc.ObjCBlock)>( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + objc.ObjCBlock)> { + void call( + ffi.Pointer arg0, + NSURLSession arg1, + NSURLSessionTask arg2, + objc.ObjCBlock arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3.ref.pointer); +} + +late final _sel_URLSession_task_needNewBodyStreamFromOffset_completionHandler_ = + objc.registerName( + "URLSession:task:needNewBodyStreamFromOffset:completionHandler:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Int64 arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>()( + arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, ffi.Int64, objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + ffi.Int64, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + ffi.Int64, + objc.ObjCBlock)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, ffi.Int64, objc.ObjCBlock)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Int64 arg3, ffi.Pointer arg4)>> ptr) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + ffi.Int64, + objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, ffi.Int64, objc.ObjCBlock)> + fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, int, objc.ObjCBlock) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask, ffi.Int64, objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, int arg3, ffi.Pointer arg4) => fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true), + arg3, + ObjCBlock_ffiVoid_NSInputStream.castFromPointer(arg4, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + ffi.Int64, + objc.ObjCBlock)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true), + arg3, + ObjCBlock_ffiVoid_NSInputStream.castFromPointer(arg4, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_qm01og(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + ffi.Int64, + objc.ObjCBlock)>( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, ffi.Int64, objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + ffi.Int64, + objc.ObjCBlock)> { + void call( + ffi.Pointer arg0, + NSURLSession arg1, + NSURLSessionTask arg2, + int arg3, + objc.ObjCBlock arg4) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Int64 arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3, arg4.ref.pointer); +} + +late final _sel_URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ = + objc.registerName( + "URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Int64 arg3, + ffi.Int64 arg4, + ffi.Int64 arg5)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + int)>()(arg0, arg1, arg2, arg3, arg4, arg5); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64, + ffi.Int64)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + int))(arg0, arg1, arg2, arg3, arg4, arg5); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64, + ffi.Int64)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + int))(arg0, arg1, arg2, arg3, arg4, arg5); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64, + ffi.Int64)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64, + ffi.Int64)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, ffi.Int64, ffi.Int64, ffi.Int64)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, ffi.Int64, ffi.Int64, ffi.Int64)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + ffi.Int64, + ffi.Int64, + ffi.Int64)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + ffi.Int64, + ffi.Int64, + ffi.Int64)> fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Int64 arg3, ffi.Int64 arg4, ffi.Int64 arg5)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, ffi.Int64, ffi.Int64, ffi.Int64)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, ffi.Int64, ffi.Int64, ffi.Int64)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, int, int, int) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask, ffi.Int64, ffi.Int64, ffi.Int64)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true), + arg3, + arg4, + arg5)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + ffi.Int64, ffi.Int64, ffi.Int64)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, int, + int, int) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true), + arg3, + arg4, + arg5)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1uuez7b(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + ffi.Int64, + ffi.Int64, + ffi.Int64)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, ffi.Int64, ffi.Int64, ffi.Int64)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + ffi.Int64, ffi.Int64, ffi.Int64)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionTask arg2, int arg3, int arg4, int arg5) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Int64 arg3, + ffi.Int64 arg4, + ffi.Int64 arg5)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + int)>()(ref.pointer, arg0, arg1.ref.pointer, + arg2.ref.pointer, arg3, arg4, arg5); +} + +late final _sel_URLSession_task_didReceiveInformationalResponse_ = + objc.registerName("URLSession:task:didReceiveInformationalResponse:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSHTTPURLResponse)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, NSHTTPURLResponse)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, NSHTTPURLResponse)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, NSURLSession, NSURLSessionTask, NSHTTPURLResponse)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, NSHTTPURLResponse)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSHTTPURLResponse)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, NSHTTPURLResponse) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSHTTPURLResponse)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true), + NSHTTPURLResponse.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + NSHTTPURLResponse)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + NSHTTPURLResponse) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true), + NSHTTPURLResponse.castFromPointer(arg3, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + NSHTTPURLResponse)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSHTTPURLResponse)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + NSHTTPURLResponse)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionTask arg2, NSHTTPURLResponse arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3.ref.pointer); +} + +/// WARNING: NSURLSessionTaskMetrics is a stub. To generate bindings for this class, include +/// NSURLSessionTaskMetrics in your config's objc-interfaces list. +/// +/// NSURLSessionTaskMetrics +class NSURLSessionTaskMetrics extends objc.NSObject { + NSURLSessionTaskMetrics._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSURLSessionTaskMetrics] that points to the same underlying object as [other]. + NSURLSessionTaskMetrics.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSURLSessionTaskMetrics] that wraps the given raw object pointer. + NSURLSessionTaskMetrics.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _sel_URLSession_task_didFinishCollectingMetrics_ = + objc.registerName("URLSession:task:didFinishCollectingMetrics:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, NSURLSessionTaskMetrics)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, NSURLSessionTaskMetrics)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, NSURLSessionTaskMetrics)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, NSURLSessionTaskMetrics)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true), + NSURLSessionTaskMetrics.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + NSURLSessionTaskMetrics)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + NSURLSessionTaskMetrics) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true), + NSURLSessionTaskMetrics.castFromPointer(arg3, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + NSURLSessionTaskMetrics)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + NSURLSessionTaskMetrics)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionTask arg2, NSURLSessionTaskMetrics arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3.ref.pointer); +} + +late final _sel_URLSession_task_didCompleteWithError_ = + objc.registerName("URLSession:task:didCompleteWithError:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, objc.NSError?)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, objc.NSError?)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionTask, + objc.NSError?)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, objc.NSError?)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionTask, objc.NSError?)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionTask, objc.NSError?)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, objc.NSError?) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionTask, objc.NSError?)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionTask.castFromPointer(arg2, retain: true, release: true), + arg3.address == 0 ? null : objc.NSError.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + objc.NSError?)> listener( + void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + objc.NSError?) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionTask.castFromPointer(arg2, + retain: false, release: true), + arg3.address == 0 + ? null + : objc.NSError.castFromPointer(arg3, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + objc.NSError?)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionTask, objc.NSError?)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, NSURLSessionTask, + objc.NSError?)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionTask arg2, objc.NSError? arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_URLSession_didBecomeInvalidWithError_ = + objc.registerName("URLSession:didBecomeInvalidWithError:"); +void _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_listenerCallable = ffi + .NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, objc.NSError?)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, objc.NSError?)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + objc.NSError?)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, NSURLSession, objc.NSError?)> + fromFunctionPointer( + ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> + ptr) => + objc.ObjCBlock, NSURLSession, objc.NSError?)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, NSURLSession, objc.NSError?)> + fromFunction(void Function(ffi.Pointer, NSURLSession, objc.NSError?) fn) => + objc.ObjCBlock, NSURLSession, objc.NSError?)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2) => fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + arg2.address == 0 ? null : objc.NSError.castFromPointer(arg2, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, NSURLSession, objc.NSError?)> listener( + void Function(ffi.Pointer, NSURLSession, objc.NSError?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + arg2.address == 0 + ? null + : objc.NSError.castFromPointer(arg2, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_ao4xm9(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + objc.NSError?)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, objc.NSError?)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, objc.NSError?)> { + void call( + ffi.Pointer arg0, NSURLSession arg1, objc.NSError? arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_URLSession_didReceiveChallenge_completionHandler_ = + objc.registerName("URLSession:didReceiveChallenge:completionHandler:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLAuthenticationChallenge, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLAuthenticationChallenge, + objc.ObjCBlock)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLAuthenticationChallenge, + objc.ObjCBlock)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock, NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock) fn) => + objc.ObjCBlock, NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLAuthenticationChallenge.castFromPointer(arg2, retain: true, release: true), + ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLAuthenticationChallenge, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)>)> listener( + void Function( + ffi.Pointer, + NSURLSession, + NSURLAuthenticationChallenge, + objc.ObjCBlock) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLAuthenticationChallenge.castFromPointer(arg2, + retain: false, release: true), + ObjCBlock_ffiVoid_NSURLSessionAuthChallengeDisposition_NSURLCredential + .castFromPointer(arg3, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_12nszru(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLAuthenticationChallenge, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)>)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLAuthenticationChallenge, + objc.ObjCBlock)> { + void call( + ffi.Pointer arg0, + NSURLSession arg1, + NSURLAuthenticationChallenge arg2, + objc.ObjCBlock + arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0, arg1.ref.pointer, arg2.ref.pointer, arg3.ref.pointer); +} + +late final _sel_URLSessionDidFinishEventsForBackgroundURLSession_ = + objc.registerName("URLSessionDidFinishEventsForBackgroundURLSession:"); +void _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_listenerCallable = ffi + .NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock, NSURLSession)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + NSURLSession)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock, NSURLSession)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession)> + fromFunction(void Function(ffi.Pointer, NSURLSession) fn) => + objc.ObjCBlock, NSURLSession)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock, NSURLSession)> + listener(void Function(ffi.Pointer, NSURLSession) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_listenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0, ffi.Pointer arg1) => fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_wjovn7(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_CallExtension + on objc.ObjCBlock, NSURLSession)> { + void call(ffi.Pointer arg0, NSURLSession arg1) => ref + .pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>()( + ref.pointer, arg0, arg1.ref.pointer); +} + +/// Messages related to the operation of a task that delivers data +/// directly to the delegate. +abstract final class NSURLSessionDataDelegate { + /// Builds an object that implements the NSURLSessionDataDelegate protocol. To implement + /// multiple protocols, use [addToBuilder] or [objc.ObjCProtocolBuilder] directly. + static objc.ObjCObjectBase implement( + {void Function(NSURLSession, NSURLSessionDataTask, NSURLResponse, objc.ObjCBlock)? + URLSession_dataTask_didReceiveResponse_completionHandler_, + void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask)? + URLSession_dataTask_didBecomeDownloadTask_, + void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask)? + URLSession_dataTask_didBecomeStreamTask_, + void Function(NSURLSession, NSURLSessionDataTask, objc.NSData)? + URLSession_dataTask_didReceiveData_, + void Function(NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, + objc.ObjCBlock)? + URLSession_dataTask_willCacheResponse_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_task_didReceiveChallenge_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, objc.ObjCBlock)? URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + final builder = objc.ObjCProtocolBuilder(); + NSURLSessionDataDelegate + .URLSession_dataTask_didReceiveResponse_completionHandler_ + .implement( + builder, URLSession_dataTask_didReceiveResponse_completionHandler_); + NSURLSessionDataDelegate.URLSession_dataTask_didBecomeDownloadTask_ + .implement(builder, URLSession_dataTask_didBecomeDownloadTask_); + NSURLSessionDataDelegate.URLSession_dataTask_didBecomeStreamTask_.implement( + builder, URLSession_dataTask_didBecomeStreamTask_); + NSURLSessionDataDelegate.URLSession_dataTask_didReceiveData_.implement( + builder, URLSession_dataTask_didReceiveData_); + NSURLSessionDataDelegate + .URLSession_dataTask_willCacheResponse_completionHandler_ + .implement( + builder, URLSession_dataTask_willCacheResponse_completionHandler_); + NSURLSessionDataDelegate.URLSession_didCreateTask_.implement( + builder, URLSession_didCreateTask_); + NSURLSessionDataDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implement(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionDataDelegate.URLSession_taskIsWaitingForConnectivity_.implement( + builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionDataDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implement(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionDataDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implement( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionDataDelegate.URLSession_task_needNewBodyStream_.implement( + builder, URLSession_task_needNewBodyStream_); + NSURLSessionDataDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implement(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionDataDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implement(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionDataDelegate.URLSession_task_didReceiveInformationalResponse_ + .implement(builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionDataDelegate.URLSession_task_didFinishCollectingMetrics_ + .implement(builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionDataDelegate.URLSession_task_didCompleteWithError_.implement( + builder, URLSession_task_didCompleteWithError_); + NSURLSessionDataDelegate.URLSession_didBecomeInvalidWithError_.implement( + builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionDataDelegate.URLSession_didReceiveChallenge_completionHandler_ + .implement(builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionDataDelegate.URLSessionDidFinishEventsForBackgroundURLSession_ + .implement(builder, URLSessionDidFinishEventsForBackgroundURLSession_); + return builder.build(); + } + + /// Adds the implementation of the NSURLSessionDataDelegate protocol to an existing + /// [objc.ObjCProtocolBuilder]. + static void addToBuilder(objc.ObjCProtocolBuilder builder, + {void Function(NSURLSession, NSURLSessionDataTask, NSURLResponse, objc.ObjCBlock)? + URLSession_dataTask_didReceiveResponse_completionHandler_, + void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask)? + URLSession_dataTask_didBecomeDownloadTask_, + void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask)? + URLSession_dataTask_didBecomeStreamTask_, + void Function(NSURLSession, NSURLSessionDataTask, objc.NSData)? + URLSession_dataTask_didReceiveData_, + void Function(NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, + objc.ObjCBlock)? + URLSession_dataTask_willCacheResponse_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_task_didReceiveChallenge_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, objc.ObjCBlock)? URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + NSURLSessionDataDelegate + .URLSession_dataTask_didReceiveResponse_completionHandler_ + .implement( + builder, URLSession_dataTask_didReceiveResponse_completionHandler_); + NSURLSessionDataDelegate.URLSession_dataTask_didBecomeDownloadTask_ + .implement(builder, URLSession_dataTask_didBecomeDownloadTask_); + NSURLSessionDataDelegate.URLSession_dataTask_didBecomeStreamTask_.implement( + builder, URLSession_dataTask_didBecomeStreamTask_); + NSURLSessionDataDelegate.URLSession_dataTask_didReceiveData_.implement( + builder, URLSession_dataTask_didReceiveData_); + NSURLSessionDataDelegate + .URLSession_dataTask_willCacheResponse_completionHandler_ + .implement( + builder, URLSession_dataTask_willCacheResponse_completionHandler_); + NSURLSessionDataDelegate.URLSession_didCreateTask_.implement( + builder, URLSession_didCreateTask_); + NSURLSessionDataDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implement(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionDataDelegate.URLSession_taskIsWaitingForConnectivity_.implement( + builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionDataDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implement(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionDataDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implement( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionDataDelegate.URLSession_task_needNewBodyStream_.implement( + builder, URLSession_task_needNewBodyStream_); + NSURLSessionDataDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implement(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionDataDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implement(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionDataDelegate.URLSession_task_didReceiveInformationalResponse_ + .implement(builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionDataDelegate.URLSession_task_didFinishCollectingMetrics_ + .implement(builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionDataDelegate.URLSession_task_didCompleteWithError_.implement( + builder, URLSession_task_didCompleteWithError_); + NSURLSessionDataDelegate.URLSession_didBecomeInvalidWithError_.implement( + builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionDataDelegate.URLSession_didReceiveChallenge_completionHandler_ + .implement(builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionDataDelegate.URLSessionDidFinishEventsForBackgroundURLSession_ + .implement(builder, URLSessionDidFinishEventsForBackgroundURLSession_); + } + + /// Builds an object that implements the NSURLSessionDataDelegate protocol. To implement + /// multiple protocols, use [addToBuilder] or [objc.ObjCProtocolBuilder] directly. All + /// methods that can be implemented as listeners will be. + static objc.ObjCObjectBase implementAsListener( + {void Function(NSURLSession, NSURLSessionDataTask, NSURLResponse, objc.ObjCBlock)? + URLSession_dataTask_didReceiveResponse_completionHandler_, + void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask)? + URLSession_dataTask_didBecomeDownloadTask_, + void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask)? + URLSession_dataTask_didBecomeStreamTask_, + void Function(NSURLSession, NSURLSessionDataTask, objc.NSData)? + URLSession_dataTask_didReceiveData_, + void Function(NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, + objc.ObjCBlock)? + URLSession_dataTask_willCacheResponse_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_task_didReceiveChallenge_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, objc.ObjCBlock)? URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + final builder = objc.ObjCProtocolBuilder(); + NSURLSessionDataDelegate + .URLSession_dataTask_didReceiveResponse_completionHandler_ + .implementAsListener( + builder, URLSession_dataTask_didReceiveResponse_completionHandler_); + NSURLSessionDataDelegate.URLSession_dataTask_didBecomeDownloadTask_ + .implementAsListener( + builder, URLSession_dataTask_didBecomeDownloadTask_); + NSURLSessionDataDelegate.URLSession_dataTask_didBecomeStreamTask_ + .implementAsListener(builder, URLSession_dataTask_didBecomeStreamTask_); + NSURLSessionDataDelegate.URLSession_dataTask_didReceiveData_ + .implementAsListener(builder, URLSession_dataTask_didReceiveData_); + NSURLSessionDataDelegate + .URLSession_dataTask_willCacheResponse_completionHandler_ + .implementAsListener( + builder, URLSession_dataTask_willCacheResponse_completionHandler_); + NSURLSessionDataDelegate.URLSession_didCreateTask_.implementAsListener( + builder, URLSession_didCreateTask_); + NSURLSessionDataDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionDataDelegate.URLSession_taskIsWaitingForConnectivity_ + .implementAsListener(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionDataDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionDataDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionDataDelegate.URLSession_task_needNewBodyStream_ + .implementAsListener(builder, URLSession_task_needNewBodyStream_); + NSURLSessionDataDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implementAsListener(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionDataDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implementAsListener(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionDataDelegate.URLSession_task_didReceiveInformationalResponse_ + .implementAsListener( + builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionDataDelegate.URLSession_task_didFinishCollectingMetrics_ + .implementAsListener( + builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionDataDelegate.URLSession_task_didCompleteWithError_ + .implementAsListener(builder, URLSession_task_didCompleteWithError_); + NSURLSessionDataDelegate.URLSession_didBecomeInvalidWithError_ + .implementAsListener(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionDataDelegate.URLSession_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionDataDelegate.URLSessionDidFinishEventsForBackgroundURLSession_ + .implementAsListener( + builder, URLSessionDidFinishEventsForBackgroundURLSession_); + return builder.build(); + } + + /// Adds the implementation of the NSURLSessionDataDelegate protocol to an existing + /// [objc.ObjCProtocolBuilder]. All methods that can be implemented as listeners will + /// be. + static void addToBuilderAsListener(objc.ObjCProtocolBuilder builder, + {void Function(NSURLSession, NSURLSessionDataTask, NSURLResponse, objc.ObjCBlock)? + URLSession_dataTask_didReceiveResponse_completionHandler_, + void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask)? + URLSession_dataTask_didBecomeDownloadTask_, + void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask)? + URLSession_dataTask_didBecomeStreamTask_, + void Function(NSURLSession, NSURLSessionDataTask, objc.NSData)? + URLSession_dataTask_didReceiveData_, + void Function(NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, + objc.ObjCBlock)? + URLSession_dataTask_willCacheResponse_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_task_didReceiveChallenge_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, objc.ObjCBlock)? URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + NSURLSessionDataDelegate + .URLSession_dataTask_didReceiveResponse_completionHandler_ + .implementAsListener( + builder, URLSession_dataTask_didReceiveResponse_completionHandler_); + NSURLSessionDataDelegate.URLSession_dataTask_didBecomeDownloadTask_ + .implementAsListener( + builder, URLSession_dataTask_didBecomeDownloadTask_); + NSURLSessionDataDelegate.URLSession_dataTask_didBecomeStreamTask_ + .implementAsListener(builder, URLSession_dataTask_didBecomeStreamTask_); + NSURLSessionDataDelegate.URLSession_dataTask_didReceiveData_ + .implementAsListener(builder, URLSession_dataTask_didReceiveData_); + NSURLSessionDataDelegate + .URLSession_dataTask_willCacheResponse_completionHandler_ + .implementAsListener( + builder, URLSession_dataTask_willCacheResponse_completionHandler_); + NSURLSessionDataDelegate.URLSession_didCreateTask_.implementAsListener( + builder, URLSession_didCreateTask_); + NSURLSessionDataDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionDataDelegate.URLSession_taskIsWaitingForConnectivity_ + .implementAsListener(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionDataDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionDataDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionDataDelegate.URLSession_task_needNewBodyStream_ + .implementAsListener(builder, URLSession_task_needNewBodyStream_); + NSURLSessionDataDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implementAsListener(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionDataDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implementAsListener(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionDataDelegate.URLSession_task_didReceiveInformationalResponse_ + .implementAsListener( + builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionDataDelegate.URLSession_task_didFinishCollectingMetrics_ + .implementAsListener( + builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionDataDelegate.URLSession_task_didCompleteWithError_ + .implementAsListener(builder, URLSession_task_didCompleteWithError_); + NSURLSessionDataDelegate.URLSession_didBecomeInvalidWithError_ + .implementAsListener(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionDataDelegate.URLSession_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionDataDelegate.URLSessionDidFinishEventsForBackgroundURLSession_ + .implementAsListener( + builder, URLSessionDidFinishEventsForBackgroundURLSession_); + } + + /// The task has received a response and no further messages will be + /// received until the completion block is called. The disposition + /// allows you to cancel a request or to turn a data task into a + /// download task. This delegate message is optional - if you do not + /// implement it, you can get the response as a property of the task. + /// + /// This method will not be called for background upload tasks (which cannot be converted to download tasks). + static final URLSession_dataTask_didReceiveResponse_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionDataTask, NSURLResponse, + objc.ObjCBlock)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_didReceiveResponse_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_didReceiveResponse_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionDataTask, NSURLResponse, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionDataTask arg2, + NSURLResponse arg3, + objc.ObjCBlock arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionDataTask, NSURLResponse, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLResponse_ffiVoidNSURLSessionResponseDisposition + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionDataTask arg2, + NSURLResponse arg3, + objc.ObjCBlock arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Notification that a data task has become a download task. No + /// future messages will be sent to the data task. + static final URLSession_dataTask_didBecomeDownloadTask_ = + objc.ObjCProtocolListenableMethod< + void Function( + NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_didBecomeDownloadTask_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_didBecomeDownloadTask_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDataTask arg2, NSURLSessionDownloadTask arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionDownloadTask + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDataTask arg2, NSURLSessionDownloadTask arg3) => + func(arg1, arg2, arg3)), + ); + + /// Notification that a data task has become a bidirectional stream + /// task. No future messages will be sent to the data task. The newly + /// created streamTask will carry the original request and response as + /// properties. + /// + /// For requests that were pipelined, the stream object will only allow + /// reading, and the object will immediately issue a + /// -URLSession:writeClosedForStream:. Pipelining can be disabled for + /// all requests in a session, or by the NSURLRequest + /// HTTPShouldUsePipelining property. + /// + /// The underlying connection is no longer considered part of the HTTP + /// connection cache and won't count against the total number of + /// connections per host. + static final URLSession_dataTask_didBecomeStreamTask_ = + objc.ObjCProtocolListenableMethod< + void Function( + NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_didBecomeStreamTask_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_didBecomeStreamTask_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDataTask arg2, NSURLSessionStreamTask arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionDataTask, NSURLSessionStreamTask) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSURLSessionStreamTask + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDataTask arg2, NSURLSessionStreamTask arg3) => + func(arg1, arg2, arg3)), + ); + + /// Sent when data is available for the delegate to consume. As the + /// data may be discontiguous, you should use + /// [NSData enumerateByteRangesUsingBlock:] to access it. + static final URLSession_dataTask_didReceiveData_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionDataTask, objc.NSData)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_didReceiveData_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_didReceiveData_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionDataTask, objc.NSData) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDataTask arg2, objc.NSData arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionDataTask, objc.NSData) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSData + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDataTask arg2, objc.NSData arg3) => + func(arg1, arg2, arg3)), + ); + + /// Invoke the completion routine with a valid NSCachedURLResponse to + /// allow the resulting data to be cached, or pass nil to prevent + /// caching. Note that there is no guarantee that caching will be + /// attempted for a given resource, and you should not rely on this + /// message to receive the resource data. + static final URLSession_dataTask_willCacheResponse_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, + objc.ObjCBlock)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_willCacheResponse_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_dataTask_willCacheResponse_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionDataTask arg2, + NSCachedURLResponse arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionDataTask, NSCachedURLResponse, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDataTask_NSCachedURLResponse_ffiVoidNSCachedURLResponse + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionDataTask arg2, + NSCachedURLResponse arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Notification that a task has been created. This method is the first message + /// a task sends, providing a place to configure the task before it is resumed. + /// + /// This delegate callback is *NOT* dispatched to the delegate queue. It is + /// invoked synchronously before the task creation method returns. + static final URLSession_didCreateTask_ = objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_didCreateTask_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_didCreateTask_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.fromFunction( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.listener( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + ); + + /// Sent when the system is ready to begin work for a task with a delayed start + /// time set (using the earliestBeginDate property). The completionHandler must + /// be invoked in order for loading to proceed. The disposition provided to the + /// completion handler continues the load with the original request provided to + /// the task, replaces the request with the specified task, or cancels the task. + /// If this delegate is not implemented, loading will proceed with the original + /// request. + /// + /// Recommendation: only implement this delegate if tasks that have the + /// earliestBeginDate property set may become stale and require alteration prior + /// to starting the network load. + /// + /// If a new request is specified, the allowsExpensiveNetworkAccess, + /// allowsConstrainedNetworkAccess, and allowsCellularAccess properties + /// from the new request will not be used; the properties from the + /// original request will continue to be used. + /// + /// Canceling the task is equivalent to calling the task's cancel method; the + /// URLSession:task:didCompleteWithError: task delegate will be called with error + /// NSURLErrorCancelled. + static final URLSession_task_willBeginDelayedRequest_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_willBeginDelayedRequest_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_willBeginDelayedRequest_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLRequest arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLRequest arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Sent when a task cannot start the network loading process because the current + /// network connectivity is not available or sufficient for the task's request. + /// + /// This delegate will be called at most one time per task, and is only called if + /// the waitsForConnectivity property in the NSURLSessionConfiguration has been + /// set to YES. + /// + /// This delegate callback will never be called for background sessions, because + /// the waitForConnectivity property is ignored by those sessions. + static final URLSession_taskIsWaitingForConnectivity_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_taskIsWaitingForConnectivity_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_taskIsWaitingForConnectivity_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.fromFunction( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.listener( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + ); + + /// An HTTP request is attempting to perform a redirection to a different + /// URL. You must invoke the completion routine to allow the + /// redirection, allow the redirection with a modified request, or + /// pass nil to the completionHandler to cause the body of the redirection + /// response to be delivered as the payload of this request. The default + /// is to follow redirections. + /// + /// For tasks in background sessions, redirections will always be followed and this method will not be called. + static final URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSHTTPURLResponse arg3, + NSURLRequest arg4, + objc.ObjCBlock arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSHTTPURLResponse arg3, + NSURLRequest arg4, + objc.ObjCBlock arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + ); + + /// The task has received a request specific authentication challenge. + /// If this delegate is not implemented, the session specific authentication challenge + /// will *NOT* be called and the behavior will be the same as using the default handling + /// disposition. + static final URLSession_task_didReceiveChallenge_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didReceiveChallenge_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didReceiveChallenge_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLAuthenticationChallenge arg3, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLAuthenticationChallenge arg3, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Sent if a task requires a new, unopened body stream. This may be + /// necessary when authentication has failed for any request that + /// involves a body stream. + static final URLSession_task_needNewBodyStream_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_needNewBodyStream_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_needNewBodyStream_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + objc.ObjCBlock + arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + objc.ObjCBlock + arg3) => + func(arg1, arg2, arg3)), + ); + + /// Tells the delegate if a task requires a new body stream starting from the given offset. This may be + /// necessary when resuming a failed upload task. + /// + /// - Parameter session: The session containing the task that needs a new body stream from the given offset. + /// - Parameter task: The task that needs a new body stream. + /// - Parameter offset: The starting offset required for the body stream. + /// - Parameter completionHandler: A completion handler that your delegate method should call with the new body stream. + static final URLSession_task_needNewBodyStreamFromOffset_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + int arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + int arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Sent periodically to notify the delegate of upload progress. This + /// information is also available as properties of the task. + static final URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, int, int, int)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, int, int, int) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64 + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, int arg3, int arg4, int arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + (void Function(NSURLSession, NSURLSessionTask, int, int, int) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64 + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, int arg3, int arg4, int arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + ); + + /// Sent for each informational response received except 101 switching protocols. + static final URLSession_task_didReceiveInformationalResponse_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didReceiveInformationalResponse_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didReceiveInformationalResponse_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSHTTPURLResponse arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSHTTPURLResponse arg3) => + func(arg1, arg2, arg3)), + ); + + /// Sent when complete statistics information has been collected for the task. + static final URLSession_task_didFinishCollectingMetrics_ = + objc.ObjCProtocolListenableMethod< + void Function( + NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didFinishCollectingMetrics_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didFinishCollectingMetrics_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSURLSessionTaskMetrics arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSURLSessionTaskMetrics arg3) => + func(arg1, arg2, arg3)), + ); + + /// Sent as the last message related to a specific task. Error may be + /// nil, which implies that no error occurred and this task is complete. + static final URLSession_task_didCompleteWithError_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didCompleteWithError_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_task_didCompleteWithError_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, objc.NSError? arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, objc.NSError? arg3) => + func(arg1, arg2, arg3)), + ); + + /// The last message a session receives. A session will only become + /// invalid because of a systemic error or when it has been + /// explicitly invalidated, in which case the error parameter will be nil. + static final URLSession_didBecomeInvalidWithError_ = objc + .ObjCProtocolListenableMethod( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_didBecomeInvalidWithError_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_didBecomeInvalidWithError_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError.fromFunction( + (ffi.Pointer _, NSURLSession arg1, objc.NSError? arg2) => + func(arg1, arg2)), + (void Function(NSURLSession, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError.listener( + (ffi.Pointer _, NSURLSession arg1, objc.NSError? arg2) => + func(arg1, arg2)), + ); + + /// If implemented, when a connection level authentication challenge + /// has occurred, this delegate will be given the opportunity to + /// provide authentication credentials to the underlying + /// connection. Some types of authentication will apply to more than + /// one request on a given connection to a server (SSL Server Trust + /// challenges). If this delegate message is not implemented, the + /// behavior will be to use the default handling, which may involve user + /// interaction. + static final URLSession_didReceiveChallenge_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLAuthenticationChallenge, + objc.ObjCBlock)>( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_didReceiveChallenge_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSession_didReceiveChallenge_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLAuthenticationChallenge arg2, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLAuthenticationChallenge arg2, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg3) => + func(arg1, arg2, arg3)), + ); + + /// If an application has received an + /// -application:handleEventsForBackgroundURLSession:completionHandler: + /// message, the session delegate will receive this message to indicate + /// that all messages previously enqueued for this session have been + /// delivered. At this time it is safe to invoke the previously stored + /// completion handler, or to begin any internal updates that will + /// result in invoking the completion handler. + static final URLSessionDidFinishEventsForBackgroundURLSession_ = + objc.ObjCProtocolListenableMethod( + _protocol_NSURLSessionDataDelegate, + _sel_URLSessionDidFinishEventsForBackgroundURLSession_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDataDelegate, + _sel_URLSessionDidFinishEventsForBackgroundURLSession_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession.fromFunction( + (ffi.Pointer _, NSURLSession arg1) => func(arg1)), + (void Function(NSURLSession) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession.listener( + (ffi.Pointer _, NSURLSession arg1) => func(arg1)), + ); +} + +late final _protocol_NSURLSessionDownloadDelegate = + objc.getProtocol("NSURLSessionDownloadDelegate"); +late final _sel_URLSession_downloadTask_didFinishDownloadingToURL_ = + objc.registerName("URLSession:downloadTask:didFinishDownloadingToURL:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, objc.NSURL)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, objc.NSURL)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDownloadTask, + objc.NSURL)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, objc.NSURL)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, objc.NSURL)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, objc.NSURL)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionDownloadTask, objc.NSURL) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, objc.NSURL)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionDownloadTask.castFromPointer(arg2, retain: true, release: true), + objc.NSURL.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, objc.NSURL)> listener( + void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, objc.NSURL) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionDownloadTask.castFromPointer(arg2, + retain: false, release: true), + objc.NSURL + .castFromPointer(arg3, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDownloadTask, + objc.NSURL)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, objc.NSURL)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, objc.NSURL)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionDownloadTask arg2, objc.NSURL arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3.ref.pointer); +} + +late final _sel_URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_ = + objc.registerName( + "URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Int64 arg3, + ffi.Int64 arg4, + ffi.Int64 arg5)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + int)>()(arg0, arg1, arg2, arg3, arg4, arg5); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64, + ffi.Int64)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + int))(arg0, arg1, arg2, arg3, arg4, arg5); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64, + ffi.Int64)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + int))(arg0, arg1, arg2, arg3, arg4, arg5); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64, + ffi.Int64)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64, + ffi.Int64)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, ffi.Int64, ffi.Int64, ffi.Int64)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, ffi.Int64, ffi.Int64, ffi.Int64)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDownloadTask, + ffi.Int64, + ffi.Int64, + ffi.Int64)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDownloadTask, + ffi.Int64, + ffi.Int64, + ffi.Int64)> fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Int64 arg3, ffi.Int64 arg4, ffi.Int64 arg5)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, ffi.Int64, ffi.Int64, ffi.Int64)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, ffi.Int64, ffi.Int64, ffi.Int64)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionDownloadTask, int, int, int) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, ffi.Int64, ffi.Int64, ffi.Int64)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionDownloadTask.castFromPointer(arg2, retain: true, release: true), + arg3, + arg4, + arg5)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, ffi.Int64, ffi.Int64, ffi.Int64)> listener( + void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, int, int, int) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4, + int arg5) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionDownloadTask.castFromPointer(arg2, + retain: false, release: true), + arg3, + arg4, + arg5)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1uuez7b(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDownloadTask, + ffi.Int64, + ffi.Int64, + ffi.Int64)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, ffi.Int64, ffi.Int64, ffi.Int64)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, ffi.Int64, ffi.Int64, ffi.Int64)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionDownloadTask arg2, int arg3, int arg4, int arg5) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Int64 arg3, + ffi.Int64 arg4, + ffi.Int64 arg5)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + int)>()(ref.pointer, arg0, arg1.ref.pointer, + arg2.ref.pointer, arg3, arg4, arg5); +} + +late final _sel_URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_ = + objc.registerName( + "URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Int64 arg3, + ffi.Int64 arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int)>()(arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int))(arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + int arg4) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int))(arg0, arg1, arg2, arg3, arg4); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, ffi.Int64, ffi.Int64)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64 { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, ffi.Int64, ffi.Int64)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDownloadTask, + ffi.Int64, + ffi.Int64)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, ffi.Int64, ffi.Int64)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Int64 arg3, ffi.Int64 arg4)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, ffi.Int64, ffi.Int64)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, ffi.Int64, ffi.Int64)> + fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionDownloadTask, int, int) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, ffi.Int64, ffi.Int64)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, int arg3, int arg4) => fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionDownloadTask.castFromPointer(arg2, retain: true, release: true), + arg3, + arg4)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, ffi.Int64, ffi.Int64)> listener( + void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, int, int) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, ffi.Pointer arg1, + ffi.Pointer arg2, int arg3, int arg4) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionDownloadTask.castFromPointer(arg2, + retain: false, release: true), + arg3, + arg4)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_9qxjkl(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionDownloadTask, + ffi.Int64, + ffi.Int64)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionDownloadTask, ffi.Int64, ffi.Int64)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, ffi.Int64, ffi.Int64)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionDownloadTask arg2, int arg3, int arg4) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Int64 arg3, + ffi.Int64 arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int)>()( + ref.pointer, arg0, arg1.ref.pointer, arg2.ref.pointer, arg3, arg4); +} + +/// Messages related to the operation of a task that writes data to a +/// file and notifies the delegate upon completion. +abstract final class NSURLSessionDownloadDelegate { + /// Builds an object that implements the NSURLSessionDownloadDelegate protocol. To implement + /// multiple protocols, use [addToBuilder] or [objc.ObjCProtocolBuilder] directly. + static objc.ObjCObjectBase implement( + {required void Function(NSURLSession, NSURLSessionDownloadTask, objc.NSURL) + URLSession_downloadTask_didFinishDownloadingToURL_, + void Function(NSURLSession, NSURLSessionDownloadTask, int, int, int)? + URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_, + void Function(NSURLSession, NSURLSessionDownloadTask, int, int)? + URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)? + URLSession_task_didReceiveChallenge_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock)? + URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + final builder = objc.ObjCProtocolBuilder(); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didFinishDownloadingToURL_ + .implement(builder, URLSession_downloadTask_didFinishDownloadingToURL_); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_ + .implement(builder, + URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_ + .implement(builder, + URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_); + NSURLSessionDownloadDelegate.URLSession_didCreateTask_.implement( + builder, URLSession_didCreateTask_); + NSURLSessionDownloadDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implement(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionDownloadDelegate.URLSession_taskIsWaitingForConnectivity_ + .implement(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionDownloadDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implement(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionDownloadDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implement( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionDownloadDelegate.URLSession_task_needNewBodyStream_.implement( + builder, URLSession_task_needNewBodyStream_); + NSURLSessionDownloadDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implement(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionDownloadDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implement(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionDownloadDelegate + .URLSession_task_didReceiveInformationalResponse_ + .implement(builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionDownloadDelegate.URLSession_task_didFinishCollectingMetrics_ + .implement(builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionDownloadDelegate.URLSession_task_didCompleteWithError_ + .implement(builder, URLSession_task_didCompleteWithError_); + NSURLSessionDownloadDelegate.URLSession_didBecomeInvalidWithError_ + .implement(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionDownloadDelegate + .URLSession_didReceiveChallenge_completionHandler_ + .implement(builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionDownloadDelegate + .URLSessionDidFinishEventsForBackgroundURLSession_ + .implement(builder, URLSessionDidFinishEventsForBackgroundURLSession_); + return builder.build(); + } + + /// Adds the implementation of the NSURLSessionDownloadDelegate protocol to an existing + /// [objc.ObjCProtocolBuilder]. + static void addToBuilder(objc.ObjCProtocolBuilder builder, + {required void Function(NSURLSession, NSURLSessionDownloadTask, objc.NSURL) + URLSession_downloadTask_didFinishDownloadingToURL_, + void Function(NSURLSession, NSURLSessionDownloadTask, int, int, int)? + URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_, + void Function(NSURLSession, NSURLSessionDownloadTask, int, int)? + URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)? + URLSession_task_didReceiveChallenge_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock)? + URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didFinishDownloadingToURL_ + .implement(builder, URLSession_downloadTask_didFinishDownloadingToURL_); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_ + .implement(builder, + URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_ + .implement(builder, + URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_); + NSURLSessionDownloadDelegate.URLSession_didCreateTask_.implement( + builder, URLSession_didCreateTask_); + NSURLSessionDownloadDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implement(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionDownloadDelegate.URLSession_taskIsWaitingForConnectivity_ + .implement(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionDownloadDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implement(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionDownloadDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implement( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionDownloadDelegate.URLSession_task_needNewBodyStream_.implement( + builder, URLSession_task_needNewBodyStream_); + NSURLSessionDownloadDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implement(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionDownloadDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implement(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionDownloadDelegate + .URLSession_task_didReceiveInformationalResponse_ + .implement(builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionDownloadDelegate.URLSession_task_didFinishCollectingMetrics_ + .implement(builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionDownloadDelegate.URLSession_task_didCompleteWithError_ + .implement(builder, URLSession_task_didCompleteWithError_); + NSURLSessionDownloadDelegate.URLSession_didBecomeInvalidWithError_ + .implement(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionDownloadDelegate + .URLSession_didReceiveChallenge_completionHandler_ + .implement(builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionDownloadDelegate + .URLSessionDidFinishEventsForBackgroundURLSession_ + .implement(builder, URLSessionDidFinishEventsForBackgroundURLSession_); + } + + /// Builds an object that implements the NSURLSessionDownloadDelegate protocol. To implement + /// multiple protocols, use [addToBuilder] or [objc.ObjCProtocolBuilder] directly. All + /// methods that can be implemented as listeners will be. + static objc.ObjCObjectBase implementAsListener( + {required void Function(NSURLSession, NSURLSessionDownloadTask, objc.NSURL) + URLSession_downloadTask_didFinishDownloadingToURL_, + void Function(NSURLSession, NSURLSessionDownloadTask, int, int, int)? + URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_, + void Function(NSURLSession, NSURLSessionDownloadTask, int, int)? + URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)? + URLSession_task_didReceiveChallenge_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock)? + URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + final builder = objc.ObjCProtocolBuilder(); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didFinishDownloadingToURL_ + .implementAsListener( + builder, URLSession_downloadTask_didFinishDownloadingToURL_); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_ + .implementAsListener(builder, + URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_ + .implementAsListener(builder, + URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_); + NSURLSessionDownloadDelegate.URLSession_didCreateTask_.implementAsListener( + builder, URLSession_didCreateTask_); + NSURLSessionDownloadDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionDownloadDelegate.URLSession_taskIsWaitingForConnectivity_ + .implementAsListener(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionDownloadDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionDownloadDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionDownloadDelegate.URLSession_task_needNewBodyStream_ + .implementAsListener(builder, URLSession_task_needNewBodyStream_); + NSURLSessionDownloadDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implementAsListener(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionDownloadDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implementAsListener(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionDownloadDelegate + .URLSession_task_didReceiveInformationalResponse_ + .implementAsListener( + builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionDownloadDelegate.URLSession_task_didFinishCollectingMetrics_ + .implementAsListener( + builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionDownloadDelegate.URLSession_task_didCompleteWithError_ + .implementAsListener(builder, URLSession_task_didCompleteWithError_); + NSURLSessionDownloadDelegate.URLSession_didBecomeInvalidWithError_ + .implementAsListener(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionDownloadDelegate + .URLSession_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionDownloadDelegate + .URLSessionDidFinishEventsForBackgroundURLSession_ + .implementAsListener( + builder, URLSessionDidFinishEventsForBackgroundURLSession_); + return builder.build(); + } + + /// Adds the implementation of the NSURLSessionDownloadDelegate protocol to an existing + /// [objc.ObjCProtocolBuilder]. All methods that can be implemented as listeners will + /// be. + static void addToBuilderAsListener(objc.ObjCProtocolBuilder builder, + {required void Function(NSURLSession, NSURLSessionDownloadTask, objc.NSURL) + URLSession_downloadTask_didFinishDownloadingToURL_, + void Function(NSURLSession, NSURLSessionDownloadTask, int, int, int)? + URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_, + void Function(NSURLSession, NSURLSessionDownloadTask, int, int)? + URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)? + URLSession_task_didReceiveChallenge_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock)? + URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didFinishDownloadingToURL_ + .implementAsListener( + builder, URLSession_downloadTask_didFinishDownloadingToURL_); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_ + .implementAsListener(builder, + URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_); + NSURLSessionDownloadDelegate + .URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_ + .implementAsListener(builder, + URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_); + NSURLSessionDownloadDelegate.URLSession_didCreateTask_.implementAsListener( + builder, URLSession_didCreateTask_); + NSURLSessionDownloadDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionDownloadDelegate.URLSession_taskIsWaitingForConnectivity_ + .implementAsListener(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionDownloadDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionDownloadDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionDownloadDelegate.URLSession_task_needNewBodyStream_ + .implementAsListener(builder, URLSession_task_needNewBodyStream_); + NSURLSessionDownloadDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implementAsListener(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionDownloadDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implementAsListener(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionDownloadDelegate + .URLSession_task_didReceiveInformationalResponse_ + .implementAsListener( + builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionDownloadDelegate.URLSession_task_didFinishCollectingMetrics_ + .implementAsListener( + builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionDownloadDelegate.URLSession_task_didCompleteWithError_ + .implementAsListener(builder, URLSession_task_didCompleteWithError_); + NSURLSessionDownloadDelegate.URLSession_didBecomeInvalidWithError_ + .implementAsListener(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionDownloadDelegate + .URLSession_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionDownloadDelegate + .URLSessionDidFinishEventsForBackgroundURLSession_ + .implementAsListener( + builder, URLSessionDidFinishEventsForBackgroundURLSession_); + } + + /// Sent when a download task that has completed a download. The delegate should + /// copy or move the file at the given location to a new location as it will be + /// removed when the delegate message returns. URLSession:task:didCompleteWithError: will + /// still be called. + static final URLSession_downloadTask_didFinishDownloadingToURL_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionDownloadTask, objc.NSURL)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_downloadTask_didFinishDownloadingToURL_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_downloadTask_didFinishDownloadingToURL_, + isRequired: true, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionDownloadTask, objc.NSURL) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDownloadTask arg2, objc.NSURL arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionDownloadTask, objc.NSURL) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_NSURL + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDownloadTask arg2, objc.NSURL arg3) => + func(arg1, arg2, arg3)), + ); + + /// Sent periodically to notify the delegate of download progress. + static final URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionDownloadTask, int, int, int)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_downloadTask_didWriteData_totalBytesWritten_totalBytesExpectedToWrite_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionDownloadTask, int, int, int) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64 + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionDownloadTask arg2, + int arg3, + int arg4, + int arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + (void Function(NSURLSession, NSURLSessionDownloadTask, int, int, int) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64_Int64 + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionDownloadTask arg2, + int arg3, + int arg4, + int arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + ); + + /// Sent when a download has been resumed. If a download failed with an + /// error, the -userInfo dictionary of the error will contain an + /// NSURLSessionDownloadTaskResumeData key, whose value is the resume + /// data. + static final URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionDownloadTask, int, int)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_downloadTask_didResumeAtOffset_expectedTotalBytes_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionDownloadTask, int, int) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64 + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDownloadTask arg2, int arg3, int arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionDownloadTask, int, int) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionDownloadTask_Int64_Int64 + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionDownloadTask arg2, int arg3, int arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Notification that a task has been created. This method is the first message + /// a task sends, providing a place to configure the task before it is resumed. + /// + /// This delegate callback is *NOT* dispatched to the delegate queue. It is + /// invoked synchronously before the task creation method returns. + static final URLSession_didCreateTask_ = objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_didCreateTask_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_didCreateTask_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.fromFunction( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.listener( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + ); + + /// Sent when the system is ready to begin work for a task with a delayed start + /// time set (using the earliestBeginDate property). The completionHandler must + /// be invoked in order for loading to proceed. The disposition provided to the + /// completion handler continues the load with the original request provided to + /// the task, replaces the request with the specified task, or cancels the task. + /// If this delegate is not implemented, loading will proceed with the original + /// request. + /// + /// Recommendation: only implement this delegate if tasks that have the + /// earliestBeginDate property set may become stale and require alteration prior + /// to starting the network load. + /// + /// If a new request is specified, the allowsExpensiveNetworkAccess, + /// allowsConstrainedNetworkAccess, and allowsCellularAccess properties + /// from the new request will not be used; the properties from the + /// original request will continue to be used. + /// + /// Canceling the task is equivalent to calling the task's cancel method; the + /// URLSession:task:didCompleteWithError: task delegate will be called with error + /// NSURLErrorCancelled. + static final URLSession_task_willBeginDelayedRequest_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_willBeginDelayedRequest_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_willBeginDelayedRequest_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLRequest arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLRequest arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Sent when a task cannot start the network loading process because the current + /// network connectivity is not available or sufficient for the task's request. + /// + /// This delegate will be called at most one time per task, and is only called if + /// the waitsForConnectivity property in the NSURLSessionConfiguration has been + /// set to YES. + /// + /// This delegate callback will never be called for background sessions, because + /// the waitForConnectivity property is ignored by those sessions. + static final URLSession_taskIsWaitingForConnectivity_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_taskIsWaitingForConnectivity_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_taskIsWaitingForConnectivity_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.fromFunction( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.listener( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + ); + + /// An HTTP request is attempting to perform a redirection to a different + /// URL. You must invoke the completion routine to allow the + /// redirection, allow the redirection with a modified request, or + /// pass nil to the completionHandler to cause the body of the redirection + /// response to be delivered as the payload of this request. The default + /// is to follow redirections. + /// + /// For tasks in background sessions, redirections will always be followed and this method will not be called. + static final URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSHTTPURLResponse arg3, + NSURLRequest arg4, + objc.ObjCBlock arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSHTTPURLResponse arg3, + NSURLRequest arg4, + objc.ObjCBlock arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + ); + + /// The task has received a request specific authentication challenge. + /// If this delegate is not implemented, the session specific authentication challenge + /// will *NOT* be called and the behavior will be the same as using the default handling + /// disposition. + static final URLSession_task_didReceiveChallenge_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didReceiveChallenge_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didReceiveChallenge_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLAuthenticationChallenge arg3, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLAuthenticationChallenge arg3, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Sent if a task requires a new, unopened body stream. This may be + /// necessary when authentication has failed for any request that + /// involves a body stream. + static final URLSession_task_needNewBodyStream_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_needNewBodyStream_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_needNewBodyStream_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + objc.ObjCBlock + arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + objc.ObjCBlock + arg3) => + func(arg1, arg2, arg3)), + ); + + /// Tells the delegate if a task requires a new body stream starting from the given offset. This may be + /// necessary when resuming a failed upload task. + /// + /// - Parameter session: The session containing the task that needs a new body stream from the given offset. + /// - Parameter task: The task that needs a new body stream. + /// - Parameter offset: The starting offset required for the body stream. + /// - Parameter completionHandler: A completion handler that your delegate method should call with the new body stream. + static final URLSession_task_needNewBodyStreamFromOffset_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + int arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + int arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Sent periodically to notify the delegate of upload progress. This + /// information is also available as properties of the task. + static final URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, int, int, int)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, int, int, int) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64 + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, int arg3, int arg4, int arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + (void Function(NSURLSession, NSURLSessionTask, int, int, int) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64 + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, int arg3, int arg4, int arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + ); + + /// Sent for each informational response received except 101 switching protocols. + static final URLSession_task_didReceiveInformationalResponse_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didReceiveInformationalResponse_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didReceiveInformationalResponse_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSHTTPURLResponse arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSHTTPURLResponse arg3) => + func(arg1, arg2, arg3)), + ); + + /// Sent when complete statistics information has been collected for the task. + static final URLSession_task_didFinishCollectingMetrics_ = + objc.ObjCProtocolListenableMethod< + void Function( + NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didFinishCollectingMetrics_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didFinishCollectingMetrics_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSURLSessionTaskMetrics arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSURLSessionTaskMetrics arg3) => + func(arg1, arg2, arg3)), + ); + + /// Sent as the last message related to a specific task. Error may be + /// nil, which implies that no error occurred and this task is complete. + static final URLSession_task_didCompleteWithError_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didCompleteWithError_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_task_didCompleteWithError_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, objc.NSError? arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, objc.NSError? arg3) => + func(arg1, arg2, arg3)), + ); + + /// The last message a session receives. A session will only become + /// invalid because of a systemic error or when it has been + /// explicitly invalidated, in which case the error parameter will be nil. + static final URLSession_didBecomeInvalidWithError_ = objc + .ObjCProtocolListenableMethod( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_didBecomeInvalidWithError_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_didBecomeInvalidWithError_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError.fromFunction( + (ffi.Pointer _, NSURLSession arg1, objc.NSError? arg2) => + func(arg1, arg2)), + (void Function(NSURLSession, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError.listener( + (ffi.Pointer _, NSURLSession arg1, objc.NSError? arg2) => + func(arg1, arg2)), + ); + + /// If implemented, when a connection level authentication challenge + /// has occurred, this delegate will be given the opportunity to + /// provide authentication credentials to the underlying + /// connection. Some types of authentication will apply to more than + /// one request on a given connection to a server (SSL Server Trust + /// challenges). If this delegate message is not implemented, the + /// behavior will be to use the default handling, which may involve user + /// interaction. + static final URLSession_didReceiveChallenge_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLAuthenticationChallenge, + objc.ObjCBlock)>( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_didReceiveChallenge_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSession_didReceiveChallenge_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLAuthenticationChallenge arg2, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLAuthenticationChallenge arg2, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg3) => + func(arg1, arg2, arg3)), + ); + + /// If an application has received an + /// -application:handleEventsForBackgroundURLSession:completionHandler: + /// message, the session delegate will receive this message to indicate + /// that all messages previously enqueued for this session have been + /// delivered. At this time it is safe to invoke the previously stored + /// completion handler, or to begin any internal updates that will + /// result in invoking the completion handler. + static final URLSessionDidFinishEventsForBackgroundURLSession_ = + objc.ObjCProtocolListenableMethod( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSessionDidFinishEventsForBackgroundURLSession_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionDownloadDelegate, + _sel_URLSessionDidFinishEventsForBackgroundURLSession_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession.fromFunction( + (ffi.Pointer _, NSURLSession arg1) => func(arg1)), + (void Function(NSURLSession) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession.listener( + (ffi.Pointer _, NSURLSession arg1) => func(arg1)), + ); +} + +late final _protocol_NSURLSessionWebSocketDelegate = + objc.getProtocol("NSURLSessionWebSocketDelegate"); +late final _sel_URLSession_webSocketTask_didOpenWithProtocol_ = + objc.registerName("URLSession:webSocketTask:didOpenWithProtocol:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionWebSocketTask, objc.NSString?)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, objc.NSString?)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionWebSocketTask, + objc.NSString?)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, objc.NSString?)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, objc.NSString?)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionWebSocketTask, objc.NSString?)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionWebSocketTask, objc.NSString?) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionWebSocketTask, objc.NSString?)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionWebSocketTask.castFromPointer(arg2, retain: true, release: true), + arg3.address == 0 ? null : objc.NSString.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, objc.NSString?)> listener( + void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, objc.NSString?) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionWebSocketTask.castFromPointer(arg2, + retain: false, release: true), + arg3.address == 0 + ? null + : objc.NSString.castFromPointer(arg3, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1r3kn8f(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionWebSocketTask, + objc.NSString?)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionWebSocketTask, objc.NSString?)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, objc.NSString?)> { + void call(ffi.Pointer arg0, NSURLSession arg1, + NSURLSessionWebSocketTask arg2, objc.NSString? arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0, + arg1.ref.pointer, arg2.ref.pointer, arg3?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_URLSession_webSocketTask_didCloseWithCode_reason_ = + objc.registerName("URLSession:webSocketTask:didCloseWithCode:reason:"); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + NSInteger arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>()( + arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSInteger, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); +ffi.Pointer + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSInteger, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer))(arg0, arg1, arg2, arg3, arg4); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSInteger, + ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSInteger, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, NSURLSession, NSURLSessionWebSocketTask, NSInteger, objc.NSData?)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, NSInteger, objc.NSData?)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionWebSocketTask, + NSInteger, + objc.NSData?)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, NSInteger, objc.NSData?)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, NSInteger arg3, ffi.Pointer arg4)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, NSInteger, objc.NSData?)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, NSURLSession, NSURLSessionWebSocketTask, NSInteger, objc.NSData?)> fromFunction(void Function(ffi.Pointer, NSURLSession, NSURLSessionWebSocketTask, DartNSInteger, objc.NSData?) fn) => + objc.ObjCBlock, NSURLSession, NSURLSessionWebSocketTask, NSInteger, objc.NSData?)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionWebSocketTask.castFromPointer(arg2, retain: true, release: true), + arg3, + arg4.address == 0 ? null : objc.NSData.castFromPointer(arg4, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, NSInteger, objc.NSData?)> listener( + void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, DartNSInteger, objc.NSData?) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + int arg3, + ffi.Pointer arg4) => + fn( + arg0, + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionWebSocketTask.castFromPointer(arg2, + retain: false, release: true), + arg3, + arg4.address == 0 + ? null + : objc.NSData.castFromPointer(arg4, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_3lo3bb(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + ffi.Pointer, + NSURLSession, + NSURLSessionWebSocketTask, + NSInteger, + objc.NSData?)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, NSURLSession, NSURLSessionWebSocketTask, NSInteger, objc.NSData?)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionWebSocketTask, NSInteger, objc.NSData?)> { + void call( + ffi.Pointer arg0, + NSURLSession arg1, + NSURLSessionWebSocketTask arg2, + DartNSInteger arg3, + objc.NSData? arg4) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + NSInteger arg3, + ffi.Pointer arg4)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>()( + ref.pointer, + arg0, + arg1.ref.pointer, + arg2.ref.pointer, + arg3, + arg4?.ref.pointer ?? ffi.nullptr); +} + +/// NSURLSessionWebSocketDelegate +abstract final class NSURLSessionWebSocketDelegate { + /// Builds an object that implements the NSURLSessionWebSocketDelegate protocol. To implement + /// multiple protocols, use [addToBuilder] or [objc.ObjCProtocolBuilder] directly. + static objc.ObjCObjectBase implement( + {void Function(NSURLSession, NSURLSessionWebSocketTask, objc.NSString?)? + URLSession_webSocketTask_didOpenWithProtocol_, + void Function(NSURLSession, NSURLSessionWebSocketTask, DartNSInteger, objc.NSData?)? + URLSession_webSocketTask_didCloseWithCode_reason_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)? + URLSession_task_didReceiveChallenge_completionHandler_, + void Function( + NSURLSession, NSURLSessionTask, objc.ObjCBlock)? + URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + final builder = objc.ObjCProtocolBuilder(); + NSURLSessionWebSocketDelegate.URLSession_webSocketTask_didOpenWithProtocol_ + .implement(builder, URLSession_webSocketTask_didOpenWithProtocol_); + NSURLSessionWebSocketDelegate + .URLSession_webSocketTask_didCloseWithCode_reason_ + .implement(builder, URLSession_webSocketTask_didCloseWithCode_reason_); + NSURLSessionWebSocketDelegate.URLSession_didCreateTask_.implement( + builder, URLSession_didCreateTask_); + NSURLSessionWebSocketDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implement(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionWebSocketDelegate.URLSession_taskIsWaitingForConnectivity_ + .implement(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionWebSocketDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implement(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implement( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionWebSocketDelegate.URLSession_task_needNewBodyStream_.implement( + builder, URLSession_task_needNewBodyStream_); + NSURLSessionWebSocketDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implement(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implement(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionWebSocketDelegate + .URLSession_task_didReceiveInformationalResponse_ + .implement(builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionWebSocketDelegate.URLSession_task_didFinishCollectingMetrics_ + .implement(builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionWebSocketDelegate.URLSession_task_didCompleteWithError_ + .implement(builder, URLSession_task_didCompleteWithError_); + NSURLSessionWebSocketDelegate.URLSession_didBecomeInvalidWithError_ + .implement(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionWebSocketDelegate + .URLSession_didReceiveChallenge_completionHandler_ + .implement(builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSessionDidFinishEventsForBackgroundURLSession_ + .implement(builder, URLSessionDidFinishEventsForBackgroundURLSession_); + return builder.build(); + } + + /// Adds the implementation of the NSURLSessionWebSocketDelegate protocol to an existing + /// [objc.ObjCProtocolBuilder]. + static void addToBuilder(objc.ObjCProtocolBuilder builder, + {void Function(NSURLSession, NSURLSessionWebSocketTask, objc.NSString?)? + URLSession_webSocketTask_didOpenWithProtocol_, + void Function(NSURLSession, NSURLSessionWebSocketTask, DartNSInteger, objc.NSData?)? + URLSession_webSocketTask_didCloseWithCode_reason_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)? + URLSession_task_didReceiveChallenge_completionHandler_, + void Function( + NSURLSession, NSURLSessionTask, objc.ObjCBlock)? + URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + NSURLSessionWebSocketDelegate.URLSession_webSocketTask_didOpenWithProtocol_ + .implement(builder, URLSession_webSocketTask_didOpenWithProtocol_); + NSURLSessionWebSocketDelegate + .URLSession_webSocketTask_didCloseWithCode_reason_ + .implement(builder, URLSession_webSocketTask_didCloseWithCode_reason_); + NSURLSessionWebSocketDelegate.URLSession_didCreateTask_.implement( + builder, URLSession_didCreateTask_); + NSURLSessionWebSocketDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implement(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionWebSocketDelegate.URLSession_taskIsWaitingForConnectivity_ + .implement(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionWebSocketDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implement(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implement( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionWebSocketDelegate.URLSession_task_needNewBodyStream_.implement( + builder, URLSession_task_needNewBodyStream_); + NSURLSessionWebSocketDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implement(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implement(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionWebSocketDelegate + .URLSession_task_didReceiveInformationalResponse_ + .implement(builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionWebSocketDelegate.URLSession_task_didFinishCollectingMetrics_ + .implement(builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionWebSocketDelegate.URLSession_task_didCompleteWithError_ + .implement(builder, URLSession_task_didCompleteWithError_); + NSURLSessionWebSocketDelegate.URLSession_didBecomeInvalidWithError_ + .implement(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionWebSocketDelegate + .URLSession_didReceiveChallenge_completionHandler_ + .implement(builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSessionDidFinishEventsForBackgroundURLSession_ + .implement(builder, URLSessionDidFinishEventsForBackgroundURLSession_); + } + + /// Builds an object that implements the NSURLSessionWebSocketDelegate protocol. To implement + /// multiple protocols, use [addToBuilder] or [objc.ObjCProtocolBuilder] directly. All + /// methods that can be implemented as listeners will be. + static objc.ObjCObjectBase implementAsListener( + {void Function(NSURLSession, NSURLSessionWebSocketTask, objc.NSString?)? + URLSession_webSocketTask_didOpenWithProtocol_, + void Function(NSURLSession, NSURLSessionWebSocketTask, DartNSInteger, objc.NSData?)? + URLSession_webSocketTask_didCloseWithCode_reason_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)? + URLSession_task_didReceiveChallenge_completionHandler_, + void Function( + NSURLSession, NSURLSessionTask, objc.ObjCBlock)? + URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + final builder = objc.ObjCProtocolBuilder(); + NSURLSessionWebSocketDelegate.URLSession_webSocketTask_didOpenWithProtocol_ + .implementAsListener( + builder, URLSession_webSocketTask_didOpenWithProtocol_); + NSURLSessionWebSocketDelegate + .URLSession_webSocketTask_didCloseWithCode_reason_ + .implementAsListener( + builder, URLSession_webSocketTask_didCloseWithCode_reason_); + NSURLSessionWebSocketDelegate.URLSession_didCreateTask_.implementAsListener( + builder, URLSession_didCreateTask_); + NSURLSessionWebSocketDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionWebSocketDelegate.URLSession_taskIsWaitingForConnectivity_ + .implementAsListener(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionWebSocketDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionWebSocketDelegate.URLSession_task_needNewBodyStream_ + .implementAsListener(builder, URLSession_task_needNewBodyStream_); + NSURLSessionWebSocketDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implementAsListener(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implementAsListener(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionWebSocketDelegate + .URLSession_task_didReceiveInformationalResponse_ + .implementAsListener( + builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionWebSocketDelegate.URLSession_task_didFinishCollectingMetrics_ + .implementAsListener( + builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionWebSocketDelegate.URLSession_task_didCompleteWithError_ + .implementAsListener(builder, URLSession_task_didCompleteWithError_); + NSURLSessionWebSocketDelegate.URLSession_didBecomeInvalidWithError_ + .implementAsListener(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionWebSocketDelegate + .URLSession_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSessionDidFinishEventsForBackgroundURLSession_ + .implementAsListener( + builder, URLSessionDidFinishEventsForBackgroundURLSession_); + return builder.build(); + } + + /// Adds the implementation of the NSURLSessionWebSocketDelegate protocol to an existing + /// [objc.ObjCProtocolBuilder]. All methods that can be implemented as listeners will + /// be. + static void addToBuilderAsListener(objc.ObjCProtocolBuilder builder, + {void Function(NSURLSession, NSURLSessionWebSocketTask, objc.NSString?)? + URLSession_webSocketTask_didOpenWithProtocol_, + void Function(NSURLSession, NSURLSessionWebSocketTask, DartNSInteger, objc.NSData?)? + URLSession_webSocketTask_didCloseWithCode_reason_, + void Function(NSURLSession, NSURLSessionTask)? URLSession_didCreateTask_, + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)? + URLSession_task_willBeginDelayedRequest_completionHandler_, + void Function(NSURLSession, NSURLSessionTask)? + URLSession_taskIsWaitingForConnectivity_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)? + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)? + URLSession_task_didReceiveChallenge_completionHandler_, + void Function( + NSURLSession, NSURLSessionTask, objc.ObjCBlock)? + URLSession_task_needNewBodyStream_, + void Function(NSURLSession, NSURLSessionTask, int, objc.ObjCBlock)? URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + void Function(NSURLSession, NSURLSessionTask, int, int, int)? URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)? URLSession_task_didReceiveInformationalResponse_, + void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)? URLSession_task_didFinishCollectingMetrics_, + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)? URLSession_task_didCompleteWithError_, + void Function(NSURLSession, objc.NSError?)? URLSession_didBecomeInvalidWithError_, + void Function(NSURLSession, NSURLAuthenticationChallenge, objc.ObjCBlock)? URLSession_didReceiveChallenge_completionHandler_, + void Function(NSURLSession)? URLSessionDidFinishEventsForBackgroundURLSession_}) { + NSURLSessionWebSocketDelegate.URLSession_webSocketTask_didOpenWithProtocol_ + .implementAsListener( + builder, URLSession_webSocketTask_didOpenWithProtocol_); + NSURLSessionWebSocketDelegate + .URLSession_webSocketTask_didCloseWithCode_reason_ + .implementAsListener( + builder, URLSession_webSocketTask_didCloseWithCode_reason_); + NSURLSessionWebSocketDelegate.URLSession_didCreateTask_.implementAsListener( + builder, URLSession_didCreateTask_); + NSURLSessionWebSocketDelegate + .URLSession_task_willBeginDelayedRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willBeginDelayedRequest_completionHandler_); + NSURLSessionWebSocketDelegate.URLSession_taskIsWaitingForConnectivity_ + .implementAsListener(builder, URLSession_taskIsWaitingForConnectivity_); + NSURLSessionWebSocketDelegate + .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ + .implementAsListener(builder, + URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSession_task_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_task_didReceiveChallenge_completionHandler_); + NSURLSessionWebSocketDelegate.URLSession_task_needNewBodyStream_ + .implementAsListener(builder, URLSession_task_needNewBodyStream_); + NSURLSessionWebSocketDelegate + .URLSession_task_needNewBodyStreamFromOffset_completionHandler_ + .implementAsListener(builder, + URLSession_task_needNewBodyStreamFromOffset_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ + .implementAsListener(builder, + URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_); + NSURLSessionWebSocketDelegate + .URLSession_task_didReceiveInformationalResponse_ + .implementAsListener( + builder, URLSession_task_didReceiveInformationalResponse_); + NSURLSessionWebSocketDelegate.URLSession_task_didFinishCollectingMetrics_ + .implementAsListener( + builder, URLSession_task_didFinishCollectingMetrics_); + NSURLSessionWebSocketDelegate.URLSession_task_didCompleteWithError_ + .implementAsListener(builder, URLSession_task_didCompleteWithError_); + NSURLSessionWebSocketDelegate.URLSession_didBecomeInvalidWithError_ + .implementAsListener(builder, URLSession_didBecomeInvalidWithError_); + NSURLSessionWebSocketDelegate + .URLSession_didReceiveChallenge_completionHandler_ + .implementAsListener( + builder, URLSession_didReceiveChallenge_completionHandler_); + NSURLSessionWebSocketDelegate + .URLSessionDidFinishEventsForBackgroundURLSession_ + .implementAsListener( + builder, URLSessionDidFinishEventsForBackgroundURLSession_); + } + + /// Indicates that the WebSocket handshake was successful and the connection has been upgraded to webSockets. + /// It will also provide the protocol that is picked in the handshake. If the handshake fails, this delegate will not be invoked. + static final URLSession_webSocketTask_didOpenWithProtocol_ = + objc.ObjCProtocolListenableMethod< + void Function( + NSURLSession, NSURLSessionWebSocketTask, objc.NSString?)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_webSocketTask_didOpenWithProtocol_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_webSocketTask_didOpenWithProtocol_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionWebSocketTask, objc.NSString?) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionWebSocketTask arg2, objc.NSString? arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionWebSocketTask, objc.NSString?) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSString + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionWebSocketTask arg2, objc.NSString? arg3) => + func(arg1, arg2, arg3)), + ); + + /// Indicates that the WebSocket has received a close frame from the server endpoint. + /// The close code and the close reason may be provided by the delegate if the server elects to send + /// this information in the close frame + static final URLSession_webSocketTask_didCloseWithCode_reason_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionWebSocketTask, DartNSInteger, + objc.NSData?)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_webSocketTask_didCloseWithCode_reason_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_webSocketTask_didCloseWithCode_reason_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionWebSocketTask, DartNSInteger, + objc.NSData?) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionWebSocketTask arg2, + DartNSInteger arg3, + objc.NSData? arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionWebSocketTask, DartNSInteger, + objc.NSData?) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionWebSocketTask_NSURLSessionWebSocketCloseCode_NSData + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionWebSocketTask arg2, + DartNSInteger arg3, + objc.NSData? arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Notification that a task has been created. This method is the first message + /// a task sends, providing a place to configure the task before it is resumed. + /// + /// This delegate callback is *NOT* dispatched to the delegate queue. It is + /// invoked synchronously before the task creation method returns. + static final URLSession_didCreateTask_ = objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_didCreateTask_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_didCreateTask_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.fromFunction( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.listener( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + ); + + /// Sent when the system is ready to begin work for a task with a delayed start + /// time set (using the earliestBeginDate property). The completionHandler must + /// be invoked in order for loading to proceed. The disposition provided to the + /// completion handler continues the load with the original request provided to + /// the task, replaces the request with the specified task, or cancels the task. + /// If this delegate is not implemented, loading will proceed with the original + /// request. + /// + /// Recommendation: only implement this delegate if tasks that have the + /// earliestBeginDate property set may become stale and require alteration prior + /// to starting the network load. + /// + /// If a new request is specified, the allowsExpensiveNetworkAccess, + /// allowsConstrainedNetworkAccess, and allowsCellularAccess properties + /// from the new request will not be used; the properties from the + /// original request will continue to be used. + /// + /// Canceling the task is equivalent to calling the task's cancel method; the + /// URLSession:task:didCompleteWithError: task delegate will be called with error + /// NSURLErrorCancelled. + static final URLSession_task_willBeginDelayedRequest_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_willBeginDelayedRequest_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_willBeginDelayedRequest_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLRequest arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionTask, NSURLRequest, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLRequest_ffiVoidNSURLSessionDelayedRequestDispositionNSURLRequest + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLRequest arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Sent when a task cannot start the network loading process because the current + /// network connectivity is not available or sufficient for the task's request. + /// + /// This delegate will be called at most one time per task, and is only called if + /// the waitsForConnectivity property in the NSURLSessionConfiguration has been + /// set to YES. + /// + /// This delegate callback will never be called for background sessions, because + /// the waitForConnectivity property is ignored by those sessions. + static final URLSession_taskIsWaitingForConnectivity_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_taskIsWaitingForConnectivity_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_taskIsWaitingForConnectivity_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.fromFunction( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + (void Function(NSURLSession, NSURLSessionTask) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask.listener( + (ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2) => + func(arg1, arg2)), + ); + + /// An HTTP request is attempting to perform a redirection to a different + /// URL. You must invoke the completion routine to allow the + /// redirection, allow the redirection with a modified request, or + /// pass nil to the completionHandler to cause the body of the redirection + /// response to be delivered as the payload of this request. The default + /// is to follow redirections. + /// + /// For tasks in background sessions, redirections will always be followed and this method will not be called. + static final URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSHTTPURLResponse arg3, + NSURLRequest arg4, + objc.ObjCBlock arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse, + NSURLRequest, objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse_NSURLRequest_ffiVoidNSURLRequest + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSHTTPURLResponse arg3, + NSURLRequest arg4, + objc.ObjCBlock arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + ); + + /// The task has received a request specific authentication challenge. + /// If this delegate is not implemented, the session specific authentication challenge + /// will *NOT* be called and the behavior will be the same as using the default handling + /// disposition. + static final URLSession_task_didReceiveChallenge_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function( + NSURLSession, + NSURLSessionTask, + NSURLAuthenticationChallenge, + objc.ObjCBlock)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didReceiveChallenge_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didReceiveChallenge_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLAuthenticationChallenge arg3, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + NSURLAuthenticationChallenge arg3, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Sent if a task requires a new, unopened body stream. This may be + /// necessary when authentication has failed for any request that + /// involves a body stream. + static final URLSession_task_needNewBodyStream_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_needNewBodyStream_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_needNewBodyStream_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + objc.ObjCBlock + arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_ffiVoidNSInputStream + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + objc.ObjCBlock + arg3) => + func(arg1, arg2, arg3)), + ); + + /// Tells the delegate if a task requires a new body stream starting from the given offset. This may be + /// necessary when resuming a failed upload task. + /// + /// - Parameter session: The session containing the task that needs a new body stream from the given offset. + /// - Parameter task: The task that needs a new body stream. + /// - Parameter offset: The starting offset required for the body stream. + /// - Parameter completionHandler: A completion handler that your delegate method should call with the new body stream. + static final URLSession_task_needNewBodyStreamFromOffset_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_needNewBodyStreamFromOffset_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + int arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + (void Function(NSURLSession, NSURLSessionTask, int, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_ffiVoidNSInputStream + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLSessionTask arg2, + int arg3, + objc.ObjCBlock + arg4) => + func(arg1, arg2, arg3, arg4)), + ); + + /// Sent periodically to notify the delegate of upload progress. This + /// information is also available as properties of the task. + static final URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, int, int, int)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didSendBodyData_totalBytesSent_totalBytesExpectedToSend_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, int, int, int) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64 + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, int arg3, int arg4, int arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + (void Function(NSURLSession, NSURLSessionTask, int, int, int) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_Int64_Int64_Int64 + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, int arg3, int arg4, int arg5) => + func(arg1, arg2, arg3, arg4, arg5)), + ); + + /// Sent for each informational response received except 101 switching protocols. + static final URLSession_task_didReceiveInformationalResponse_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didReceiveInformationalResponse_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didReceiveInformationalResponse_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSHTTPURLResponse arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, NSHTTPURLResponse) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSHTTPURLResponse + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSHTTPURLResponse arg3) => + func(arg1, arg2, arg3)), + ); + + /// Sent when complete statistics information has been collected for the task. + static final URLSession_task_didFinishCollectingMetrics_ = + objc.ObjCProtocolListenableMethod< + void Function( + NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didFinishCollectingMetrics_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didFinishCollectingMetrics_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSURLSessionTaskMetrics arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, NSURLSessionTaskMetrics) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSURLSessionTaskMetrics + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, NSURLSessionTaskMetrics arg3) => + func(arg1, arg2, arg3)), + ); + + /// Sent as the last message related to a specific task. Error may be + /// nil, which implies that no error occurred and this task is complete. + static final URLSession_task_didCompleteWithError_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLSessionTask, objc.NSError?)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didCompleteWithError_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_task_didCompleteWithError_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLSessionTask, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError + .fromFunction((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, objc.NSError? arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLSessionTask, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLSessionTask_NSError + .listener((ffi.Pointer _, NSURLSession arg1, + NSURLSessionTask arg2, objc.NSError? arg3) => + func(arg1, arg2, arg3)), + ); + + /// The last message a session receives. A session will only become + /// invalid because of a systemic error or when it has been + /// explicitly invalidated, in which case the error parameter will be nil. + static final URLSession_didBecomeInvalidWithError_ = objc + .ObjCProtocolListenableMethod( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_didBecomeInvalidWithError_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_didBecomeInvalidWithError_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError.fromFunction( + (ffi.Pointer _, NSURLSession arg1, objc.NSError? arg2) => + func(arg1, arg2)), + (void Function(NSURLSession, objc.NSError?) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSError.listener( + (ffi.Pointer _, NSURLSession arg1, objc.NSError? arg2) => + func(arg1, arg2)), + ); + + /// If implemented, when a connection level authentication challenge + /// has occurred, this delegate will be given the opportunity to + /// provide authentication credentials to the underlying + /// connection. Some types of authentication will apply to more than + /// one request on a given connection to a server (SSL Server Trust + /// challenges). If this delegate message is not implemented, the + /// behavior will be to use the default handling, which may involve user + /// interaction. + static final URLSession_didReceiveChallenge_completionHandler_ = + objc.ObjCProtocolListenableMethod< + void Function(NSURLSession, NSURLAuthenticationChallenge, + objc.ObjCBlock)>( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_didReceiveChallenge_completionHandler_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSession_didReceiveChallenge_completionHandler_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .fromFunction((ffi.Pointer _, + NSURLSession arg1, + NSURLAuthenticationChallenge arg2, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg3) => + func(arg1, arg2, arg3)), + (void Function(NSURLSession, NSURLAuthenticationChallenge, + objc.ObjCBlock) + func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession_NSURLAuthenticationChallenge_ffiVoidNSURLSessionAuthChallengeDispositionNSURLCredential + .listener((ffi.Pointer _, + NSURLSession arg1, + NSURLAuthenticationChallenge arg2, + objc.ObjCBlock< + ffi.Void Function(NSInteger, NSURLCredential?)> + arg3) => + func(arg1, arg2, arg3)), + ); + + /// If an application has received an + /// -application:handleEventsForBackgroundURLSession:completionHandler: + /// message, the session delegate will receive this message to indicate + /// that all messages previously enqueued for this session have been + /// delivered. At this time it is safe to invoke the previously stored + /// completion handler, or to begin any internal updates that will + /// result in invoking the completion handler. + static final URLSessionDidFinishEventsForBackgroundURLSession_ = + objc.ObjCProtocolListenableMethod( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSessionDidFinishEventsForBackgroundURLSession_, + objc.getProtocolMethodSignature( + _protocol_NSURLSessionWebSocketDelegate, + _sel_URLSessionDidFinishEventsForBackgroundURLSession_, + isRequired: false, + isInstanceMethod: true, + ), + (void Function(NSURLSession) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession.fromFunction( + (ffi.Pointer _, NSURLSession arg1) => func(arg1)), + (void Function(NSURLSession) func) => + ObjCBlock_ffiVoid_ffiVoid_NSURLSession.listener( + (ffi.Pointer _, NSURLSession arg1) => func(arg1)), + ); +} + +typedef unichar = ffi.UnsignedShort; +typedef Dartunichar = int; +late final _class_NSValue = objc.getClass("NSValue"); +late final _sel_valueWithBytes_objCType_ = + objc.registerName("valueWithBytes:objCType:"); +final _objc_msgSend_qtxoq7 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_value_withObjCType_ = objc.registerName("value:withObjCType:"); + +/// NSValueCreation +extension NSValueCreation on objc.NSValue { + /// valueWithBytes:objCType: + static objc.NSValue valueWithBytes_objCType_( + ffi.Pointer value, ffi.Pointer type) { + final _ret = _objc_msgSend_qtxoq7( + _class_NSValue, _sel_valueWithBytes_objCType_, value, type); + return objc.NSValue.castFromPointer(_ret, retain: true, release: true); + } + + /// value:withObjCType: + static objc.NSValue value_withObjCType_( + ffi.Pointer value, ffi.Pointer type) { + final _ret = _objc_msgSend_qtxoq7( + _class_NSValue, _sel_value_withObjCType_, value, type); + return objc.NSValue.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _sel_valueWithNonretainedObject_ = + objc.registerName("valueWithNonretainedObject:"); +late final _sel_nonretainedObjectValue = + objc.registerName("nonretainedObjectValue"); +late final _sel_valueWithPointer_ = objc.registerName("valueWithPointer:"); +final _objc_msgSend_1yesha9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_pointerValue = objc.registerName("pointerValue"); +final _objc_msgSend_6ex6p5 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_isEqualToValue_ = objc.registerName("isEqualToValue:"); + +/// NSValueExtensionMethods +extension NSValueExtensionMethods on objc.NSValue { + /// valueWithNonretainedObject: + static objc.NSValue valueWithNonretainedObject_( + objc.ObjCObjectBase? anObject) { + final _ret = _objc_msgSend_62nh5j(_class_NSValue, + _sel_valueWithNonretainedObject_, anObject?.ref.pointer ?? ffi.nullptr); + return objc.NSValue.castFromPointer(_ret, retain: true, release: true); + } + + /// nonretainedObjectValue + objc.ObjCObjectBase? get nonretainedObjectValue { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_nonretainedObjectValue); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// valueWithPointer: + static objc.NSValue valueWithPointer_(ffi.Pointer pointer) { + final _ret = + _objc_msgSend_1yesha9(_class_NSValue, _sel_valueWithPointer_, pointer); + return objc.NSValue.castFromPointer(_ret, retain: true, release: true); + } + + /// pointerValue + ffi.Pointer get pointerValue { + return _objc_msgSend_6ex6p5(this.ref.pointer, _sel_pointerValue); + } + + /// isEqualToValue: + bool isEqualToValue_(objc.NSValue value) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_isEqualToValue_, value.ref.pointer); + } +} + +late final _class_NSNumber = objc.getClass("NSNumber"); +late final _sel_numberWithChar_ = objc.registerName("numberWithChar:"); +final _objc_msgSend_vx1f2d = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Char)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_numberWithUnsignedChar_ = + objc.registerName("numberWithUnsignedChar:"); +final _objc_msgSend_uzucl8 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedChar)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_numberWithShort_ = objc.registerName("numberWithShort:"); +final _objc_msgSend_cvzqr9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Short)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_numberWithUnsignedShort_ = + objc.registerName("numberWithUnsignedShort:"); +final _objc_msgSend_onx6bi = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedShort)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_numberWithInt_ = objc.registerName("numberWithInt:"); +final _objc_msgSend_1a0iyvk = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_numberWithUnsignedInt_ = + objc.registerName("numberWithUnsignedInt:"); +final _objc_msgSend_12mhqtk = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedInt)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_numberWithLong_ = objc.registerName("numberWithLong:"); +late final _sel_numberWithUnsignedLong_ = + objc.registerName("numberWithUnsignedLong:"); +late final _sel_numberWithLongLong_ = objc.registerName("numberWithLongLong:"); +final _objc_msgSend_94zdgv = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.LongLong)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_numberWithUnsignedLongLong_ = + objc.registerName("numberWithUnsignedLongLong:"); +final _objc_msgSend_98pnic = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLongLong)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_numberWithFloat_ = objc.registerName("numberWithFloat:"); +final _objc_msgSend_1f4qa0h = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Float)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, double)>(); +late final _sel_numberWithDouble_ = objc.registerName("numberWithDouble:"); +late final _sel_numberWithBool_ = objc.registerName("numberWithBool:"); +final _objc_msgSend_1l3kbc1 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Bool)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, bool)>(); +late final _sel_numberWithInteger_ = objc.registerName("numberWithInteger:"); +late final _sel_numberWithUnsignedInteger_ = + objc.registerName("numberWithUnsignedInteger:"); + +/// NSNumberCreation +extension NSNumberCreation on objc.NSNumber { + /// numberWithChar: + static objc.NSNumber numberWithChar_(int value) { + final _ret = + _objc_msgSend_vx1f2d(_class_NSNumber, _sel_numberWithChar_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithUnsignedChar: + static objc.NSNumber numberWithUnsignedChar_(int value) { + final _ret = _objc_msgSend_uzucl8( + _class_NSNumber, _sel_numberWithUnsignedChar_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithShort: + static objc.NSNumber numberWithShort_(int value) { + final _ret = + _objc_msgSend_cvzqr9(_class_NSNumber, _sel_numberWithShort_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithUnsignedShort: + static objc.NSNumber numberWithUnsignedShort_(int value) { + final _ret = _objc_msgSend_onx6bi( + _class_NSNumber, _sel_numberWithUnsignedShort_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithInt: + static objc.NSNumber numberWithInt_(int value) { + final _ret = + _objc_msgSend_1a0iyvk(_class_NSNumber, _sel_numberWithInt_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithUnsignedInt: + static objc.NSNumber numberWithUnsignedInt_(int value) { + final _ret = _objc_msgSend_12mhqtk( + _class_NSNumber, _sel_numberWithUnsignedInt_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithLong: + static objc.NSNumber numberWithLong_(int value) { + final _ret = + _objc_msgSend_8o14b(_class_NSNumber, _sel_numberWithLong_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithUnsignedLong: + static objc.NSNumber numberWithUnsignedLong_(int value) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSNumber, _sel_numberWithUnsignedLong_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithLongLong: + static objc.NSNumber numberWithLongLong_(int value) { + final _ret = + _objc_msgSend_94zdgv(_class_NSNumber, _sel_numberWithLongLong_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithUnsignedLongLong: + static objc.NSNumber numberWithUnsignedLongLong_(int value) { + final _ret = _objc_msgSend_98pnic( + _class_NSNumber, _sel_numberWithUnsignedLongLong_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithFloat: + static objc.NSNumber numberWithFloat_(double value) { + final _ret = + _objc_msgSend_1f4qa0h(_class_NSNumber, _sel_numberWithFloat_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithDouble: + static objc.NSNumber numberWithDouble_(double value) { + final _ret = + _objc_msgSend_1x911p2(_class_NSNumber, _sel_numberWithDouble_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithBool: + static objc.NSNumber numberWithBool_(bool value) { + final _ret = + _objc_msgSend_1l3kbc1(_class_NSNumber, _sel_numberWithBool_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithInteger: + static objc.NSNumber numberWithInteger_(DartNSInteger value) { + final _ret = + _objc_msgSend_8o14b(_class_NSNumber, _sel_numberWithInteger_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } + + /// numberWithUnsignedInteger: + static objc.NSNumber numberWithUnsignedInteger_(DartNSUInteger value) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSNumber, _sel_numberWithUnsignedInteger_, value); + return objc.NSNumber.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _sel_getValue_ = objc.registerName("getValue:"); +final _objc_msgSend_ovsamd = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + +/// NSDeprecated +extension NSDeprecated2 on objc.NSValue { + /// getValue: + void getValue_(ffi.Pointer value) { + _objc_msgSend_ovsamd(this.ref.pointer, _sel_getValue_, value); + } +} + +typedef NSRange = objc.NSRange; +typedef NSRangePointer = ffi.Pointer; +late final _sel_valueWithRange_ = objc.registerName("valueWithRange:"); +final _objc_msgSend_83z673 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, objc.NSRange)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, objc.NSRange)>(); +late final _sel_rangeValue = objc.registerName("rangeValue"); +final _objc_msgSend_1u11dbb = objc.msgSendPointer + .cast< + ffi.NativeFunction< + objc.NSRange Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + objc.NSRange Function( + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_1u11dbbStret = objc.msgSendStretPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>(); + +/// NSValueRangeExtensions +extension NSValueRangeExtensions on objc.NSValue { + /// valueWithRange: + static objc.NSValue valueWithRange_(NSRange range) { + final _ret = + _objc_msgSend_83z673(_class_NSValue, _sel_valueWithRange_, range); + return objc.NSValue.castFromPointer(_ret, retain: true, release: true); + } + + /// rangeValue + NSRange get rangeValue { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_1u11dbbStret(_ptr, this.ref.pointer, _sel_rangeValue) + : _ptr.ref = _objc_msgSend_1u11dbb(this.ref.pointer, _sel_rangeValue); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } +} + +late final _class_NSArray = objc.getClass("NSArray"); +late final _sel_arrayByAddingObject_ = + objc.registerName("arrayByAddingObject:"); +late final _sel_arrayByAddingObjectsFromArray_ = + objc.registerName("arrayByAddingObjectsFromArray:"); +late final _sel_componentsJoinedByString_ = + objc.registerName("componentsJoinedByString:"); +late final _sel_containsObject_ = objc.registerName("containsObject:"); +late final _sel_firstObjectCommonWithArray_ = + objc.registerName("firstObjectCommonWithArray:"); +late final _sel_getObjects_range_ = objc.registerName("getObjects:range:"); +final _objc_msgSend_o16d3k = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + objc.NSRange)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + objc.NSRange)>(); +late final _sel_indexOfObject_ = objc.registerName("indexOfObject:"); +final _objc_msgSend_1p4b7x4 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_indexOfObject_inRange_ = + objc.registerName("indexOfObject:inRange:"); +final _objc_msgSend_1c913oo = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange)>(); +late final _sel_indexOfObjectIdenticalTo_ = + objc.registerName("indexOfObjectIdenticalTo:"); +late final _sel_indexOfObjectIdenticalTo_inRange_ = + objc.registerName("indexOfObjectIdenticalTo:inRange:"); +late final _sel_isEqualToArray_ = objc.registerName("isEqualToArray:"); +late final _sel_firstObject = objc.registerName("firstObject"); +late final _sel_lastObject = objc.registerName("lastObject"); +late final _sel_reverseObjectEnumerator = + objc.registerName("reverseObjectEnumerator"); +late final _sel_sortedArrayHint = objc.registerName("sortedArrayHint"); +late final _sel_sortedArrayUsingFunction_context_ = + objc.registerName("sortedArrayUsingFunction:context:"); +final _objc_msgSend_1iiv4px = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>, + ffi.Pointer)>(); +late final _sel_sortedArrayUsingFunction_context_hint_ = + objc.registerName("sortedArrayUsingFunction:context:hint:"); +final _objc_msgSend_iqbzrn = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_sortedArrayUsingSelector_ = + objc.registerName("sortedArrayUsingSelector:"); +late final _sel_subarrayWithRange_ = objc.registerName("subarrayWithRange:"); +late final _sel_makeObjectsPerformSelector_ = + objc.registerName("makeObjectsPerformSelector:"); +final _objc_msgSend_1d9e4oe = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_makeObjectsPerformSelector_withObject_ = + objc.registerName("makeObjectsPerformSelector:withObject:"); +final _objc_msgSend_1c03bya = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_objectsAtIndexes_ = objc.registerName("objectsAtIndexes:"); +late final _sel_objectAtIndexedSubscript_ = + objc.registerName("objectAtIndexedSubscript:"); +void _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + NSUInteger arg1, ffi.Pointer arg2)>>() + .asFunction< + void Function(ffi.Pointer, int, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + int, ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2) { + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + int, ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger, ffi.Pointer)> + _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_listenerCallable = ffi + .NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, ffi.UnsignedLong, ffi.Pointer)>`. +abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.UnsignedLong, ffi.Pointer)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.UnsignedLong, ffi.Pointer)> + fromFunctionPointer(ffi.Pointer arg0, NSUInteger arg1, ffi.Pointer arg2)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.UnsignedLong, ffi.Pointer)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, ffi.UnsignedLong, ffi.Pointer)> + fromFunction(void Function(objc.ObjCObjectBase, DartNSUInteger, ffi.Pointer) fn) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.UnsignedLong, ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_closureCallable, + (ffi.Pointer arg0, int arg1, ffi.Pointer arg2) => + fn(objc.ObjCObjectBase(arg0, retain: true, release: true), arg1, arg2)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> listener( + void Function(objc.ObjCObjectBase, DartNSUInteger, ffi.Pointer) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, int arg1, + ffi.Pointer arg2) => + fn(objc.ObjCObjectBase(arg0, retain: false, release: true), arg1, + arg2)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_16ko9u(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, ffi.UnsignedLong, ffi.Pointer)>`. +extension ObjCBlock_ffiVoid_objcObjCObject_NSUInteger_bool_CallExtension + on objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> { + void call(objc.ObjCObjectBase arg0, DartNSUInteger arg1, + ffi.Pointer arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + NSUInteger arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>()( + ref.pointer, arg0.ref.pointer, arg1, arg2); +} + +late final _sel_enumerateObjectsUsingBlock_ = + objc.registerName("enumerateObjectsUsingBlock:"); +late final _sel_enumerateObjectsWithOptions_usingBlock_ = + objc.registerName("enumerateObjectsWithOptions:usingBlock:"); +late final _sel_enumerateObjectsAtIndexes_options_usingBlock_ = + objc.registerName("enumerateObjectsAtIndexes:options:usingBlock:"); +final _objc_msgSend_p1bhs = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +bool _ObjCBlock_bool_objcObjCObject_NSUInteger_bool_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer arg0, + NSUInteger arg1, ffi.Pointer arg2)>>() + .asFunction< + bool Function(ffi.Pointer, int, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_bool_objcObjCObject_NSUInteger_bool_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>( + _ObjCBlock_bool_objcObjCObject_NSUInteger_bool_fnPtrTrampoline, + false) + .cast(); +bool _ObjCBlock_bool_objcObjCObject_NSUInteger_bool_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as bool Function(ffi.Pointer, + int, ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_bool_objcObjCObject_NSUInteger_bool_closureCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>( + _ObjCBlock_bool_objcObjCObject_NSUInteger_bool_closureTrampoline, + false) + .cast(); + +/// Construction methods for `objc.ObjCBlock, ffi.UnsignedLong, ffi.Pointer)>`. +abstract final class ObjCBlock_bool_objcObjCObject_NSUInteger_bool { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.UnsignedLong, ffi.Pointer)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.UnsignedLong, ffi.Pointer)> + fromFunctionPointer(ffi.Pointer arg0, NSUInteger arg1, ffi.Pointer arg2)>> ptr) => + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.UnsignedLong, ffi.Pointer)>( + objc.newPointerBlock( + _ObjCBlock_bool_objcObjCObject_NSUInteger_bool_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, ffi.UnsignedLong, ffi.Pointer)> + fromFunction(bool Function(objc.ObjCObjectBase, DartNSUInteger, ffi.Pointer) fn) => + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.UnsignedLong, ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_bool_objcObjCObject_NSUInteger_bool_closureCallable, + (ffi.Pointer arg0, int arg1, ffi.Pointer arg2) => + fn(objc.ObjCObjectBase(arg0, retain: true, release: true), arg1, arg2)), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, ffi.UnsignedLong, ffi.Pointer)>`. +extension ObjCBlock_bool_objcObjCObject_NSUInteger_bool_CallExtension + on objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> { + bool call(objc.ObjCObjectBase arg0, DartNSUInteger arg1, + ffi.Pointer arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer block, + ffi.Pointer arg0, + NSUInteger arg1, + ffi.Pointer arg2)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>()( + ref.pointer, arg0.ref.pointer, arg1, arg2); +} + +late final _sel_indexOfObjectPassingTest_ = + objc.registerName("indexOfObjectPassingTest:"); +final _objc_msgSend_10mlopr = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_indexOfObjectWithOptions_passingTest_ = + objc.registerName("indexOfObjectWithOptions:passingTest:"); +final _objc_msgSend_1698hqz = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +late final _sel_indexOfObjectAtIndexes_options_passingTest_ = + objc.registerName("indexOfObjectAtIndexes:options:passingTest:"); +final _objc_msgSend_viax9j = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +late final _sel_indexesOfObjectsPassingTest_ = + objc.registerName("indexesOfObjectsPassingTest:"); +late final _sel_indexesOfObjectsWithOptions_passingTest_ = + objc.registerName("indexesOfObjectsWithOptions:passingTest:"); +late final _sel_indexesOfObjectsAtIndexes_options_passingTest_ = + objc.registerName("indexesOfObjectsAtIndexes:options:passingTest:"); +final _objc_msgSend_1bj2f0k = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +late final _sel_sortedArrayUsingComparator_ = + objc.registerName("sortedArrayUsingComparator:"); +late final _sel_sortedArrayWithOptions_usingComparator_ = + objc.registerName("sortedArrayWithOptions:usingComparator:"); +late final _sel_indexOfObject_inSortedRange_options_usingComparator_ = + objc.registerName("indexOfObject:inSortedRange:options:usingComparator:"); +final _objc_msgSend_9efhbf = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + int, + ffi.Pointer)>(); + +/// NSExtendedArray +extension NSExtendedArray on objc.NSArray { + /// arrayByAddingObject: + objc.NSArray arrayByAddingObject_(objc.ObjCObjectBase anObject) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_arrayByAddingObject_, anObject.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// arrayByAddingObjectsFromArray: + objc.NSArray arrayByAddingObjectsFromArray_(objc.NSArray otherArray) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_arrayByAddingObjectsFromArray_, otherArray.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// componentsJoinedByString: + objc.NSString componentsJoinedByString_(objc.NSString separator) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_componentsJoinedByString_, separator.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// containsObject: + bool containsObject_(objc.ObjCObjectBase anObject) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_containsObject_, anObject.ref.pointer); + } + + /// description + objc.NSString get description { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_description); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// descriptionWithLocale: + objc.NSString descriptionWithLocale_(objc.ObjCObjectBase? locale) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_descriptionWithLocale_, locale?.ref.pointer ?? ffi.nullptr); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// descriptionWithLocale:indent: + objc.NSString descriptionWithLocale_indent_( + objc.ObjCObjectBase? locale, DartNSUInteger level) { + final _ret = _objc_msgSend_dcd68g( + this.ref.pointer, + _sel_descriptionWithLocale_indent_, + locale?.ref.pointer ?? ffi.nullptr, + level); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// firstObjectCommonWithArray: + objc.ObjCObjectBase? firstObjectCommonWithArray_(objc.NSArray otherArray) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_firstObjectCommonWithArray_, otherArray.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// getObjects:range: + void getObjects_range_( + ffi.Pointer> objects, NSRange range) { + _objc_msgSend_o16d3k( + this.ref.pointer, _sel_getObjects_range_, objects, range); + } + + /// indexOfObject: + DartNSUInteger indexOfObject_(objc.ObjCObjectBase anObject) { + return _objc_msgSend_1p4b7x4( + this.ref.pointer, _sel_indexOfObject_, anObject.ref.pointer); + } + + /// indexOfObject:inRange: + DartNSUInteger indexOfObject_inRange_( + objc.ObjCObjectBase anObject, NSRange range) { + return _objc_msgSend_1c913oo(this.ref.pointer, _sel_indexOfObject_inRange_, + anObject.ref.pointer, range); + } + + /// indexOfObjectIdenticalTo: + DartNSUInteger indexOfObjectIdenticalTo_(objc.ObjCObjectBase anObject) { + return _objc_msgSend_1p4b7x4( + this.ref.pointer, _sel_indexOfObjectIdenticalTo_, anObject.ref.pointer); + } + + /// indexOfObjectIdenticalTo:inRange: + DartNSUInteger indexOfObjectIdenticalTo_inRange_( + objc.ObjCObjectBase anObject, NSRange range) { + return _objc_msgSend_1c913oo(this.ref.pointer, + _sel_indexOfObjectIdenticalTo_inRange_, anObject.ref.pointer, range); + } + + /// isEqualToArray: + bool isEqualToArray_(objc.NSArray otherArray) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_isEqualToArray_, otherArray.ref.pointer); + } + + /// firstObject + objc.ObjCObjectBase? get firstObject { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_firstObject); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// lastObject + objc.ObjCObjectBase? get lastObject { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_lastObject); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// objectEnumerator + objc.NSEnumerator objectEnumerator() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_objectEnumerator); + return objc.NSEnumerator.castFromPointer(_ret, retain: true, release: true); + } + + /// reverseObjectEnumerator + objc.NSEnumerator reverseObjectEnumerator() { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_reverseObjectEnumerator); + return objc.NSEnumerator.castFromPointer(_ret, retain: true, release: true); + } + + /// sortedArrayHint + objc.NSData get sortedArrayHint { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_sortedArrayHint); + return objc.NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// sortedArrayUsingFunction:context: + objc.NSArray sortedArrayUsingFunction_context_( + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>> + comparator, + ffi.Pointer context) { + final _ret = _objc_msgSend_1iiv4px(this.ref.pointer, + _sel_sortedArrayUsingFunction_context_, comparator, context); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// sortedArrayUsingFunction:context:hint: + objc.NSArray sortedArrayUsingFunction_context_hint_( + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>> + comparator, + ffi.Pointer context, + objc.NSData? hint) { + final _ret = _objc_msgSend_iqbzrn( + this.ref.pointer, + _sel_sortedArrayUsingFunction_context_hint_, + comparator, + context, + hint?.ref.pointer ?? ffi.nullptr); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// sortedArrayUsingSelector: + objc.NSArray sortedArrayUsingSelector_( + ffi.Pointer comparator) { + final _ret = _objc_msgSend_19hbqky( + this.ref.pointer, _sel_sortedArrayUsingSelector_, comparator); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// subarrayWithRange: + objc.NSArray subarrayWithRange_(NSRange range) { + final _ret = + _objc_msgSend_83z673(this.ref.pointer, _sel_subarrayWithRange_, range); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// writeToURL:error: + bool writeToURL_error_( + objc.NSURL url, ffi.Pointer> error) { + return _objc_msgSend_blqzg8( + this.ref.pointer, _sel_writeToURL_error_, url.ref.pointer, error); + } + + /// makeObjectsPerformSelector: + void makeObjectsPerformSelector_(ffi.Pointer aSelector) { + _objc_msgSend_1d9e4oe( + this.ref.pointer, _sel_makeObjectsPerformSelector_, aSelector); + } + + /// makeObjectsPerformSelector:withObject: + void makeObjectsPerformSelector_withObject_( + ffi.Pointer aSelector, objc.ObjCObjectBase? argument) { + _objc_msgSend_1c03bya( + this.ref.pointer, + _sel_makeObjectsPerformSelector_withObject_, + aSelector, + argument?.ref.pointer ?? ffi.nullptr); + } + + /// objectsAtIndexes: + objc.NSArray objectsAtIndexes_(objc.NSIndexSet indexes) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_objectsAtIndexes_, indexes.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// objectAtIndexedSubscript: + objc.ObjCObjectBase objectAtIndexedSubscript_(DartNSUInteger idx) { + final _ret = _objc_msgSend_1qrcblu( + this.ref.pointer, _sel_objectAtIndexedSubscript_, idx); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// enumerateObjectsUsingBlock: + void enumerateObjectsUsingBlock_( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + block) { + _objc_msgSend_f167m6( + this.ref.pointer, _sel_enumerateObjectsUsingBlock_, block.ref.pointer); + } + + /// enumerateObjectsWithOptions:usingBlock: + void enumerateObjectsWithOptions_usingBlock_( + objc.NSEnumerationOptions opts, + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + block) { + _objc_msgSend_yx8yc6( + this.ref.pointer, + _sel_enumerateObjectsWithOptions_usingBlock_, + opts.value, + block.ref.pointer); + } + + /// enumerateObjectsAtIndexes:options:usingBlock: + void enumerateObjectsAtIndexes_options_usingBlock_( + objc.NSIndexSet s, + objc.NSEnumerationOptions opts, + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + block) { + _objc_msgSend_p1bhs( + this.ref.pointer, + _sel_enumerateObjectsAtIndexes_options_usingBlock_, + s.ref.pointer, + opts.value, + block.ref.pointer); + } + + /// indexOfObjectPassingTest: + DartNSUInteger indexOfObjectPassingTest_( + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + predicate) { + return _objc_msgSend_10mlopr(this.ref.pointer, + _sel_indexOfObjectPassingTest_, predicate.ref.pointer); + } + + /// indexOfObjectWithOptions:passingTest: + DartNSUInteger indexOfObjectWithOptions_passingTest_( + objc.NSEnumerationOptions opts, + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + predicate) { + return _objc_msgSend_1698hqz( + this.ref.pointer, + _sel_indexOfObjectWithOptions_passingTest_, + opts.value, + predicate.ref.pointer); + } + + /// indexOfObjectAtIndexes:options:passingTest: + DartNSUInteger indexOfObjectAtIndexes_options_passingTest_( + objc.NSIndexSet s, + objc.NSEnumerationOptions opts, + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + predicate) { + return _objc_msgSend_viax9j( + this.ref.pointer, + _sel_indexOfObjectAtIndexes_options_passingTest_, + s.ref.pointer, + opts.value, + predicate.ref.pointer); + } + + /// indexesOfObjectsPassingTest: + objc.NSIndexSet indexesOfObjectsPassingTest_( + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + predicate) { + final _ret = _objc_msgSend_cy99le(this.ref.pointer, + _sel_indexesOfObjectsPassingTest_, predicate.ref.pointer); + return objc.NSIndexSet.castFromPointer(_ret, retain: true, release: true); + } + + /// indexesOfObjectsWithOptions:passingTest: + objc.NSIndexSet indexesOfObjectsWithOptions_passingTest_( + objc.NSEnumerationOptions opts, + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + predicate) { + final _ret = _objc_msgSend_hd4f96( + this.ref.pointer, + _sel_indexesOfObjectsWithOptions_passingTest_, + opts.value, + predicate.ref.pointer); + return objc.NSIndexSet.castFromPointer(_ret, retain: true, release: true); + } + + /// indexesOfObjectsAtIndexes:options:passingTest: + objc.NSIndexSet indexesOfObjectsAtIndexes_options_passingTest_( + objc.NSIndexSet s, + objc.NSEnumerationOptions opts, + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, ffi.UnsignedLong, + ffi.Pointer)> + predicate) { + final _ret = _objc_msgSend_1bj2f0k( + this.ref.pointer, + _sel_indexesOfObjectsAtIndexes_options_passingTest_, + s.ref.pointer, + opts.value, + predicate.ref.pointer); + return objc.NSIndexSet.castFromPointer(_ret, retain: true, release: true); + } + + /// sortedArrayUsingComparator: + objc.NSArray sortedArrayUsingComparator_(DartNSComparator cmptr) { + final _ret = _objc_msgSend_cy99le( + this.ref.pointer, _sel_sortedArrayUsingComparator_, cmptr.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// sortedArrayWithOptions:usingComparator: + objc.NSArray sortedArrayWithOptions_usingComparator_( + objc.NSSortOptions opts, DartNSComparator cmptr) { + final _ret = _objc_msgSend_1u2b7ut( + this.ref.pointer, + _sel_sortedArrayWithOptions_usingComparator_, + opts.value, + cmptr.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// indexOfObject:inSortedRange:options:usingComparator: + DartNSUInteger indexOfObject_inSortedRange_options_usingComparator_( + objc.ObjCObjectBase obj, + NSRange r, + objc.NSBinarySearchingOptions opts, + DartNSComparator cmp) { + return _objc_msgSend_9efhbf( + this.ref.pointer, + _sel_indexOfObject_inSortedRange_options_usingComparator_, + obj.ref.pointer, + r, + opts.value, + cmp.ref.pointer); + } +} + +late final _sel_array = objc.registerName("array"); +late final _sel_arrayWithObject_ = objc.registerName("arrayWithObject:"); +late final _sel_arrayWithObjects_count_ = + objc.registerName("arrayWithObjects:count:"); +final _objc_msgSend_1lqqdvl = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + int)>(); +late final _sel_arrayWithObjects_ = objc.registerName("arrayWithObjects:"); +late final _sel_arrayWithArray_ = objc.registerName("arrayWithArray:"); +late final _sel_initWithObjects_ = objc.registerName("initWithObjects:"); +late final _sel_initWithArray_ = objc.registerName("initWithArray:"); +late final _sel_initWithArray_copyItems_ = + objc.registerName("initWithArray:copyItems:"); +late final _sel_arrayWithContentsOfURL_error_ = + objc.registerName("arrayWithContentsOfURL:error:"); + +/// NSArrayCreation +extension NSArrayCreation on objc.NSArray { + /// array + static objc.NSArray array() { + final _ret = _objc_msgSend_1x359cv(_class_NSArray, _sel_array); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// arrayWithObject: + static objc.NSArray arrayWithObject_(objc.ObjCObjectBase anObject) { + final _ret = _objc_msgSend_62nh5j( + _class_NSArray, _sel_arrayWithObject_, anObject.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// arrayWithObjects:count: + static objc.NSArray arrayWithObjects_count_( + ffi.Pointer> objects, DartNSUInteger cnt) { + final _ret = _objc_msgSend_1lqqdvl( + _class_NSArray, _sel_arrayWithObjects_count_, objects, cnt); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// arrayWithObjects: + static objc.NSArray arrayWithObjects_(objc.ObjCObjectBase firstObj) { + final _ret = _objc_msgSend_62nh5j( + _class_NSArray, _sel_arrayWithObjects_, firstObj.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// arrayWithArray: + static objc.NSArray arrayWithArray_(objc.NSArray array) { + final _ret = _objc_msgSend_62nh5j( + _class_NSArray, _sel_arrayWithArray_, array.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// initWithObjects: + objc.NSArray initWithObjects_(objc.ObjCObjectBase firstObj) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithObjects_, firstObj.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithArray: + objc.NSArray initWithArray_(objc.NSArray array) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithArray_, array.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithArray:copyItems: + objc.NSArray initWithArray_copyItems_(objc.NSArray array, bool flag) { + final _ret = _objc_msgSend_1bdmr5f(this.ref.retainAndReturnPointer(), + _sel_initWithArray_copyItems_, array.ref.pointer, flag); + return objc.NSArray.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithContentsOfURL:error: + objc.NSArray? initWithContentsOfURL_error_( + objc.NSURL url, ffi.Pointer> error) { + final _ret = _objc_msgSend_1705co6(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfURL_error_, url.ref.pointer, error); + return _ret.address == 0 + ? null + : objc.NSArray.castFromPointer(_ret, retain: false, release: true); + } + + /// arrayWithContentsOfURL:error: + static objc.NSArray? arrayWithContentsOfURL_error_( + objc.NSURL url, ffi.Pointer> error) { + final _ret = _objc_msgSend_1705co6(_class_NSArray, + _sel_arrayWithContentsOfURL_error_, url.ref.pointer, error); + return _ret.address == 0 + ? null + : objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } +} + +bool _ObjCBlock_bool_objcObjCObject_objcObjCObject_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + bool Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer + _ObjCBlock_bool_objcObjCObject_objcObjCObject_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_bool_objcObjCObject_objcObjCObject_fnPtrTrampoline, + false) + .cast(); +bool _ObjCBlock_bool_objcObjCObject_objcObjCObject_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as bool Function(ffi.Pointer, + ffi.Pointer))(arg0, arg1); +ffi.Pointer + _ObjCBlock_bool_objcObjCObject_objcObjCObject_closureCallable = + ffi.Pointer.fromFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_bool_objcObjCObject_objcObjCObject_closureTrampoline, + false) + .cast(); + +/// Construction methods for `objc.ObjCBlock, ffi.Pointer)>`. +abstract final class ObjCBlock_bool_objcObjCObject_objcObjCObject { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Bool Function( + ffi.Pointer, ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.Pointer)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1)>> ptr) => + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer)>( + objc.newPointerBlock( + _ObjCBlock_bool_objcObjCObject_objcObjCObject_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.Pointer)> + fromFunction(bool Function(objc.ObjCObjectBase, objc.ObjCObjectBase) fn) => + objc.ObjCBlock, ffi.Pointer)>( + objc.newClosureBlock( + _ObjCBlock_bool_objcObjCObject_objcObjCObject_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => fn( + objc.ObjCObjectBase(arg0, retain: true, release: true), + objc.ObjCObjectBase(arg1, retain: true, release: true))), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, ffi.Pointer)>`. +extension ObjCBlock_bool_objcObjCObject_objcObjCObject_CallExtension + on objc.ObjCBlock< + ffi.Bool Function( + ffi.Pointer, ffi.Pointer)> { + bool call(objc.ObjCObjectBase arg0, objc.ObjCObjectBase arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer); +} + +late final _sel_differenceFromArray_withOptions_usingEquivalenceTest_ = + objc.registerName("differenceFromArray:withOptions:usingEquivalenceTest:"); +final _objc_msgSend_1jy28v8 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +late final _sel_differenceFromArray_withOptions_ = + objc.registerName("differenceFromArray:withOptions:"); +final _objc_msgSend_4yz83j = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +late final _sel_differenceFromArray_ = + objc.registerName("differenceFromArray:"); +late final _sel_arrayByApplyingDifference_ = + objc.registerName("arrayByApplyingDifference:"); + +/// NSArrayDiffing +extension NSArrayDiffing on objc.NSArray { + /// differenceFromArray:withOptions:usingEquivalenceTest: + objc.NSOrderedCollectionDifference + differenceFromArray_withOptions_usingEquivalenceTest_( + objc.NSArray other, + objc.NSOrderedCollectionDifferenceCalculationOptions options, + objc.ObjCBlock< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer)> + block) { + final _ret = _objc_msgSend_1jy28v8( + this.ref.pointer, + _sel_differenceFromArray_withOptions_usingEquivalenceTest_, + other.ref.pointer, + options.value, + block.ref.pointer); + return objc.NSOrderedCollectionDifference.castFromPointer(_ret, + retain: true, release: true); + } + + /// differenceFromArray:withOptions: + objc.NSOrderedCollectionDifference differenceFromArray_withOptions_( + objc.NSArray other, + objc.NSOrderedCollectionDifferenceCalculationOptions options) { + final _ret = _objc_msgSend_4yz83j( + this.ref.pointer, + _sel_differenceFromArray_withOptions_, + other.ref.pointer, + options.value); + return objc.NSOrderedCollectionDifference.castFromPointer(_ret, + retain: true, release: true); + } + + /// differenceFromArray: + objc.NSOrderedCollectionDifference differenceFromArray_(objc.NSArray other) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_differenceFromArray_, other.ref.pointer); + return objc.NSOrderedCollectionDifference.castFromPointer(_ret, + retain: true, release: true); + } + + /// arrayByApplyingDifference: + objc.NSArray? arrayByApplyingDifference_( + objc.NSOrderedCollectionDifference difference) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_arrayByApplyingDifference_, difference.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _sel_getObjects_ = objc.registerName("getObjects:"); +final _objc_msgSend_1dau4w = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +late final _sel_arrayWithContentsOfFile_ = + objc.registerName("arrayWithContentsOfFile:"); +late final _sel_arrayWithContentsOfURL_ = + objc.registerName("arrayWithContentsOfURL:"); + +/// NSDeprecated +extension NSDeprecated3 on objc.NSArray { + /// getObjects: + void getObjects_(ffi.Pointer> objects) { + _objc_msgSend_1dau4w(this.ref.pointer, _sel_getObjects_, objects); + } + + /// arrayWithContentsOfFile: + static objc.NSArray? arrayWithContentsOfFile_(objc.NSString path) { + final _ret = _objc_msgSend_62nh5j( + _class_NSArray, _sel_arrayWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// arrayWithContentsOfURL: + static objc.NSArray? arrayWithContentsOfURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j( + _class_NSArray, _sel_arrayWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// initWithContentsOfFile: + objc.NSArray? initWithContentsOfFile_(objc.NSString path) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSArray.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithContentsOfURL: + objc.NSArray? initWithContentsOfURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSArray.castFromPointer(_ret, retain: false, release: true); + } + + /// writeToFile:atomically: + bool writeToFile_atomically_(objc.NSString path, bool useAuxiliaryFile) { + return _objc_msgSend_w8pbfh(this.ref.pointer, _sel_writeToFile_atomically_, + path.ref.pointer, useAuxiliaryFile); + } + + /// writeToURL:atomically: + bool writeToURL_atomically_(objc.NSURL url, bool atomically) { + return _objc_msgSend_w8pbfh(this.ref.pointer, _sel_writeToURL_atomically_, + url.ref.pointer, atomically); + } +} + +late final _class_NSMutableArray = objc.getClass("NSMutableArray"); +late final _sel_addObjectsFromArray_ = + objc.registerName("addObjectsFromArray:"); +late final _sel_exchangeObjectAtIndex_withObjectAtIndex_ = + objc.registerName("exchangeObjectAtIndex:withObjectAtIndex:"); +final _objc_msgSend_bfp043 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.UnsignedLong)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int, int)>(); +late final _sel_removeObject_inRange_ = + objc.registerName("removeObject:inRange:"); +final _objc_msgSend_16f6m81 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange)>(); +late final _sel_removeObject_ = objc.registerName("removeObject:"); +late final _sel_removeObjectIdenticalTo_inRange_ = + objc.registerName("removeObjectIdenticalTo:inRange:"); +late final _sel_removeObjectIdenticalTo_ = + objc.registerName("removeObjectIdenticalTo:"); +late final _sel_removeObjectsFromIndices_numIndices_ = + objc.registerName("removeObjectsFromIndices:numIndices:"); +final _objc_msgSend_swohtd = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +late final _sel_removeObjectsInArray_ = + objc.registerName("removeObjectsInArray:"); +late final _sel_removeObjectsInRange_ = + objc.registerName("removeObjectsInRange:"); +final _objc_msgSend_1e3pm0z = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, objc.NSRange)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, objc.NSRange)>(); +late final _sel_replaceObjectsInRange_withObjectsFromArray_range_ = + objc.registerName("replaceObjectsInRange:withObjectsFromArray:range:"); +final _objc_msgSend_169h6dj = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + ffi.Pointer, + objc.NSRange)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + ffi.Pointer, + objc.NSRange)>(); +late final _sel_replaceObjectsInRange_withObjectsFromArray_ = + objc.registerName("replaceObjectsInRange:withObjectsFromArray:"); +final _objc_msgSend_i4ny2p = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + ffi.Pointer)>(); +late final _sel_setArray_ = objc.registerName("setArray:"); +late final _sel_sortUsingFunction_context_ = + objc.registerName("sortUsingFunction:context:"); +final _objc_msgSend_1bvics1 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>, + ffi.Pointer)>(); +late final _sel_sortUsingSelector_ = objc.registerName("sortUsingSelector:"); +late final _sel_insertObjects_atIndexes_ = + objc.registerName("insertObjects:atIndexes:"); +late final _sel_removeObjectsAtIndexes_ = + objc.registerName("removeObjectsAtIndexes:"); +late final _sel_replaceObjectsAtIndexes_withObjects_ = + objc.registerName("replaceObjectsAtIndexes:withObjects:"); +late final _sel_setObject_atIndexedSubscript_ = + objc.registerName("setObject:atIndexedSubscript:"); +final _objc_msgSend_10i1axw = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +late final _sel_sortUsingComparator_ = + objc.registerName("sortUsingComparator:"); +late final _sel_sortWithOptions_usingComparator_ = + objc.registerName("sortWithOptions:usingComparator:"); +final _objc_msgSend_jjgvjt = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); + +/// NSExtendedMutableArray +extension NSExtendedMutableArray on objc.NSMutableArray { + /// addObjectsFromArray: + void addObjectsFromArray_(objc.NSArray otherArray) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_addObjectsFromArray_, otherArray.ref.pointer); + } + + /// exchangeObjectAtIndex:withObjectAtIndex: + void exchangeObjectAtIndex_withObjectAtIndex_( + DartNSUInteger idx1, DartNSUInteger idx2) { + _objc_msgSend_bfp043(this.ref.pointer, + _sel_exchangeObjectAtIndex_withObjectAtIndex_, idx1, idx2); + } + + /// removeAllObjects + void removeAllObjects() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_removeAllObjects); + } + + /// removeObject:inRange: + void removeObject_inRange_(objc.ObjCObjectBase anObject, NSRange range) { + _objc_msgSend_16f6m81(this.ref.pointer, _sel_removeObject_inRange_, + anObject.ref.pointer, range); + } + + /// removeObject: + void removeObject_(objc.ObjCObjectBase anObject) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_removeObject_, anObject.ref.pointer); + } + + /// removeObjectIdenticalTo:inRange: + void removeObjectIdenticalTo_inRange_( + objc.ObjCObjectBase anObject, NSRange range) { + _objc_msgSend_16f6m81(this.ref.pointer, + _sel_removeObjectIdenticalTo_inRange_, anObject.ref.pointer, range); + } + + /// removeObjectIdenticalTo: + void removeObjectIdenticalTo_(objc.ObjCObjectBase anObject) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_removeObjectIdenticalTo_, anObject.ref.pointer); + } + + /// removeObjectsFromIndices:numIndices: + void removeObjectsFromIndices_numIndices_( + ffi.Pointer indices, DartNSUInteger cnt) { + _objc_msgSend_swohtd(this.ref.pointer, + _sel_removeObjectsFromIndices_numIndices_, indices, cnt); + } + + /// removeObjectsInArray: + void removeObjectsInArray_(objc.NSArray otherArray) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_removeObjectsInArray_, otherArray.ref.pointer); + } + + /// removeObjectsInRange: + void removeObjectsInRange_(NSRange range) { + _objc_msgSend_1e3pm0z(this.ref.pointer, _sel_removeObjectsInRange_, range); + } + + /// replaceObjectsInRange:withObjectsFromArray:range: + void replaceObjectsInRange_withObjectsFromArray_range_( + NSRange range, objc.NSArray otherArray, NSRange otherRange) { + _objc_msgSend_169h6dj( + this.ref.pointer, + _sel_replaceObjectsInRange_withObjectsFromArray_range_, + range, + otherArray.ref.pointer, + otherRange); + } + + /// replaceObjectsInRange:withObjectsFromArray: + void replaceObjectsInRange_withObjectsFromArray_( + NSRange range, objc.NSArray otherArray) { + _objc_msgSend_i4ny2p( + this.ref.pointer, + _sel_replaceObjectsInRange_withObjectsFromArray_, + range, + otherArray.ref.pointer); + } + + /// setArray: + void setArray_(objc.NSArray otherArray) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setArray_, otherArray.ref.pointer); + } + + /// sortUsingFunction:context: + void sortUsingFunction_context_( + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>> + compare, + ffi.Pointer context) { + _objc_msgSend_1bvics1( + this.ref.pointer, _sel_sortUsingFunction_context_, compare, context); + } + + /// sortUsingSelector: + void sortUsingSelector_(ffi.Pointer comparator) { + _objc_msgSend_1d9e4oe( + this.ref.pointer, _sel_sortUsingSelector_, comparator); + } + + /// insertObjects:atIndexes: + void insertObjects_atIndexes_(objc.NSArray objects, objc.NSIndexSet indexes) { + _objc_msgSend_wjvic9(this.ref.pointer, _sel_insertObjects_atIndexes_, + objects.ref.pointer, indexes.ref.pointer); + } + + /// removeObjectsAtIndexes: + void removeObjectsAtIndexes_(objc.NSIndexSet indexes) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_removeObjectsAtIndexes_, indexes.ref.pointer); + } + + /// replaceObjectsAtIndexes:withObjects: + void replaceObjectsAtIndexes_withObjects_( + objc.NSIndexSet indexes, objc.NSArray objects) { + _objc_msgSend_wjvic9( + this.ref.pointer, + _sel_replaceObjectsAtIndexes_withObjects_, + indexes.ref.pointer, + objects.ref.pointer); + } + + /// setObject:atIndexedSubscript: + void setObject_atIndexedSubscript_( + objc.ObjCObjectBase obj, DartNSUInteger idx) { + _objc_msgSend_10i1axw(this.ref.pointer, _sel_setObject_atIndexedSubscript_, + obj.ref.pointer, idx); + } + + /// sortUsingComparator: + void sortUsingComparator_(DartNSComparator cmptr) { + _objc_msgSend_f167m6( + this.ref.pointer, _sel_sortUsingComparator_, cmptr.ref.pointer); + } + + /// sortWithOptions:usingComparator: + void sortWithOptions_usingComparator_( + objc.NSSortOptions opts, DartNSComparator cmptr) { + _objc_msgSend_jjgvjt(this.ref.pointer, + _sel_sortWithOptions_usingComparator_, opts.value, cmptr.ref.pointer); + } +} + +late final _sel_arrayWithCapacity_ = objc.registerName("arrayWithCapacity:"); + +/// NSMutableArrayCreation +extension NSMutableArrayCreation on objc.NSMutableArray { + /// arrayWithCapacity: + static objc.NSMutableArray arrayWithCapacity_(DartNSUInteger numItems) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSMutableArray, _sel_arrayWithCapacity_, numItems); + return objc.NSMutableArray.castFromPointer(_ret, + retain: true, release: true); + } + + /// arrayWithContentsOfFile: + static objc.NSMutableArray? arrayWithContentsOfFile_(objc.NSString path) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableArray, _sel_arrayWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSMutableArray.castFromPointer(_ret, + retain: true, release: true); + } + + /// arrayWithContentsOfURL: + static objc.NSMutableArray? arrayWithContentsOfURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j( + _class_NSMutableArray, _sel_arrayWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSMutableArray.castFromPointer(_ret, + retain: true, release: true); + } + + /// initWithContentsOfFile: + objc.NSMutableArray? initWithContentsOfFile_(objc.NSString path) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSMutableArray.castFromPointer(_ret, + retain: false, release: true); + } + + /// initWithContentsOfURL: + objc.NSMutableArray? initWithContentsOfURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSMutableArray.castFromPointer(_ret, + retain: false, release: true); + } +} + +late final _sel_applyDifference_ = objc.registerName("applyDifference:"); + +/// NSMutableArrayDiffing +extension NSMutableArrayDiffing on objc.NSMutableArray { + /// applyDifference: + void applyDifference_(objc.NSOrderedCollectionDifference difference) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_applyDifference_, difference.ref.pointer); + } +} + +void _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + ffi.Pointer))(arg0, arg1); +ffi.Pointer + _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerCallable = ffi + .NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock?, objc.NSError)>`. +abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock?, objc.NSError)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, + objc.NSError)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock?, objc.NSError)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock?, objc.NSError)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_objcObjCObject_NSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock?, objc.NSError)> fromFunction( + void Function(objc.ObjCObjectBase?, objc.NSError) fn) => + objc.ObjCBlock?, objc.NSError)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => fn( + arg0.address == 0 + ? null + : objc.ObjCObjectBase(arg0, retain: true, release: true), + objc.NSError.castFromPointer(arg1, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc + .ObjCBlock?, objc.NSError)> + listener(void Function(objc.ObjCObjectBase?, objc.NSError) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_objcObjCObject_NSError_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1) => + fn( + arg0.address == 0 + ? null + : objc.ObjCObjectBase(arg0, retain: false, release: true), + objc.NSError.castFromPointer(arg1, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_wjvic9(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, + objc.NSError)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock?, objc.NSError)>`. +extension ObjCBlock_ffiVoid_objcObjCObject_NSError_CallExtension on objc + .ObjCBlock?, objc.NSError)> { + void call(objc.ObjCObjectBase? arg0, objc.NSError arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1.ref.pointer); +} + +typedef NSItemProviderCompletionHandler = ffi.Pointer; +typedef DartNSItemProviderCompletionHandler = objc + .ObjCBlock?, objc.NSError)>; +void + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_fnPtrTrampoline( + ffi.Pointer block, + NSItemProviderCompletionHandler arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + NSItemProviderCompletionHandler arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + NSItemProviderCompletionHandler, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + NSItemProviderCompletionHandler, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_closureTrampoline( + ffi.Pointer block, + NSItemProviderCompletionHandler arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as void Function( + NSItemProviderCompletionHandler, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + NSItemProviderCompletionHandler, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_listenerTrampoline( + ffi.Pointer block, + NSItemProviderCompletionHandler arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) { + (objc.getBlockClosure(block) as void Function( + NSItemProviderCompletionHandler, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + NSItemProviderCompletionHandler, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + NSItemProviderCompletionHandler, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock?, objc.NSError)>, ffi.Pointer, objc.NSDictionary)>`. +abstract final class ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, objc.NSError)>, + ffi.Pointer, + objc.NSDictionary)> + castFromPointer(ffi.Pointer pointer, {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + objc.ObjCBlock?, objc.NSError)>, + ffi.Pointer, + objc.NSDictionary)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, objc.NSError)>, + ffi.Pointer, + objc.NSDictionary)> + fromFunctionPointer(ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => + objc.ObjCBlock< + ffi.Void Function( + objc.ObjCBlock?, objc.NSError)>, + ffi.Pointer, + objc.NSDictionary)>(objc.newPointerBlock(_ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_fnPtrCallable, ptr.cast()), retain: false, release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock?, objc.NSError)>, ffi.Pointer, objc.NSDictionary)> + fromFunction(void Function(DartNSItemProviderCompletionHandler, objc.ObjCObjectBase, objc.NSDictionary) fn) => + objc.ObjCBlock?, objc.NSError)>, ffi.Pointer, objc.NSDictionary)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_closureCallable, + (NSItemProviderCompletionHandler arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + ObjCBlock_ffiVoid_objcObjCObject_NSError.castFromPointer(arg0, retain: true, release: true), + objc.ObjCObjectBase(arg1, retain: true, release: true), + objc.NSDictionary.castFromPointer(arg2, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, objc.NSError)>, + ffi.Pointer, + objc.NSDictionary)> listener( + void Function(DartNSItemProviderCompletionHandler, objc.ObjCObjectBase, + objc.NSDictionary) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_listenerCallable + .nativeFunction + .cast(), + (NSItemProviderCompletionHandler arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + fn( + ObjCBlock_ffiVoid_objcObjCObject_NSError.castFromPointer(arg0, + retain: false, release: true), + objc.ObjCObjectBase(arg1, retain: false, release: true), + objc.NSDictionary.castFromPointer(arg2, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_1j2nt86(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, objc.NSError)>, + ffi.Pointer, + objc.NSDictionary)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock?, objc.NSError)>, ffi.Pointer, objc.NSDictionary)>`. +extension ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, objc.NSError)>, + ffi.Pointer, + objc.NSDictionary)> { + void call(DartNSItemProviderCompletionHandler arg0, objc.ObjCObjectBase arg1, + objc.NSDictionary arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + NSItemProviderCompletionHandler arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + void Function( + ffi.Pointer, + NSItemProviderCompletionHandler, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, arg0.ref.pointer, arg1.ref.pointer, arg2.ref.pointer); +} + +typedef NSItemProviderLoadHandler = ffi.Pointer; +typedef DartNSItemProviderLoadHandler = objc.ObjCBlock< + ffi.Void Function( + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer?, objc.NSError)>, + ffi.Pointer, + objc.NSDictionary)>; +late final _class_NSItemProvider = objc.getClass("NSItemProvider"); +late final _sel_previewImageHandler = objc.registerName("previewImageHandler"); +final _objc_msgSend_uwvaik = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_setPreviewImageHandler_ = + objc.registerName("setPreviewImageHandler:"); +late final _sel_loadPreviewImageWithOptions_completionHandler_ = + objc.registerName("loadPreviewImageWithOptions:completionHandler:"); + +/// NSPreviewSupport +extension NSPreviewSupport on objc.NSItemProvider { + /// previewImageHandler + DartNSItemProviderLoadHandler? get previewImageHandler { + final _ret = + _objc_msgSend_uwvaik(this.ref.pointer, _sel_previewImageHandler); + return _ret.address == 0 + ? null + : ObjCBlock_ffiVoid_NSItemProviderCompletionHandler_objcObjCObject_NSDictionary + .castFromPointer(_ret, retain: true, release: true); + } + + /// setPreviewImageHandler: + set previewImageHandler(DartNSItemProviderLoadHandler? value) { + return _objc_msgSend_f167m6(this.ref.pointer, _sel_setPreviewImageHandler_, + value?.ref.pointer ?? ffi.nullptr); + } + + /// loadPreviewImageWithOptions:completionHandler: + void loadPreviewImageWithOptions_completionHandler_(objc.NSDictionary options, + DartNSItemProviderCompletionHandler completionHandler) { + _objc_msgSend_14pxqbs( + this.ref.pointer, + _sel_loadPreviewImageWithOptions_completionHandler_, + options.ref.pointer, + completionHandler.ref.pointer); + } +} + +typedef NSStringEncoding = NSUInteger; +late final _class_NSString = objc.getClass("NSString"); +late final _sel_substringFromIndex_ = objc.registerName("substringFromIndex:"); +late final _sel_substringToIndex_ = objc.registerName("substringToIndex:"); +late final _sel_substringWithRange_ = objc.registerName("substringWithRange:"); +late final _sel_getCharacters_range_ = + objc.registerName("getCharacters:range:"); +final _objc_msgSend_898fog = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange)>(); +late final _sel_compare_options_ = objc.registerName("compare:options:"); +final _objc_msgSend_16ydezh = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +late final _sel_compare_options_range_ = + objc.registerName("compare:options:range:"); +final _objc_msgSend_eeuxub = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + objc.NSRange)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + objc.NSRange)>(); +late final _sel_compare_options_range_locale_ = + objc.registerName("compare:options:range:locale:"); +final _objc_msgSend_i4hdht = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + objc.NSRange, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + objc.NSRange, + ffi.Pointer)>(); +late final _sel_caseInsensitiveCompare_ = + objc.registerName("caseInsensitiveCompare:"); +late final _sel_localizedCompare_ = objc.registerName("localizedCompare:"); +late final _sel_localizedCaseInsensitiveCompare_ = + objc.registerName("localizedCaseInsensitiveCompare:"); +late final _sel_localizedStandardCompare_ = + objc.registerName("localizedStandardCompare:"); +late final _sel_isEqualToString_ = objc.registerName("isEqualToString:"); +late final _sel_hasPrefix_ = objc.registerName("hasPrefix:"); +late final _sel_hasSuffix_ = objc.registerName("hasSuffix:"); +late final _sel_commonPrefixWithString_options_ = + objc.registerName("commonPrefixWithString:options:"); +final _objc_msgSend_fcs5vo = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +late final _sel_containsString_ = objc.registerName("containsString:"); +late final _sel_localizedCaseInsensitiveContainsString_ = + objc.registerName("localizedCaseInsensitiveContainsString:"); +late final _sel_localizedStandardContainsString_ = + objc.registerName("localizedStandardContainsString:"); +late final _sel_localizedStandardRangeOfString_ = + objc.registerName("localizedStandardRangeOfString:"); +final _objc_msgSend_x4muu7 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + objc.NSRange Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + objc.NSRange Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +final _objc_msgSend_x4muu7Stret = objc.msgSendStretPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_rangeOfString_ = objc.registerName("rangeOfString:"); +late final _sel_rangeOfString_options_ = + objc.registerName("rangeOfString:options:"); +final _objc_msgSend_1kwndnw = objc.msgSendPointer + .cast< + ffi.NativeFunction< + objc.NSRange Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger)>>() + .asFunction< + objc.NSRange Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +final _objc_msgSend_1kwndnwStret = objc.msgSendStretPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +late final _sel_rangeOfString_options_range_ = + objc.registerName("rangeOfString:options:range:"); +final _objc_msgSend_ackzik = objc.msgSendPointer + .cast< + ffi.NativeFunction< + objc.NSRange Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + objc.NSRange)>>() + .asFunction< + objc.NSRange Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + objc.NSRange)>(); +final _objc_msgSend_ackzikStret = objc.msgSendStretPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + objc.NSRange)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + objc.NSRange)>(); +late final _sel_rangeOfString_options_range_locale_ = + objc.registerName("rangeOfString:options:range:locale:"); +final _objc_msgSend_198mga8 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + objc.NSRange Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + objc.NSRange, + ffi.Pointer)>>() + .asFunction< + objc.NSRange Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + objc.NSRange, + ffi.Pointer)>(); +final _objc_msgSend_198mga8Stret = objc.msgSendStretPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + objc.NSRange, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + objc.NSRange, + ffi.Pointer)>(); +late final _sel_rangeOfCharacterFromSet_ = + objc.registerName("rangeOfCharacterFromSet:"); +late final _sel_rangeOfCharacterFromSet_options_ = + objc.registerName("rangeOfCharacterFromSet:options:"); +late final _sel_rangeOfCharacterFromSet_options_range_ = + objc.registerName("rangeOfCharacterFromSet:options:range:"); +late final _sel_rangeOfComposedCharacterSequenceAtIndex_ = + objc.registerName("rangeOfComposedCharacterSequenceAtIndex:"); +final _objc_msgSend_d3i1uy = objc.msgSendPointer + .cast< + ffi.NativeFunction< + objc.NSRange Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() + .asFunction< + objc.NSRange Function(ffi.Pointer, + ffi.Pointer, int)>(); +final _objc_msgSend_d3i1uyStret = objc.msgSendStretPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_rangeOfComposedCharacterSequencesForRange_ = + objc.registerName("rangeOfComposedCharacterSequencesForRange:"); +final _objc_msgSend_uimyc7 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + objc.NSRange Function(ffi.Pointer, + ffi.Pointer, objc.NSRange)>>() + .asFunction< + objc.NSRange Function(ffi.Pointer, + ffi.Pointer, objc.NSRange)>(); +final _objc_msgSend_uimyc7Stret = objc.msgSendStretPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange)>>() + .asFunction< + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, objc.NSRange)>(); +late final _sel_stringByAppendingString_ = + objc.registerName("stringByAppendingString:"); +late final _sel_stringByAppendingFormat_ = + objc.registerName("stringByAppendingFormat:"); +late final _sel_doubleValue = objc.registerName("doubleValue"); +late final _sel_floatValue = objc.registerName("floatValue"); +late final _sel_intValue = objc.registerName("intValue"); +final _objc_msgSend_13yqbb6 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_integerValue = objc.registerName("integerValue"); +late final _sel_longLongValue = objc.registerName("longLongValue"); +late final _sel_boolValue = objc.registerName("boolValue"); +late final _sel_uppercaseString = objc.registerName("uppercaseString"); +late final _sel_lowercaseString = objc.registerName("lowercaseString"); +late final _sel_capitalizedString = objc.registerName("capitalizedString"); +late final _sel_localizedUppercaseString = + objc.registerName("localizedUppercaseString"); +late final _sel_localizedLowercaseString = + objc.registerName("localizedLowercaseString"); +late final _sel_localizedCapitalizedString = + objc.registerName("localizedCapitalizedString"); +late final _sel_uppercaseStringWithLocale_ = + objc.registerName("uppercaseStringWithLocale:"); +late final _sel_lowercaseStringWithLocale_ = + objc.registerName("lowercaseStringWithLocale:"); +late final _sel_capitalizedStringWithLocale_ = + objc.registerName("capitalizedStringWithLocale:"); +late final _sel_getLineStart_end_contentsEnd_forRange_ = + objc.registerName("getLineStart:end:contentsEnd:forRange:"); +final _objc_msgSend_ourvf2 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + objc.NSRange)>(); +late final _sel_lineRangeForRange_ = objc.registerName("lineRangeForRange:"); +late final _sel_getParagraphStart_end_contentsEnd_forRange_ = + objc.registerName("getParagraphStart:end:contentsEnd:forRange:"); +late final _sel_paragraphRangeForRange_ = + objc.registerName("paragraphRangeForRange:"); +void _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + NSRange arg1, + NSRange arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + NSRange arg1, NSRange arg2, ffi.Pointer arg3)>>() + .asFunction< + void Function(ffi.Pointer, NSRange, NSRange, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSRange, + NSRange, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + NSRange arg1, + NSRange arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + NSRange, NSRange, ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSRange, + NSRange, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + NSRange arg1, + NSRange arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + NSRange, NSRange, ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSRange, + NSRange, + ffi.Pointer)> + _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_listenerCallable = ffi + .NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + NSRange, + NSRange, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + objc.NSString?, objc.NSRange, objc.NSRange, ffi.Pointer)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(objc.NSString?, objc.NSRange, objc.NSRange, + ffi.Pointer)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunctionPointer(ffi.Pointer arg0, NSRange arg1, NSRange arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(objc.NSString?, objc.NSRange, objc.NSRange, + ffi.Pointer)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> fromFunction( + void Function(objc.NSString?, NSRange, NSRange, ffi.Pointer) + fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_closureCallable, + (ffi.Pointer arg0, NSRange arg1, NSRange arg2, + ffi.Pointer arg3) => + fn(arg0.address == 0 ? null : objc.NSString.castFromPointer(arg0, retain: true, release: true), arg1, arg2, arg3)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(objc.NSString?, objc.NSRange, objc.NSRange, + ffi.Pointer)> listener( + void Function(objc.NSString?, NSRange, NSRange, ffi.Pointer) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, NSRange arg1, NSRange arg2, + ffi.Pointer arg3) => + fn( + arg0.address == 0 + ? null + : objc.NSString.castFromPointer(arg0, + retain: false, release: true), + arg1, + arg2, + arg3)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_8wbg7l(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(objc.NSString?, objc.NSRange, objc.NSRange, + ffi.Pointer)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_NSString_NSRange_NSRange_bool_CallExtension + on objc.ObjCBlock< + ffi.Void Function(objc.NSString?, objc.NSRange, objc.NSRange, + ffi.Pointer)> { + void call(objc.NSString? arg0, NSRange arg1, NSRange arg2, + ffi.Pointer arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + NSRange arg1, + NSRange arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + NSRange, + NSRange, + ffi.Pointer)>()( + ref.pointer, arg0?.ref.pointer ?? ffi.nullptr, arg1, arg2, arg3); +} + +late final _sel_enumerateSubstringsInRange_options_usingBlock_ = + objc.registerName("enumerateSubstringsInRange:options:usingBlock:"); +final _objc_msgSend_14ew8zr = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + int, + ffi.Pointer)>(); +void _ObjCBlock_ffiVoid_NSString_bool_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_NSString_bool_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSString_bool_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSString_bool_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_NSString_bool_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSString_bool_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSString_bool_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_NSString_bool_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSString_bool_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_NSString_bool { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(objc.NSString, ffi.Pointer)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_ffiVoid_NSString_bool_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunction(void Function(objc.NSString, ffi.Pointer) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSString_bool_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => fn( + objc.NSString.castFromPointer(arg0, + retain: true, release: true), + arg1)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock)> + listener(void Function(objc.NSString, ffi.Pointer) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSString_bool_listenerCallable.nativeFunction.cast(), + (ffi.Pointer arg0, ffi.Pointer arg1) => fn( + objc.NSString.castFromPointer(arg0, retain: false, release: true), + arg1)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_148br51(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(objc.NSString, ffi.Pointer)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_NSString_bool_CallExtension + on objc.ObjCBlock)> { + void call(objc.NSString arg0, ffi.Pointer arg1) => ref + .pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0.ref.pointer, arg1); +} + +late final _sel_enumerateLinesUsingBlock_ = + objc.registerName("enumerateLinesUsingBlock:"); +late final _sel_UTF8String = objc.registerName("UTF8String"); +final _objc_msgSend_1fuqfwb = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_fastestEncoding = objc.registerName("fastestEncoding"); +late final _sel_smallestEncoding = objc.registerName("smallestEncoding"); +late final _sel_dataUsingEncoding_allowLossyConversion_ = + objc.registerName("dataUsingEncoding:allowLossyConversion:"); +final _objc_msgSend_rubz6a = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong, ffi.Bool)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int, bool)>(); +late final _sel_dataUsingEncoding_ = objc.registerName("dataUsingEncoding:"); +late final _sel_canBeConvertedToEncoding_ = + objc.registerName("canBeConvertedToEncoding:"); +final _objc_msgSend_6peh6o = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() + .asFunction< + bool Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_cStringUsingEncoding_ = + objc.registerName("cStringUsingEncoding:"); +final _objc_msgSend_1jtxufi = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_getCString_maxLength_encoding_ = + objc.registerName("getCString:maxLength:encoding:"); +final _objc_msgSend_1lv8yz3 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.UnsignedLong)>>() + .asFunction< + bool Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int, int)>(); +late final _sel_getBytes_maxLength_usedLength_encoding_options_range_remainingRange_ = + objc.registerName( + "getBytes:maxLength:usedLength:encoding:options:range:remainingRange:"); +final _objc_msgSend_i30zh3 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.Pointer, + ffi.UnsignedLong, + NSUInteger, + objc.NSRange, + ffi.Pointer)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer, + int, + int, + objc.NSRange, + ffi.Pointer)>(); +late final _sel_maximumLengthOfBytesUsingEncoding_ = + objc.registerName("maximumLengthOfBytesUsingEncoding:"); +final _objc_msgSend_12py2ux = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer, ffi.UnsignedLong)>>() + .asFunction< + int Function(ffi.Pointer, + ffi.Pointer, int)>(); +late final _sel_lengthOfBytesUsingEncoding_ = + objc.registerName("lengthOfBytesUsingEncoding:"); +late final _sel_availableStringEncodings = + objc.registerName("availableStringEncodings"); +final _objc_msgSend_1h2q612 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); +late final _sel_localizedNameOfStringEncoding_ = + objc.registerName("localizedNameOfStringEncoding:"); +late final _sel_defaultCStringEncoding = + objc.registerName("defaultCStringEncoding"); +late final _sel_decomposedStringWithCanonicalMapping = + objc.registerName("decomposedStringWithCanonicalMapping"); +late final _sel_precomposedStringWithCanonicalMapping = + objc.registerName("precomposedStringWithCanonicalMapping"); +late final _sel_decomposedStringWithCompatibilityMapping = + objc.registerName("decomposedStringWithCompatibilityMapping"); +late final _sel_precomposedStringWithCompatibilityMapping = + objc.registerName("precomposedStringWithCompatibilityMapping"); +late final _sel_componentsSeparatedByString_ = + objc.registerName("componentsSeparatedByString:"); +late final _sel_componentsSeparatedByCharactersInSet_ = + objc.registerName("componentsSeparatedByCharactersInSet:"); +late final _sel_stringByTrimmingCharactersInSet_ = + objc.registerName("stringByTrimmingCharactersInSet:"); +late final _sel_stringByPaddingToLength_withString_startingAtIndex_ = + objc.registerName("stringByPaddingToLength:withString:startingAtIndex:"); +final _objc_msgSend_exgdqb = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer, + int)>(); +late final _sel_stringByFoldingWithOptions_locale_ = + objc.registerName("stringByFoldingWithOptions:locale:"); +final _objc_msgSend_146986e = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + NSUInteger, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +late final _sel_stringByReplacingOccurrencesOfString_withString_options_range_ = + objc.registerName( + "stringByReplacingOccurrencesOfString:withString:options:range:"); +final _objc_msgSend_1wrs2o6 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + objc.NSRange)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + objc.NSRange)>(); +late final _sel_stringByReplacingOccurrencesOfString_withString_ = + objc.registerName("stringByReplacingOccurrencesOfString:withString:"); +late final _sel_stringByReplacingCharactersInRange_withString_ = + objc.registerName("stringByReplacingCharactersInRange:withString:"); +final _objc_msgSend_197wcu5 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + objc.NSRange, + ffi.Pointer)>(); +typedef NSStringTransform = ffi.Pointer; +typedef DartNSStringTransform = objc.NSString; +late final _sel_stringByApplyingTransform_reverse_ = + objc.registerName("stringByApplyingTransform:reverse:"); +late final _sel_writeToURL_atomically_encoding_error_ = + objc.registerName("writeToURL:atomically:encoding:error:"); +final _objc_msgSend_1140663 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Bool, + ffi.UnsignedLong, + ffi.Pointer>)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + bool, + int, + ffi.Pointer>)>(); +late final _sel_writeToFile_atomically_encoding_error_ = + objc.registerName("writeToFile:atomically:encoding:error:"); +late final _sel_hash = objc.registerName("hash"); +late final _sel_initWithCharactersNoCopy_length_freeWhenDone_ = + objc.registerName("initWithCharactersNoCopy:length:freeWhenDone:"); +final _objc_msgSend_zsd8q9 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.Bool)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + bool)>(); +void _ObjCBlock_ffiVoid_unichar_NSUInteger_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, NSUInteger arg1)>>() + .asFunction, int)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_unichar_NSUInteger_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>( + _ObjCBlock_ffiVoid_unichar_NSUInteger_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_unichar_NSUInteger_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1) => + (objc.getBlockClosure(block) as void Function(ffi.Pointer, int))( + arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_unichar_NSUInteger_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>( + _ObjCBlock_ffiVoid_unichar_NSUInteger_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_unichar_NSUInteger_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1) { + (objc.getBlockClosure(block) as void Function(ffi.Pointer, int))( + arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer, NSUInteger)> + _ObjCBlock_ffiVoid_unichar_NSUInteger_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>.listener( + _ObjCBlock_ffiVoid_unichar_NSUInteger_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, ffi.UnsignedLong)>`. +abstract final class ObjCBlock_ffiVoid_unichar_NSUInteger { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock, ffi.UnsignedLong)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.UnsignedLong)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong)> fromFunctionPointer( + ffi.Pointer arg0, NSUInteger arg1)>> + ptr) => + objc.ObjCBlock, ffi.UnsignedLong)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_unichar_NSUInteger_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong)> fromFunction( + void Function(ffi.Pointer, DartNSUInteger) fn) => + objc.ObjCBlock, ffi.UnsignedLong)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_unichar_NSUInteger_closureCallable, + (ffi.Pointer arg0, int arg1) => fn(arg0, arg1)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc + .ObjCBlock, ffi.UnsignedLong)> + listener(void Function(ffi.Pointer, DartNSUInteger) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_unichar_NSUInteger_listenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0, int arg1) => fn(arg0, arg1)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_vhbh5h(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, ffi.UnsignedLong)>`. +extension ObjCBlock_ffiVoid_unichar_NSUInteger_CallExtension on objc + .ObjCBlock, ffi.UnsignedLong)> { + void call(ffi.Pointer arg0, DartNSUInteger arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0, NSUInteger arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>()(ref.pointer, arg0, arg1); +} + +late final _sel_initWithCharactersNoCopy_length_deallocator_ = + objc.registerName("initWithCharactersNoCopy:length:deallocator:"); +final _objc_msgSend_1pr13r6 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer)>(); +late final _sel_initWithCharacters_length_ = + objc.registerName("initWithCharacters:length:"); +final _objc_msgSend_13z9dkp = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); +late final _sel_initWithUTF8String_ = objc.registerName("initWithUTF8String:"); +final _objc_msgSend_rqwdif = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_initWithFormat_ = objc.registerName("initWithFormat:"); +late final _sel_initWithFormat_locale_ = + objc.registerName("initWithFormat:locale:"); +late final _sel_initWithValidatedFormat_validFormatSpecifiers_error_ = + objc.registerName("initWithValidatedFormat:validFormatSpecifiers:error:"); +final _objc_msgSend_bo6ep4 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +late final _sel_initWithValidatedFormat_validFormatSpecifiers_locale_error_ = + objc.registerName( + "initWithValidatedFormat:validFormatSpecifiers:locale:error:"); +final _objc_msgSend_2izev6 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +late final _sel_initWithData_encoding_ = + objc.registerName("initWithData:encoding:"); +late final _sel_initWithBytes_length_encoding_ = + objc.registerName("initWithBytes:length:encoding:"); +final _objc_msgSend_i38ton = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int, int)>(); +late final _sel_initWithBytesNoCopy_length_encoding_freeWhenDone_ = + objc.registerName("initWithBytesNoCopy:length:encoding:freeWhenDone:"); +final _objc_msgSend_o2ktnn = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.UnsignedLong, + ffi.Bool)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + bool)>(); +void _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, NSUInteger arg1)>>() + .asFunction, int)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>( + _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1) => + (objc.getBlockClosure(block) as void Function(ffi.Pointer, int))( + arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>( + _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + int arg1) { + (objc.getBlockClosure(block) as void Function(ffi.Pointer, int))( + arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer, NSUInteger)> + _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, NSUInteger)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock, ffi.UnsignedLong)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid_NSUInteger { + /// Returns a block that wraps the given raw block pointer. + static objc + .ObjCBlock, ffi.UnsignedLong)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, + ffi.UnsignedLong)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong)> fromFunctionPointer( + ffi.Pointer arg0, NSUInteger arg1)>> + ptr) => + objc.ObjCBlock, ffi.UnsignedLong)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc + .ObjCBlock, ffi.UnsignedLong)> + fromFunction(void Function(ffi.Pointer, DartNSUInteger) fn) => + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong)>( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_closureCallable, + (ffi.Pointer arg0, int arg1) => fn(arg0, arg1)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc + .ObjCBlock, ffi.UnsignedLong)> + listener(void Function(ffi.Pointer, DartNSUInteger) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_NSUInteger_listenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0, int arg1) => fn(arg0, arg1)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_zuf90e(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock, ffi.UnsignedLong)>`. +extension ObjCBlock_ffiVoid_ffiVoid_NSUInteger_CallExtension on objc + .ObjCBlock, ffi.UnsignedLong)> { + void call(ffi.Pointer arg0, DartNSUInteger arg1) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0, NSUInteger arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, int)>()(ref.pointer, arg0, arg1); +} + +late final _sel_initWithBytesNoCopy_length_encoding_deallocator_ = + objc.registerName("initWithBytesNoCopy:length:encoding:deallocator:"); +final _objc_msgSend_1nnfqvg = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.UnsignedLong, + ffi.Pointer)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + ffi.Pointer)>(); +late final _sel_stringWithString_ = objc.registerName("stringWithString:"); +late final _sel_stringWithCharacters_length_ = + objc.registerName("stringWithCharacters:length:"); +late final _sel_stringWithUTF8String_ = + objc.registerName("stringWithUTF8String:"); +late final _sel_stringWithFormat_ = objc.registerName("stringWithFormat:"); +late final _sel_localizedStringWithFormat_ = + objc.registerName("localizedStringWithFormat:"); +late final _sel_stringWithValidatedFormat_validFormatSpecifiers_error_ = + objc.registerName("stringWithValidatedFormat:validFormatSpecifiers:error:"); +late final _sel_localizedStringWithValidatedFormat_validFormatSpecifiers_error_ = + objc.registerName( + "localizedStringWithValidatedFormat:validFormatSpecifiers:error:"); +late final _sel_initWithCString_encoding_ = + objc.registerName("initWithCString:encoding:"); +final _objc_msgSend_a15xhc = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int)>(); +late final _sel_stringWithCString_encoding_ = + objc.registerName("stringWithCString:encoding:"); +late final _sel_initWithContentsOfURL_encoding_error_ = + objc.registerName("initWithContentsOfURL:encoding:error:"); +final _objc_msgSend_94cet5 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.Pointer>)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer>)>(); +late final _sel_initWithContentsOfFile_encoding_error_ = + objc.registerName("initWithContentsOfFile:encoding:error:"); +late final _sel_stringWithContentsOfURL_encoding_error_ = + objc.registerName("stringWithContentsOfURL:encoding:error:"); +late final _sel_stringWithContentsOfFile_encoding_error_ = + objc.registerName("stringWithContentsOfFile:encoding:error:"); +late final _sel_initWithContentsOfURL_usedEncoding_error_ = + objc.registerName("initWithContentsOfURL:usedEncoding:error:"); +final _objc_msgSend_1gxo8gv = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); +late final _sel_initWithContentsOfFile_usedEncoding_error_ = + objc.registerName("initWithContentsOfFile:usedEncoding:error:"); +late final _sel_stringWithContentsOfURL_usedEncoding_error_ = + objc.registerName("stringWithContentsOfURL:usedEncoding:error:"); +late final _sel_stringWithContentsOfFile_usedEncoding_error_ = + objc.registerName("stringWithContentsOfFile:usedEncoding:error:"); + +/// NSStringExtensionMethods +extension NSStringExtensionMethods on objc.NSString { + /// substringFromIndex: + objc.NSString substringFromIndex_(DartNSUInteger from) { + final _ret = + _objc_msgSend_1qrcblu(this.ref.pointer, _sel_substringFromIndex_, from); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// substringToIndex: + objc.NSString substringToIndex_(DartNSUInteger to) { + final _ret = + _objc_msgSend_1qrcblu(this.ref.pointer, _sel_substringToIndex_, to); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// substringWithRange: + objc.NSString substringWithRange_(NSRange range) { + final _ret = + _objc_msgSend_83z673(this.ref.pointer, _sel_substringWithRange_, range); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// getCharacters:range: + void getCharacters_range_(ffi.Pointer buffer, NSRange range) { + _objc_msgSend_898fog( + this.ref.pointer, _sel_getCharacters_range_, buffer, range); + } + + /// compare: + objc.NSComparisonResult compare_(objc.NSString string) { + final _ret = _objc_msgSend_1wpduvy( + this.ref.pointer, _sel_compare_, string.ref.pointer); + return objc.NSComparisonResult.fromValue(_ret); + } + + /// compare:options: + objc.NSComparisonResult compare_options_( + objc.NSString string, objc.NSStringCompareOptions mask) { + final _ret = _objc_msgSend_16ydezh(this.ref.pointer, _sel_compare_options_, + string.ref.pointer, mask.value); + return objc.NSComparisonResult.fromValue(_ret); + } + + /// compare:options:range: + objc.NSComparisonResult compare_options_range_(objc.NSString string, + objc.NSStringCompareOptions mask, NSRange rangeOfReceiverToCompare) { + final _ret = _objc_msgSend_eeuxub( + this.ref.pointer, + _sel_compare_options_range_, + string.ref.pointer, + mask.value, + rangeOfReceiverToCompare); + return objc.NSComparisonResult.fromValue(_ret); + } + + /// compare:options:range:locale: + objc.NSComparisonResult compare_options_range_locale_( + objc.NSString string, + objc.NSStringCompareOptions mask, + NSRange rangeOfReceiverToCompare, + objc.ObjCObjectBase? locale) { + final _ret = _objc_msgSend_i4hdht( + this.ref.pointer, + _sel_compare_options_range_locale_, + string.ref.pointer, + mask.value, + rangeOfReceiverToCompare, + locale?.ref.pointer ?? ffi.nullptr); + return objc.NSComparisonResult.fromValue(_ret); + } + + /// caseInsensitiveCompare: + objc.NSComparisonResult caseInsensitiveCompare_(objc.NSString string) { + final _ret = _objc_msgSend_1wpduvy( + this.ref.pointer, _sel_caseInsensitiveCompare_, string.ref.pointer); + return objc.NSComparisonResult.fromValue(_ret); + } + + /// localizedCompare: + objc.NSComparisonResult localizedCompare_(objc.NSString string) { + final _ret = _objc_msgSend_1wpduvy( + this.ref.pointer, _sel_localizedCompare_, string.ref.pointer); + return objc.NSComparisonResult.fromValue(_ret); + } + + /// localizedCaseInsensitiveCompare: + objc.NSComparisonResult localizedCaseInsensitiveCompare_( + objc.NSString string) { + final _ret = _objc_msgSend_1wpduvy(this.ref.pointer, + _sel_localizedCaseInsensitiveCompare_, string.ref.pointer); + return objc.NSComparisonResult.fromValue(_ret); + } + + /// localizedStandardCompare: + objc.NSComparisonResult localizedStandardCompare_(objc.NSString string) { + final _ret = _objc_msgSend_1wpduvy( + this.ref.pointer, _sel_localizedStandardCompare_, string.ref.pointer); + return objc.NSComparisonResult.fromValue(_ret); + } + + /// isEqualToString: + bool isEqualToString_(objc.NSString aString) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_isEqualToString_, aString.ref.pointer); + } + + /// hasPrefix: + bool hasPrefix_(objc.NSString str) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_hasPrefix_, str.ref.pointer); + } + + /// hasSuffix: + bool hasSuffix_(objc.NSString str) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_hasSuffix_, str.ref.pointer); + } + + /// commonPrefixWithString:options: + objc.NSString commonPrefixWithString_options_( + objc.NSString str, objc.NSStringCompareOptions mask) { + final _ret = _objc_msgSend_fcs5vo(this.ref.pointer, + _sel_commonPrefixWithString_options_, str.ref.pointer, mask.value); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// containsString: + bool containsString_(objc.NSString str) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_containsString_, str.ref.pointer); + } + + /// localizedCaseInsensitiveContainsString: + bool localizedCaseInsensitiveContainsString_(objc.NSString str) { + return _objc_msgSend_69e0x1(this.ref.pointer, + _sel_localizedCaseInsensitiveContainsString_, str.ref.pointer); + } + + /// localizedStandardContainsString: + bool localizedStandardContainsString_(objc.NSString str) { + return _objc_msgSend_69e0x1(this.ref.pointer, + _sel_localizedStandardContainsString_, str.ref.pointer); + } + + /// localizedStandardRangeOfString: + NSRange localizedStandardRangeOfString_(objc.NSString str) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_x4muu7Stret(_ptr, this.ref.pointer, + _sel_localizedStandardRangeOfString_, str.ref.pointer) + : _ptr.ref = _objc_msgSend_x4muu7(this.ref.pointer, + _sel_localizedStandardRangeOfString_, str.ref.pointer); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfString: + NSRange rangeOfString_(objc.NSString searchString) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_x4muu7Stret(_ptr, this.ref.pointer, _sel_rangeOfString_, + searchString.ref.pointer) + : _ptr.ref = _objc_msgSend_x4muu7( + this.ref.pointer, _sel_rangeOfString_, searchString.ref.pointer); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfString:options: + NSRange rangeOfString_options_( + objc.NSString searchString, objc.NSStringCompareOptions mask) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_1kwndnwStret(_ptr, this.ref.pointer, + _sel_rangeOfString_options_, searchString.ref.pointer, mask.value) + : _ptr.ref = _objc_msgSend_1kwndnw(this.ref.pointer, + _sel_rangeOfString_options_, searchString.ref.pointer, mask.value); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfString:options:range: + NSRange rangeOfString_options_range_(objc.NSString searchString, + objc.NSStringCompareOptions mask, NSRange rangeOfReceiverToSearch) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_ackzikStret( + _ptr, + this.ref.pointer, + _sel_rangeOfString_options_range_, + searchString.ref.pointer, + mask.value, + rangeOfReceiverToSearch) + : _ptr.ref = _objc_msgSend_ackzik( + this.ref.pointer, + _sel_rangeOfString_options_range_, + searchString.ref.pointer, + mask.value, + rangeOfReceiverToSearch); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfString:options:range:locale: + NSRange rangeOfString_options_range_locale_( + objc.NSString searchString, + objc.NSStringCompareOptions mask, + NSRange rangeOfReceiverToSearch, + objc.NSLocale? locale) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_198mga8Stret( + _ptr, + this.ref.pointer, + _sel_rangeOfString_options_range_locale_, + searchString.ref.pointer, + mask.value, + rangeOfReceiverToSearch, + locale?.ref.pointer ?? ffi.nullptr) + : _ptr.ref = _objc_msgSend_198mga8( + this.ref.pointer, + _sel_rangeOfString_options_range_locale_, + searchString.ref.pointer, + mask.value, + rangeOfReceiverToSearch, + locale?.ref.pointer ?? ffi.nullptr); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfCharacterFromSet: + NSRange rangeOfCharacterFromSet_(objc.NSCharacterSet searchSet) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_x4muu7Stret(_ptr, this.ref.pointer, + _sel_rangeOfCharacterFromSet_, searchSet.ref.pointer) + : _ptr.ref = _objc_msgSend_x4muu7(this.ref.pointer, + _sel_rangeOfCharacterFromSet_, searchSet.ref.pointer); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfCharacterFromSet:options: + NSRange rangeOfCharacterFromSet_options_( + objc.NSCharacterSet searchSet, objc.NSStringCompareOptions mask) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_1kwndnwStret( + _ptr, + this.ref.pointer, + _sel_rangeOfCharacterFromSet_options_, + searchSet.ref.pointer, + mask.value) + : _ptr.ref = _objc_msgSend_1kwndnw( + this.ref.pointer, + _sel_rangeOfCharacterFromSet_options_, + searchSet.ref.pointer, + mask.value); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfCharacterFromSet:options:range: + NSRange rangeOfCharacterFromSet_options_range_(objc.NSCharacterSet searchSet, + objc.NSStringCompareOptions mask, NSRange rangeOfReceiverToSearch) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_ackzikStret( + _ptr, + this.ref.pointer, + _sel_rangeOfCharacterFromSet_options_range_, + searchSet.ref.pointer, + mask.value, + rangeOfReceiverToSearch) + : _ptr.ref = _objc_msgSend_ackzik( + this.ref.pointer, + _sel_rangeOfCharacterFromSet_options_range_, + searchSet.ref.pointer, + mask.value, + rangeOfReceiverToSearch); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfComposedCharacterSequenceAtIndex: + NSRange rangeOfComposedCharacterSequenceAtIndex_(DartNSUInteger index) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_d3i1uyStret(_ptr, this.ref.pointer, + _sel_rangeOfComposedCharacterSequenceAtIndex_, index) + : _ptr.ref = _objc_msgSend_d3i1uy(this.ref.pointer, + _sel_rangeOfComposedCharacterSequenceAtIndex_, index); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// rangeOfComposedCharacterSequencesForRange: + NSRange rangeOfComposedCharacterSequencesForRange_(NSRange range) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_uimyc7Stret(_ptr, this.ref.pointer, + _sel_rangeOfComposedCharacterSequencesForRange_, range) + : _ptr.ref = _objc_msgSend_uimyc7(this.ref.pointer, + _sel_rangeOfComposedCharacterSequencesForRange_, range); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// stringByAppendingString: + objc.NSString stringByAppendingString_(objc.NSString aString) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_stringByAppendingString_, aString.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByAppendingFormat: + objc.NSString stringByAppendingFormat_(objc.NSString format) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_stringByAppendingFormat_, format.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// doubleValue + double get doubleValue { + return objc.useMsgSendVariants + ? _objc_msgSend_1ukqyt8Fpret(this.ref.pointer, _sel_doubleValue) + : _objc_msgSend_1ukqyt8(this.ref.pointer, _sel_doubleValue); + } + + /// floatValue + double get floatValue { + return objc.useMsgSendVariants + ? _objc_msgSend_2cgrxlFpret(this.ref.pointer, _sel_floatValue) + : _objc_msgSend_2cgrxl(this.ref.pointer, _sel_floatValue); + } + + /// intValue + int get intValue { + return _objc_msgSend_13yqbb6(this.ref.pointer, _sel_intValue); + } + + /// integerValue + DartNSInteger get integerValue { + return _objc_msgSend_1hz7y9r(this.ref.pointer, _sel_integerValue); + } + + /// longLongValue + int get longLongValue { + return _objc_msgSend_1k101e3(this.ref.pointer, _sel_longLongValue); + } + + /// boolValue + bool get boolValue { + return _objc_msgSend_91o635(this.ref.pointer, _sel_boolValue); + } + + /// uppercaseString + objc.NSString get uppercaseString { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_uppercaseString); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// lowercaseString + objc.NSString get lowercaseString { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_lowercaseString); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// capitalizedString + objc.NSString get capitalizedString { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_capitalizedString); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// localizedUppercaseString + objc.NSString get localizedUppercaseString { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_localizedUppercaseString); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// localizedLowercaseString + objc.NSString get localizedLowercaseString { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_localizedLowercaseString); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// localizedCapitalizedString + objc.NSString get localizedCapitalizedString { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_localizedCapitalizedString); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// uppercaseStringWithLocale: + objc.NSString uppercaseStringWithLocale_(objc.NSLocale? locale) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_uppercaseStringWithLocale_, locale?.ref.pointer ?? ffi.nullptr); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// lowercaseStringWithLocale: + objc.NSString lowercaseStringWithLocale_(objc.NSLocale? locale) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_lowercaseStringWithLocale_, locale?.ref.pointer ?? ffi.nullptr); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// capitalizedStringWithLocale: + objc.NSString capitalizedStringWithLocale_(objc.NSLocale? locale) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_capitalizedStringWithLocale_, locale?.ref.pointer ?? ffi.nullptr); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// getLineStart:end:contentsEnd:forRange: + void getLineStart_end_contentsEnd_forRange_( + ffi.Pointer startPtr, + ffi.Pointer lineEndPtr, + ffi.Pointer contentsEndPtr, + NSRange range) { + _objc_msgSend_ourvf2( + this.ref.pointer, + _sel_getLineStart_end_contentsEnd_forRange_, + startPtr, + lineEndPtr, + contentsEndPtr, + range); + } + + /// lineRangeForRange: + NSRange lineRangeForRange_(NSRange range) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_uimyc7Stret( + _ptr, this.ref.pointer, _sel_lineRangeForRange_, range) + : _ptr.ref = _objc_msgSend_uimyc7( + this.ref.pointer, _sel_lineRangeForRange_, range); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// getParagraphStart:end:contentsEnd:forRange: + void getParagraphStart_end_contentsEnd_forRange_( + ffi.Pointer startPtr, + ffi.Pointer parEndPtr, + ffi.Pointer contentsEndPtr, + NSRange range) { + _objc_msgSend_ourvf2( + this.ref.pointer, + _sel_getParagraphStart_end_contentsEnd_forRange_, + startPtr, + parEndPtr, + contentsEndPtr, + range); + } + + /// paragraphRangeForRange: + NSRange paragraphRangeForRange_(NSRange range) { + final _ptr = pkg_ffi.calloc(); + objc.useMsgSendVariants + ? _objc_msgSend_uimyc7Stret( + _ptr, this.ref.pointer, _sel_paragraphRangeForRange_, range) + : _ptr.ref = _objc_msgSend_uimyc7( + this.ref.pointer, _sel_paragraphRangeForRange_, range); + final _finalizable = _ptr.cast().asTypedList( + ffi.sizeOf(), + finalizer: pkg_ffi.calloc.nativeFree); + return ffi.Struct.create(_finalizable); + } + + /// enumerateSubstringsInRange:options:usingBlock: + void enumerateSubstringsInRange_options_usingBlock_( + NSRange range, + objc.NSStringEnumerationOptions opts, + objc.ObjCBlock< + ffi.Void Function(objc.NSString?, objc.NSRange, objc.NSRange, + ffi.Pointer)> + block) { + _objc_msgSend_14ew8zr( + this.ref.pointer, + _sel_enumerateSubstringsInRange_options_usingBlock_, + range, + opts.value, + block.ref.pointer); + } + + /// enumerateLinesUsingBlock: + void enumerateLinesUsingBlock_( + objc.ObjCBlock)> + block) { + _objc_msgSend_f167m6( + this.ref.pointer, _sel_enumerateLinesUsingBlock_, block.ref.pointer); + } + + /// UTF8String + ffi.Pointer get UTF8String { + return _objc_msgSend_1fuqfwb(this.ref.pointer, _sel_UTF8String); + } + + /// fastestEncoding + DartNSUInteger get fastestEncoding { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_fastestEncoding); + } + + /// smallestEncoding + DartNSUInteger get smallestEncoding { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_smallestEncoding); + } + + /// dataUsingEncoding:allowLossyConversion: + objc.NSData? dataUsingEncoding_allowLossyConversion_( + DartNSUInteger encoding, bool lossy) { + final _ret = _objc_msgSend_rubz6a(this.ref.pointer, + _sel_dataUsingEncoding_allowLossyConversion_, encoding, lossy); + return _ret.address == 0 + ? null + : objc.NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// dataUsingEncoding: + objc.NSData? dataUsingEncoding_(DartNSUInteger encoding) { + final _ret = _objc_msgSend_1qrcblu( + this.ref.pointer, _sel_dataUsingEncoding_, encoding); + return _ret.address == 0 + ? null + : objc.NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// canBeConvertedToEncoding: + bool canBeConvertedToEncoding_(DartNSUInteger encoding) { + return _objc_msgSend_6peh6o( + this.ref.pointer, _sel_canBeConvertedToEncoding_, encoding); + } + + /// cStringUsingEncoding: + ffi.Pointer cStringUsingEncoding_(DartNSUInteger encoding) { + return _objc_msgSend_1jtxufi( + this.ref.pointer, _sel_cStringUsingEncoding_, encoding); + } + + /// getCString:maxLength:encoding: + bool getCString_maxLength_encoding_(ffi.Pointer buffer, + DartNSUInteger maxBufferCount, DartNSUInteger encoding) { + return _objc_msgSend_1lv8yz3(this.ref.pointer, + _sel_getCString_maxLength_encoding_, buffer, maxBufferCount, encoding); + } + + /// getBytes:maxLength:usedLength:encoding:options:range:remainingRange: + bool getBytes_maxLength_usedLength_encoding_options_range_remainingRange_( + ffi.Pointer buffer, + DartNSUInteger maxBufferCount, + ffi.Pointer usedBufferCount, + DartNSUInteger encoding, + objc.NSStringEncodingConversionOptions options, + NSRange range, + NSRangePointer leftover) { + return _objc_msgSend_i30zh3( + this.ref.pointer, + _sel_getBytes_maxLength_usedLength_encoding_options_range_remainingRange_, + buffer, + maxBufferCount, + usedBufferCount, + encoding, + options.value, + range, + leftover); + } + + /// maximumLengthOfBytesUsingEncoding: + DartNSUInteger maximumLengthOfBytesUsingEncoding_(DartNSUInteger enc) { + return _objc_msgSend_12py2ux( + this.ref.pointer, _sel_maximumLengthOfBytesUsingEncoding_, enc); + } + + /// lengthOfBytesUsingEncoding: + DartNSUInteger lengthOfBytesUsingEncoding_(DartNSUInteger enc) { + return _objc_msgSend_12py2ux( + this.ref.pointer, _sel_lengthOfBytesUsingEncoding_, enc); + } + + /// availableStringEncodings + static ffi.Pointer getAvailableStringEncodings() { + return _objc_msgSend_1h2q612( + _class_NSString, _sel_availableStringEncodings); + } + + /// localizedNameOfStringEncoding: + static objc.NSString localizedNameOfStringEncoding_(DartNSUInteger encoding) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSString, _sel_localizedNameOfStringEncoding_, encoding); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// defaultCStringEncoding + static DartNSUInteger getDefaultCStringEncoding() { + return _objc_msgSend_xw2lbc(_class_NSString, _sel_defaultCStringEncoding); + } + + /// decomposedStringWithCanonicalMapping + objc.NSString get decomposedStringWithCanonicalMapping { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_decomposedStringWithCanonicalMapping); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// precomposedStringWithCanonicalMapping + objc.NSString get precomposedStringWithCanonicalMapping { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_precomposedStringWithCanonicalMapping); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// decomposedStringWithCompatibilityMapping + objc.NSString get decomposedStringWithCompatibilityMapping { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_decomposedStringWithCompatibilityMapping); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// precomposedStringWithCompatibilityMapping + objc.NSString get precomposedStringWithCompatibilityMapping { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_precomposedStringWithCompatibilityMapping); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// componentsSeparatedByString: + objc.NSArray componentsSeparatedByString_(objc.NSString separator) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_componentsSeparatedByString_, separator.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// componentsSeparatedByCharactersInSet: + objc.NSArray componentsSeparatedByCharactersInSet_( + objc.NSCharacterSet separator) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_componentsSeparatedByCharactersInSet_, separator.ref.pointer); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByTrimmingCharactersInSet: + objc.NSString stringByTrimmingCharactersInSet_(objc.NSCharacterSet set) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_stringByTrimmingCharactersInSet_, set.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByPaddingToLength:withString:startingAtIndex: + objc.NSString stringByPaddingToLength_withString_startingAtIndex_( + DartNSUInteger newLength, + objc.NSString padString, + DartNSUInteger padIndex) { + final _ret = _objc_msgSend_exgdqb( + this.ref.pointer, + _sel_stringByPaddingToLength_withString_startingAtIndex_, + newLength, + padString.ref.pointer, + padIndex); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByFoldingWithOptions:locale: + objc.NSString stringByFoldingWithOptions_locale_( + objc.NSStringCompareOptions options, objc.NSLocale? locale) { + final _ret = _objc_msgSend_146986e( + this.ref.pointer, + _sel_stringByFoldingWithOptions_locale_, + options.value, + locale?.ref.pointer ?? ffi.nullptr); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByReplacingOccurrencesOfString:withString:options:range: + objc.NSString stringByReplacingOccurrencesOfString_withString_options_range_( + objc.NSString target, + objc.NSString replacement, + objc.NSStringCompareOptions options, + NSRange searchRange) { + final _ret = _objc_msgSend_1wrs2o6( + this.ref.pointer, + _sel_stringByReplacingOccurrencesOfString_withString_options_range_, + target.ref.pointer, + replacement.ref.pointer, + options.value, + searchRange); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByReplacingOccurrencesOfString:withString: + objc.NSString stringByReplacingOccurrencesOfString_withString_( + objc.NSString target, objc.NSString replacement) { + final _ret = _objc_msgSend_rsfdlh( + this.ref.pointer, + _sel_stringByReplacingOccurrencesOfString_withString_, + target.ref.pointer, + replacement.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByReplacingCharactersInRange:withString: + objc.NSString stringByReplacingCharactersInRange_withString_( + NSRange range, objc.NSString replacement) { + final _ret = _objc_msgSend_197wcu5( + this.ref.pointer, + _sel_stringByReplacingCharactersInRange_withString_, + range, + replacement.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByApplyingTransform:reverse: + objc.NSString? stringByApplyingTransform_reverse_( + DartNSStringTransform transform, bool reverse) { + final _ret = _objc_msgSend_1bdmr5f( + this.ref.pointer, + _sel_stringByApplyingTransform_reverse_, + transform.ref.pointer, + reverse); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// writeToURL:atomically:encoding:error: + bool writeToURL_atomically_encoding_error_( + objc.NSURL url, + bool useAuxiliaryFile, + DartNSUInteger enc, + ffi.Pointer> error) { + return _objc_msgSend_1140663( + this.ref.pointer, + _sel_writeToURL_atomically_encoding_error_, + url.ref.pointer, + useAuxiliaryFile, + enc, + error); + } + + /// writeToFile:atomically:encoding:error: + bool writeToFile_atomically_encoding_error_( + objc.NSString path, + bool useAuxiliaryFile, + DartNSUInteger enc, + ffi.Pointer> error) { + return _objc_msgSend_1140663( + this.ref.pointer, + _sel_writeToFile_atomically_encoding_error_, + path.ref.pointer, + useAuxiliaryFile, + enc, + error); + } + + /// description + objc.NSString get description { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_description); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// hash + DartNSUInteger get hash { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_hash); + } + + /// initWithCharactersNoCopy:length:freeWhenDone: + objc.NSString initWithCharactersNoCopy_length_freeWhenDone_( + ffi.Pointer characters, DartNSUInteger length, bool freeBuffer) { + final _ret = _objc_msgSend_zsd8q9( + this.ref.retainAndReturnPointer(), + _sel_initWithCharactersNoCopy_length_freeWhenDone_, + characters, + length, + freeBuffer); + return objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithCharactersNoCopy:length:deallocator: + objc.NSString initWithCharactersNoCopy_length_deallocator_( + ffi.Pointer chars, + DartNSUInteger len, + objc.ObjCBlock, ffi.UnsignedLong)>? + deallocator) { + final _ret = _objc_msgSend_1pr13r6( + this.ref.retainAndReturnPointer(), + _sel_initWithCharactersNoCopy_length_deallocator_, + chars, + len, + deallocator?.ref.pointer ?? ffi.nullptr); + return objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithCharacters:length: + objc.NSString initWithCharacters_length_( + ffi.Pointer characters, DartNSUInteger length) { + final _ret = _objc_msgSend_13z9dkp(this.ref.retainAndReturnPointer(), + _sel_initWithCharacters_length_, characters, length); + return objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithUTF8String: + objc.NSString? initWithUTF8String_( + ffi.Pointer nullTerminatedCString) { + final _ret = _objc_msgSend_rqwdif(this.ref.retainAndReturnPointer(), + _sel_initWithUTF8String_, nullTerminatedCString); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithString: + objc.NSString initWithString_(objc.NSString aString) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithString_, aString.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithFormat: + objc.NSString initWithFormat_(objc.NSString format) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithFormat_, format.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithFormat:locale: + objc.NSString initWithFormat_locale_( + objc.NSString format, objc.ObjCObjectBase? locale) { + final _ret = _objc_msgSend_rsfdlh( + this.ref.retainAndReturnPointer(), + _sel_initWithFormat_locale_, + format.ref.pointer, + locale?.ref.pointer ?? ffi.nullptr); + return objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithValidatedFormat:validFormatSpecifiers:error: + objc.NSString? initWithValidatedFormat_validFormatSpecifiers_error_( + objc.NSString format, + objc.NSString validFormatSpecifiers, + ffi.Pointer> error) { + final _ret = _objc_msgSend_bo6ep4( + this.ref.retainAndReturnPointer(), + _sel_initWithValidatedFormat_validFormatSpecifiers_error_, + format.ref.pointer, + validFormatSpecifiers.ref.pointer, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithValidatedFormat:validFormatSpecifiers:locale:error: + objc.NSString? initWithValidatedFormat_validFormatSpecifiers_locale_error_( + objc.NSString format, + objc.NSString validFormatSpecifiers, + objc.ObjCObjectBase? locale, + ffi.Pointer> error) { + final _ret = _objc_msgSend_2izev6( + this.ref.retainAndReturnPointer(), + _sel_initWithValidatedFormat_validFormatSpecifiers_locale_error_, + format.ref.pointer, + validFormatSpecifiers.ref.pointer, + locale?.ref.pointer ?? ffi.nullptr, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithData:encoding: + objc.NSString? initWithData_encoding_( + objc.NSData data, DartNSUInteger encoding) { + final _ret = _objc_msgSend_dcd68g(this.ref.retainAndReturnPointer(), + _sel_initWithData_encoding_, data.ref.pointer, encoding); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithBytes:length:encoding: + objc.NSString? initWithBytes_length_encoding_(ffi.Pointer bytes, + DartNSUInteger len, DartNSUInteger encoding) { + final _ret = _objc_msgSend_i38ton(this.ref.retainAndReturnPointer(), + _sel_initWithBytes_length_encoding_, bytes, len, encoding); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithBytesNoCopy:length:encoding:freeWhenDone: + objc.NSString? initWithBytesNoCopy_length_encoding_freeWhenDone_( + ffi.Pointer bytes, + DartNSUInteger len, + DartNSUInteger encoding, + bool freeBuffer) { + final _ret = _objc_msgSend_o2ktnn( + this.ref.retainAndReturnPointer(), + _sel_initWithBytesNoCopy_length_encoding_freeWhenDone_, + bytes, + len, + encoding, + freeBuffer); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithBytesNoCopy:length:encoding:deallocator: + objc.NSString? initWithBytesNoCopy_length_encoding_deallocator_( + ffi.Pointer bytes, + DartNSUInteger len, + DartNSUInteger encoding, + objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, ffi.UnsignedLong)>? + deallocator) { + final _ret = _objc_msgSend_1nnfqvg( + this.ref.retainAndReturnPointer(), + _sel_initWithBytesNoCopy_length_encoding_deallocator_, + bytes, + len, + encoding, + deallocator?.ref.pointer ?? ffi.nullptr); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// string + static objc.NSString string() { + final _ret = _objc_msgSend_1x359cv(_class_NSString, _sel_string); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithString: + static objc.NSString stringWithString_(objc.NSString string) { + final _ret = _objc_msgSend_62nh5j( + _class_NSString, _sel_stringWithString_, string.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithCharacters:length: + static objc.NSString stringWithCharacters_length_( + ffi.Pointer characters, DartNSUInteger length) { + final _ret = _objc_msgSend_13z9dkp( + _class_NSString, _sel_stringWithCharacters_length_, characters, length); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithUTF8String: + static objc.NSString? stringWithUTF8String_( + ffi.Pointer nullTerminatedCString) { + final _ret = _objc_msgSend_rqwdif( + _class_NSString, _sel_stringWithUTF8String_, nullTerminatedCString); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithFormat: + static objc.NSString stringWithFormat_(objc.NSString format) { + final _ret = _objc_msgSend_62nh5j( + _class_NSString, _sel_stringWithFormat_, format.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// localizedStringWithFormat: + static objc.NSString localizedStringWithFormat_(objc.NSString format) { + final _ret = _objc_msgSend_62nh5j( + _class_NSString, _sel_localizedStringWithFormat_, format.ref.pointer); + return objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithValidatedFormat:validFormatSpecifiers:error: + static objc.NSString? stringWithValidatedFormat_validFormatSpecifiers_error_( + objc.NSString format, + objc.NSString validFormatSpecifiers, + ffi.Pointer> error) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSString, + _sel_stringWithValidatedFormat_validFormatSpecifiers_error_, + format.ref.pointer, + validFormatSpecifiers.ref.pointer, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// localizedStringWithValidatedFormat:validFormatSpecifiers:error: + static objc.NSString? + localizedStringWithValidatedFormat_validFormatSpecifiers_error_( + objc.NSString format, + objc.NSString validFormatSpecifiers, + ffi.Pointer> error) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSString, + _sel_localizedStringWithValidatedFormat_validFormatSpecifiers_error_, + format.ref.pointer, + validFormatSpecifiers.ref.pointer, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// initWithCString:encoding: + objc.NSString? initWithCString_encoding_( + ffi.Pointer nullTerminatedCString, DartNSUInteger encoding) { + final _ret = _objc_msgSend_a15xhc(this.ref.retainAndReturnPointer(), + _sel_initWithCString_encoding_, nullTerminatedCString, encoding); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// stringWithCString:encoding: + static objc.NSString? stringWithCString_encoding_( + ffi.Pointer cString, DartNSUInteger enc) { + final _ret = _objc_msgSend_a15xhc( + _class_NSString, _sel_stringWithCString_encoding_, cString, enc); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// initWithContentsOfURL:encoding:error: + objc.NSString? initWithContentsOfURL_encoding_error_(objc.NSURL url, + DartNSUInteger enc, ffi.Pointer> error) { + final _ret = _objc_msgSend_94cet5( + this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfURL_encoding_error_, + url.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithContentsOfFile:encoding:error: + objc.NSString? initWithContentsOfFile_encoding_error_(objc.NSString path, + DartNSUInteger enc, ffi.Pointer> error) { + final _ret = _objc_msgSend_94cet5( + this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfFile_encoding_error_, + path.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// stringWithContentsOfURL:encoding:error: + static objc.NSString? stringWithContentsOfURL_encoding_error_(objc.NSURL url, + DartNSUInteger enc, ffi.Pointer> error) { + final _ret = _objc_msgSend_94cet5( + _class_NSString, + _sel_stringWithContentsOfURL_encoding_error_, + url.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithContentsOfFile:encoding:error: + static objc.NSString? stringWithContentsOfFile_encoding_error_( + objc.NSString path, + DartNSUInteger enc, + ffi.Pointer> error) { + final _ret = _objc_msgSend_94cet5( + _class_NSString, + _sel_stringWithContentsOfFile_encoding_error_, + path.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// initWithContentsOfURL:usedEncoding:error: + objc.NSString? initWithContentsOfURL_usedEncoding_error_( + objc.NSURL url, + ffi.Pointer enc, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1gxo8gv( + this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfURL_usedEncoding_error_, + url.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// initWithContentsOfFile:usedEncoding:error: + objc.NSString? initWithContentsOfFile_usedEncoding_error_( + objc.NSString path, + ffi.Pointer enc, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1gxo8gv( + this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfFile_usedEncoding_error_, + path.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: false, release: true); + } + + /// stringWithContentsOfURL:usedEncoding:error: + static objc.NSString? stringWithContentsOfURL_usedEncoding_error_( + objc.NSURL url, + ffi.Pointer enc, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1gxo8gv( + _class_NSString, + _sel_stringWithContentsOfURL_usedEncoding_error_, + url.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringWithContentsOfFile:usedEncoding:error: + static objc.NSString? stringWithContentsOfFile_usedEncoding_error_( + objc.NSString path, + ffi.Pointer enc, + ffi.Pointer> error) { + final _ret = _objc_msgSend_1gxo8gv( + _class_NSString, + _sel_stringWithContentsOfFile_usedEncoding_error_, + path.ref.pointer, + enc, + error); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } +} + +typedef NSStringEncodingDetectionOptionsKey = ffi.Pointer; +typedef DartNSStringEncodingDetectionOptionsKey = objc.NSString; +late final _sel_stringEncodingForData_encodingOptions_convertedString_usedLossyConversion_ = + objc.registerName( + "stringEncodingForData:encodingOptions:convertedString:usedLossyConversion:"); +final _objc_msgSend_pi68en = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer)>(); + +/// NSStringEncodingDetection +extension NSStringEncodingDetection on objc.NSString { + /// stringEncodingForData:encodingOptions:convertedString:usedLossyConversion: + static DartNSUInteger + stringEncodingForData_encodingOptions_convertedString_usedLossyConversion_( + objc.NSData data, + objc.NSDictionary? opts, + ffi.Pointer> string, + ffi.Pointer usedLossyConversion) { + return _objc_msgSend_pi68en( + _class_NSString, + _sel_stringEncodingForData_encodingOptions_convertedString_usedLossyConversion_, + data.ref.pointer, + opts?.ref.pointer ?? ffi.nullptr, + string, + usedLossyConversion); + } +} + +late final _sel_readableTypeIdentifiersForItemProvider = + objc.registerName("readableTypeIdentifiersForItemProvider"); +ffi.Pointer _ObjCBlock_NSArray_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer)>()(arg0); +ffi.Pointer _ObjCBlock_NSArray_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_NSArray_ffiVoid_fnPtrTrampoline) + .cast(); +ffi.Pointer _ObjCBlock_NSArray_ffiVoid_closureTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + (objc.getBlockClosure(block) as ffi.Pointer Function( + ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_NSArray_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_NSArray_ffiVoid_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_NSArray_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_NSArray_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> + fromFunction(objc.NSArray Function(ffi.Pointer) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_NSArray_ffiVoid_closureCallable, + (ffi.Pointer arg0) => + fn(arg0).ref.retainAndAutorelease()), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_NSArray_ffiVoid_CallExtension + on objc.ObjCBlock)> { + objc.NSArray call(ffi.Pointer arg0) => objc.NSArray.castFromPointer( + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0), + retain: true, + release: true); +} + +late final _sel_objectWithItemProviderData_typeIdentifier_error_ = + objc.registerName("objectWithItemProviderData:typeIdentifier:error:"); +instancetype + _ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer> arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + instancetype Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer> arg3)>>() + .asFunction< + instancetype Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>()( + arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError_fnPtrCallable = + ffi.Pointer.fromFunction< + instancetype Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>( + _ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError_fnPtrTrampoline) + .cast(); +instancetype + _ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer> arg3) => + (objc.getBlockClosure(block) as instancetype Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError_closureCallable = + ffi.Pointer.fromFunction< + instancetype Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>( + _ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock? Function(ffi.Pointer, objc.NSData, objc.NSString, ffi.Pointer>)>`. +abstract final class ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Pointer? Function( + ffi.Pointer, + objc.NSData, + objc.NSString, + ffi.Pointer>)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Pointer? Function( + ffi.Pointer, + objc.NSData, + objc.NSString, + ffi.Pointer>)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + ffi.Pointer? Function( + ffi.Pointer, objc.NSData, objc.NSString, ffi.Pointer>)> + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer> arg3)>> ptr) => + objc.ObjCBlock< + ffi.Pointer? Function( + ffi.Pointer, + objc.NSData, + objc.NSString, + ffi.Pointer>)>( + objc.newPointerBlock(_ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock? Function(ffi.Pointer, objc.NSData, objc.NSString, ffi.Pointer>)> + fromFunction(Dartinstancetype? Function(ffi.Pointer, objc.NSData, objc.NSString, ffi.Pointer>) fn) => + objc.ObjCBlock? Function(ffi.Pointer, objc.NSData, objc.NSString, ffi.Pointer>)>( + objc.newClosureBlock( + _ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer> arg3) => + fn(arg0, objc.NSData.castFromPointer(arg1, retain: true, release: true), objc.NSString.castFromPointer(arg2, retain: true, release: true), arg3)?.ref.retainAndAutorelease() ?? + ffi.nullptr), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock? Function(ffi.Pointer, objc.NSData, objc.NSString, ffi.Pointer>)>`. +extension ObjCBlock_instancetype_ffiVoid_NSData_NSString_NSError_CallExtension + on objc.ObjCBlock< + ffi.Pointer? Function( + ffi.Pointer, + objc.NSData, + objc.NSString, + ffi.Pointer>)> { + Dartinstancetype? call(ffi.Pointer arg0, objc.NSData arg1, objc.NSString arg2, ffi.Pointer> arg3) => ref + .pointer.ref.invoke + .cast< + ffi.NativeFunction< + instancetype Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer> arg3)>>() + .asFunction< + instancetype Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>() + (ref.pointer, arg0, arg1.ref.pointer, arg2.ref.pointer, arg3) + .address == + 0 + ? null + : objc.ObjCObjectBase( + ref.pointer.ref.invoke.cast block, ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer> arg3)>>().asFunction, ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer>)>()(ref.pointer, arg0, arg1.ref.pointer, arg2.ref.pointer, arg3), + retain: true, + release: true); +} + +late final _sel_writableTypeIdentifiersForItemProvider = + objc.registerName("writableTypeIdentifiersForItemProvider"); +late final _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_ = + objc.registerName( + "itemProviderVisibilityForRepresentationWithTypeIdentifier:"); +final _objc_msgSend_96wwe1 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + int Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +int _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + int Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer + _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_fnPtrCallable = + ffi.Pointer.fromFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_fnPtrTrampoline, + 0) + .cast(); +int _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as int Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); +ffi.Pointer + _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_closureCallable = + ffi.Pointer.fromFunction< + NSInteger Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_closureTrampoline, + 0) + .cast(); + +/// Construction methods for `objc.ObjCBlock, objc.NSString)>`. +abstract final class ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + NSInteger Function(ffi.Pointer, objc.NSString)> castFromPointer( + ffi.Pointer pointer, + {bool retain = false, + bool release = false}) => + objc.ObjCBlock, objc.NSString)>( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, objc.NSString)> + fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + NSInteger Function(ffi.Pointer arg0, + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock, objc.NSString)>( + objc.newPointerBlock(_ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, objc.NSString)> fromFunction( + objc.NSItemProviderRepresentationVisibility Function( + ffi.Pointer, objc.NSString) + fn) => + objc.ObjCBlock, objc.NSString)>( + objc.newClosureBlock( + _ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => + fn(arg0, objc.NSString.castFromPointer(arg1, retain: true, release: true)) + .value), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, objc.NSString)>`. +extension ObjCBlock_NSItemProviderRepresentationVisibility_ffiVoid_NSString_CallExtension + on objc + .ObjCBlock, objc.NSString)> { + objc.NSItemProviderRepresentationVisibility call( + ffi.Pointer arg0, objc.NSString arg1) => + objc.NSItemProviderRepresentationVisibility.fromValue(ref + .pointer.ref.invoke + .cast< + ffi.NativeFunction< + NSInteger Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction, ffi.Pointer, ffi.Pointer)>()( + ref.pointer, arg0, arg1.ref.pointer)); +} + +void _ObjCBlock_ffiVoid_NSData_NSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_NSData_NSError_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSData_NSError_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSData_NSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) => + (objc.getBlockClosure(block) as void Function(ffi.Pointer, + ffi.Pointer))(arg0, arg1); +ffi.Pointer _ObjCBlock_ffiVoid_NSData_NSError_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSData_NSError_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_NSData_NSError_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, ffi.Pointer))(arg0, arg1); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_NSData_NSError_listenerCallable = ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSData_NSError_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSData_NSError { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock( + pointer, + retain: retain, + release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0, + ffi.Pointer arg1)>> + ptr) => + objc.ObjCBlock( + objc.newPointerBlock(_ObjCBlock_ffiVoid_NSData_NSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction( + void Function(objc.NSData?, objc.NSError?) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSData_NSError_closureCallable, + (ffi.Pointer arg0, ffi.Pointer arg1) => fn( + arg0.address == 0 + ? null + : objc.NSData.castFromPointer(arg0, + retain: true, release: true), + arg1.address == 0 ? null : objc.NSError.castFromPointer(arg1, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock + listener(void Function(objc.NSData?, objc.NSError?) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSData_NSError_listenerCallable.nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1) => + fn( + arg0.address == 0 + ? null + : objc.NSData.castFromPointer(arg0, + retain: false, release: true), + arg1.address == 0 + ? null + : objc.NSError.castFromPointer(arg1, + retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_wjvic9(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock( + wrapper, + retain: false, + release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSData_NSError_CallExtension + on objc.ObjCBlock { + void call(objc.NSData? arg0, objc.NSError? arg1) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(ref.pointer, + arg0?.ref.pointer ?? ffi.nullptr, arg1?.ref.pointer ?? ffi.nullptr); +} + +late final _sel_loadDataWithTypeIdentifier_forItemProviderCompletionHandler_ = + objc.registerName( + "loadDataWithTypeIdentifier:forItemProviderCompletionHandler:"); +ffi.Pointer + _ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError_fnPtrTrampoline) + .cast(); +ffi.Pointer + _ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + (objc.getBlockClosure(block) as ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2); +ffi.Pointer + _ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError_closureCallable = + ffi.Pointer.fromFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError_closureTrampoline) + .cast(); + +/// Construction methods for `objc.ObjCBlock, objc.NSString, objc.ObjCBlock)>`. +abstract final class ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + NSProgress? Function(ffi.Pointer, objc.NSString, + objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + NSProgress? Function(ffi.Pointer, objc.NSString, + objc.ObjCBlock)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock< + NSProgress? Function(ffi.Pointer, objc.NSString, + objc.ObjCBlock)> + fromFunctionPointer(ffi.Pointer Function(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>> ptr) => + objc.ObjCBlock< + NSProgress? Function(ffi.Pointer, objc.NSString, + objc.ObjCBlock)>( + objc.newPointerBlock(_ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock, objc.NSString, objc.ObjCBlock)> + fromFunction(NSProgress? Function(ffi.Pointer, objc.NSString, objc.ObjCBlock) fn) => + objc.ObjCBlock, objc.NSString, objc.ObjCBlock)>( + objc.newClosureBlock( + _ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2) => + fn(arg0, objc.NSString.castFromPointer(arg1, retain: true, release: true), ObjCBlock_ffiVoid_NSData_NSError.castFromPointer(arg2, retain: true, release: true)) + ?.ref + .retainAndAutorelease() ?? + ffi.nullptr), + retain: false, + release: true); +} + +/// Call operator for `objc.ObjCBlock, objc.NSString, objc.ObjCBlock)>`. +extension ObjCBlock_NSProgress_ffiVoid_NSString_ffiVoidNSDataNSError_CallExtension + on objc.ObjCBlock< + NSProgress? Function(ffi.Pointer, objc.NSString, + objc.ObjCBlock)> { + NSProgress? call(ffi.Pointer arg0, objc.NSString arg1, objc.ObjCBlock arg2) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>() + (ref.pointer, arg0, arg1.ref.pointer, arg2.ref.pointer) + .address == + 0 + ? null + : NSProgress.castFromPointer( + ref.pointer.ref.invoke.cast Function(ffi.Pointer block, ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2)>>().asFunction Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>()(ref.pointer, arg0, arg1.ref.pointer, arg2.ref.pointer), + retain: true, + release: true); +} + +/// NSItemProvider +extension NSItemProvider on objc.NSString { + /// readableTypeIdentifiersForItemProvider + static objc.NSArray getReadableTypeIdentifiersForItemProvider() { + final _ret = _objc_msgSend_1x359cv( + _class_NSString, _sel_readableTypeIdentifiersForItemProvider); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// objectWithItemProviderData:typeIdentifier:error: + static objc.NSString? objectWithItemProviderData_typeIdentifier_error_( + objc.NSData data, + objc.NSString typeIdentifier, + ffi.Pointer> outError) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSString, + _sel_objectWithItemProviderData_typeIdentifier_error_, + data.ref.pointer, + typeIdentifier.ref.pointer, + outError); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// writableTypeIdentifiersForItemProvider + static objc.NSArray getWritableTypeIdentifiersForItemProvider() { + final _ret = _objc_msgSend_1x359cv( + _class_NSString, _sel_writableTypeIdentifiersForItemProvider); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// writableTypeIdentifiersForItemProvider + objc.NSArray get writableTypeIdentifiersForItemProvider1 { + if (!objc.respondsToSelector( + this.ref.pointer, _sel_writableTypeIdentifiersForItemProvider)) { + throw objc.UnimplementedOptionalMethodException( + 'NSString', 'writableTypeIdentifiersForItemProvider'); + } + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_writableTypeIdentifiersForItemProvider); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// itemProviderVisibilityForRepresentationWithTypeIdentifier: + static objc.NSItemProviderRepresentationVisibility + itemProviderVisibilityForRepresentationWithTypeIdentifier_( + objc.NSString typeIdentifier) { + if (!objc.respondsToSelector(_class_NSString, + _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_)) { + throw objc.UnimplementedOptionalMethodException('NSString', + 'itemProviderVisibilityForRepresentationWithTypeIdentifier:'); + } + final _ret = _objc_msgSend_96wwe1( + _class_NSString, + _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_, + typeIdentifier.ref.pointer); + return objc.NSItemProviderRepresentationVisibility.fromValue(_ret); + } + + /// itemProviderVisibilityForRepresentationWithTypeIdentifier: + objc.NSItemProviderRepresentationVisibility + itemProviderVisibilityForRepresentationWithTypeIdentifier_1( + objc.NSString typeIdentifier) { + if (!objc.respondsToSelector(this.ref.pointer, + _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_)) { + throw objc.UnimplementedOptionalMethodException('NSString', + 'itemProviderVisibilityForRepresentationWithTypeIdentifier:'); + } + final _ret = _objc_msgSend_96wwe1( + this.ref.pointer, + _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_, + typeIdentifier.ref.pointer); + return objc.NSItemProviderRepresentationVisibility.fromValue(_ret); + } + + /// loadDataWithTypeIdentifier:forItemProviderCompletionHandler: + NSProgress? loadDataWithTypeIdentifier_forItemProviderCompletionHandler_( + objc.NSString typeIdentifier, + objc.ObjCBlock + completionHandler) { + final _ret = _objc_msgSend_o4sqyk( + this.ref.pointer, + _sel_loadDataWithTypeIdentifier_forItemProviderCompletionHandler_, + typeIdentifier.ref.pointer, + completionHandler.ref.pointer); + return _ret.address == 0 + ? null + : NSProgress.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _class_NSMutableString = objc.getClass("NSMutableString"); +late final _sel_insertString_atIndex_ = + objc.registerName("insertString:atIndex:"); +late final _sel_deleteCharactersInRange_ = + objc.registerName("deleteCharactersInRange:"); +late final _sel_appendString_ = objc.registerName("appendString:"); +late final _sel_appendFormat_ = objc.registerName("appendFormat:"); +late final _sel_setString_ = objc.registerName("setString:"); +late final _sel_replaceOccurrencesOfString_withString_options_range_ = + objc.registerName("replaceOccurrencesOfString:withString:options:range:"); +final _objc_msgSend_19rhlmt = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + NSUInteger, + objc.NSRange)>>() + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + objc.NSRange)>(); +late final _sel_applyTransform_reverse_range_updatedRange_ = + objc.registerName("applyTransform:reverse:range:updatedRange:"); +final _objc_msgSend_1wfeihn = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Bool, + objc.NSRange, + ffi.Pointer)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + bool, + objc.NSRange, + ffi.Pointer)>(); +late final _sel_initWithCapacity_ = objc.registerName("initWithCapacity:"); +late final _sel_stringWithCapacity_ = objc.registerName("stringWithCapacity:"); + +/// NSMutableStringExtensionMethods +extension NSMutableStringExtensionMethods on objc.NSMutableString { + /// insertString:atIndex: + void insertString_atIndex_(objc.NSString aString, DartNSUInteger loc) { + _objc_msgSend_10i1axw( + this.ref.pointer, _sel_insertString_atIndex_, aString.ref.pointer, loc); + } + + /// deleteCharactersInRange: + void deleteCharactersInRange_(NSRange range) { + _objc_msgSend_1e3pm0z( + this.ref.pointer, _sel_deleteCharactersInRange_, range); + } + + /// appendString: + void appendString_(objc.NSString aString) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_appendString_, aString.ref.pointer); + } + + /// appendFormat: + void appendFormat_(objc.NSString format) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_appendFormat_, format.ref.pointer); + } + + /// setString: + void setString_(objc.NSString aString) { + _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setString_, aString.ref.pointer); + } + + /// replaceOccurrencesOfString:withString:options:range: + DartNSUInteger replaceOccurrencesOfString_withString_options_range_( + objc.NSString target, + objc.NSString replacement, + objc.NSStringCompareOptions options, + NSRange searchRange) { + return _objc_msgSend_19rhlmt( + this.ref.pointer, + _sel_replaceOccurrencesOfString_withString_options_range_, + target.ref.pointer, + replacement.ref.pointer, + options.value, + searchRange); + } + + /// applyTransform:reverse:range:updatedRange: + bool applyTransform_reverse_range_updatedRange_( + DartNSStringTransform transform, + bool reverse, + NSRange range, + NSRangePointer resultingRange) { + return _objc_msgSend_1wfeihn( + this.ref.pointer, + _sel_applyTransform_reverse_range_updatedRange_, + transform.ref.pointer, + reverse, + range, + resultingRange); + } + + /// initWithCapacity: + objc.NSMutableString initWithCapacity_(DartNSUInteger capacity) { + final _ret = _objc_msgSend_1qrcblu( + this.ref.retainAndReturnPointer(), _sel_initWithCapacity_, capacity); + return objc.NSMutableString.castFromPointer(_ret, + retain: false, release: true); + } + + /// stringWithCapacity: + static objc.NSMutableString stringWithCapacity_(DartNSUInteger capacity) { + final _ret = _objc_msgSend_1qrcblu( + _class_NSMutableString, _sel_stringWithCapacity_, capacity); + return objc.NSMutableString.castFromPointer(_ret, + retain: true, release: true); + } +} + +late final _sel_propertyList = objc.registerName("propertyList"); +late final _sel_propertyListFromStringsFileFormat = + objc.registerName("propertyListFromStringsFileFormat"); + +/// NSExtendedStringPropertyListParsing +extension NSExtendedStringPropertyListParsing on objc.NSString { + /// propertyList + objc.ObjCObjectBase propertyList() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_propertyList); + return objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// propertyListFromStringsFileFormat + objc.NSDictionary? propertyListFromStringsFileFormat() { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_propertyListFromStringsFileFormat); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _sel_cString = objc.registerName("cString"); +late final _sel_lossyCString = objc.registerName("lossyCString"); +late final _sel_cStringLength = objc.registerName("cStringLength"); +late final _sel_getCString_ = objc.registerName("getCString:"); +final _objc_msgSend_1r7ue5f = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); +late final _sel_getCString_maxLength_ = + objc.registerName("getCString:maxLength:"); +final _objc_msgSend_1h3mito = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int)>(); +late final _sel_getCString_maxLength_range_remainingRange_ = + objc.registerName("getCString:maxLength:range:remainingRange:"); +final _objc_msgSend_3gpdva = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + objc.NSRange, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + objc.NSRange, + ffi.Pointer)>(); +late final _sel_stringWithContentsOfFile_ = + objc.registerName("stringWithContentsOfFile:"); +late final _sel_stringWithContentsOfURL_ = + objc.registerName("stringWithContentsOfURL:"); +late final _sel_initWithCStringNoCopy_length_freeWhenDone_ = + objc.registerName("initWithCStringNoCopy:length:freeWhenDone:"); +final _objc_msgSend_fjj4b8 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.Bool)>>() + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + bool)>(); +late final _sel_initWithCString_length_ = + objc.registerName("initWithCString:length:"); +late final _sel_initWithCString_ = objc.registerName("initWithCString:"); +late final _sel_stringWithCString_length_ = + objc.registerName("stringWithCString:length:"); +late final _sel_stringWithCString_ = objc.registerName("stringWithCString:"); +late final _sel_getCharacters_ = objc.registerName("getCharacters:"); +final _objc_msgSend_g3kdhc = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + +/// NSStringDeprecated +extension NSStringDeprecated on objc.NSString { + /// cString + ffi.Pointer cString() { + return _objc_msgSend_1fuqfwb(this.ref.pointer, _sel_cString); + } + + /// lossyCString + ffi.Pointer lossyCString() { + return _objc_msgSend_1fuqfwb(this.ref.pointer, _sel_lossyCString); + } + + /// cStringLength + DartNSUInteger cStringLength() { + return _objc_msgSend_xw2lbc(this.ref.pointer, _sel_cStringLength); + } + + /// getCString: + void getCString_(ffi.Pointer bytes) { + _objc_msgSend_1r7ue5f(this.ref.pointer, _sel_getCString_, bytes); + } + + /// getCString:maxLength: + void getCString_maxLength_( + ffi.Pointer bytes, DartNSUInteger maxLength) { + _objc_msgSend_1h3mito( + this.ref.pointer, _sel_getCString_maxLength_, bytes, maxLength); + } + + /// getCString:maxLength:range:remainingRange: + void getCString_maxLength_range_remainingRange_(ffi.Pointer bytes, + DartNSUInteger maxLength, NSRange aRange, NSRangePointer leftoverRange) { + _objc_msgSend_3gpdva( + this.ref.pointer, + _sel_getCString_maxLength_range_remainingRange_, + bytes, + maxLength, + aRange, + leftoverRange); + } + + /// writeToFile:atomically: + bool writeToFile_atomically_(objc.NSString path, bool useAuxiliaryFile) { + return _objc_msgSend_w8pbfh(this.ref.pointer, _sel_writeToFile_atomically_, + path.ref.pointer, useAuxiliaryFile); + } + + /// writeToURL:atomically: + bool writeToURL_atomically_(objc.NSURL url, bool atomically) { + return _objc_msgSend_w8pbfh(this.ref.pointer, _sel_writeToURL_atomically_, + url.ref.pointer, atomically); + } + + /// initWithContentsOfFile: + objc.ObjCObjectBase? initWithContentsOfFile_(objc.NSString path) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: false, release: true); + } + + /// initWithContentsOfURL: + objc.ObjCObjectBase? initWithContentsOfURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j(this.ref.retainAndReturnPointer(), + _sel_initWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: false, release: true); + } + + /// stringWithContentsOfFile: + static objc.ObjCObjectBase? stringWithContentsOfFile_(objc.NSString path) { + final _ret = _objc_msgSend_62nh5j( + _class_NSString, _sel_stringWithContentsOfFile_, path.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// stringWithContentsOfURL: + static objc.ObjCObjectBase? stringWithContentsOfURL_(objc.NSURL url) { + final _ret = _objc_msgSend_62nh5j( + _class_NSString, _sel_stringWithContentsOfURL_, url.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// initWithCStringNoCopy:length:freeWhenDone: + objc.ObjCObjectBase? initWithCStringNoCopy_length_freeWhenDone_( + ffi.Pointer bytes, DartNSUInteger length, bool freeBuffer) { + final _ret = _objc_msgSend_fjj4b8( + this.ref.retainAndReturnPointer(), + _sel_initWithCStringNoCopy_length_freeWhenDone_, + bytes, + length, + freeBuffer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: false, release: true); + } + + /// initWithCString:length: + objc.ObjCObjectBase? initWithCString_length_( + ffi.Pointer bytes, DartNSUInteger length) { + final _ret = _objc_msgSend_a15xhc(this.ref.retainAndReturnPointer(), + _sel_initWithCString_length_, bytes, length); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: false, release: true); + } + + /// initWithCString: + objc.ObjCObjectBase? initWithCString_(ffi.Pointer bytes) { + final _ret = _objc_msgSend_rqwdif( + this.ref.retainAndReturnPointer(), _sel_initWithCString_, bytes); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: false, release: true); + } + + /// stringWithCString:length: + static objc.ObjCObjectBase? stringWithCString_length_( + ffi.Pointer bytes, DartNSUInteger length) { + final _ret = _objc_msgSend_a15xhc( + _class_NSString, _sel_stringWithCString_length_, bytes, length); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// stringWithCString: + static objc.ObjCObjectBase? stringWithCString_(ffi.Pointer bytes) { + final _ret = + _objc_msgSend_rqwdif(_class_NSString, _sel_stringWithCString_, bytes); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// getCharacters: + void getCharacters_(ffi.Pointer buffer) { + _objc_msgSend_g3kdhc(this.ref.pointer, _sel_getCharacters_, buffer); + } +} + +typedef NSURLResourceKey = ffi.Pointer; +typedef DartNSURLResourceKey = objc.NSString; +typedef NSURLFileResourceType = ffi.Pointer; +typedef DartNSURLFileResourceType = objc.NSString; +typedef NSURLThumbnailDictionaryItem = ffi.Pointer; +typedef DartNSURLThumbnailDictionaryItem = objc.NSString; +typedef NSURLFileProtectionType = ffi.Pointer; +typedef DartNSURLFileProtectionType = objc.NSString; +typedef NSURLUbiquitousItemDownloadingStatus = ffi.Pointer; +typedef DartNSURLUbiquitousItemDownloadingStatus = objc.NSString; +typedef NSURLUbiquitousSharedItemRole = ffi.Pointer; +typedef DartNSURLUbiquitousSharedItemRole = objc.NSString; +typedef NSURLUbiquitousSharedItemPermissions = ffi.Pointer; +typedef DartNSURLUbiquitousSharedItemPermissions = objc.NSString; +typedef NSURLBookmarkFileCreationOptions = NSUInteger; +late final _class_NSURL = objc.getClass("NSURL"); +late final _sel_getPromisedItemResourceValue_forKey_error_ = + objc.registerName("getPromisedItemResourceValue:forKey:error:"); +final _objc_msgSend_7iv28v = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer, + ffi.Pointer>)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ffi.Pointer, + ffi.Pointer>)>(); +late final _sel_promisedItemResourceValuesForKeys_error_ = + objc.registerName("promisedItemResourceValuesForKeys:error:"); +late final _sel_checkPromisedItemIsReachableAndReturnError_ = + objc.registerName("checkPromisedItemIsReachableAndReturnError:"); +final _objc_msgSend_1dom33q = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); + +/// NSPromisedItems +extension NSPromisedItems on objc.NSURL { + /// Get resource values from URLs of 'promised' items. A promised item is not guaranteed to have its contents in the file system until you use NSFileCoordinator to perform a coordinated read on its URL, which causes the contents to be downloaded or otherwise generated. Promised item URLs are returned by various APIs, including currently: + /// - NSMetadataQueryUbiquitousDataScope + /// - NSMetadataQueryUbiquitousDocumentsScope + /// - An NSFilePresenter presenting the contents of the directory located by -URLForUbiquitousContainerIdentifier: or a subdirectory thereof + /// + /// The following methods behave identically to their similarly named methods above (-getResourceValue:forKey:error:, etc.), except that they allow you to get resource values and check for presence regardless of whether the promised item's contents currently exist at the URL. You must use these APIs instead of the normal NSURL resource value APIs if and only if any of the following are true: + /// - You are using a URL that you know came directly from one of the above APIs + /// - You are inside the accessor block of a coordinated read or write that used NSFileCoordinatorReadingImmediatelyAvailableMetadataOnly, NSFileCoordinatorWritingForDeleting, NSFileCoordinatorWritingForMoving, or NSFileCoordinatorWritingContentIndependentMetadataOnly + /// + /// Most of the NSURL resource value keys will work with these APIs. However, there are some that are tied to the item's contents that will not work, such as NSURLContentAccessDateKey or NSURLGenerationIdentifierKey. If one of these keys is used, the method will return YES, but the value for the key will be nil. + bool getPromisedItemResourceValue_forKey_error_( + ffi.Pointer> value, + DartNSURLResourceKey key, + ffi.Pointer> error) { + return _objc_msgSend_7iv28v( + this.ref.pointer, + _sel_getPromisedItemResourceValue_forKey_error_, + value, + key.ref.pointer, + error); + } + + /// promisedItemResourceValuesForKeys:error: + objc.NSDictionary? promisedItemResourceValuesForKeys_error_( + objc.NSArray keys, ffi.Pointer> error) { + final _ret = _objc_msgSend_1705co6(this.ref.pointer, + _sel_promisedItemResourceValuesForKeys_error_, keys.ref.pointer, error); + return _ret.address == 0 + ? null + : objc.NSDictionary.castFromPointer(_ret, retain: true, release: true); + } + + /// checkPromisedItemIsReachableAndReturnError: + bool checkPromisedItemIsReachableAndReturnError_( + ffi.Pointer> error) { + return _objc_msgSend_1dom33q(this.ref.pointer, + _sel_checkPromisedItemIsReachableAndReturnError_, error); + } +} + +/// NSItemProvider +extension NSItemProvider1 on objc.NSURL { + /// readableTypeIdentifiersForItemProvider + static objc.NSArray getReadableTypeIdentifiersForItemProvider() { + final _ret = _objc_msgSend_1x359cv( + _class_NSURL, _sel_readableTypeIdentifiersForItemProvider); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// objectWithItemProviderData:typeIdentifier:error: + static objc.NSURL? objectWithItemProviderData_typeIdentifier_error_( + objc.NSData data, + objc.NSString typeIdentifier, + ffi.Pointer> outError) { + final _ret = _objc_msgSend_bo6ep4( + _class_NSURL, + _sel_objectWithItemProviderData_typeIdentifier_error_, + data.ref.pointer, + typeIdentifier.ref.pointer, + outError); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// writableTypeIdentifiersForItemProvider + static objc.NSArray getWritableTypeIdentifiersForItemProvider() { + final _ret = _objc_msgSend_1x359cv( + _class_NSURL, _sel_writableTypeIdentifiersForItemProvider); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// writableTypeIdentifiersForItemProvider + objc.NSArray get writableTypeIdentifiersForItemProvider1 { + if (!objc.respondsToSelector( + this.ref.pointer, _sel_writableTypeIdentifiersForItemProvider)) { + throw objc.UnimplementedOptionalMethodException( + 'NSURL', 'writableTypeIdentifiersForItemProvider'); + } + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_writableTypeIdentifiersForItemProvider); + return objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// itemProviderVisibilityForRepresentationWithTypeIdentifier: + static objc.NSItemProviderRepresentationVisibility + itemProviderVisibilityForRepresentationWithTypeIdentifier_( + objc.NSString typeIdentifier) { + if (!objc.respondsToSelector(_class_NSURL, + _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_)) { + throw objc.UnimplementedOptionalMethodException('NSURL', + 'itemProviderVisibilityForRepresentationWithTypeIdentifier:'); + } + final _ret = _objc_msgSend_96wwe1( + _class_NSURL, + _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_, + typeIdentifier.ref.pointer); + return objc.NSItemProviderRepresentationVisibility.fromValue(_ret); + } + + /// itemProviderVisibilityForRepresentationWithTypeIdentifier: + objc.NSItemProviderRepresentationVisibility + itemProviderVisibilityForRepresentationWithTypeIdentifier_1( + objc.NSString typeIdentifier) { + if (!objc.respondsToSelector(this.ref.pointer, + _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_)) { + throw objc.UnimplementedOptionalMethodException('NSURL', + 'itemProviderVisibilityForRepresentationWithTypeIdentifier:'); + } + final _ret = _objc_msgSend_96wwe1( + this.ref.pointer, + _sel_itemProviderVisibilityForRepresentationWithTypeIdentifier_, + typeIdentifier.ref.pointer); + return objc.NSItemProviderRepresentationVisibility.fromValue(_ret); + } + + /// loadDataWithTypeIdentifier:forItemProviderCompletionHandler: + NSProgress? loadDataWithTypeIdentifier_forItemProviderCompletionHandler_( + objc.NSString typeIdentifier, + objc.ObjCBlock + completionHandler) { + final _ret = _objc_msgSend_o4sqyk( + this.ref.pointer, + _sel_loadDataWithTypeIdentifier_forItemProviderCompletionHandler_, + typeIdentifier.ref.pointer, + completionHandler.ref.pointer); + return _ret.address == 0 + ? null + : NSProgress.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _class_NSCharacterSet = objc.getClass("NSCharacterSet"); +late final _sel_URLUserAllowedCharacterSet = + objc.registerName("URLUserAllowedCharacterSet"); +late final _sel_URLPasswordAllowedCharacterSet = + objc.registerName("URLPasswordAllowedCharacterSet"); +late final _sel_URLHostAllowedCharacterSet = + objc.registerName("URLHostAllowedCharacterSet"); +late final _sel_URLPathAllowedCharacterSet = + objc.registerName("URLPathAllowedCharacterSet"); +late final _sel_URLQueryAllowedCharacterSet = + objc.registerName("URLQueryAllowedCharacterSet"); +late final _sel_URLFragmentAllowedCharacterSet = + objc.registerName("URLFragmentAllowedCharacterSet"); + +/// NSURLUtilities +extension NSURLUtilities on objc.NSCharacterSet { + /// Returns a character set containing the characters allowed in a URL's user subcomponent. + static objc.NSCharacterSet getURLUserAllowedCharacterSet() { + final _ret = _objc_msgSend_1x359cv( + _class_NSCharacterSet, _sel_URLUserAllowedCharacterSet); + return objc.NSCharacterSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// Returns a character set containing the characters allowed in a URL's password subcomponent. + static objc.NSCharacterSet getURLPasswordAllowedCharacterSet() { + final _ret = _objc_msgSend_1x359cv( + _class_NSCharacterSet, _sel_URLPasswordAllowedCharacterSet); + return objc.NSCharacterSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// Returns a character set containing the characters allowed in a URL's host subcomponent. + static objc.NSCharacterSet getURLHostAllowedCharacterSet() { + final _ret = _objc_msgSend_1x359cv( + _class_NSCharacterSet, _sel_URLHostAllowedCharacterSet); + return objc.NSCharacterSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// Returns a character set containing the characters allowed in a URL's path component. ';' is a legal path character, but it is recommended that it be percent-encoded for best compatibility with NSURL (-stringByAddingPercentEncodingWithAllowedCharacters: will percent-encode any ';' characters if you pass the URLPathAllowedCharacterSet). + static objc.NSCharacterSet getURLPathAllowedCharacterSet() { + final _ret = _objc_msgSend_1x359cv( + _class_NSCharacterSet, _sel_URLPathAllowedCharacterSet); + return objc.NSCharacterSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// Returns a character set containing the characters allowed in a URL's query component. + static objc.NSCharacterSet getURLQueryAllowedCharacterSet() { + final _ret = _objc_msgSend_1x359cv( + _class_NSCharacterSet, _sel_URLQueryAllowedCharacterSet); + return objc.NSCharacterSet.castFromPointer(_ret, + retain: true, release: true); + } + + /// Returns a character set containing the characters allowed in a URL's fragment component. + static objc.NSCharacterSet getURLFragmentAllowedCharacterSet() { + final _ret = _objc_msgSend_1x359cv( + _class_NSCharacterSet, _sel_URLFragmentAllowedCharacterSet); + return objc.NSCharacterSet.castFromPointer(_ret, + retain: true, release: true); + } +} + +late final _sel_stringByAddingPercentEncodingWithAllowedCharacters_ = + objc.registerName("stringByAddingPercentEncodingWithAllowedCharacters:"); +late final _sel_stringByRemovingPercentEncoding = + objc.registerName("stringByRemovingPercentEncoding"); +late final _sel_stringByAddingPercentEscapesUsingEncoding_ = + objc.registerName("stringByAddingPercentEscapesUsingEncoding:"); +late final _sel_stringByReplacingPercentEscapesUsingEncoding_ = + objc.registerName("stringByReplacingPercentEscapesUsingEncoding:"); + +/// NSURLUtilities +extension NSURLUtilities1 on objc.NSString { + /// Returns a new string made from the receiver by replacing all characters not in the allowedCharacters set with percent encoded characters. UTF-8 encoding is used to determine the correct percent encoded characters. Entire URL strings cannot be percent-encoded. This method is intended to percent-encode a URL component or subcomponent string, NOT the entire URL string. Any characters in allowedCharacters outside of the 7-bit ASCII range are ignored. + objc.NSString? stringByAddingPercentEncodingWithAllowedCharacters_( + objc.NSCharacterSet allowedCharacters) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, + _sel_stringByAddingPercentEncodingWithAllowedCharacters_, + allowedCharacters.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// Returns a new string made from the receiver by replacing all percent encoded sequences with the matching UTF-8 characters. + objc.NSString? get stringByRemovingPercentEncoding { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_stringByRemovingPercentEncoding); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByAddingPercentEscapesUsingEncoding: + objc.NSString? stringByAddingPercentEscapesUsingEncoding_( + DartNSUInteger enc) { + final _ret = _objc_msgSend_1qrcblu( + this.ref.pointer, _sel_stringByAddingPercentEscapesUsingEncoding_, enc); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// stringByReplacingPercentEscapesUsingEncoding: + objc.NSString? stringByReplacingPercentEscapesUsingEncoding_( + DartNSUInteger enc) { + final _ret = _objc_msgSend_1qrcblu(this.ref.pointer, + _sel_stringByReplacingPercentEscapesUsingEncoding_, enc); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _sel_fileURLWithPathComponents_ = + objc.registerName("fileURLWithPathComponents:"); +late final _sel_pathComponents = objc.registerName("pathComponents"); +late final _sel_lastPathComponent = objc.registerName("lastPathComponent"); +late final _sel_pathExtension = objc.registerName("pathExtension"); +late final _sel_URLByAppendingPathComponent_ = + objc.registerName("URLByAppendingPathComponent:"); +late final _sel_URLByAppendingPathComponent_isDirectory_ = + objc.registerName("URLByAppendingPathComponent:isDirectory:"); +late final _sel_URLByDeletingLastPathComponent = + objc.registerName("URLByDeletingLastPathComponent"); +late final _sel_URLByAppendingPathExtension_ = + objc.registerName("URLByAppendingPathExtension:"); +late final _sel_URLByDeletingPathExtension = + objc.registerName("URLByDeletingPathExtension"); +late final _sel_checkResourceIsReachableAndReturnError_ = + objc.registerName("checkResourceIsReachableAndReturnError:"); +late final _sel_URLByStandardizingPath = + objc.registerName("URLByStandardizingPath"); +late final _sel_URLByResolvingSymlinksInPath = + objc.registerName("URLByResolvingSymlinksInPath"); + +/// NSURLPathUtilities +extension NSURLPathUtilities on objc.NSURL { + /// The following methods work on the path portion of a URL in the same manner that the NSPathUtilities methods on NSString do. + static objc.NSURL? fileURLWithPathComponents_(objc.NSArray components) { + final _ret = _objc_msgSend_62nh5j( + _class_NSURL, _sel_fileURLWithPathComponents_, components.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// pathComponents + objc.NSArray? get pathComponents { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_pathComponents); + return _ret.address == 0 + ? null + : objc.NSArray.castFromPointer(_ret, retain: true, release: true); + } + + /// lastPathComponent + objc.NSString? get lastPathComponent { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_lastPathComponent); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// pathExtension + objc.NSString? get pathExtension { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_pathExtension); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// URLByAppendingPathComponent: + objc.NSURL? URLByAppendingPathComponent_(objc.NSString pathComponent) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_URLByAppendingPathComponent_, pathComponent.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// URLByAppendingPathComponent:isDirectory: + objc.NSURL? URLByAppendingPathComponent_isDirectory_( + objc.NSString pathComponent, bool isDirectory) { + final _ret = _objc_msgSend_1bdmr5f( + this.ref.pointer, + _sel_URLByAppendingPathComponent_isDirectory_, + pathComponent.ref.pointer, + isDirectory); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// URLByDeletingLastPathComponent + objc.NSURL? get URLByDeletingLastPathComponent { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_URLByDeletingLastPathComponent); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// URLByAppendingPathExtension: + objc.NSURL? URLByAppendingPathExtension_(objc.NSString pathExtension) { + final _ret = _objc_msgSend_62nh5j(this.ref.pointer, + _sel_URLByAppendingPathExtension_, pathExtension.ref.pointer); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// URLByDeletingPathExtension + objc.NSURL? get URLByDeletingPathExtension { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_URLByDeletingPathExtension); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// Returns whether the URL's resource exists and is reachable. This method synchronously checks if the resource's backing store is reachable. Checking reachability is appropriate when making decisions that do not require other immediate operations on the resource, e.g. periodic maintenance of UI state that depends on the existence of a specific document. When performing operations such as opening a file or copying resource properties, it is more efficient to simply try the operation and handle failures. If this method returns NO, the optional error is populated. This method is currently applicable only to URLs for file system resources. For other URL types, NO is returned. Symbol is present in iOS 4, but performs no operation. + bool checkResourceIsReachableAndReturnError_( + ffi.Pointer> error) { + return _objc_msgSend_1dom33q( + this.ref.pointer, _sel_checkResourceIsReachableAndReturnError_, error); + } + + /// URLByStandardizingPath + objc.NSURL? get URLByStandardizingPath { + final _ret = + _objc_msgSend_1x359cv(this.ref.pointer, _sel_URLByStandardizingPath); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } + + /// URLByResolvingSymlinksInPath + objc.NSURL? get URLByResolvingSymlinksInPath { + final _ret = _objc_msgSend_1x359cv( + this.ref.pointer, _sel_URLByResolvingSymlinksInPath); + return _ret.address == 0 + ? null + : objc.NSURL.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _sel_URL_resourceDataDidBecomeAvailable_ = + objc.registerName("URL:resourceDataDidBecomeAvailable:"); +late final _sel_URLResourceDidFinishLoading_ = + objc.registerName("URLResourceDidFinishLoading:"); +late final _sel_URLResourceDidCancelLoading_ = + objc.registerName("URLResourceDidCancelLoading:"); +late final _sel_URL_resourceDidFailLoadingWithReason_ = + objc.registerName("URL:resourceDidFailLoadingWithReason:"); + +/// NSURLClient +extension NSURLClient on objc.NSObject { + /// URL:resourceDataDidBecomeAvailable: + void URL_resourceDataDidBecomeAvailable_( + objc.NSURL sender, objc.NSData newBytes) { + _objc_msgSend_wjvic9( + this.ref.pointer, + _sel_URL_resourceDataDidBecomeAvailable_, + sender.ref.pointer, + newBytes.ref.pointer); + } + + /// URLResourceDidFinishLoading: + void URLResourceDidFinishLoading_(objc.NSURL sender) { + _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_URLResourceDidFinishLoading_, + sender.ref.pointer); + } + + /// URLResourceDidCancelLoading: + void URLResourceDidCancelLoading_(objc.NSURL sender) { + _objc_msgSend_1jdvcbf(this.ref.pointer, _sel_URLResourceDidCancelLoading_, + sender.ref.pointer); + } + + /// URL:resourceDidFailLoadingWithReason: + void URL_resourceDidFailLoadingWithReason_( + objc.NSURL sender, objc.NSString reason) { + _objc_msgSend_wjvic9( + this.ref.pointer, + _sel_URL_resourceDidFailLoadingWithReason_, + sender.ref.pointer, + reason.ref.pointer); + } +} + +late final _sel_resourceDataUsingCache_ = + objc.registerName("resourceDataUsingCache:"); +late final _sel_loadResourceDataNotifyingClient_usingCache_ = + objc.registerName("loadResourceDataNotifyingClient:usingCache:"); +late final _sel_propertyForKey_ = objc.registerName("propertyForKey:"); +late final _sel_setResourceData_ = objc.registerName("setResourceData:"); +late final _sel_setProperty_forKey_ = objc.registerName("setProperty:forKey:"); +final _objc_msgSend_1lqxdg3 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_URLHandleUsingCache_ = + objc.registerName("URLHandleUsingCache:"); + +/// NSURLLoading +extension NSURLLoading on objc.NSURL { + /// Blocks to load the data if necessary. If shouldUseCache is YES, then if an equivalent URL has already been loaded and cached, its resource data will be returned immediately. If shouldUseCache is NO, a new load will be started + objc.NSData? resourceDataUsingCache_(bool shouldUseCache) { + final _ret = _objc_msgSend_1l3kbc1( + this.ref.pointer, _sel_resourceDataUsingCache_, shouldUseCache); + return _ret.address == 0 + ? null + : objc.NSData.castFromPointer(_ret, retain: true, release: true); + } + + /// Starts an asynchronous load of the data, registering delegate to receive notification. Only one such background load can proceed at a time. + void loadResourceDataNotifyingClient_usingCache_( + objc.ObjCObjectBase client, bool shouldUseCache) { + _objc_msgSend_gk45w7( + this.ref.pointer, + _sel_loadResourceDataNotifyingClient_usingCache_, + client.ref.pointer, + shouldUseCache); + } + + /// propertyForKey: + objc.ObjCObjectBase? propertyForKey_(objc.NSString propertyKey) { + final _ret = _objc_msgSend_62nh5j( + this.ref.pointer, _sel_propertyForKey_, propertyKey.ref.pointer); + return _ret.address == 0 + ? null + : objc.ObjCObjectBase(_ret, retain: true, release: true); + } + + /// These attempt to write the given arguments for the resource specified by the URL; they return success or failure + bool setResourceData_(objc.NSData data) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_setResourceData_, data.ref.pointer); + } + + /// setProperty:forKey: + bool setProperty_forKey_( + objc.ObjCObjectBase property, objc.NSString propertyKey) { + return _objc_msgSend_1lqxdg3(this.ref.pointer, _sel_setProperty_forKey_, + property.ref.pointer, propertyKey.ref.pointer); + } + + /// Sophisticated clients will want to ask for this, then message the handle directly. If shouldUseCache is NO, a newly instantiated handle is returned, even if an equivalent URL has been loaded + objc.NSURLHandle? URLHandleUsingCache_(bool shouldUseCache) { + final _ret = _objc_msgSend_1l3kbc1( + this.ref.pointer, _sel_URLHandleUsingCache_, shouldUseCache); + return _ret.address == 0 + ? null + : objc.NSURLHandle.castFromPointer(_ret, retain: true, release: true); + } +} + +late final _class_NSCondition = objc.getClass("NSCondition"); +late final _sel_wait = objc.registerName("wait"); +late final _sel_waitUntilDate_ = objc.registerName("waitUntilDate:"); +late final _sel_signal = objc.registerName("signal"); +late final _sel_broadcast = objc.registerName("broadcast"); +late final _sel_lock = objc.registerName("lock"); +void _ObjCBlock_ffiVoid_ffiVoid_fnPtrTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + block.ref.target + .cast< + ffi.NativeFunction arg0)>>() + .asFunction)>()(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_fnPtrTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_closureTrampoline( + ffi.Pointer block, ffi.Pointer arg0) => + (objc.getBlockClosure(block) as void Function(ffi.Pointer))(arg0); +ffi.Pointer _ObjCBlock_ffiVoid_ffiVoid_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)>( + _ObjCBlock_ffiVoid_ffiVoid_closureTrampoline) + .cast(); +void _ObjCBlock_ffiVoid_ffiVoid_listenerTrampoline( + ffi.Pointer block, ffi.Pointer arg0) { + (objc.getBlockClosure(block) as void Function(ffi.Pointer))(arg0); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, ffi.Pointer)> + _ObjCBlock_ffiVoid_ffiVoid_listenerCallable = ffi.NativeCallable< + ffi.Void Function(ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_ffiVoid_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock)>`. +abstract final class ObjCBlock_ffiVoid_ffiVoid { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock)>(pointer, + retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> fromFunctionPointer( + ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer arg0)>> + ptr) => + objc.ObjCBlock)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_ffiVoid_fnPtrCallable, ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock)> fromFunction( + void Function(ffi.Pointer) fn) => + objc.ObjCBlock)>( + objc.newClosureBlock(_ObjCBlock_ffiVoid_ffiVoid_closureCallable, + (ffi.Pointer arg0) => fn(arg0)), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock)> listener( + void Function(ffi.Pointer) fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_ffiVoid_listenerCallable.nativeFunction.cast(), + (ffi.Pointer arg0) => fn(arg0)); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_ovsamd(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock)>(wrapper, + retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock)>`. +extension ObjCBlock_ffiVoid_ffiVoid_CallExtension + on objc.ObjCBlock)> { + void call(ffi.Pointer arg0) => ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer block, + ffi.Pointer arg0)>>() + .asFunction< + void Function(ffi.Pointer, + ffi.Pointer)>()(ref.pointer, arg0); +} + +late final _sel_unlock = objc.registerName("unlock"); + +/// NSCondition +class NSCondition extends objc.NSObject { + NSCondition._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSCondition] that points to the same underlying object as [other]. + NSCondition.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSCondition] that wraps the given raw object pointer. + NSCondition.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); + + /// Returns whether [obj] is an instance of [NSCondition]. + static bool isInstance(objc.ObjCObjectBase obj) { + return _objc_msgSend_69e0x1( + obj.ref.pointer, _sel_isKindOfClass_, _class_NSCondition); + } + + /// wait + void wait1() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_wait); + } + + /// waitUntilDate: + bool waitUntilDate_(objc.NSDate limit) { + return _objc_msgSend_69e0x1( + this.ref.pointer, _sel_waitUntilDate_, limit.ref.pointer); + } + + /// signal + void signal() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_signal); + } + + /// broadcast + void broadcast() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_broadcast); + } + + /// name + objc.NSString? get name { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_name); + return _ret.address == 0 + ? null + : objc.NSString.castFromPointer(_ret, retain: true, release: true); + } + + /// setName: + set name(objc.NSString? value) { + return _objc_msgSend_1jdvcbf( + this.ref.pointer, _sel_setName_, value?.ref.pointer ?? ffi.nullptr); + } + + /// init + NSCondition init() { + final _ret = + _objc_msgSend_1x359cv(this.ref.retainAndReturnPointer(), _sel_init); + return NSCondition.castFromPointer(_ret, retain: false, release: true); + } + + /// new + static NSCondition new1() { + final _ret = _objc_msgSend_1x359cv(_class_NSCondition, _sel_new); + return NSCondition.castFromPointer(_ret, retain: false, release: true); + } + + /// allocWithZone: + static NSCondition allocWithZone_(ffi.Pointer<_NSZone> zone) { + final _ret = + _objc_msgSend_hzlb60(_class_NSCondition, _sel_allocWithZone_, zone); + return NSCondition.castFromPointer(_ret, retain: false, release: true); + } + + /// alloc + static NSCondition alloc() { + final _ret = _objc_msgSend_1x359cv(_class_NSCondition, _sel_alloc); + return NSCondition.castFromPointer(_ret, retain: false, release: true); + } + + /// self + NSCondition self() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_self); + return NSCondition.castFromPointer(_ret, retain: true, release: true); + } + + /// retain + NSCondition retain() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_retain); + return NSCondition.castFromPointer(_ret, retain: true, release: true); + } + + /// autorelease + NSCondition autorelease() { + final _ret = _objc_msgSend_1x359cv(this.ref.pointer, _sel_autorelease); + return NSCondition.castFromPointer(_ret, retain: true, release: true); + } + + /// lock + void lock() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_lock); + } + + /// unlock + void unlock() { + _objc_msgSend_1pl9qdv(this.ref.pointer, _sel_unlock); + } +} + +typedef NSProgressKind1 = ffi.Pointer; +typedef DartNSProgressKind1 = objc.NSString; +typedef NSProgressUserInfoKey1 = ffi.Pointer; +typedef DartNSProgressUserInfoKey1 = objc.NSString; +typedef NSProgressFileOperationKind1 = ffi.Pointer; +typedef DartNSProgressFileOperationKind1 = objc.NSString; +typedef NSProgressUnpublishingHandler1 = ffi.Pointer; +typedef DartNSProgressUnpublishingHandler1 + = objc.ObjCBlock; +typedef NSProgressPublishingHandler1 = ffi.Pointer; +typedef DartNSProgressPublishingHandler1 + = objc.ObjCBlock? Function(NSProgress)>; + +/// WARNING: NSException is a stub. To generate bindings for this class, include +/// NSException in your config's objc-interfaces list. +/// +/// NSException +class NSException extends objc.NSObject { + NSException._(ffi.Pointer pointer, + {bool retain = false, bool release = false}) + : super.castFromPointer(pointer, retain: retain, release: release); + + /// Constructs a [NSException] that points to the same underlying object as [other]. + NSException.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [NSException] that wraps the given raw object pointer. + NSException.castFromPointer(ffi.Pointer other, + {bool retain = false, bool release = false}) + : this._(other, retain: retain, release: release); +} + +late final _class_NSException = objc.getClass("NSException"); +late final _sel_raise_format_ = objc.registerName("raise:format:"); + +/// NSExceptionRaisingConveniences +extension NSExceptionRaisingConveniences on NSException { + /// raise:format: + static void raise_format_(DartNSExceptionName name, objc.NSString format) { + _objc_msgSend_wjvic9(_class_NSException, _sel_raise_format_, + name.ref.pointer, format.ref.pointer); + } +} + +typedef NSUncaughtExceptionHandler = ffi + .NativeFunction exception)>; + +enum NSOperationQueuePriority { + NSOperationQueuePriorityVeryLow(-8), + NSOperationQueuePriorityLow(-4), + NSOperationQueuePriorityNormal(0), + NSOperationQueuePriorityHigh(4), + NSOperationQueuePriorityVeryHigh(8); + + final int value; + const NSOperationQueuePriority(this.value); + + static NSOperationQueuePriority fromValue(int value) => switch (value) { + -8 => NSOperationQueuePriorityVeryLow, + -4 => NSOperationQueuePriorityLow, + 0 => NSOperationQueuePriorityNormal, + 4 => NSOperationQueuePriorityHigh, + 8 => NSOperationQueuePriorityVeryHigh, + _ => throw ArgumentError( + "Unknown value for NSOperationQueuePriority: $value"), + }; +} + +typedef NSErrorDomain = ffi.Pointer; +typedef DartNSErrorDomain = objc.NSString; +typedef NSErrorUserInfoKey = ffi.Pointer; +typedef DartNSErrorUserInfoKey = objc.NSString; +late final _sel_attemptRecoveryFromError_optionIndex_delegate_didRecoverSelector_contextInfo_ = + objc.registerName( + "attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:"); +final _objc_msgSend_3kga1r = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); +late final _sel_attemptRecoveryFromError_optionIndex_ = + objc.registerName("attemptRecoveryFromError:optionIndex:"); +final _objc_msgSend_1yvrem6 = objc.msgSendPointer + .cast< + ffi.NativeFunction< + ffi.Bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedLong)>>() + .asFunction< + bool Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int)>(); + +/// NSErrorRecoveryAttempting +extension NSErrorRecoveryAttempting on objc.NSObject { + /// Given that an error alert has been presented document-modally to the user, and the user has chosen one of the error's recovery options, attempt recovery from the error, and send the selected message to the specified delegate. The option index is an index into the error's array of localized recovery options. The method selected by didRecoverSelector must have the same signature as: + /// + /// - (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo; + /// + /// The value passed for didRecover must be YES if error recovery was completely successful, NO otherwise. + void + attemptRecoveryFromError_optionIndex_delegate_didRecoverSelector_contextInfo_( + objc.NSError error, + DartNSUInteger recoveryOptionIndex, + objc.ObjCObjectBase? delegate, + ffi.Pointer didRecoverSelector, + ffi.Pointer contextInfo) { + _objc_msgSend_3kga1r( + this.ref.pointer, + _sel_attemptRecoveryFromError_optionIndex_delegate_didRecoverSelector_contextInfo_, + error.ref.pointer, + recoveryOptionIndex, + delegate?.ref.pointer ?? ffi.nullptr, + didRecoverSelector, + contextInfo); + } + + /// Given that an error alert has been presented applicaton-modally to the user, and the user has chosen one of the error's recovery options, attempt recovery from the error, and return YES if error recovery was completely successful, NO otherwise. The recovery option index is an index into the error's array of localized recovery options. + bool attemptRecoveryFromError_optionIndex_( + objc.NSError error, DartNSUInteger recoveryOptionIndex) { + return _objc_msgSend_1yvrem6( + this.ref.pointer, + _sel_attemptRecoveryFromError_optionIndex_, + error.ref.pointer, + recoveryOptionIndex); + } +} + +typedef NSURLResourceKey1 = ffi.Pointer; +typedef DartNSURLResourceKey1 = objc.NSString; +typedef NSURLFileResourceType1 = ffi.Pointer; +typedef DartNSURLFileResourceType1 = objc.NSString; +typedef NSURLThumbnailDictionaryItem1 = ffi.Pointer; +typedef DartNSURLThumbnailDictionaryItem1 = objc.NSString; +typedef NSURLFileProtectionType1 = ffi.Pointer; +typedef DartNSURLFileProtectionType1 = objc.NSString; +typedef NSURLUbiquitousItemDownloadingStatus1 = ffi.Pointer; +typedef DartNSURLUbiquitousItemDownloadingStatus1 = objc.NSString; +typedef NSURLUbiquitousSharedItemRole1 = ffi.Pointer; +typedef DartNSURLUbiquitousSharedItemRole1 = objc.NSString; +typedef NSURLUbiquitousSharedItemPermissions1 = ffi.Pointer; +typedef DartNSURLUbiquitousSharedItemPermissions1 = objc.NSString; +typedef NSURLBookmarkFileCreationOptions1 = NSUInteger; +typedef _DidFinish = ffi.Pointer; +typedef Dart_DidFinish = objc.ObjCBlock< + ffi.Void Function(ffi.Pointer, NSURLSession, + NSURLSessionDownloadTask, objc.NSURL)>; +void + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_fnPtrTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + block.ref.target + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_fnPtrCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_fnPtrTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_closureTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); +ffi.Pointer + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_closureCallable = + ffi.Pointer.fromFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>( + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_closureTrampoline) + .cast(); +void + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_listenerTrampoline( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) { + (objc.getBlockClosure(block) as void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer))(arg0, arg1, arg2, arg3); + objc.objectRelease(block.cast()); +} + +ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)> + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_listenerCallable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>.listener( + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_listenerTrampoline) + ..keepIsolateAlive = false; + +/// Construction methods for `objc.ObjCBlock`. +abstract final class ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL { + /// Returns a block that wraps the given raw block pointer. + static objc.ObjCBlock< + ffi.Void Function( + NSCondition, NSURLSession, NSURLSessionDownloadTask, objc.NSURL)> + castFromPointer(ffi.Pointer pointer, + {bool retain = false, bool release = false}) => + objc.ObjCBlock< + ffi.Void Function( + NSCondition, + NSURLSession, + NSURLSessionDownloadTask, + objc.NSURL)>(pointer, retain: retain, release: release); + + /// Creates a block from a C function pointer. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock + fromFunctionPointer(ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ffi.Pointer arg3)>> ptr) => + objc.ObjCBlock< + ffi.Void Function(NSCondition, NSURLSession, + NSURLSessionDownloadTask, objc.NSURL)>( + objc.newPointerBlock( + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_fnPtrCallable, + ptr.cast()), + retain: false, + release: true); + + /// Creates a block from a Dart function. + /// + /// This block must be invoked by native code running on the same thread as + /// the isolate that registered it. Invoking the block on the wrong thread + /// will result in a crash. + static objc.ObjCBlock fromFunction(void Function(NSCondition, NSURLSession, NSURLSessionDownloadTask, objc.NSURL) fn) => + objc.ObjCBlock( + objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_closureCallable, + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + NSCondition.castFromPointer(arg0, retain: true, release: true), + NSURLSession.castFromPointer(arg1, retain: true, release: true), + NSURLSessionDownloadTask.castFromPointer(arg2, retain: true, release: true), + objc.NSURL.castFromPointer(arg3, retain: true, release: true))), + retain: false, + release: true); + + /// Creates a listener block from a Dart function. + /// + /// This is based on FFI's NativeCallable.listener, and has the same + /// capabilities and limitations. This block can be invoked from any thread, + /// but only supports void functions, and is not run synchronously. See + /// NativeCallable.listener for more details. + /// + /// Note that unlike the default behavior of NativeCallable.listener, listener + /// blocks do not keep the isolate alive. + static objc.ObjCBlock< + ffi.Void Function(NSCondition, NSURLSession, NSURLSessionDownloadTask, + objc.NSURL)> listener( + void Function( + NSCondition, NSURLSession, NSURLSessionDownloadTask, objc.NSURL) + fn) { + final raw = objc.newClosureBlock( + _ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_listenerCallable + .nativeFunction + .cast(), + (ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3) => + fn( + NSCondition.castFromPointer(arg0, retain: false, release: true), + NSURLSession.castFromPointer(arg1, + retain: false, release: true), + NSURLSessionDownloadTask.castFromPointer(arg2, + retain: false, release: true), + objc.NSURL + .castFromPointer(arg3, retain: false, release: true))); + final wrapper = _NativeCupertinoHttp_wrapListenerBlock_4ya7yd(raw); + objc.objectRelease(raw.cast()); + return objc.ObjCBlock< + ffi.Void Function(NSCondition, NSURLSession, NSURLSessionDownloadTask, + objc.NSURL)>(wrapper, retain: false, release: true); + } +} + +/// Call operator for `objc.ObjCBlock`. +extension ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL_CallExtension + on objc.ObjCBlock< + ffi.Void Function( + NSCondition, NSURLSession, NSURLSessionDownloadTask, objc.NSURL)> { + void call(NSCondition arg0, NSURLSession arg1, NSURLSessionDownloadTask arg2, + objc.NSURL arg3) => + ref.pointer.ref.invoke + .cast< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer block, + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ffi.Pointer arg3)>>() + .asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>()( + ref.pointer, + arg0.ref.pointer, + arg1.ref.pointer, + arg2.ref.pointer, + arg3.ref.pointer); +} + +typedef _DidFinishWithLock = ffi.Pointer; +typedef Dart_DidFinishWithLock = objc.ObjCBlock< + ffi.Void Function( + NSCondition, NSURLSession, NSURLSessionDownloadTask, objc.NSURL)>; + +const int noErr = 0; + +const int kNilOptions = 0; + +const int kVariableLengthArray = 1; + +const int kUnknownType = 1061109567; + +const int normal = 0; + +const int bold = 1; + +const int italic = 2; + +const int underline = 4; + +const int outline = 8; + +const int shadow = 16; + +const int condense = 32; + +const int extend = 64; + +const int developStage = 32; + +const int alphaStage = 64; + +const int betaStage = 96; + +const int finalStage = 128; + +const int NSScannedOption = 1; + +const int NSCollectorDisabledOption = 2; + +const int noErr1 = 0; + +const int kNilOptions1 = 0; + +const int kVariableLengthArray1 = 1; + +const int kUnknownType1 = 1061109567; + +const int normal1 = 0; + +const int bold1 = 1; + +const int italic1 = 2; + +const int underline1 = 4; + +const int outline1 = 8; + +const int shadow1 = 16; + +const int condense1 = 32; + +const int extend1 = 64; + +const int developStage1 = 32; + +const int alphaStage1 = 64; + +const int betaStage1 = 96; + +const int finalStage1 = 128; + +const int NSScannedOption1 = 1; + +const int NSCollectorDisabledOption1 = 2; + +const int noErr2 = 0; + +const int kNilOptions2 = 0; + +const int kVariableLengthArray2 = 1; + +const int kUnknownType2 = 1061109567; + +const int normal2 = 0; + +const int bold2 = 1; + +const int italic2 = 2; + +const int underline2 = 4; + +const int outline2 = 8; + +const int shadow2 = 16; + +const int condense2 = 32; + +const int extend2 = 64; + +const int developStage2 = 32; + +const int alphaStage2 = 64; + +const int betaStage2 = 96; + +const int finalStage2 = 128; + +const int NSScannedOption2 = 1; + +const int NSCollectorDisabledOption2 = 2; + +const int errSecSuccess = 0; + +const int errSecUnimplemented = -4; + +const int errSecDiskFull = -34; + +const int errSecDskFull = -34; + +const int errSecIO = -36; + +const int errSecOpWr = -49; + +const int errSecParam = -50; + +const int errSecWrPerm = -61; + +const int errSecAllocate = -108; + +const int errSecUserCanceled = -128; + +const int errSecBadReq = -909; + +const int errSecInternalComponent = -2070; + +const int errSecCoreFoundationUnknown = -4960; + +const int errSecMissingEntitlement = -34018; + +const int errSecRestrictedAPI = -34020; + +const int errSecNotAvailable = -25291; + +const int errSecReadOnly = -25292; + +const int errSecAuthFailed = -25293; + +const int errSecNoSuchKeychain = -25294; + +const int errSecInvalidKeychain = -25295; + +const int errSecDuplicateKeychain = -25296; + +const int errSecDuplicateCallback = -25297; + +const int errSecInvalidCallback = -25298; + +const int errSecDuplicateItem = -25299; + +const int errSecItemNotFound = -25300; + +const int errSecBufferTooSmall = -25301; + +const int errSecDataTooLarge = -25302; + +const int errSecNoSuchAttr = -25303; + +const int errSecInvalidItemRef = -25304; + +const int errSecInvalidSearchRef = -25305; + +const int errSecNoSuchClass = -25306; + +const int errSecNoDefaultKeychain = -25307; + +const int errSecInteractionNotAllowed = -25308; + +const int errSecReadOnlyAttr = -25309; + +const int errSecWrongSecVersion = -25310; + +const int errSecKeySizeNotAllowed = -25311; + +const int errSecNoStorageModule = -25312; + +const int errSecNoCertificateModule = -25313; + +const int errSecNoPolicyModule = -25314; + +const int errSecInteractionRequired = -25315; + +const int errSecDataNotAvailable = -25316; + +const int errSecDataNotModifiable = -25317; + +const int errSecCreateChainFailed = -25318; + +const int errSecInvalidPrefsDomain = -25319; + +const int errSecInDarkWake = -25320; + +const int errSecACLNotSimple = -25240; + +const int errSecPolicyNotFound = -25241; + +const int errSecInvalidTrustSetting = -25242; + +const int errSecNoAccessForItem = -25243; + +const int errSecInvalidOwnerEdit = -25244; + +const int errSecTrustNotAvailable = -25245; + +const int errSecUnsupportedFormat = -25256; + +const int errSecUnknownFormat = -25257; + +const int errSecKeyIsSensitive = -25258; + +const int errSecMultiplePrivKeys = -25259; + +const int errSecPassphraseRequired = -25260; + +const int errSecInvalidPasswordRef = -25261; + +const int errSecInvalidTrustSettings = -25262; + +const int errSecNoTrustSettings = -25263; + +const int errSecPkcs12VerifyFailure = -25264; + +const int errSecNotSigner = -26267; + +const int errSecDecode = -26275; + +const int errSecServiceNotAvailable = -67585; + +const int errSecInsufficientClientID = -67586; + +const int errSecDeviceReset = -67587; + +const int errSecDeviceFailed = -67588; + +const int errSecAppleAddAppACLSubject = -67589; + +const int errSecApplePublicKeyIncomplete = -67590; + +const int errSecAppleSignatureMismatch = -67591; + +const int errSecAppleInvalidKeyStartDate = -67592; + +const int errSecAppleInvalidKeyEndDate = -67593; + +const int errSecConversionError = -67594; + +const int errSecAppleSSLv2Rollback = -67595; + +const int errSecQuotaExceeded = -67596; + +const int errSecFileTooBig = -67597; + +const int errSecInvalidDatabaseBlob = -67598; + +const int errSecInvalidKeyBlob = -67599; + +const int errSecIncompatibleDatabaseBlob = -67600; + +const int errSecIncompatibleKeyBlob = -67601; + +const int errSecHostNameMismatch = -67602; + +const int errSecUnknownCriticalExtensionFlag = -67603; + +const int errSecNoBasicConstraints = -67604; + +const int errSecNoBasicConstraintsCA = -67605; + +const int errSecInvalidAuthorityKeyID = -67606; + +const int errSecInvalidSubjectKeyID = -67607; + +const int errSecInvalidKeyUsageForPolicy = -67608; + +const int errSecInvalidExtendedKeyUsage = -67609; + +const int errSecInvalidIDLinkage = -67610; + +const int errSecPathLengthConstraintExceeded = -67611; + +const int errSecInvalidRoot = -67612; + +const int errSecCRLExpired = -67613; + +const int errSecCRLNotValidYet = -67614; + +const int errSecCRLNotFound = -67615; + +const int errSecCRLServerDown = -67616; + +const int errSecCRLBadURI = -67617; + +const int errSecUnknownCertExtension = -67618; + +const int errSecUnknownCRLExtension = -67619; + +const int errSecCRLNotTrusted = -67620; + +const int errSecCRLPolicyFailed = -67621; + +const int errSecIDPFailure = -67622; + +const int errSecSMIMEEmailAddressesNotFound = -67623; + +const int errSecSMIMEBadExtendedKeyUsage = -67624; + +const int errSecSMIMEBadKeyUsage = -67625; + +const int errSecSMIMEKeyUsageNotCritical = -67626; + +const int errSecSMIMENoEmailAddress = -67627; + +const int errSecSMIMESubjAltNameNotCritical = -67628; + +const int errSecSSLBadExtendedKeyUsage = -67629; + +const int errSecOCSPBadResponse = -67630; + +const int errSecOCSPBadRequest = -67631; + +const int errSecOCSPUnavailable = -67632; + +const int errSecOCSPStatusUnrecognized = -67633; + +const int errSecEndOfData = -67634; + +const int errSecIncompleteCertRevocationCheck = -67635; + +const int errSecNetworkFailure = -67636; + +const int errSecOCSPNotTrustedToAnchor = -67637; + +const int errSecRecordModified = -67638; + +const int errSecOCSPSignatureError = -67639; + +const int errSecOCSPNoSigner = -67640; + +const int errSecOCSPResponderMalformedReq = -67641; + +const int errSecOCSPResponderInternalError = -67642; + +const int errSecOCSPResponderTryLater = -67643; + +const int errSecOCSPResponderSignatureRequired = -67644; + +const int errSecOCSPResponderUnauthorized = -67645; + +const int errSecOCSPResponseNonceMismatch = -67646; + +const int errSecCodeSigningBadCertChainLength = -67647; + +const int errSecCodeSigningNoBasicConstraints = -67648; + +const int errSecCodeSigningBadPathLengthConstraint = -67649; + +const int errSecCodeSigningNoExtendedKeyUsage = -67650; + +const int errSecCodeSigningDevelopment = -67651; + +const int errSecResourceSignBadCertChainLength = -67652; + +const int errSecResourceSignBadExtKeyUsage = -67653; + +const int errSecTrustSettingDeny = -67654; + +const int errSecInvalidSubjectName = -67655; + +const int errSecUnknownQualifiedCertStatement = -67656; + +const int errSecMobileMeRequestQueued = -67657; + +const int errSecMobileMeRequestRedirected = -67658; + +const int errSecMobileMeServerError = -67659; + +const int errSecMobileMeServerNotAvailable = -67660; + +const int errSecMobileMeServerAlreadyExists = -67661; + +const int errSecMobileMeServerServiceErr = -67662; + +const int errSecMobileMeRequestAlreadyPending = -67663; + +const int errSecMobileMeNoRequestPending = -67664; + +const int errSecMobileMeCSRVerifyFailure = -67665; + +const int errSecMobileMeFailedConsistencyCheck = -67666; + +const int errSecNotInitialized = -67667; + +const int errSecInvalidHandleUsage = -67668; + +const int errSecPVCReferentNotFound = -67669; + +const int errSecFunctionIntegrityFail = -67670; + +const int errSecInternalError = -67671; + +const int errSecMemoryError = -67672; + +const int errSecInvalidData = -67673; + +const int errSecMDSError = -67674; + +const int errSecInvalidPointer = -67675; + +const int errSecSelfCheckFailed = -67676; + +const int errSecFunctionFailed = -67677; + +const int errSecModuleManifestVerifyFailed = -67678; + +const int errSecInvalidGUID = -67679; + +const int errSecInvalidHandle = -67680; + +const int errSecInvalidDBList = -67681; + +const int errSecInvalidPassthroughID = -67682; + +const int errSecInvalidNetworkAddress = -67683; + +const int errSecCRLAlreadySigned = -67684; + +const int errSecInvalidNumberOfFields = -67685; + +const int errSecVerificationFailure = -67686; + +const int errSecUnknownTag = -67687; + +const int errSecInvalidSignature = -67688; + +const int errSecInvalidName = -67689; + +const int errSecInvalidCertificateRef = -67690; + +const int errSecInvalidCertificateGroup = -67691; + +const int errSecTagNotFound = -67692; + +const int errSecInvalidQuery = -67693; + +const int errSecInvalidValue = -67694; + +const int errSecCallbackFailed = -67695; + +const int errSecACLDeleteFailed = -67696; + +const int errSecACLReplaceFailed = -67697; + +const int errSecACLAddFailed = -67698; + +const int errSecACLChangeFailed = -67699; + +const int errSecInvalidAccessCredentials = -67700; + +const int errSecInvalidRecord = -67701; + +const int errSecInvalidACL = -67702; + +const int errSecInvalidSampleValue = -67703; + +const int errSecIncompatibleVersion = -67704; + +const int errSecPrivilegeNotGranted = -67705; + +const int errSecInvalidScope = -67706; + +const int errSecPVCAlreadyConfigured = -67707; + +const int errSecInvalidPVC = -67708; + +const int errSecEMMLoadFailed = -67709; + +const int errSecEMMUnloadFailed = -67710; + +const int errSecAddinLoadFailed = -67711; + +const int errSecInvalidKeyRef = -67712; + +const int errSecInvalidKeyHierarchy = -67713; + +const int errSecAddinUnloadFailed = -67714; + +const int errSecLibraryReferenceNotFound = -67715; + +const int errSecInvalidAddinFunctionTable = -67716; + +const int errSecInvalidServiceMask = -67717; + +const int errSecModuleNotLoaded = -67718; + +const int errSecInvalidSubServiceID = -67719; + +const int errSecAttributeNotInContext = -67720; + +const int errSecModuleManagerInitializeFailed = -67721; + +const int errSecModuleManagerNotFound = -67722; + +const int errSecEventNotificationCallbackNotFound = -67723; + +const int errSecInputLengthError = -67724; + +const int errSecOutputLengthError = -67725; + +const int errSecPrivilegeNotSupported = -67726; + +const int errSecDeviceError = -67727; + +const int errSecAttachHandleBusy = -67728; + +const int errSecNotLoggedIn = -67729; + +const int errSecAlgorithmMismatch = -67730; + +const int errSecKeyUsageIncorrect = -67731; + +const int errSecKeyBlobTypeIncorrect = -67732; + +const int errSecKeyHeaderInconsistent = -67733; + +const int errSecUnsupportedKeyFormat = -67734; + +const int errSecUnsupportedKeySize = -67735; + +const int errSecInvalidKeyUsageMask = -67736; + +const int errSecUnsupportedKeyUsageMask = -67737; + +const int errSecInvalidKeyAttributeMask = -67738; + +const int errSecUnsupportedKeyAttributeMask = -67739; + +const int errSecInvalidKeyLabel = -67740; + +const int errSecUnsupportedKeyLabel = -67741; + +const int errSecInvalidKeyFormat = -67742; + +const int errSecUnsupportedVectorOfBuffers = -67743; + +const int errSecInvalidInputVector = -67744; + +const int errSecInvalidOutputVector = -67745; + +const int errSecInvalidContext = -67746; + +const int errSecInvalidAlgorithm = -67747; + +const int errSecInvalidAttributeKey = -67748; + +const int errSecMissingAttributeKey = -67749; + +const int errSecInvalidAttributeInitVector = -67750; + +const int errSecMissingAttributeInitVector = -67751; + +const int errSecInvalidAttributeSalt = -67752; + +const int errSecMissingAttributeSalt = -67753; + +const int errSecInvalidAttributePadding = -67754; + +const int errSecMissingAttributePadding = -67755; + +const int errSecInvalidAttributeRandom = -67756; + +const int errSecMissingAttributeRandom = -67757; + +const int errSecInvalidAttributeSeed = -67758; + +const int errSecMissingAttributeSeed = -67759; + +const int errSecInvalidAttributePassphrase = -67760; + +const int errSecMissingAttributePassphrase = -67761; + +const int errSecInvalidAttributeKeyLength = -67762; + +const int errSecMissingAttributeKeyLength = -67763; + +const int errSecInvalidAttributeBlockSize = -67764; + +const int errSecMissingAttributeBlockSize = -67765; + +const int errSecInvalidAttributeOutputSize = -67766; + +const int errSecMissingAttributeOutputSize = -67767; + +const int errSecInvalidAttributeRounds = -67768; + +const int errSecMissingAttributeRounds = -67769; + +const int errSecInvalidAlgorithmParms = -67770; + +const int errSecMissingAlgorithmParms = -67771; + +const int errSecInvalidAttributeLabel = -67772; + +const int errSecMissingAttributeLabel = -67773; + +const int errSecInvalidAttributeKeyType = -67774; + +const int errSecMissingAttributeKeyType = -67775; + +const int errSecInvalidAttributeMode = -67776; + +const int errSecMissingAttributeMode = -67777; + +const int errSecInvalidAttributeEffectiveBits = -67778; + +const int errSecMissingAttributeEffectiveBits = -67779; + +const int errSecInvalidAttributeStartDate = -67780; + +const int errSecMissingAttributeStartDate = -67781; + +const int errSecInvalidAttributeEndDate = -67782; + +const int errSecMissingAttributeEndDate = -67783; + +const int errSecInvalidAttributeVersion = -67784; + +const int errSecMissingAttributeVersion = -67785; + +const int errSecInvalidAttributePrime = -67786; + +const int errSecMissingAttributePrime = -67787; + +const int errSecInvalidAttributeBase = -67788; + +const int errSecMissingAttributeBase = -67789; + +const int errSecInvalidAttributeSubprime = -67790; + +const int errSecMissingAttributeSubprime = -67791; + +const int errSecInvalidAttributeIterationCount = -67792; + +const int errSecMissingAttributeIterationCount = -67793; + +const int errSecInvalidAttributeDLDBHandle = -67794; + +const int errSecMissingAttributeDLDBHandle = -67795; + +const int errSecInvalidAttributeAccessCredentials = -67796; + +const int errSecMissingAttributeAccessCredentials = -67797; + +const int errSecInvalidAttributePublicKeyFormat = -67798; + +const int errSecMissingAttributePublicKeyFormat = -67799; + +const int errSecInvalidAttributePrivateKeyFormat = -67800; + +const int errSecMissingAttributePrivateKeyFormat = -67801; + +const int errSecInvalidAttributeSymmetricKeyFormat = -67802; + +const int errSecMissingAttributeSymmetricKeyFormat = -67803; + +const int errSecInvalidAttributeWrappedKeyFormat = -67804; + +const int errSecMissingAttributeWrappedKeyFormat = -67805; + +const int errSecStagedOperationInProgress = -67806; + +const int errSecStagedOperationNotStarted = -67807; + +const int errSecVerifyFailed = -67808; + +const int errSecQuerySizeUnknown = -67809; + +const int errSecBlockSizeMismatch = -67810; + +const int errSecPublicKeyInconsistent = -67811; + +const int errSecDeviceVerifyFailed = -67812; + +const int errSecInvalidLoginName = -67813; + +const int errSecAlreadyLoggedIn = -67814; + +const int errSecInvalidDigestAlgorithm = -67815; + +const int errSecInvalidCRLGroup = -67816; + +const int errSecCertificateCannotOperate = -67817; + +const int errSecCertificateExpired = -67818; + +const int errSecCertificateNotValidYet = -67819; + +const int errSecCertificateRevoked = -67820; + +const int errSecCertificateSuspended = -67821; + +const int errSecInsufficientCredentials = -67822; + +const int errSecInvalidAction = -67823; + +const int errSecInvalidAuthority = -67824; + +const int errSecVerifyActionFailed = -67825; + +const int errSecInvalidCertAuthority = -67826; + +const int errSecInvalidCRLAuthority = -67827; + +const int errSecInvaldCRLAuthority = -67827; + +const int errSecInvalidCRLEncoding = -67828; + +const int errSecInvalidCRLType = -67829; + +const int errSecInvalidCRL = -67830; + +const int errSecInvalidFormType = -67831; + +const int errSecInvalidID = -67832; + +const int errSecInvalidIdentifier = -67833; + +const int errSecInvalidIndex = -67834; + +const int errSecInvalidPolicyIdentifiers = -67835; + +const int errSecInvalidTimeString = -67836; + +const int errSecInvalidReason = -67837; + +const int errSecInvalidRequestInputs = -67838; + +const int errSecInvalidResponseVector = -67839; + +const int errSecInvalidStopOnPolicy = -67840; + +const int errSecInvalidTuple = -67841; + +const int errSecMultipleValuesUnsupported = -67842; + +const int errSecNotTrusted = -67843; + +const int errSecNoDefaultAuthority = -67844; + +const int errSecRejectedForm = -67845; + +const int errSecRequestLost = -67846; + +const int errSecRequestRejected = -67847; + +const int errSecUnsupportedAddressType = -67848; + +const int errSecUnsupportedService = -67849; + +const int errSecInvalidTupleGroup = -67850; + +const int errSecInvalidBaseACLs = -67851; + +const int errSecInvalidTupleCredentials = -67852; + +const int errSecInvalidTupleCredendtials = -67852; + +const int errSecInvalidEncoding = -67853; + +const int errSecInvalidValidityPeriod = -67854; + +const int errSecInvalidRequestor = -67855; + +const int errSecRequestDescriptor = -67856; + +const int errSecInvalidBundleInfo = -67857; + +const int errSecInvalidCRLIndex = -67858; + +const int errSecNoFieldValues = -67859; + +const int errSecUnsupportedFieldFormat = -67860; + +const int errSecUnsupportedIndexInfo = -67861; + +const int errSecUnsupportedLocality = -67862; + +const int errSecUnsupportedNumAttributes = -67863; + +const int errSecUnsupportedNumIndexes = -67864; + +const int errSecUnsupportedNumRecordTypes = -67865; + +const int errSecFieldSpecifiedMultiple = -67866; + +const int errSecIncompatibleFieldFormat = -67867; + +const int errSecInvalidParsingModule = -67868; + +const int errSecDatabaseLocked = -67869; + +const int errSecDatastoreIsOpen = -67870; + +const int errSecMissingValue = -67871; + +const int errSecUnsupportedQueryLimits = -67872; + +const int errSecUnsupportedNumSelectionPreds = -67873; + +const int errSecUnsupportedOperator = -67874; + +const int errSecInvalidDBLocation = -67875; + +const int errSecInvalidAccessRequest = -67876; + +const int errSecInvalidIndexInfo = -67877; + +const int errSecInvalidNewOwner = -67878; + +const int errSecInvalidModifyMode = -67879; + +const int errSecMissingRequiredExtension = -67880; + +const int errSecExtendedKeyUsageNotCritical = -67881; + +const int errSecTimestampMissing = -67882; + +const int errSecTimestampInvalid = -67883; + +const int errSecTimestampNotTrusted = -67884; + +const int errSecTimestampServiceNotAvailable = -67885; + +const int errSecTimestampBadAlg = -67886; + +const int errSecTimestampBadRequest = -67887; + +const int errSecTimestampBadDataFormat = -67888; + +const int errSecTimestampTimeNotAvailable = -67889; + +const int errSecTimestampUnacceptedPolicy = -67890; + +const int errSecTimestampUnacceptedExtension = -67891; + +const int errSecTimestampAddInfoNotAvailable = -67892; + +const int errSecTimestampSystemFailure = -67893; + +const int errSecSigningTimeMissing = -67894; + +const int errSecTimestampRejection = -67895; + +const int errSecTimestampWaiting = -67896; + +const int errSecTimestampRevocationWarning = -67897; + +const int errSecTimestampRevocationNotification = -67898; + +const int errSecCertificatePolicyNotAllowed = -67899; + +const int errSecCertificateNameNotAllowed = -67900; + +const int errSecCertificateValidityPeriodTooLong = -67901; + +const int errSecCertificateIsCA = -67902; + +const int errSecCertificateDuplicateExtension = -67903; + +const int errSSLProtocol = -9800; + +const int errSSLNegotiation = -9801; + +const int errSSLFatalAlert = -9802; + +const int errSSLWouldBlock = -9803; + +const int errSSLSessionNotFound = -9804; + +const int errSSLClosedGraceful = -9805; + +const int errSSLClosedAbort = -9806; + +const int errSSLXCertChainInvalid = -9807; + +const int errSSLBadCert = -9808; + +const int errSSLCrypto = -9809; + +const int errSSLInternal = -9810; + +const int errSSLModuleAttach = -9811; + +const int errSSLUnknownRootCert = -9812; + +const int errSSLNoRootCert = -9813; + +const int errSSLCertExpired = -9814; + +const int errSSLCertNotYetValid = -9815; + +const int errSSLClosedNoNotify = -9816; + +const int errSSLBufferOverflow = -9817; + +const int errSSLBadCipherSuite = -9818; + +const int errSSLPeerUnexpectedMsg = -9819; + +const int errSSLPeerBadRecordMac = -9820; + +const int errSSLPeerDecryptionFail = -9821; + +const int errSSLPeerRecordOverflow = -9822; + +const int errSSLPeerDecompressFail = -9823; + +const int errSSLPeerHandshakeFail = -9824; + +const int errSSLPeerBadCert = -9825; + +const int errSSLPeerUnsupportedCert = -9826; + +const int errSSLPeerCertRevoked = -9827; + +const int errSSLPeerCertExpired = -9828; + +const int errSSLPeerCertUnknown = -9829; + +const int errSSLIllegalParam = -9830; + +const int errSSLPeerUnknownCA = -9831; + +const int errSSLPeerAccessDenied = -9832; + +const int errSSLPeerDecodeError = -9833; + +const int errSSLPeerDecryptError = -9834; + +const int errSSLPeerExportRestriction = -9835; + +const int errSSLPeerProtocolVersion = -9836; + +const int errSSLPeerInsufficientSecurity = -9837; + +const int errSSLPeerInternalError = -9838; + +const int errSSLPeerUserCancelled = -9839; + +const int errSSLPeerNoRenegotiation = -9840; + +const int errSSLPeerAuthCompleted = -9841; + +const int errSSLClientCertRequested = -9842; + +const int errSSLHostNameMismatch = -9843; + +const int errSSLConnectionRefused = -9844; + +const int errSSLDecryptionFail = -9845; + +const int errSSLBadRecordMac = -9846; + +const int errSSLRecordOverflow = -9847; + +const int errSSLBadConfiguration = -9848; + +const int errSSLUnexpectedRecord = -9849; + +const int errSSLWeakPeerEphemeralDHKey = -9850; + +const int errSSLClientHelloReceived = -9851; + +const int errSSLTransportReset = -9852; + +const int errSSLNetworkTimeout = -9853; + +const int errSSLConfigurationFailed = -9854; + +const int errSSLUnsupportedExtension = -9855; + +const int errSSLUnexpectedMessage = -9856; + +const int errSSLDecompressFail = -9857; + +const int errSSLHandshakeFail = -9858; + +const int errSSLDecodeError = -9859; + +const int errSSLInappropriateFallback = -9860; + +const int errSSLMissingExtension = -9861; + +const int errSSLBadCertificateStatusResponse = -9862; + +const int errSSLCertificateRequired = -9863; + +const int errSSLUnknownPSKIdentity = -9864; + +const int errSSLUnrecognizedName = -9865; + +const int errSSLATSViolation = -9880; + +const int errSSLATSMinimumVersionViolation = -9881; + +const int errSSLATSCiphersuiteViolation = -9882; + +const int errSSLATSMinimumKeySizeViolation = -9883; + +const int errSSLATSLeafCertificateHashAlgorithmViolation = -9884; + +const int errSSLATSCertificateHashAlgorithmViolation = -9885; + +const int errSSLATSCertificateTrustViolation = -9886; + +const int errSSLEarlyDataRejected = -9890; + +const int OSUnknownByteOrder = 0; + +const int OSLittleEndian = 1; + +const int OSBigEndian = 2; + +const int kCFNotificationDeliverImmediately = 1; + +const int kCFNotificationPostToAllSessions = 2; + +const int kCFCalendarComponentsWrap = 1; + +const int kCFSocketAutomaticallyReenableReadCallBack = 1; + +const int kCFSocketAutomaticallyReenableAcceptCallBack = 2; + +const int kCFSocketAutomaticallyReenableDataCallBack = 3; + +const int kCFSocketAutomaticallyReenableWriteCallBack = 8; + +const int kCFSocketLeaveErrors = 64; + +const int kCFSocketCloseOnInvalidate = 128; + +const int DISPATCH_WALLTIME_NOW = -2; + +const int kCFPropertyListReadCorruptError = 3840; + +const int kCFPropertyListReadUnknownVersionError = 3841; + +const int kCFPropertyListReadStreamError = 3842; + +const int kCFPropertyListWriteStreamError = 3851; + +const int kCFBundleExecutableArchitectureI386 = 7; + +const int kCFBundleExecutableArchitecturePPC = 18; + +const int kCFBundleExecutableArchitectureX86_64 = 16777223; + +const int kCFBundleExecutableArchitecturePPC64 = 16777234; + +const int kCFBundleExecutableArchitectureARM64 = 16777228; + +const int kCFMessagePortSuccess = 0; + +const int kCFMessagePortSendTimeout = -1; + +const int kCFMessagePortReceiveTimeout = -2; + +const int kCFMessagePortIsInvalid = -3; + +const int kCFMessagePortTransportError = -4; + +const int kCFMessagePortBecameInvalidError = -5; + +const int kCFStringTokenizerUnitWord = 0; + +const int kCFStringTokenizerUnitSentence = 1; + +const int kCFStringTokenizerUnitParagraph = 2; + +const int kCFStringTokenizerUnitLineBreak = 3; + +const int kCFStringTokenizerUnitWordBoundary = 4; + +const int kCFStringTokenizerAttributeLatinTranscription = 65536; + +const int kCFStringTokenizerAttributeLanguage = 131072; + +const int kCFFileDescriptorReadCallBack = 1; + +const int kCFFileDescriptorWriteCallBack = 2; + +const int kCFUserNotificationStopAlertLevel = 0; + +const int kCFUserNotificationNoteAlertLevel = 1; + +const int kCFUserNotificationCautionAlertLevel = 2; + +const int kCFUserNotificationPlainAlertLevel = 3; + +const int kCFUserNotificationDefaultResponse = 0; + +const int kCFUserNotificationAlternateResponse = 1; + +const int kCFUserNotificationOtherResponse = 2; + +const int kCFUserNotificationCancelResponse = 3; + +const int kCFUserNotificationNoDefaultButtonFlag = 32; + +const int kCFUserNotificationUseRadioButtonsFlag = 64; + +const int kCFXMLNodeCurrentVersion = 1; + +const int CSSM_INVALID_HANDLE = 0; + +const int CSSM_FALSE = 0; + +const int CSSM_TRUE = 1; + +const int CSSM_OK = 0; + +const int CSSM_MODULE_STRING_SIZE = 64; + +const int CSSM_KEY_HIERARCHY_NONE = 0; + +const int CSSM_KEY_HIERARCHY_INTEG = 1; + +const int CSSM_KEY_HIERARCHY_EXPORT = 2; + +const int CSSM_PVC_NONE = 0; + +const int CSSM_PVC_APP = 1; + +const int CSSM_PVC_SP = 2; + +const int CSSM_PRIVILEGE_SCOPE_NONE = 0; + +const int CSSM_PRIVILEGE_SCOPE_PROCESS = 1; + +const int CSSM_PRIVILEGE_SCOPE_THREAD = 2; + +const int CSSM_SERVICE_CSSM = 1; + +const int CSSM_SERVICE_CSP = 2; + +const int CSSM_SERVICE_DL = 4; + +const int CSSM_SERVICE_CL = 8; + +const int CSSM_SERVICE_TP = 16; + +const int CSSM_SERVICE_AC = 32; + +const int CSSM_SERVICE_KR = 64; + +const int CSSM_NOTIFY_INSERT = 1; + +const int CSSM_NOTIFY_REMOVE = 2; + +const int CSSM_NOTIFY_FAULT = 3; + +const int CSSM_ATTACH_READ_ONLY = 1; + +const int CSSM_USEE_LAST = 255; + +const int CSSM_USEE_NONE = 0; + +const int CSSM_USEE_DOMESTIC = 1; + +const int CSSM_USEE_FINANCIAL = 2; + +const int CSSM_USEE_KRLE = 3; + +const int CSSM_USEE_KRENT = 4; + +const int CSSM_USEE_SSL = 5; + +const int CSSM_USEE_AUTHENTICATION = 6; + +const int CSSM_USEE_KEYEXCH = 7; + +const int CSSM_USEE_MEDICAL = 8; + +const int CSSM_USEE_INSURANCE = 9; + +const int CSSM_USEE_WEAK = 10; + +const int CSSM_ADDR_NONE = 0; + +const int CSSM_ADDR_CUSTOM = 1; + +const int CSSM_ADDR_URL = 2; + +const int CSSM_ADDR_SOCKADDR = 3; + +const int CSSM_ADDR_NAME = 4; + +const int CSSM_NET_PROTO_NONE = 0; + +const int CSSM_NET_PROTO_CUSTOM = 1; + +const int CSSM_NET_PROTO_UNSPECIFIED = 2; + +const int CSSM_NET_PROTO_LDAP = 3; + +const int CSSM_NET_PROTO_LDAPS = 4; + +const int CSSM_NET_PROTO_LDAPNS = 5; + +const int CSSM_NET_PROTO_X500DAP = 6; + +const int CSSM_NET_PROTO_FTP = 7; + +const int CSSM_NET_PROTO_FTPS = 8; + +const int CSSM_NET_PROTO_OCSP = 9; + +const int CSSM_NET_PROTO_CMP = 10; + +const int CSSM_NET_PROTO_CMPS = 11; + +const int CSSM_WORDID__UNK_ = -1; + +const int CSSM_WORDID__NLU_ = 0; + +const int CSSM_WORDID__STAR_ = 1; + +const int CSSM_WORDID_A = 2; + +const int CSSM_WORDID_ACL = 3; + +const int CSSM_WORDID_ALPHA = 4; + +const int CSSM_WORDID_B = 5; + +const int CSSM_WORDID_BER = 6; + +const int CSSM_WORDID_BINARY = 7; + +const int CSSM_WORDID_BIOMETRIC = 8; + +const int CSSM_WORDID_C = 9; + +const int CSSM_WORDID_CANCELED = 10; + +const int CSSM_WORDID_CERT = 11; + +const int CSSM_WORDID_COMMENT = 12; + +const int CSSM_WORDID_CRL = 13; + +const int CSSM_WORDID_CUSTOM = 14; + +const int CSSM_WORDID_D = 15; + +const int CSSM_WORDID_DATE = 16; + +const int CSSM_WORDID_DB_DELETE = 17; + +const int CSSM_WORDID_DB_EXEC_STORED_QUERY = 18; + +const int CSSM_WORDID_DB_INSERT = 19; + +const int CSSM_WORDID_DB_MODIFY = 20; + +const int CSSM_WORDID_DB_READ = 21; + +const int CSSM_WORDID_DBS_CREATE = 22; + +const int CSSM_WORDID_DBS_DELETE = 23; + +const int CSSM_WORDID_DECRYPT = 24; + +const int CSSM_WORDID_DELETE = 25; + +const int CSSM_WORDID_DELTA_CRL = 26; + +const int CSSM_WORDID_DER = 27; + +const int CSSM_WORDID_DERIVE = 28; + +const int CSSM_WORDID_DISPLAY = 29; + +const int CSSM_WORDID_DO = 30; + +const int CSSM_WORDID_DSA = 31; + +const int CSSM_WORDID_DSA_SHA1 = 32; + +const int CSSM_WORDID_E = 33; + +const int CSSM_WORDID_ELGAMAL = 34; + +const int CSSM_WORDID_ENCRYPT = 35; + +const int CSSM_WORDID_ENTRY = 36; + +const int CSSM_WORDID_EXPORT_CLEAR = 37; + +const int CSSM_WORDID_EXPORT_WRAPPED = 38; + +const int CSSM_WORDID_G = 39; + +const int CSSM_WORDID_GE = 40; + +const int CSSM_WORDID_GENKEY = 41; + +const int CSSM_WORDID_HASH = 42; + +const int CSSM_WORDID_HASHED_PASSWORD = 43; + +const int CSSM_WORDID_HASHED_SUBJECT = 44; + +const int CSSM_WORDID_HAVAL = 45; + +const int CSSM_WORDID_IBCHASH = 46; + +const int CSSM_WORDID_IMPORT_CLEAR = 47; + +const int CSSM_WORDID_IMPORT_WRAPPED = 48; + +const int CSSM_WORDID_INTEL = 49; + +const int CSSM_WORDID_ISSUER = 50; + +const int CSSM_WORDID_ISSUER_INFO = 51; + +const int CSSM_WORDID_K_OF_N = 52; + +const int CSSM_WORDID_KEA = 53; + +const int CSSM_WORDID_KEYHOLDER = 54; + +const int CSSM_WORDID_L = 55; + +const int CSSM_WORDID_LE = 56; + +const int CSSM_WORDID_LOGIN = 57; + +const int CSSM_WORDID_LOGIN_NAME = 58; + +const int CSSM_WORDID_MAC = 59; + +const int CSSM_WORDID_MD2 = 60; + +const int CSSM_WORDID_MD2WITHRSA = 61; + +const int CSSM_WORDID_MD4 = 62; + +const int CSSM_WORDID_MD5 = 63; + +const int CSSM_WORDID_MD5WITHRSA = 64; + +const int CSSM_WORDID_N = 65; + +const int CSSM_WORDID_NAME = 66; + +const int CSSM_WORDID_NDR = 67; + +const int CSSM_WORDID_NHASH = 68; + +const int CSSM_WORDID_NOT_AFTER = 69; + +const int CSSM_WORDID_NOT_BEFORE = 70; + +const int CSSM_WORDID_NULL = 71; + +const int CSSM_WORDID_NUMERIC = 72; + +const int CSSM_WORDID_OBJECT_HASH = 73; + +const int CSSM_WORDID_ONE_TIME = 74; + +const int CSSM_WORDID_ONLINE = 75; + +const int CSSM_WORDID_OWNER = 76; + +const int CSSM_WORDID_P = 77; + +const int CSSM_WORDID_PAM_NAME = 78; + +const int CSSM_WORDID_PASSWORD = 79; + +const int CSSM_WORDID_PGP = 80; + +const int CSSM_WORDID_PREFIX = 81; + +const int CSSM_WORDID_PRIVATE_KEY = 82; + +const int CSSM_WORDID_PROMPTED_BIOMETRIC = 83; + +const int CSSM_WORDID_PROMPTED_PASSWORD = 84; + +const int CSSM_WORDID_PROPAGATE = 85; + +const int CSSM_WORDID_PROTECTED_BIOMETRIC = 86; + +const int CSSM_WORDID_PROTECTED_PASSWORD = 87; + +const int CSSM_WORDID_PROTECTED_PIN = 88; + +const int CSSM_WORDID_PUBLIC_KEY = 89; + +const int CSSM_WORDID_PUBLIC_KEY_FROM_CERT = 90; + +const int CSSM_WORDID_Q = 91; + +const int CSSM_WORDID_RANGE = 92; + +const int CSSM_WORDID_REVAL = 93; + +const int CSSM_WORDID_RIPEMAC = 94; + +const int CSSM_WORDID_RIPEMD = 95; + +const int CSSM_WORDID_RIPEMD160 = 96; + +const int CSSM_WORDID_RSA = 97; + +const int CSSM_WORDID_RSA_ISO9796 = 98; + +const int CSSM_WORDID_RSA_PKCS = 99; + +const int CSSM_WORDID_RSA_PKCS_MD5 = 100; + +const int CSSM_WORDID_RSA_PKCS_SHA1 = 101; + +const int CSSM_WORDID_RSA_PKCS1 = 102; + +const int CSSM_WORDID_RSA_PKCS1_MD5 = 103; + +const int CSSM_WORDID_RSA_PKCS1_SHA1 = 104; + +const int CSSM_WORDID_RSA_PKCS1_SIG = 105; + +const int CSSM_WORDID_RSA_RAW = 106; + +const int CSSM_WORDID_SDSIV1 = 107; + +const int CSSM_WORDID_SEQUENCE = 108; + +const int CSSM_WORDID_SET = 109; + +const int CSSM_WORDID_SEXPR = 110; + +const int CSSM_WORDID_SHA1 = 111; + +const int CSSM_WORDID_SHA1WITHDSA = 112; + +const int CSSM_WORDID_SHA1WITHECDSA = 113; + +const int CSSM_WORDID_SHA1WITHRSA = 114; + +const int CSSM_WORDID_SIGN = 115; + +const int CSSM_WORDID_SIGNATURE = 116; + +const int CSSM_WORDID_SIGNED_NONCE = 117; + +const int CSSM_WORDID_SIGNED_SECRET = 118; + +const int CSSM_WORDID_SPKI = 119; + +const int CSSM_WORDID_SUBJECT = 120; + +const int CSSM_WORDID_SUBJECT_INFO = 121; + +const int CSSM_WORDID_TAG = 122; + +const int CSSM_WORDID_THRESHOLD = 123; + +const int CSSM_WORDID_TIME = 124; + +const int CSSM_WORDID_URI = 125; + +const int CSSM_WORDID_VERSION = 126; + +const int CSSM_WORDID_X509_ATTRIBUTE = 127; + +const int CSSM_WORDID_X509V1 = 128; + +const int CSSM_WORDID_X509V2 = 129; + +const int CSSM_WORDID_X509V3 = 130; + +const int CSSM_WORDID_X9_ATTRIBUTE = 131; + +const int CSSM_WORDID_VENDOR_START = 65536; + +const int CSSM_WORDID_VENDOR_END = 2147418112; + +const int CSSM_LIST_ELEMENT_DATUM = 0; + +const int CSSM_LIST_ELEMENT_SUBLIST = 1; + +const int CSSM_LIST_ELEMENT_WORDID = 2; + +const int CSSM_LIST_TYPE_UNKNOWN = 0; + +const int CSSM_LIST_TYPE_CUSTOM = 1; + +const int CSSM_LIST_TYPE_SEXPR = 2; + +const int CSSM_SAMPLE_TYPE_PASSWORD = 79; + +const int CSSM_SAMPLE_TYPE_HASHED_PASSWORD = 43; + +const int CSSM_SAMPLE_TYPE_PROTECTED_PASSWORD = 87; + +const int CSSM_SAMPLE_TYPE_PROMPTED_PASSWORD = 84; + +const int CSSM_SAMPLE_TYPE_SIGNED_NONCE = 117; + +const int CSSM_SAMPLE_TYPE_SIGNED_SECRET = 118; + +const int CSSM_SAMPLE_TYPE_BIOMETRIC = 8; + +const int CSSM_SAMPLE_TYPE_PROTECTED_BIOMETRIC = 86; + +const int CSSM_SAMPLE_TYPE_PROMPTED_BIOMETRIC = 83; + +const int CSSM_SAMPLE_TYPE_THRESHOLD = 123; + +const int CSSM_CERT_UNKNOWN = 0; + +const int CSSM_CERT_X_509v1 = 1; + +const int CSSM_CERT_X_509v2 = 2; + +const int CSSM_CERT_X_509v3 = 3; + +const int CSSM_CERT_PGP = 4; + +const int CSSM_CERT_SPKI = 5; + +const int CSSM_CERT_SDSIv1 = 6; + +const int CSSM_CERT_Intel = 8; + +const int CSSM_CERT_X_509_ATTRIBUTE = 9; + +const int CSSM_CERT_X9_ATTRIBUTE = 10; + +const int CSSM_CERT_TUPLE = 11; + +const int CSSM_CERT_ACL_ENTRY = 12; + +const int CSSM_CERT_MULTIPLE = 32766; + +const int CSSM_CERT_LAST = 32767; + +const int CSSM_CL_CUSTOM_CERT_TYPE = 32768; + +const int CSSM_CERT_ENCODING_UNKNOWN = 0; + +const int CSSM_CERT_ENCODING_CUSTOM = 1; + +const int CSSM_CERT_ENCODING_BER = 2; + +const int CSSM_CERT_ENCODING_DER = 3; + +const int CSSM_CERT_ENCODING_NDR = 4; + +const int CSSM_CERT_ENCODING_SEXPR = 5; + +const int CSSM_CERT_ENCODING_PGP = 6; + +const int CSSM_CERT_ENCODING_MULTIPLE = 32766; + +const int CSSM_CERT_ENCODING_LAST = 32767; + +const int CSSM_CL_CUSTOM_CERT_ENCODING = 32768; + +const int CSSM_CERT_PARSE_FORMAT_NONE = 0; + +const int CSSM_CERT_PARSE_FORMAT_CUSTOM = 1; + +const int CSSM_CERT_PARSE_FORMAT_SEXPR = 2; + +const int CSSM_CERT_PARSE_FORMAT_COMPLEX = 3; + +const int CSSM_CERT_PARSE_FORMAT_OID_NAMED = 4; + +const int CSSM_CERT_PARSE_FORMAT_TUPLE = 5; + +const int CSSM_CERT_PARSE_FORMAT_MULTIPLE = 32766; + +const int CSSM_CERT_PARSE_FORMAT_LAST = 32767; + +const int CSSM_CL_CUSTOM_CERT_PARSE_FORMAT = 32768; + +const int CSSM_CERTGROUP_DATA = 0; + +const int CSSM_CERTGROUP_ENCODED_CERT = 1; + +const int CSSM_CERTGROUP_PARSED_CERT = 2; + +const int CSSM_CERTGROUP_CERT_PAIR = 3; + +const int CSSM_ACL_SUBJECT_TYPE_ANY = 1; + +const int CSSM_ACL_SUBJECT_TYPE_THRESHOLD = 123; + +const int CSSM_ACL_SUBJECT_TYPE_PASSWORD = 79; + +const int CSSM_ACL_SUBJECT_TYPE_PROTECTED_PASSWORD = 87; + +const int CSSM_ACL_SUBJECT_TYPE_PROMPTED_PASSWORD = 84; + +const int CSSM_ACL_SUBJECT_TYPE_PUBLIC_KEY = 89; + +const int CSSM_ACL_SUBJECT_TYPE_HASHED_SUBJECT = 44; + +const int CSSM_ACL_SUBJECT_TYPE_BIOMETRIC = 8; + +const int CSSM_ACL_SUBJECT_TYPE_PROTECTED_BIOMETRIC = 86; + +const int CSSM_ACL_SUBJECT_TYPE_PROMPTED_BIOMETRIC = 83; + +const int CSSM_ACL_SUBJECT_TYPE_LOGIN_NAME = 58; + +const int CSSM_ACL_SUBJECT_TYPE_EXT_PAM_NAME = 78; + +const int CSSM_ACL_AUTHORIZATION_TAG_VENDOR_DEFINED_START = 65536; + +const int CSSM_ACL_AUTHORIZATION_ANY = 1; + +const int CSSM_ACL_AUTHORIZATION_LOGIN = 57; + +const int CSSM_ACL_AUTHORIZATION_GENKEY = 41; + +const int CSSM_ACL_AUTHORIZATION_DELETE = 25; + +const int CSSM_ACL_AUTHORIZATION_EXPORT_WRAPPED = 38; + +const int CSSM_ACL_AUTHORIZATION_EXPORT_CLEAR = 37; + +const int CSSM_ACL_AUTHORIZATION_IMPORT_WRAPPED = 48; + +const int CSSM_ACL_AUTHORIZATION_IMPORT_CLEAR = 47; + +const int CSSM_ACL_AUTHORIZATION_SIGN = 115; + +const int CSSM_ACL_AUTHORIZATION_ENCRYPT = 35; + +const int CSSM_ACL_AUTHORIZATION_DECRYPT = 24; + +const int CSSM_ACL_AUTHORIZATION_MAC = 59; + +const int CSSM_ACL_AUTHORIZATION_DERIVE = 28; + +const int CSSM_ACL_AUTHORIZATION_DBS_CREATE = 22; + +const int CSSM_ACL_AUTHORIZATION_DBS_DELETE = 23; + +const int CSSM_ACL_AUTHORIZATION_DB_READ = 21; + +const int CSSM_ACL_AUTHORIZATION_DB_INSERT = 19; + +const int CSSM_ACL_AUTHORIZATION_DB_MODIFY = 20; + +const int CSSM_ACL_AUTHORIZATION_DB_DELETE = 17; + +const int CSSM_ACL_EDIT_MODE_ADD = 1; + +const int CSSM_ACL_EDIT_MODE_DELETE = 2; + +const int CSSM_ACL_EDIT_MODE_REPLACE = 3; + +const int CSSM_KEYHEADER_VERSION = 2; + +const int CSSM_KEYBLOB_RAW = 0; + +const int CSSM_KEYBLOB_REFERENCE = 2; + +const int CSSM_KEYBLOB_WRAPPED = 3; + +const int CSSM_KEYBLOB_OTHER = -1; + +const int CSSM_KEYBLOB_RAW_FORMAT_NONE = 0; + +const int CSSM_KEYBLOB_RAW_FORMAT_PKCS1 = 1; + +const int CSSM_KEYBLOB_RAW_FORMAT_PKCS3 = 2; + +const int CSSM_KEYBLOB_RAW_FORMAT_MSCAPI = 3; + +const int CSSM_KEYBLOB_RAW_FORMAT_PGP = 4; + +const int CSSM_KEYBLOB_RAW_FORMAT_FIPS186 = 5; + +const int CSSM_KEYBLOB_RAW_FORMAT_BSAFE = 6; + +const int CSSM_KEYBLOB_RAW_FORMAT_CCA = 9; + +const int CSSM_KEYBLOB_RAW_FORMAT_PKCS8 = 10; + +const int CSSM_KEYBLOB_RAW_FORMAT_SPKI = 11; + +const int CSSM_KEYBLOB_RAW_FORMAT_OCTET_STRING = 12; + +const int CSSM_KEYBLOB_RAW_FORMAT_OTHER = -1; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_NONE = 0; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_PKCS8 = 1; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_PKCS7 = 2; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_MSCAPI = 3; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_OTHER = -1; + +const int CSSM_KEYBLOB_REF_FORMAT_INTEGER = 0; + +const int CSSM_KEYBLOB_REF_FORMAT_STRING = 1; + +const int CSSM_KEYBLOB_REF_FORMAT_SPKI = 2; + +const int CSSM_KEYBLOB_REF_FORMAT_OTHER = -1; + +const int CSSM_KEYCLASS_PUBLIC_KEY = 0; + +const int CSSM_KEYCLASS_PRIVATE_KEY = 1; + +const int CSSM_KEYCLASS_SESSION_KEY = 2; + +const int CSSM_KEYCLASS_SECRET_PART = 3; + +const int CSSM_KEYCLASS_OTHER = -1; + +const int CSSM_KEYATTR_RETURN_DEFAULT = 0; + +const int CSSM_KEYATTR_RETURN_DATA = 268435456; + +const int CSSM_KEYATTR_RETURN_REF = 536870912; + +const int CSSM_KEYATTR_RETURN_NONE = 1073741824; + +const int CSSM_KEYATTR_PERMANENT = 1; + +const int CSSM_KEYATTR_PRIVATE = 2; + +const int CSSM_KEYATTR_MODIFIABLE = 4; + +const int CSSM_KEYATTR_SENSITIVE = 8; + +const int CSSM_KEYATTR_EXTRACTABLE = 32; + +const int CSSM_KEYATTR_ALWAYS_SENSITIVE = 16; + +const int CSSM_KEYATTR_NEVER_EXTRACTABLE = 64; + +const int CSSM_KEYUSE_ANY = -2147483648; + +const int CSSM_KEYUSE_ENCRYPT = 1; + +const int CSSM_KEYUSE_DECRYPT = 2; + +const int CSSM_KEYUSE_SIGN = 4; + +const int CSSM_KEYUSE_VERIFY = 8; + +const int CSSM_KEYUSE_SIGN_RECOVER = 16; + +const int CSSM_KEYUSE_VERIFY_RECOVER = 32; + +const int CSSM_KEYUSE_WRAP = 64; + +const int CSSM_KEYUSE_UNWRAP = 128; + +const int CSSM_KEYUSE_DERIVE = 256; + +const int CSSM_ALGID_NONE = 0; + +const int CSSM_ALGID_CUSTOM = 1; + +const int CSSM_ALGID_DH = 2; + +const int CSSM_ALGID_PH = 3; + +const int CSSM_ALGID_KEA = 4; + +const int CSSM_ALGID_MD2 = 5; + +const int CSSM_ALGID_MD4 = 6; + +const int CSSM_ALGID_MD5 = 7; + +const int CSSM_ALGID_SHA1 = 8; + +const int CSSM_ALGID_NHASH = 9; + +const int CSSM_ALGID_HAVAL = 10; + +const int CSSM_ALGID_RIPEMD = 11; + +const int CSSM_ALGID_IBCHASH = 12; + +const int CSSM_ALGID_RIPEMAC = 13; + +const int CSSM_ALGID_DES = 14; + +const int CSSM_ALGID_DESX = 15; + +const int CSSM_ALGID_RDES = 16; + +const int CSSM_ALGID_3DES_3KEY_EDE = 17; + +const int CSSM_ALGID_3DES_2KEY_EDE = 18; + +const int CSSM_ALGID_3DES_1KEY_EEE = 19; + +const int CSSM_ALGID_3DES_3KEY = 17; + +const int CSSM_ALGID_3DES_3KEY_EEE = 20; + +const int CSSM_ALGID_3DES_2KEY = 18; + +const int CSSM_ALGID_3DES_2KEY_EEE = 21; + +const int CSSM_ALGID_3DES_1KEY = 20; + +const int CSSM_ALGID_IDEA = 22; + +const int CSSM_ALGID_RC2 = 23; + +const int CSSM_ALGID_RC5 = 24; + +const int CSSM_ALGID_RC4 = 25; + +const int CSSM_ALGID_SEAL = 26; + +const int CSSM_ALGID_CAST = 27; + +const int CSSM_ALGID_BLOWFISH = 28; + +const int CSSM_ALGID_SKIPJACK = 29; + +const int CSSM_ALGID_LUCIFER = 30; + +const int CSSM_ALGID_MADRYGA = 31; + +const int CSSM_ALGID_FEAL = 32; + +const int CSSM_ALGID_REDOC = 33; + +const int CSSM_ALGID_REDOC3 = 34; + +const int CSSM_ALGID_LOKI = 35; + +const int CSSM_ALGID_KHUFU = 36; + +const int CSSM_ALGID_KHAFRE = 37; + +const int CSSM_ALGID_MMB = 38; + +const int CSSM_ALGID_GOST = 39; + +const int CSSM_ALGID_SAFER = 40; + +const int CSSM_ALGID_CRAB = 41; + +const int CSSM_ALGID_RSA = 42; + +const int CSSM_ALGID_DSA = 43; + +const int CSSM_ALGID_MD5WithRSA = 44; + +const int CSSM_ALGID_MD2WithRSA = 45; + +const int CSSM_ALGID_ElGamal = 46; + +const int CSSM_ALGID_MD2Random = 47; + +const int CSSM_ALGID_MD5Random = 48; + +const int CSSM_ALGID_SHARandom = 49; + +const int CSSM_ALGID_DESRandom = 50; + +const int CSSM_ALGID_SHA1WithRSA = 51; + +const int CSSM_ALGID_CDMF = 52; + +const int CSSM_ALGID_CAST3 = 53; + +const int CSSM_ALGID_CAST5 = 54; + +const int CSSM_ALGID_GenericSecret = 55; + +const int CSSM_ALGID_ConcatBaseAndKey = 56; + +const int CSSM_ALGID_ConcatKeyAndBase = 57; + +const int CSSM_ALGID_ConcatBaseAndData = 58; + +const int CSSM_ALGID_ConcatDataAndBase = 59; + +const int CSSM_ALGID_XORBaseAndData = 60; + +const int CSSM_ALGID_ExtractFromKey = 61; + +const int CSSM_ALGID_SSL3PrePrimaryGen = 62; + +const int CSSM_ALGID_SSL3PreMasterGen = 62; + +const int CSSM_ALGID_SSL3PrimaryDerive = 63; + +const int CSSM_ALGID_SSL3MasterDerive = 63; + +const int CSSM_ALGID_SSL3KeyAndMacDerive = 64; + +const int CSSM_ALGID_SSL3MD5_MAC = 65; + +const int CSSM_ALGID_SSL3SHA1_MAC = 66; + +const int CSSM_ALGID_PKCS5_PBKDF1_MD5 = 67; + +const int CSSM_ALGID_PKCS5_PBKDF1_MD2 = 68; + +const int CSSM_ALGID_PKCS5_PBKDF1_SHA1 = 69; + +const int CSSM_ALGID_WrapLynks = 70; + +const int CSSM_ALGID_WrapSET_OAEP = 71; + +const int CSSM_ALGID_BATON = 72; + +const int CSSM_ALGID_ECDSA = 73; + +const int CSSM_ALGID_MAYFLY = 74; + +const int CSSM_ALGID_JUNIPER = 75; + +const int CSSM_ALGID_FASTHASH = 76; + +const int CSSM_ALGID_3DES = 77; + +const int CSSM_ALGID_SSL3MD5 = 78; + +const int CSSM_ALGID_SSL3SHA1 = 79; + +const int CSSM_ALGID_FortezzaTimestamp = 80; + +const int CSSM_ALGID_SHA1WithDSA = 81; + +const int CSSM_ALGID_SHA1WithECDSA = 82; + +const int CSSM_ALGID_DSA_BSAFE = 83; + +const int CSSM_ALGID_ECDH = 84; + +const int CSSM_ALGID_ECMQV = 85; + +const int CSSM_ALGID_PKCS12_SHA1_PBE = 86; + +const int CSSM_ALGID_ECNRA = 87; + +const int CSSM_ALGID_SHA1WithECNRA = 88; + +const int CSSM_ALGID_ECES = 89; + +const int CSSM_ALGID_ECAES = 90; + +const int CSSM_ALGID_SHA1HMAC = 91; + +const int CSSM_ALGID_FIPS186Random = 92; + +const int CSSM_ALGID_ECC = 93; + +const int CSSM_ALGID_MQV = 94; + +const int CSSM_ALGID_NRA = 95; + +const int CSSM_ALGID_IntelPlatformRandom = 96; + +const int CSSM_ALGID_UTC = 97; + +const int CSSM_ALGID_HAVAL3 = 98; + +const int CSSM_ALGID_HAVAL4 = 99; + +const int CSSM_ALGID_HAVAL5 = 100; + +const int CSSM_ALGID_TIGER = 101; + +const int CSSM_ALGID_MD5HMAC = 102; + +const int CSSM_ALGID_PKCS5_PBKDF2 = 103; + +const int CSSM_ALGID_RUNNING_COUNTER = 104; + +const int CSSM_ALGID_LAST = 2147483647; + +const int CSSM_ALGID_VENDOR_DEFINED = -2147483648; + +const int CSSM_ALGMODE_NONE = 0; + +const int CSSM_ALGMODE_CUSTOM = 1; + +const int CSSM_ALGMODE_ECB = 2; + +const int CSSM_ALGMODE_ECBPad = 3; + +const int CSSM_ALGMODE_CBC = 4; + +const int CSSM_ALGMODE_CBC_IV8 = 5; + +const int CSSM_ALGMODE_CBCPadIV8 = 6; + +const int CSSM_ALGMODE_CFB = 7; + +const int CSSM_ALGMODE_CFB_IV8 = 8; + +const int CSSM_ALGMODE_CFBPadIV8 = 9; + +const int CSSM_ALGMODE_OFB = 10; + +const int CSSM_ALGMODE_OFB_IV8 = 11; + +const int CSSM_ALGMODE_OFBPadIV8 = 12; + +const int CSSM_ALGMODE_COUNTER = 13; + +const int CSSM_ALGMODE_BC = 14; + +const int CSSM_ALGMODE_PCBC = 15; + +const int CSSM_ALGMODE_CBCC = 16; + +const int CSSM_ALGMODE_OFBNLF = 17; + +const int CSSM_ALGMODE_PBC = 18; + +const int CSSM_ALGMODE_PFB = 19; + +const int CSSM_ALGMODE_CBCPD = 20; + +const int CSSM_ALGMODE_PUBLIC_KEY = 21; + +const int CSSM_ALGMODE_PRIVATE_KEY = 22; + +const int CSSM_ALGMODE_SHUFFLE = 23; + +const int CSSM_ALGMODE_ECB64 = 24; + +const int CSSM_ALGMODE_CBC64 = 25; + +const int CSSM_ALGMODE_OFB64 = 26; + +const int CSSM_ALGMODE_CFB32 = 28; + +const int CSSM_ALGMODE_CFB16 = 29; + +const int CSSM_ALGMODE_CFB8 = 30; + +const int CSSM_ALGMODE_WRAP = 31; + +const int CSSM_ALGMODE_PRIVATE_WRAP = 32; + +const int CSSM_ALGMODE_RELAYX = 33; + +const int CSSM_ALGMODE_ECB128 = 34; + +const int CSSM_ALGMODE_ECB96 = 35; + +const int CSSM_ALGMODE_CBC128 = 36; + +const int CSSM_ALGMODE_OAEP_HASH = 37; + +const int CSSM_ALGMODE_PKCS1_EME_V15 = 38; + +const int CSSM_ALGMODE_PKCS1_EME_OAEP = 39; + +const int CSSM_ALGMODE_PKCS1_EMSA_V15 = 40; + +const int CSSM_ALGMODE_ISO_9796 = 41; + +const int CSSM_ALGMODE_X9_31 = 42; + +const int CSSM_ALGMODE_LAST = 2147483647; + +const int CSSM_ALGMODE_VENDOR_DEFINED = -2147483648; + +const int CSSM_CSP_SOFTWARE = 1; + +const int CSSM_CSP_HARDWARE = 2; + +const int CSSM_CSP_HYBRID = 3; + +const int CSSM_ALGCLASS_NONE = 0; + +const int CSSM_ALGCLASS_CUSTOM = 1; + +const int CSSM_ALGCLASS_SIGNATURE = 2; + +const int CSSM_ALGCLASS_SYMMETRIC = 3; + +const int CSSM_ALGCLASS_DIGEST = 4; + +const int CSSM_ALGCLASS_RANDOMGEN = 5; + +const int CSSM_ALGCLASS_UNIQUEGEN = 6; + +const int CSSM_ALGCLASS_MAC = 7; + +const int CSSM_ALGCLASS_ASYMMETRIC = 8; + +const int CSSM_ALGCLASS_KEYGEN = 9; + +const int CSSM_ALGCLASS_DERIVEKEY = 10; + +const int CSSM_ATTRIBUTE_DATA_NONE = 0; + +const int CSSM_ATTRIBUTE_DATA_UINT32 = 268435456; + +const int CSSM_ATTRIBUTE_DATA_CSSM_DATA = 536870912; + +const int CSSM_ATTRIBUTE_DATA_CRYPTO_DATA = 805306368; + +const int CSSM_ATTRIBUTE_DATA_KEY = 1073741824; + +const int CSSM_ATTRIBUTE_DATA_STRING = 1342177280; + +const int CSSM_ATTRIBUTE_DATA_DATE = 1610612736; + +const int CSSM_ATTRIBUTE_DATA_RANGE = 1879048192; + +const int CSSM_ATTRIBUTE_DATA_ACCESS_CREDENTIALS = -2147483648; + +const int CSSM_ATTRIBUTE_DATA_VERSION = 16777216; + +const int CSSM_ATTRIBUTE_DATA_DL_DB_HANDLE = 33554432; + +const int CSSM_ATTRIBUTE_DATA_KR_PROFILE = 50331648; + +const int CSSM_ATTRIBUTE_TYPE_MASK = -16777216; + +const int CSSM_ATTRIBUTE_NONE = 0; + +const int CSSM_ATTRIBUTE_CUSTOM = 536870913; + +const int CSSM_ATTRIBUTE_DESCRIPTION = 1342177282; + +const int CSSM_ATTRIBUTE_KEY = 1073741827; + +const int CSSM_ATTRIBUTE_INIT_VECTOR = 536870916; + +const int CSSM_ATTRIBUTE_SALT = 536870917; + +const int CSSM_ATTRIBUTE_PADDING = 268435462; + +const int CSSM_ATTRIBUTE_RANDOM = 536870919; + +const int CSSM_ATTRIBUTE_SEED = 805306376; + +const int CSSM_ATTRIBUTE_PASSPHRASE = 805306377; + +const int CSSM_ATTRIBUTE_KEY_LENGTH = 268435466; + +const int CSSM_ATTRIBUTE_KEY_LENGTH_RANGE = 1879048203; + +const int CSSM_ATTRIBUTE_BLOCK_SIZE = 268435468; + +const int CSSM_ATTRIBUTE_OUTPUT_SIZE = 268435469; + +const int CSSM_ATTRIBUTE_ROUNDS = 268435470; + +const int CSSM_ATTRIBUTE_IV_SIZE = 268435471; + +const int CSSM_ATTRIBUTE_ALG_PARAMS = 536870928; + +const int CSSM_ATTRIBUTE_LABEL = 536870929; + +const int CSSM_ATTRIBUTE_KEY_TYPE = 268435474; + +const int CSSM_ATTRIBUTE_MODE = 268435475; + +const int CSSM_ATTRIBUTE_EFFECTIVE_BITS = 268435476; + +const int CSSM_ATTRIBUTE_START_DATE = 1610612757; + +const int CSSM_ATTRIBUTE_END_DATE = 1610612758; + +const int CSSM_ATTRIBUTE_KEYUSAGE = 268435479; + +const int CSSM_ATTRIBUTE_KEYATTR = 268435480; + +const int CSSM_ATTRIBUTE_VERSION = 16777241; + +const int CSSM_ATTRIBUTE_PRIME = 536870938; + +const int CSSM_ATTRIBUTE_BASE = 536870939; + +const int CSSM_ATTRIBUTE_SUBPRIME = 536870940; + +const int CSSM_ATTRIBUTE_ALG_ID = 268435485; + +const int CSSM_ATTRIBUTE_ITERATION_COUNT = 268435486; + +const int CSSM_ATTRIBUTE_ROUNDS_RANGE = 1879048223; + +const int CSSM_ATTRIBUTE_KRPROFILE_LOCAL = 50331680; + +const int CSSM_ATTRIBUTE_KRPROFILE_REMOTE = 50331681; + +const int CSSM_ATTRIBUTE_CSP_HANDLE = 268435490; + +const int CSSM_ATTRIBUTE_DL_DB_HANDLE = 33554467; + +const int CSSM_ATTRIBUTE_ACCESS_CREDENTIALS = -2147483612; + +const int CSSM_ATTRIBUTE_PUBLIC_KEY_FORMAT = 268435493; + +const int CSSM_ATTRIBUTE_PRIVATE_KEY_FORMAT = 268435494; + +const int CSSM_ATTRIBUTE_SYMMETRIC_KEY_FORMAT = 268435495; + +const int CSSM_ATTRIBUTE_WRAPPED_KEY_FORMAT = 268435496; + +const int CSSM_PADDING_NONE = 0; + +const int CSSM_PADDING_CUSTOM = 1; + +const int CSSM_PADDING_ZERO = 2; + +const int CSSM_PADDING_ONE = 3; + +const int CSSM_PADDING_ALTERNATE = 4; + +const int CSSM_PADDING_FF = 5; + +const int CSSM_PADDING_PKCS5 = 6; + +const int CSSM_PADDING_PKCS7 = 7; + +const int CSSM_PADDING_CIPHERSTEALING = 8; + +const int CSSM_PADDING_RANDOM = 9; + +const int CSSM_PADDING_PKCS1 = 10; + +const int CSSM_PADDING_SIGRAW = 11; + +const int CSSM_PADDING_VENDOR_DEFINED = -2147483648; + +const int CSSM_CSP_TOK_RNG = 1; + +const int CSSM_CSP_TOK_CLOCK_EXISTS = 64; + +const int CSSM_CSP_RDR_TOKENPRESENT = 1; + +const int CSSM_CSP_RDR_EXISTS = 2; + +const int CSSM_CSP_RDR_HW = 4; + +const int CSSM_CSP_TOK_WRITE_PROTECTED = 2; + +const int CSSM_CSP_TOK_LOGIN_REQUIRED = 4; + +const int CSSM_CSP_TOK_USER_PIN_INITIALIZED = 8; + +const int CSSM_CSP_TOK_PROT_AUTHENTICATION = 256; + +const int CSSM_CSP_TOK_USER_PIN_EXPIRED = 1048576; + +const int CSSM_CSP_TOK_SESSION_KEY_PASSWORD = 2097152; + +const int CSSM_CSP_TOK_PRIVATE_KEY_PASSWORD = 4194304; + +const int CSSM_CSP_STORES_PRIVATE_KEYS = 16777216; + +const int CSSM_CSP_STORES_PUBLIC_KEYS = 33554432; + +const int CSSM_CSP_STORES_SESSION_KEYS = 67108864; + +const int CSSM_CSP_STORES_CERTIFICATES = 134217728; + +const int CSSM_CSP_STORES_GENERIC = 268435456; + +const int CSSM_PKCS_OAEP_MGF_NONE = 0; + +const int CSSM_PKCS_OAEP_MGF1_SHA1 = 1; + +const int CSSM_PKCS_OAEP_MGF1_MD5 = 2; + +const int CSSM_PKCS_OAEP_PSOURCE_NONE = 0; + +const int CSSM_PKCS_OAEP_PSOURCE_Pspecified = 1; + +const int CSSM_VALUE_NOT_AVAILABLE = -1; + +const int CSSM_PKCS5_PBKDF2_PRF_HMAC_SHA1 = 0; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTISSUE = 1; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTREVOKE = 2; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTSUSPEND = 3; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTRESUME = 4; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTVERIFY = 5; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTNOTARIZE = 6; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTUSERECOVER = 7; + +const int CSSM_TP_AUTHORITY_REQUEST_CRLISSUE = 256; + +const int CSSM_TP_KEY_ARCHIVE = 1; + +const int CSSM_TP_CERT_PUBLISH = 2; + +const int CSSM_TP_CERT_NOTIFY_RENEW = 4; + +const int CSSM_TP_CERT_DIR_UPDATE = 8; + +const int CSSM_TP_CRL_DISTRIBUTE = 16; + +const int CSSM_TP_ACTION_DEFAULT = 0; + +const int CSSM_TP_STOP_ON_POLICY = 0; + +const int CSSM_TP_STOP_ON_NONE = 1; + +const int CSSM_TP_STOP_ON_FIRST_PASS = 2; + +const int CSSM_TP_STOP_ON_FIRST_FAIL = 3; + +const int CSSM_CRL_PARSE_FORMAT_NONE = 0; + +const int CSSM_CRL_PARSE_FORMAT_CUSTOM = 1; + +const int CSSM_CRL_PARSE_FORMAT_SEXPR = 2; + +const int CSSM_CRL_PARSE_FORMAT_COMPLEX = 3; + +const int CSSM_CRL_PARSE_FORMAT_OID_NAMED = 4; + +const int CSSM_CRL_PARSE_FORMAT_TUPLE = 5; + +const int CSSM_CRL_PARSE_FORMAT_MULTIPLE = 32766; + +const int CSSM_CRL_PARSE_FORMAT_LAST = 32767; + +const int CSSM_CL_CUSTOM_CRL_PARSE_FORMAT = 32768; + +const int CSSM_CRL_TYPE_UNKNOWN = 0; + +const int CSSM_CRL_TYPE_X_509v1 = 1; + +const int CSSM_CRL_TYPE_X_509v2 = 2; + +const int CSSM_CRL_TYPE_SPKI = 3; + +const int CSSM_CRL_TYPE_MULTIPLE = 32766; + +const int CSSM_CRL_ENCODING_UNKNOWN = 0; + +const int CSSM_CRL_ENCODING_CUSTOM = 1; + +const int CSSM_CRL_ENCODING_BER = 2; + +const int CSSM_CRL_ENCODING_DER = 3; + +const int CSSM_CRL_ENCODING_BLOOM = 4; + +const int CSSM_CRL_ENCODING_SEXPR = 5; + +const int CSSM_CRL_ENCODING_MULTIPLE = 32766; + +const int CSSM_CRLGROUP_DATA = 0; + +const int CSSM_CRLGROUP_ENCODED_CRL = 1; + +const int CSSM_CRLGROUP_PARSED_CRL = 2; + +const int CSSM_CRLGROUP_CRL_PAIR = 3; + +const int CSSM_EVIDENCE_FORM_UNSPECIFIC = 0; + +const int CSSM_EVIDENCE_FORM_CERT = 1; + +const int CSSM_EVIDENCE_FORM_CRL = 2; + +const int CSSM_EVIDENCE_FORM_CERT_ID = 3; + +const int CSSM_EVIDENCE_FORM_CRL_ID = 4; + +const int CSSM_EVIDENCE_FORM_VERIFIER_TIME = 5; + +const int CSSM_EVIDENCE_FORM_CRL_THISTIME = 6; + +const int CSSM_EVIDENCE_FORM_CRL_NEXTTIME = 7; + +const int CSSM_EVIDENCE_FORM_POLICYINFO = 8; + +const int CSSM_EVIDENCE_FORM_TUPLEGROUP = 9; + +const int CSSM_TP_CONFIRM_STATUS_UNKNOWN = 0; + +const int CSSM_TP_CONFIRM_ACCEPT = 1; + +const int CSSM_TP_CONFIRM_REJECT = 2; + +const int CSSM_ESTIMATED_TIME_UNKNOWN = -1; + +const int CSSM_ELAPSED_TIME_UNKNOWN = -1; + +const int CSSM_ELAPSED_TIME_COMPLETE = -2; + +const int CSSM_TP_CERTISSUE_STATUS_UNKNOWN = 0; + +const int CSSM_TP_CERTISSUE_OK = 1; + +const int CSSM_TP_CERTISSUE_OKWITHCERTMODS = 2; + +const int CSSM_TP_CERTISSUE_OKWITHSERVICEMODS = 3; + +const int CSSM_TP_CERTISSUE_REJECTED = 4; + +const int CSSM_TP_CERTISSUE_NOT_AUTHORIZED = 5; + +const int CSSM_TP_CERTISSUE_WILL_BE_REVOKED = 6; + +const int CSSM_TP_CERTCHANGE_NONE = 0; + +const int CSSM_TP_CERTCHANGE_REVOKE = 1; + +const int CSSM_TP_CERTCHANGE_HOLD = 2; + +const int CSSM_TP_CERTCHANGE_RELEASE = 3; + +const int CSSM_TP_CERTCHANGE_REASON_UNKNOWN = 0; + +const int CSSM_TP_CERTCHANGE_REASON_KEYCOMPROMISE = 1; + +const int CSSM_TP_CERTCHANGE_REASON_CACOMPROMISE = 2; + +const int CSSM_TP_CERTCHANGE_REASON_CEASEOPERATION = 3; + +const int CSSM_TP_CERTCHANGE_REASON_AFFILIATIONCHANGE = 4; + +const int CSSM_TP_CERTCHANGE_REASON_SUPERCEDED = 5; + +const int CSSM_TP_CERTCHANGE_REASON_SUSPECTEDCOMPROMISE = 6; + +const int CSSM_TP_CERTCHANGE_REASON_HOLDRELEASE = 7; + +const int CSSM_TP_CERTCHANGE_STATUS_UNKNOWN = 0; + +const int CSSM_TP_CERTCHANGE_OK = 1; + +const int CSSM_TP_CERTCHANGE_OKWITHNEWTIME = 2; + +const int CSSM_TP_CERTCHANGE_WRONGCA = 3; + +const int CSSM_TP_CERTCHANGE_REJECTED = 4; + +const int CSSM_TP_CERTCHANGE_NOT_AUTHORIZED = 5; + +const int CSSM_TP_CERTVERIFY_UNKNOWN = 0; + +const int CSSM_TP_CERTVERIFY_VALID = 1; + +const int CSSM_TP_CERTVERIFY_INVALID = 2; + +const int CSSM_TP_CERTVERIFY_REVOKED = 3; + +const int CSSM_TP_CERTVERIFY_SUSPENDED = 4; + +const int CSSM_TP_CERTVERIFY_EXPIRED = 5; + +const int CSSM_TP_CERTVERIFY_NOT_VALID_YET = 6; + +const int CSSM_TP_CERTVERIFY_INVALID_AUTHORITY = 7; + +const int CSSM_TP_CERTVERIFY_INVALID_SIGNATURE = 8; + +const int CSSM_TP_CERTVERIFY_INVALID_CERT_VALUE = 9; + +const int CSSM_TP_CERTVERIFY_INVALID_CERTGROUP = 10; + +const int CSSM_TP_CERTVERIFY_INVALID_POLICY = 11; + +const int CSSM_TP_CERTVERIFY_INVALID_POLICY_IDS = 12; + +const int CSSM_TP_CERTVERIFY_INVALID_BASIC_CONSTRAINTS = 13; + +const int CSSM_TP_CERTVERIFY_INVALID_CRL_DIST_PT = 14; + +const int CSSM_TP_CERTVERIFY_INVALID_NAME_TREE = 15; + +const int CSSM_TP_CERTVERIFY_UNKNOWN_CRITICAL_EXT = 16; + +const int CSSM_TP_CERTNOTARIZE_STATUS_UNKNOWN = 0; + +const int CSSM_TP_CERTNOTARIZE_OK = 1; + +const int CSSM_TP_CERTNOTARIZE_OKWITHOUTFIELDS = 2; + +const int CSSM_TP_CERTNOTARIZE_OKWITHSERVICEMODS = 3; + +const int CSSM_TP_CERTNOTARIZE_REJECTED = 4; + +const int CSSM_TP_CERTNOTARIZE_NOT_AUTHORIZED = 5; + +const int CSSM_TP_CERTRECLAIM_STATUS_UNKNOWN = 0; + +const int CSSM_TP_CERTRECLAIM_OK = 1; + +const int CSSM_TP_CERTRECLAIM_NOMATCH = 2; + +const int CSSM_TP_CERTRECLAIM_REJECTED = 3; + +const int CSSM_TP_CERTRECLAIM_NOT_AUTHORIZED = 4; + +const int CSSM_TP_CRLISSUE_STATUS_UNKNOWN = 0; + +const int CSSM_TP_CRLISSUE_OK = 1; + +const int CSSM_TP_CRLISSUE_NOT_CURRENT = 2; + +const int CSSM_TP_CRLISSUE_INVALID_DOMAIN = 3; + +const int CSSM_TP_CRLISSUE_UNKNOWN_IDENTIFIER = 4; + +const int CSSM_TP_CRLISSUE_REJECTED = 5; + +const int CSSM_TP_CRLISSUE_NOT_AUTHORIZED = 6; + +const int CSSM_TP_FORM_TYPE_GENERIC = 0; + +const int CSSM_TP_FORM_TYPE_REGISTRATION = 1; + +const int CSSM_CL_TEMPLATE_INTERMEDIATE_CERT = 1; + +const int CSSM_CL_TEMPLATE_PKIX_CERTTEMPLATE = 2; + +const int CSSM_CERT_BUNDLE_UNKNOWN = 0; + +const int CSSM_CERT_BUNDLE_CUSTOM = 1; + +const int CSSM_CERT_BUNDLE_PKCS7_SIGNED_DATA = 2; + +const int CSSM_CERT_BUNDLE_PKCS7_SIGNED_ENVELOPED_DATA = 3; + +const int CSSM_CERT_BUNDLE_PKCS12 = 4; + +const int CSSM_CERT_BUNDLE_PFX = 5; + +const int CSSM_CERT_BUNDLE_SPKI_SEQUENCE = 6; + +const int CSSM_CERT_BUNDLE_PGP_KEYRING = 7; + +const int CSSM_CERT_BUNDLE_LAST = 32767; + +const int CSSM_CL_CUSTOM_CERT_BUNDLE_TYPE = 32768; + +const int CSSM_CERT_BUNDLE_ENCODING_UNKNOWN = 0; + +const int CSSM_CERT_BUNDLE_ENCODING_CUSTOM = 1; + +const int CSSM_CERT_BUNDLE_ENCODING_BER = 2; + +const int CSSM_CERT_BUNDLE_ENCODING_DER = 3; + +const int CSSM_CERT_BUNDLE_ENCODING_SEXPR = 4; + +const int CSSM_CERT_BUNDLE_ENCODING_PGP = 5; + +const int CSSM_FIELDVALUE_COMPLEX_DATA_TYPE = -1; + +const int CSSM_DB_ATTRIBUTE_NAME_AS_STRING = 0; + +const int CSSM_DB_ATTRIBUTE_NAME_AS_OID = 1; + +const int CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER = 2; + +const int CSSM_DB_ATTRIBUTE_FORMAT_STRING = 0; + +const int CSSM_DB_ATTRIBUTE_FORMAT_SINT32 = 1; + +const int CSSM_DB_ATTRIBUTE_FORMAT_UINT32 = 2; + +const int CSSM_DB_ATTRIBUTE_FORMAT_BIG_NUM = 3; + +const int CSSM_DB_ATTRIBUTE_FORMAT_REAL = 4; + +const int CSSM_DB_ATTRIBUTE_FORMAT_TIME_DATE = 5; + +const int CSSM_DB_ATTRIBUTE_FORMAT_BLOB = 6; + +const int CSSM_DB_ATTRIBUTE_FORMAT_MULTI_UINT32 = 7; + +const int CSSM_DB_ATTRIBUTE_FORMAT_COMPLEX = 8; + +const int CSSM_DB_RECORDTYPE_SCHEMA_START = 0; + +const int CSSM_DB_RECORDTYPE_SCHEMA_END = 4; + +const int CSSM_DB_RECORDTYPE_OPEN_GROUP_START = 10; + +const int CSSM_DB_RECORDTYPE_OPEN_GROUP_END = 18; + +const int CSSM_DB_RECORDTYPE_APP_DEFINED_START = -2147483648; + +const int CSSM_DB_RECORDTYPE_APP_DEFINED_END = -1; + +const int CSSM_DL_DB_SCHEMA_INFO = 0; + +const int CSSM_DL_DB_SCHEMA_INDEXES = 1; + +const int CSSM_DL_DB_SCHEMA_ATTRIBUTES = 2; + +const int CSSM_DL_DB_SCHEMA_PARSING_MODULE = 3; + +const int CSSM_DL_DB_RECORD_ANY = 10; + +const int CSSM_DL_DB_RECORD_CERT = 11; + +const int CSSM_DL_DB_RECORD_CRL = 12; + +const int CSSM_DL_DB_RECORD_POLICY = 13; + +const int CSSM_DL_DB_RECORD_GENERIC = 14; + +const int CSSM_DL_DB_RECORD_PUBLIC_KEY = 15; + +const int CSSM_DL_DB_RECORD_PRIVATE_KEY = 16; + +const int CSSM_DL_DB_RECORD_SYMMETRIC_KEY = 17; + +const int CSSM_DL_DB_RECORD_ALL_KEYS = 18; + +const int CSSM_DB_CERT_USE_TRUSTED = 1; + +const int CSSM_DB_CERT_USE_SYSTEM = 2; + +const int CSSM_DB_CERT_USE_OWNER = 4; + +const int CSSM_DB_CERT_USE_REVOKED = 8; + +const int CSSM_DB_CERT_USE_SIGNING = 16; + +const int CSSM_DB_CERT_USE_PRIVACY = 32; + +const int CSSM_DB_INDEX_UNIQUE = 0; + +const int CSSM_DB_INDEX_NONUNIQUE = 1; + +const int CSSM_DB_INDEX_ON_UNKNOWN = 0; + +const int CSSM_DB_INDEX_ON_ATTRIBUTE = 1; + +const int CSSM_DB_INDEX_ON_RECORD = 2; + +const int CSSM_DB_ACCESS_READ = 1; + +const int CSSM_DB_ACCESS_WRITE = 2; + +const int CSSM_DB_ACCESS_PRIVILEGED = 4; + +const int CSSM_DB_MODIFY_ATTRIBUTE_NONE = 0; + +const int CSSM_DB_MODIFY_ATTRIBUTE_ADD = 1; + +const int CSSM_DB_MODIFY_ATTRIBUTE_DELETE = 2; + +const int CSSM_DB_MODIFY_ATTRIBUTE_REPLACE = 3; + +const int CSSM_DB_EQUAL = 0; + +const int CSSM_DB_NOT_EQUAL = 1; + +const int CSSM_DB_LESS_THAN = 2; + +const int CSSM_DB_GREATER_THAN = 3; + +const int CSSM_DB_CONTAINS = 4; + +const int CSSM_DB_CONTAINS_INITIAL_SUBSTRING = 5; + +const int CSSM_DB_CONTAINS_FINAL_SUBSTRING = 6; + +const int CSSM_DB_NONE = 0; + +const int CSSM_DB_AND = 1; + +const int CSSM_DB_OR = 2; + +const int CSSM_QUERY_TIMELIMIT_NONE = 0; + +const int CSSM_QUERY_SIZELIMIT_NONE = 0; + +const int CSSM_QUERY_RETURN_DATA = 1; + +const int CSSM_DL_UNKNOWN = 0; + +const int CSSM_DL_CUSTOM = 1; + +const int CSSM_DL_LDAP = 2; + +const int CSSM_DL_ODBC = 3; + +const int CSSM_DL_PKCS11 = 4; + +const int CSSM_DL_FFS = 5; + +const int CSSM_DL_MEMORY = 6; + +const int CSSM_DL_REMOTEDIR = 7; + +const int CSSM_DB_DATASTORES_UNKNOWN = -1; + +const int CSSM_DB_TRANSACTIONAL_MODE = 0; + +const int CSSM_DB_FILESYSTEMSCAN_MODE = 1; + +const int CSSM_BASE_ERROR = -2147418112; + +const int CSSM_ERRORCODE_MODULE_EXTENT = 2048; + +const int CSSM_ERRORCODE_CUSTOM_OFFSET = 1024; + +const int CSSM_ERRORCODE_COMMON_EXTENT = 256; + +const int CSSM_CSSM_BASE_ERROR = -2147418112; + +const int CSSM_CSSM_PRIVATE_ERROR = -2147417088; + +const int CSSM_CSP_BASE_ERROR = -2147416064; + +const int CSSM_CSP_PRIVATE_ERROR = -2147415040; + +const int CSSM_DL_BASE_ERROR = -2147414016; + +const int CSSM_DL_PRIVATE_ERROR = -2147412992; + +const int CSSM_CL_BASE_ERROR = -2147411968; + +const int CSSM_CL_PRIVATE_ERROR = -2147410944; + +const int CSSM_TP_BASE_ERROR = -2147409920; + +const int CSSM_TP_PRIVATE_ERROR = -2147408896; + +const int CSSM_KR_BASE_ERROR = -2147407872; + +const int CSSM_KR_PRIVATE_ERROR = -2147406848; + +const int CSSM_AC_BASE_ERROR = -2147405824; + +const int CSSM_AC_PRIVATE_ERROR = -2147404800; + +const int CSSM_MDS_BASE_ERROR = -2147414016; + +const int CSSM_MDS_PRIVATE_ERROR = -2147412992; + +const int CSSMERR_CSSM_INVALID_ADDIN_HANDLE = -2147417855; + +const int CSSMERR_CSSM_NOT_INITIALIZED = -2147417854; + +const int CSSMERR_CSSM_INVALID_HANDLE_USAGE = -2147417853; + +const int CSSMERR_CSSM_PVC_REFERENT_NOT_FOUND = -2147417852; + +const int CSSMERR_CSSM_FUNCTION_INTEGRITY_FAIL = -2147417851; + +const int CSSM_ERRCODE_INTERNAL_ERROR = 1; + +const int CSSM_ERRCODE_MEMORY_ERROR = 2; + +const int CSSM_ERRCODE_MDS_ERROR = 3; + +const int CSSM_ERRCODE_INVALID_POINTER = 4; + +const int CSSM_ERRCODE_INVALID_INPUT_POINTER = 5; + +const int CSSM_ERRCODE_INVALID_OUTPUT_POINTER = 6; + +const int CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED = 7; + +const int CSSM_ERRCODE_SELF_CHECK_FAILED = 8; + +const int CSSM_ERRCODE_OS_ACCESS_DENIED = 9; + +const int CSSM_ERRCODE_FUNCTION_FAILED = 10; + +const int CSSM_ERRCODE_MODULE_MANIFEST_VERIFY_FAILED = 11; + +const int CSSM_ERRCODE_INVALID_GUID = 12; + +const int CSSM_ERRCODE_OPERATION_AUTH_DENIED = 32; + +const int CSSM_ERRCODE_OBJECT_USE_AUTH_DENIED = 33; + +const int CSSM_ERRCODE_OBJECT_MANIP_AUTH_DENIED = 34; + +const int CSSM_ERRCODE_OBJECT_ACL_NOT_SUPPORTED = 35; + +const int CSSM_ERRCODE_OBJECT_ACL_REQUIRED = 36; + +const int CSSM_ERRCODE_INVALID_ACCESS_CREDENTIALS = 37; + +const int CSSM_ERRCODE_INVALID_ACL_BASE_CERTS = 38; + +const int CSSM_ERRCODE_ACL_BASE_CERTS_NOT_SUPPORTED = 39; + +const int CSSM_ERRCODE_INVALID_SAMPLE_VALUE = 40; + +const int CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED = 41; + +const int CSSM_ERRCODE_INVALID_ACL_SUBJECT_VALUE = 42; + +const int CSSM_ERRCODE_ACL_SUBJECT_TYPE_NOT_SUPPORTED = 43; + +const int CSSM_ERRCODE_INVALID_ACL_CHALLENGE_CALLBACK = 44; + +const int CSSM_ERRCODE_ACL_CHALLENGE_CALLBACK_FAILED = 45; + +const int CSSM_ERRCODE_INVALID_ACL_ENTRY_TAG = 46; + +const int CSSM_ERRCODE_ACL_ENTRY_TAG_NOT_FOUND = 47; + +const int CSSM_ERRCODE_INVALID_ACL_EDIT_MODE = 48; + +const int CSSM_ERRCODE_ACL_CHANGE_FAILED = 49; + +const int CSSM_ERRCODE_INVALID_NEW_ACL_ENTRY = 50; + +const int CSSM_ERRCODE_INVALID_NEW_ACL_OWNER = 51; + +const int CSSM_ERRCODE_ACL_DELETE_FAILED = 52; + +const int CSSM_ERRCODE_ACL_REPLACE_FAILED = 53; + +const int CSSM_ERRCODE_ACL_ADD_FAILED = 54; + +const int CSSM_ERRCODE_INVALID_CONTEXT_HANDLE = 64; + +const int CSSM_ERRCODE_INCOMPATIBLE_VERSION = 65; + +const int CSSM_ERRCODE_INVALID_CERTGROUP_POINTER = 66; + +const int CSSM_ERRCODE_INVALID_CERT_POINTER = 67; + +const int CSSM_ERRCODE_INVALID_CRL_POINTER = 68; + +const int CSSM_ERRCODE_INVALID_FIELD_POINTER = 69; + +const int CSSM_ERRCODE_INVALID_DATA = 70; + +const int CSSM_ERRCODE_CRL_ALREADY_SIGNED = 71; + +const int CSSM_ERRCODE_INVALID_NUMBER_OF_FIELDS = 72; + +const int CSSM_ERRCODE_VERIFICATION_FAILURE = 73; + +const int CSSM_ERRCODE_INVALID_DB_HANDLE = 74; + +const int CSSM_ERRCODE_PRIVILEGE_NOT_GRANTED = 75; + +const int CSSM_ERRCODE_INVALID_DB_LIST = 76; + +const int CSSM_ERRCODE_INVALID_DB_LIST_POINTER = 77; + +const int CSSM_ERRCODE_UNKNOWN_FORMAT = 78; + +const int CSSM_ERRCODE_UNKNOWN_TAG = 79; + +const int CSSM_ERRCODE_INVALID_CSP_HANDLE = 80; + +const int CSSM_ERRCODE_INVALID_DL_HANDLE = 81; + +const int CSSM_ERRCODE_INVALID_CL_HANDLE = 82; + +const int CSSM_ERRCODE_INVALID_TP_HANDLE = 83; + +const int CSSM_ERRCODE_INVALID_KR_HANDLE = 84; + +const int CSSM_ERRCODE_INVALID_AC_HANDLE = 85; + +const int CSSM_ERRCODE_INVALID_PASSTHROUGH_ID = 86; + +const int CSSM_ERRCODE_INVALID_NETWORK_ADDR = 87; + +const int CSSM_ERRCODE_INVALID_CRYPTO_DATA = 88; + +const int CSSMERR_CSSM_INTERNAL_ERROR = -2147418111; + +const int CSSMERR_CSSM_MEMORY_ERROR = -2147418110; + +const int CSSMERR_CSSM_MDS_ERROR = -2147418109; + +const int CSSMERR_CSSM_INVALID_POINTER = -2147418108; + +const int CSSMERR_CSSM_INVALID_INPUT_POINTER = -2147418107; + +const int CSSMERR_CSSM_INVALID_OUTPUT_POINTER = -2147418106; + +const int CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED = -2147418105; + +const int CSSMERR_CSSM_SELF_CHECK_FAILED = -2147418104; + +const int CSSMERR_CSSM_OS_ACCESS_DENIED = -2147418103; + +const int CSSMERR_CSSM_FUNCTION_FAILED = -2147418102; + +const int CSSMERR_CSSM_MODULE_MANIFEST_VERIFY_FAILED = -2147418101; + +const int CSSMERR_CSSM_INVALID_GUID = -2147418100; + +const int CSSMERR_CSSM_INVALID_CONTEXT_HANDLE = -2147418048; + +const int CSSMERR_CSSM_INCOMPATIBLE_VERSION = -2147418047; + +const int CSSMERR_CSSM_PRIVILEGE_NOT_GRANTED = -2147418037; + +const int CSSM_CSSM_BASE_CSSM_ERROR = -2147417840; + +const int CSSMERR_CSSM_SCOPE_NOT_SUPPORTED = -2147417839; + +const int CSSMERR_CSSM_PVC_ALREADY_CONFIGURED = -2147417838; + +const int CSSMERR_CSSM_INVALID_PVC = -2147417837; + +const int CSSMERR_CSSM_EMM_LOAD_FAILED = -2147417836; + +const int CSSMERR_CSSM_EMM_UNLOAD_FAILED = -2147417835; + +const int CSSMERR_CSSM_ADDIN_LOAD_FAILED = -2147417834; + +const int CSSMERR_CSSM_INVALID_KEY_HIERARCHY = -2147417833; + +const int CSSMERR_CSSM_ADDIN_UNLOAD_FAILED = -2147417832; + +const int CSSMERR_CSSM_LIB_REF_NOT_FOUND = -2147417831; + +const int CSSMERR_CSSM_INVALID_ADDIN_FUNCTION_TABLE = -2147417830; + +const int CSSMERR_CSSM_EMM_AUTHENTICATE_FAILED = -2147417829; + +const int CSSMERR_CSSM_ADDIN_AUTHENTICATE_FAILED = -2147417828; + +const int CSSMERR_CSSM_INVALID_SERVICE_MASK = -2147417827; + +const int CSSMERR_CSSM_MODULE_NOT_LOADED = -2147417826; + +const int CSSMERR_CSSM_INVALID_SUBSERVICEID = -2147417825; + +const int CSSMERR_CSSM_BUFFER_TOO_SMALL = -2147417824; + +const int CSSMERR_CSSM_INVALID_ATTRIBUTE = -2147417823; + +const int CSSMERR_CSSM_ATTRIBUTE_NOT_IN_CONTEXT = -2147417822; + +const int CSSMERR_CSSM_MODULE_MANAGER_INITIALIZE_FAIL = -2147417821; + +const int CSSMERR_CSSM_MODULE_MANAGER_NOT_FOUND = -2147417820; + +const int CSSMERR_CSSM_EVENT_NOTIFICATION_CALLBACK_NOT_FOUND = -2147417819; + +const int CSSMERR_CSP_INTERNAL_ERROR = -2147416063; + +const int CSSMERR_CSP_MEMORY_ERROR = -2147416062; + +const int CSSMERR_CSP_MDS_ERROR = -2147416061; + +const int CSSMERR_CSP_INVALID_POINTER = -2147416060; + +const int CSSMERR_CSP_INVALID_INPUT_POINTER = -2147416059; + +const int CSSMERR_CSP_INVALID_OUTPUT_POINTER = -2147416058; + +const int CSSMERR_CSP_FUNCTION_NOT_IMPLEMENTED = -2147416057; + +const int CSSMERR_CSP_SELF_CHECK_FAILED = -2147416056; + +const int CSSMERR_CSP_OS_ACCESS_DENIED = -2147416055; + +const int CSSMERR_CSP_FUNCTION_FAILED = -2147416054; + +const int CSSMERR_CSP_OPERATION_AUTH_DENIED = -2147416032; + +const int CSSMERR_CSP_OBJECT_USE_AUTH_DENIED = -2147416031; + +const int CSSMERR_CSP_OBJECT_MANIP_AUTH_DENIED = -2147416030; + +const int CSSMERR_CSP_OBJECT_ACL_NOT_SUPPORTED = -2147416029; + +const int CSSMERR_CSP_OBJECT_ACL_REQUIRED = -2147416028; + +const int CSSMERR_CSP_INVALID_ACCESS_CREDENTIALS = -2147416027; + +const int CSSMERR_CSP_INVALID_ACL_BASE_CERTS = -2147416026; + +const int CSSMERR_CSP_ACL_BASE_CERTS_NOT_SUPPORTED = -2147416025; + +const int CSSMERR_CSP_INVALID_SAMPLE_VALUE = -2147416024; + +const int CSSMERR_CSP_SAMPLE_VALUE_NOT_SUPPORTED = -2147416023; + +const int CSSMERR_CSP_INVALID_ACL_SUBJECT_VALUE = -2147416022; + +const int CSSMERR_CSP_ACL_SUBJECT_TYPE_NOT_SUPPORTED = -2147416021; + +const int CSSMERR_CSP_INVALID_ACL_CHALLENGE_CALLBACK = -2147416020; + +const int CSSMERR_CSP_ACL_CHALLENGE_CALLBACK_FAILED = -2147416019; + +const int CSSMERR_CSP_INVALID_ACL_ENTRY_TAG = -2147416018; + +const int CSSMERR_CSP_ACL_ENTRY_TAG_NOT_FOUND = -2147416017; + +const int CSSMERR_CSP_INVALID_ACL_EDIT_MODE = -2147416016; + +const int CSSMERR_CSP_ACL_CHANGE_FAILED = -2147416015; + +const int CSSMERR_CSP_INVALID_NEW_ACL_ENTRY = -2147416014; + +const int CSSMERR_CSP_INVALID_NEW_ACL_OWNER = -2147416013; + +const int CSSMERR_CSP_ACL_DELETE_FAILED = -2147416012; + +const int CSSMERR_CSP_ACL_REPLACE_FAILED = -2147416011; + +const int CSSMERR_CSP_ACL_ADD_FAILED = -2147416010; + +const int CSSMERR_CSP_INVALID_CONTEXT_HANDLE = -2147416000; + +const int CSSMERR_CSP_PRIVILEGE_NOT_GRANTED = -2147415989; + +const int CSSMERR_CSP_INVALID_DATA = -2147415994; + +const int CSSMERR_CSP_INVALID_PASSTHROUGH_ID = -2147415978; + +const int CSSMERR_CSP_INVALID_CRYPTO_DATA = -2147415976; + +const int CSSM_CSP_BASE_CSP_ERROR = -2147415808; + +const int CSSMERR_CSP_INPUT_LENGTH_ERROR = -2147415807; + +const int CSSMERR_CSP_OUTPUT_LENGTH_ERROR = -2147415806; + +const int CSSMERR_CSP_PRIVILEGE_NOT_SUPPORTED = -2147415805; + +const int CSSMERR_CSP_DEVICE_ERROR = -2147415804; + +const int CSSMERR_CSP_DEVICE_MEMORY_ERROR = -2147415803; + +const int CSSMERR_CSP_ATTACH_HANDLE_BUSY = -2147415802; + +const int CSSMERR_CSP_NOT_LOGGED_IN = -2147415801; + +const int CSSMERR_CSP_INVALID_KEY = -2147415792; + +const int CSSMERR_CSP_INVALID_KEY_REFERENCE = -2147415791; + +const int CSSMERR_CSP_INVALID_KEY_CLASS = -2147415790; + +const int CSSMERR_CSP_ALGID_MISMATCH = -2147415789; + +const int CSSMERR_CSP_KEY_USAGE_INCORRECT = -2147415788; + +const int CSSMERR_CSP_KEY_BLOB_TYPE_INCORRECT = -2147415787; + +const int CSSMERR_CSP_KEY_HEADER_INCONSISTENT = -2147415786; + +const int CSSMERR_CSP_UNSUPPORTED_KEY_FORMAT = -2147415785; + +const int CSSMERR_CSP_UNSUPPORTED_KEY_SIZE = -2147415784; + +const int CSSMERR_CSP_INVALID_KEY_POINTER = -2147415783; + +const int CSSMERR_CSP_INVALID_KEYUSAGE_MASK = -2147415782; + +const int CSSMERR_CSP_UNSUPPORTED_KEYUSAGE_MASK = -2147415781; + +const int CSSMERR_CSP_INVALID_KEYATTR_MASK = -2147415780; + +const int CSSMERR_CSP_UNSUPPORTED_KEYATTR_MASK = -2147415779; + +const int CSSMERR_CSP_INVALID_KEY_LABEL = -2147415778; + +const int CSSMERR_CSP_UNSUPPORTED_KEY_LABEL = -2147415777; + +const int CSSMERR_CSP_INVALID_KEY_FORMAT = -2147415776; + +const int CSSMERR_CSP_INVALID_DATA_COUNT = -2147415768; + +const int CSSMERR_CSP_VECTOR_OF_BUFS_UNSUPPORTED = -2147415767; + +const int CSSMERR_CSP_INVALID_INPUT_VECTOR = -2147415766; + +const int CSSMERR_CSP_INVALID_OUTPUT_VECTOR = -2147415765; + +const int CSSMERR_CSP_INVALID_CONTEXT = -2147415760; + +const int CSSMERR_CSP_INVALID_ALGORITHM = -2147415759; + +const int CSSMERR_CSP_INVALID_ATTR_KEY = -2147415754; + +const int CSSMERR_CSP_MISSING_ATTR_KEY = -2147415753; + +const int CSSMERR_CSP_INVALID_ATTR_INIT_VECTOR = -2147415752; + +const int CSSMERR_CSP_MISSING_ATTR_INIT_VECTOR = -2147415751; + +const int CSSMERR_CSP_INVALID_ATTR_SALT = -2147415750; + +const int CSSMERR_CSP_MISSING_ATTR_SALT = -2147415749; + +const int CSSMERR_CSP_INVALID_ATTR_PADDING = -2147415748; + +const int CSSMERR_CSP_MISSING_ATTR_PADDING = -2147415747; + +const int CSSMERR_CSP_INVALID_ATTR_RANDOM = -2147415746; + +const int CSSMERR_CSP_MISSING_ATTR_RANDOM = -2147415745; + +const int CSSMERR_CSP_INVALID_ATTR_SEED = -2147415744; + +const int CSSMERR_CSP_MISSING_ATTR_SEED = -2147415743; + +const int CSSMERR_CSP_INVALID_ATTR_PASSPHRASE = -2147415742; + +const int CSSMERR_CSP_MISSING_ATTR_PASSPHRASE = -2147415741; + +const int CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH = -2147415740; + +const int CSSMERR_CSP_MISSING_ATTR_KEY_LENGTH = -2147415739; + +const int CSSMERR_CSP_INVALID_ATTR_BLOCK_SIZE = -2147415738; + +const int CSSMERR_CSP_MISSING_ATTR_BLOCK_SIZE = -2147415737; + +const int CSSMERR_CSP_INVALID_ATTR_OUTPUT_SIZE = -2147415708; + +const int CSSMERR_CSP_MISSING_ATTR_OUTPUT_SIZE = -2147415707; + +const int CSSMERR_CSP_INVALID_ATTR_ROUNDS = -2147415706; + +const int CSSMERR_CSP_MISSING_ATTR_ROUNDS = -2147415705; + +const int CSSMERR_CSP_INVALID_ATTR_ALG_PARAMS = -2147415704; + +const int CSSMERR_CSP_MISSING_ATTR_ALG_PARAMS = -2147415703; + +const int CSSMERR_CSP_INVALID_ATTR_LABEL = -2147415702; + +const int CSSMERR_CSP_MISSING_ATTR_LABEL = -2147415701; + +const int CSSMERR_CSP_INVALID_ATTR_KEY_TYPE = -2147415700; + +const int CSSMERR_CSP_MISSING_ATTR_KEY_TYPE = -2147415699; + +const int CSSMERR_CSP_INVALID_ATTR_MODE = -2147415698; + +const int CSSMERR_CSP_MISSING_ATTR_MODE = -2147415697; + +const int CSSMERR_CSP_INVALID_ATTR_EFFECTIVE_BITS = -2147415696; + +const int CSSMERR_CSP_MISSING_ATTR_EFFECTIVE_BITS = -2147415695; + +const int CSSMERR_CSP_INVALID_ATTR_START_DATE = -2147415694; + +const int CSSMERR_CSP_MISSING_ATTR_START_DATE = -2147415693; + +const int CSSMERR_CSP_INVALID_ATTR_END_DATE = -2147415692; + +const int CSSMERR_CSP_MISSING_ATTR_END_DATE = -2147415691; + +const int CSSMERR_CSP_INVALID_ATTR_VERSION = -2147415690; + +const int CSSMERR_CSP_MISSING_ATTR_VERSION = -2147415689; + +const int CSSMERR_CSP_INVALID_ATTR_PRIME = -2147415688; + +const int CSSMERR_CSP_MISSING_ATTR_PRIME = -2147415687; + +const int CSSMERR_CSP_INVALID_ATTR_BASE = -2147415686; + +const int CSSMERR_CSP_MISSING_ATTR_BASE = -2147415685; + +const int CSSMERR_CSP_INVALID_ATTR_SUBPRIME = -2147415684; + +const int CSSMERR_CSP_MISSING_ATTR_SUBPRIME = -2147415683; + +const int CSSMERR_CSP_INVALID_ATTR_ITERATION_COUNT = -2147415682; + +const int CSSMERR_CSP_MISSING_ATTR_ITERATION_COUNT = -2147415681; + +const int CSSMERR_CSP_INVALID_ATTR_DL_DB_HANDLE = -2147415680; + +const int CSSMERR_CSP_MISSING_ATTR_DL_DB_HANDLE = -2147415679; + +const int CSSMERR_CSP_INVALID_ATTR_ACCESS_CREDENTIALS = -2147415678; + +const int CSSMERR_CSP_MISSING_ATTR_ACCESS_CREDENTIALS = -2147415677; + +const int CSSMERR_CSP_INVALID_ATTR_PUBLIC_KEY_FORMAT = -2147415676; + +const int CSSMERR_CSP_MISSING_ATTR_PUBLIC_KEY_FORMAT = -2147415675; + +const int CSSMERR_CSP_INVALID_ATTR_PRIVATE_KEY_FORMAT = -2147415674; + +const int CSSMERR_CSP_MISSING_ATTR_PRIVATE_KEY_FORMAT = -2147415673; + +const int CSSMERR_CSP_INVALID_ATTR_SYMMETRIC_KEY_FORMAT = -2147415672; + +const int CSSMERR_CSP_MISSING_ATTR_SYMMETRIC_KEY_FORMAT = -2147415671; + +const int CSSMERR_CSP_INVALID_ATTR_WRAPPED_KEY_FORMAT = -2147415670; + +const int CSSMERR_CSP_MISSING_ATTR_WRAPPED_KEY_FORMAT = -2147415669; + +const int CSSMERR_CSP_STAGED_OPERATION_IN_PROGRESS = -2147415736; + +const int CSSMERR_CSP_STAGED_OPERATION_NOT_STARTED = -2147415735; + +const int CSSMERR_CSP_VERIFY_FAILED = -2147415734; + +const int CSSMERR_CSP_INVALID_SIGNATURE = -2147415733; + +const int CSSMERR_CSP_QUERY_SIZE_UNKNOWN = -2147415732; + +const int CSSMERR_CSP_BLOCK_SIZE_MISMATCH = -2147415731; + +const int CSSMERR_CSP_PRIVATE_KEY_NOT_FOUND = -2147415730; + +const int CSSMERR_CSP_PUBLIC_KEY_INCONSISTENT = -2147415729; + +const int CSSMERR_CSP_DEVICE_VERIFY_FAILED = -2147415728; + +const int CSSMERR_CSP_INVALID_LOGIN_NAME = -2147415727; + +const int CSSMERR_CSP_ALREADY_LOGGED_IN = -2147415726; + +const int CSSMERR_CSP_PRIVATE_KEY_ALREADY_EXISTS = -2147415725; + +const int CSSMERR_CSP_KEY_LABEL_ALREADY_EXISTS = -2147415724; + +const int CSSMERR_CSP_INVALID_DIGEST_ALGORITHM = -2147415723; + +const int CSSMERR_CSP_CRYPTO_DATA_CALLBACK_FAILED = -2147415722; + +const int CSSMERR_TP_INTERNAL_ERROR = -2147409919; + +const int CSSMERR_TP_MEMORY_ERROR = -2147409918; + +const int CSSMERR_TP_MDS_ERROR = -2147409917; + +const int CSSMERR_TP_INVALID_POINTER = -2147409916; + +const int CSSMERR_TP_INVALID_INPUT_POINTER = -2147409915; + +const int CSSMERR_TP_INVALID_OUTPUT_POINTER = -2147409914; + +const int CSSMERR_TP_FUNCTION_NOT_IMPLEMENTED = -2147409913; + +const int CSSMERR_TP_SELF_CHECK_FAILED = -2147409912; + +const int CSSMERR_TP_OS_ACCESS_DENIED = -2147409911; + +const int CSSMERR_TP_FUNCTION_FAILED = -2147409910; + +const int CSSMERR_TP_INVALID_CONTEXT_HANDLE = -2147409856; + +const int CSSMERR_TP_INVALID_DATA = -2147409850; + +const int CSSMERR_TP_INVALID_DB_LIST = -2147409844; + +const int CSSMERR_TP_INVALID_CERTGROUP_POINTER = -2147409854; + +const int CSSMERR_TP_INVALID_CERT_POINTER = -2147409853; + +const int CSSMERR_TP_INVALID_CRL_POINTER = -2147409852; + +const int CSSMERR_TP_INVALID_FIELD_POINTER = -2147409851; + +const int CSSMERR_TP_INVALID_NETWORK_ADDR = -2147409833; + +const int CSSMERR_TP_CRL_ALREADY_SIGNED = -2147409849; + +const int CSSMERR_TP_INVALID_NUMBER_OF_FIELDS = -2147409848; + +const int CSSMERR_TP_VERIFICATION_FAILURE = -2147409847; + +const int CSSMERR_TP_INVALID_DB_HANDLE = -2147409846; + +const int CSSMERR_TP_UNKNOWN_FORMAT = -2147409842; + +const int CSSMERR_TP_UNKNOWN_TAG = -2147409841; + +const int CSSMERR_TP_INVALID_PASSTHROUGH_ID = -2147409834; + +const int CSSMERR_TP_INVALID_CSP_HANDLE = -2147409840; + +const int CSSMERR_TP_INVALID_DL_HANDLE = -2147409839; + +const int CSSMERR_TP_INVALID_CL_HANDLE = -2147409838; + +const int CSSMERR_TP_INVALID_DB_LIST_POINTER = -2147409843; + +const int CSSM_TP_BASE_TP_ERROR = -2147409664; + +const int CSSMERR_TP_INVALID_CALLERAUTH_CONTEXT_POINTER = -2147409663; + +const int CSSMERR_TP_INVALID_IDENTIFIER_POINTER = -2147409662; + +const int CSSMERR_TP_INVALID_KEYCACHE_HANDLE = -2147409661; + +const int CSSMERR_TP_INVALID_CERTGROUP = -2147409660; + +const int CSSMERR_TP_INVALID_CRLGROUP = -2147409659; + +const int CSSMERR_TP_INVALID_CRLGROUP_POINTER = -2147409658; + +const int CSSMERR_TP_AUTHENTICATION_FAILED = -2147409657; + +const int CSSMERR_TP_CERTGROUP_INCOMPLETE = -2147409656; + +const int CSSMERR_TP_CERTIFICATE_CANT_OPERATE = -2147409655; + +const int CSSMERR_TP_CERT_EXPIRED = -2147409654; + +const int CSSMERR_TP_CERT_NOT_VALID_YET = -2147409653; + +const int CSSMERR_TP_CERT_REVOKED = -2147409652; + +const int CSSMERR_TP_CERT_SUSPENDED = -2147409651; + +const int CSSMERR_TP_INSUFFICIENT_CREDENTIALS = -2147409650; + +const int CSSMERR_TP_INVALID_ACTION = -2147409649; + +const int CSSMERR_TP_INVALID_ACTION_DATA = -2147409648; + +const int CSSMERR_TP_INVALID_ANCHOR_CERT = -2147409646; + +const int CSSMERR_TP_INVALID_AUTHORITY = -2147409645; + +const int CSSMERR_TP_VERIFY_ACTION_FAILED = -2147409644; + +const int CSSMERR_TP_INVALID_CERTIFICATE = -2147409643; + +const int CSSMERR_TP_INVALID_CERT_AUTHORITY = -2147409642; + +const int CSSMERR_TP_INVALID_CRL_AUTHORITY = -2147409641; + +const int CSSMERR_TP_INVALID_CRL_ENCODING = -2147409640; + +const int CSSMERR_TP_INVALID_CRL_TYPE = -2147409639; + +const int CSSMERR_TP_INVALID_CRL = -2147409638; + +const int CSSMERR_TP_INVALID_FORM_TYPE = -2147409637; + +const int CSSMERR_TP_INVALID_ID = -2147409636; + +const int CSSMERR_TP_INVALID_IDENTIFIER = -2147409635; + +const int CSSMERR_TP_INVALID_INDEX = -2147409634; + +const int CSSMERR_TP_INVALID_NAME = -2147409633; + +const int CSSMERR_TP_INVALID_POLICY_IDENTIFIERS = -2147409632; + +const int CSSMERR_TP_INVALID_TIMESTRING = -2147409631; + +const int CSSMERR_TP_INVALID_REASON = -2147409630; + +const int CSSMERR_TP_INVALID_REQUEST_INPUTS = -2147409629; + +const int CSSMERR_TP_INVALID_RESPONSE_VECTOR = -2147409628; + +const int CSSMERR_TP_INVALID_SIGNATURE = -2147409627; + +const int CSSMERR_TP_INVALID_STOP_ON_POLICY = -2147409626; + +const int CSSMERR_TP_INVALID_CALLBACK = -2147409625; + +const int CSSMERR_TP_INVALID_TUPLE = -2147409624; + +const int CSSMERR_TP_NOT_SIGNER = -2147409623; + +const int CSSMERR_TP_NOT_TRUSTED = -2147409622; + +const int CSSMERR_TP_NO_DEFAULT_AUTHORITY = -2147409621; + +const int CSSMERR_TP_REJECTED_FORM = -2147409620; + +const int CSSMERR_TP_REQUEST_LOST = -2147409619; + +const int CSSMERR_TP_REQUEST_REJECTED = -2147409618; + +const int CSSMERR_TP_UNSUPPORTED_ADDR_TYPE = -2147409617; + +const int CSSMERR_TP_UNSUPPORTED_SERVICE = -2147409616; + +const int CSSMERR_TP_INVALID_TUPLEGROUP_POINTER = -2147409615; + +const int CSSMERR_TP_INVALID_TUPLEGROUP = -2147409614; + +const int CSSMERR_AC_INTERNAL_ERROR = -2147405823; + +const int CSSMERR_AC_MEMORY_ERROR = -2147405822; + +const int CSSMERR_AC_MDS_ERROR = -2147405821; + +const int CSSMERR_AC_INVALID_POINTER = -2147405820; + +const int CSSMERR_AC_INVALID_INPUT_POINTER = -2147405819; + +const int CSSMERR_AC_INVALID_OUTPUT_POINTER = -2147405818; + +const int CSSMERR_AC_FUNCTION_NOT_IMPLEMENTED = -2147405817; + +const int CSSMERR_AC_SELF_CHECK_FAILED = -2147405816; + +const int CSSMERR_AC_OS_ACCESS_DENIED = -2147405815; + +const int CSSMERR_AC_FUNCTION_FAILED = -2147405814; + +const int CSSMERR_AC_INVALID_CONTEXT_HANDLE = -2147405760; + +const int CSSMERR_AC_INVALID_DATA = -2147405754; + +const int CSSMERR_AC_INVALID_DB_LIST = -2147405748; + +const int CSSMERR_AC_INVALID_PASSTHROUGH_ID = -2147405738; + +const int CSSMERR_AC_INVALID_DL_HANDLE = -2147405743; + +const int CSSMERR_AC_INVALID_CL_HANDLE = -2147405742; + +const int CSSMERR_AC_INVALID_TP_HANDLE = -2147405741; + +const int CSSMERR_AC_INVALID_DB_HANDLE = -2147405750; + +const int CSSMERR_AC_INVALID_DB_LIST_POINTER = -2147405747; + +const int CSSM_AC_BASE_AC_ERROR = -2147405568; + +const int CSSMERR_AC_INVALID_BASE_ACLS = -2147405567; + +const int CSSMERR_AC_INVALID_TUPLE_CREDENTIALS = -2147405566; + +const int CSSMERR_AC_INVALID_ENCODING = -2147405565; + +const int CSSMERR_AC_INVALID_VALIDITY_PERIOD = -2147405564; + +const int CSSMERR_AC_INVALID_REQUESTOR = -2147405563; + +const int CSSMERR_AC_INVALID_REQUEST_DESCRIPTOR = -2147405562; + +const int CSSMERR_CL_INTERNAL_ERROR = -2147411967; + +const int CSSMERR_CL_MEMORY_ERROR = -2147411966; + +const int CSSMERR_CL_MDS_ERROR = -2147411965; + +const int CSSMERR_CL_INVALID_POINTER = -2147411964; + +const int CSSMERR_CL_INVALID_INPUT_POINTER = -2147411963; + +const int CSSMERR_CL_INVALID_OUTPUT_POINTER = -2147411962; + +const int CSSMERR_CL_FUNCTION_NOT_IMPLEMENTED = -2147411961; + +const int CSSMERR_CL_SELF_CHECK_FAILED = -2147411960; + +const int CSSMERR_CL_OS_ACCESS_DENIED = -2147411959; + +const int CSSMERR_CL_FUNCTION_FAILED = -2147411958; + +const int CSSMERR_CL_INVALID_CONTEXT_HANDLE = -2147411904; + +const int CSSMERR_CL_INVALID_CERTGROUP_POINTER = -2147411902; + +const int CSSMERR_CL_INVALID_CERT_POINTER = -2147411901; + +const int CSSMERR_CL_INVALID_CRL_POINTER = -2147411900; + +const int CSSMERR_CL_INVALID_FIELD_POINTER = -2147411899; + +const int CSSMERR_CL_INVALID_DATA = -2147411898; + +const int CSSMERR_CL_CRL_ALREADY_SIGNED = -2147411897; + +const int CSSMERR_CL_INVALID_NUMBER_OF_FIELDS = -2147411896; + +const int CSSMERR_CL_VERIFICATION_FAILURE = -2147411895; + +const int CSSMERR_CL_UNKNOWN_FORMAT = -2147411890; + +const int CSSMERR_CL_UNKNOWN_TAG = -2147411889; + +const int CSSMERR_CL_INVALID_PASSTHROUGH_ID = -2147411882; + +const int CSSM_CL_BASE_CL_ERROR = -2147411712; + +const int CSSMERR_CL_INVALID_BUNDLE_POINTER = -2147411711; + +const int CSSMERR_CL_INVALID_CACHE_HANDLE = -2147411710; + +const int CSSMERR_CL_INVALID_RESULTS_HANDLE = -2147411709; + +const int CSSMERR_CL_INVALID_BUNDLE_INFO = -2147411708; + +const int CSSMERR_CL_INVALID_CRL_INDEX = -2147411707; + +const int CSSMERR_CL_INVALID_SCOPE = -2147411706; + +const int CSSMERR_CL_NO_FIELD_VALUES = -2147411705; + +const int CSSMERR_CL_SCOPE_NOT_SUPPORTED = -2147411704; + +const int CSSMERR_DL_INTERNAL_ERROR = -2147414015; + +const int CSSMERR_DL_MEMORY_ERROR = -2147414014; + +const int CSSMERR_DL_MDS_ERROR = -2147414013; + +const int CSSMERR_DL_INVALID_POINTER = -2147414012; + +const int CSSMERR_DL_INVALID_INPUT_POINTER = -2147414011; + +const int CSSMERR_DL_INVALID_OUTPUT_POINTER = -2147414010; + +const int CSSMERR_DL_FUNCTION_NOT_IMPLEMENTED = -2147414009; + +const int CSSMERR_DL_SELF_CHECK_FAILED = -2147414008; + +const int CSSMERR_DL_OS_ACCESS_DENIED = -2147414007; + +const int CSSMERR_DL_FUNCTION_FAILED = -2147414006; + +const int CSSMERR_DL_INVALID_CSP_HANDLE = -2147413936; + +const int CSSMERR_DL_INVALID_DL_HANDLE = -2147413935; + +const int CSSMERR_DL_INVALID_CL_HANDLE = -2147413934; + +const int CSSMERR_DL_INVALID_DB_LIST_POINTER = -2147413939; + +const int CSSMERR_DL_OPERATION_AUTH_DENIED = -2147413984; + +const int CSSMERR_DL_OBJECT_USE_AUTH_DENIED = -2147413983; + +const int CSSMERR_DL_OBJECT_MANIP_AUTH_DENIED = -2147413982; + +const int CSSMERR_DL_OBJECT_ACL_NOT_SUPPORTED = -2147413981; + +const int CSSMERR_DL_OBJECT_ACL_REQUIRED = -2147413980; + +const int CSSMERR_DL_INVALID_ACCESS_CREDENTIALS = -2147413979; + +const int CSSMERR_DL_INVALID_ACL_BASE_CERTS = -2147413978; + +const int CSSMERR_DL_ACL_BASE_CERTS_NOT_SUPPORTED = -2147413977; + +const int CSSMERR_DL_INVALID_SAMPLE_VALUE = -2147413976; + +const int CSSMERR_DL_SAMPLE_VALUE_NOT_SUPPORTED = -2147413975; + +const int CSSMERR_DL_INVALID_ACL_SUBJECT_VALUE = -2147413974; + +const int CSSMERR_DL_ACL_SUBJECT_TYPE_NOT_SUPPORTED = -2147413973; + +const int CSSMERR_DL_INVALID_ACL_CHALLENGE_CALLBACK = -2147413972; + +const int CSSMERR_DL_ACL_CHALLENGE_CALLBACK_FAILED = -2147413971; + +const int CSSMERR_DL_INVALID_ACL_ENTRY_TAG = -2147413970; + +const int CSSMERR_DL_ACL_ENTRY_TAG_NOT_FOUND = -2147413969; + +const int CSSMERR_DL_INVALID_ACL_EDIT_MODE = -2147413968; + +const int CSSMERR_DL_ACL_CHANGE_FAILED = -2147413967; + +const int CSSMERR_DL_INVALID_NEW_ACL_ENTRY = -2147413966; + +const int CSSMERR_DL_INVALID_NEW_ACL_OWNER = -2147413965; + +const int CSSMERR_DL_ACL_DELETE_FAILED = -2147413964; + +const int CSSMERR_DL_ACL_REPLACE_FAILED = -2147413963; + +const int CSSMERR_DL_ACL_ADD_FAILED = -2147413962; + +const int CSSMERR_DL_INVALID_DB_HANDLE = -2147413942; + +const int CSSMERR_DL_INVALID_PASSTHROUGH_ID = -2147413930; + +const int CSSMERR_DL_INVALID_NETWORK_ADDR = -2147413929; + +const int CSSM_DL_BASE_DL_ERROR = -2147413760; + +const int CSSMERR_DL_DATABASE_CORRUPT = -2147413759; + +const int CSSMERR_DL_INVALID_RECORD_INDEX = -2147413752; + +const int CSSMERR_DL_INVALID_RECORDTYPE = -2147413751; + +const int CSSMERR_DL_INVALID_FIELD_NAME = -2147413750; + +const int CSSMERR_DL_UNSUPPORTED_FIELD_FORMAT = -2147413749; + +const int CSSMERR_DL_UNSUPPORTED_INDEX_INFO = -2147413748; + +const int CSSMERR_DL_UNSUPPORTED_LOCALITY = -2147413747; + +const int CSSMERR_DL_UNSUPPORTED_NUM_ATTRIBUTES = -2147413746; + +const int CSSMERR_DL_UNSUPPORTED_NUM_INDEXES = -2147413745; + +const int CSSMERR_DL_UNSUPPORTED_NUM_RECORDTYPES = -2147413744; + +const int CSSMERR_DL_UNSUPPORTED_RECORDTYPE = -2147413743; + +const int CSSMERR_DL_FIELD_SPECIFIED_MULTIPLE = -2147413742; + +const int CSSMERR_DL_INCOMPATIBLE_FIELD_FORMAT = -2147413741; + +const int CSSMERR_DL_INVALID_PARSING_MODULE = -2147413740; + +const int CSSMERR_DL_INVALID_DB_NAME = -2147413738; + +const int CSSMERR_DL_DATASTORE_DOESNOT_EXIST = -2147413737; + +const int CSSMERR_DL_DATASTORE_ALREADY_EXISTS = -2147413736; + +const int CSSMERR_DL_DB_LOCKED = -2147413735; + +const int CSSMERR_DL_DATASTORE_IS_OPEN = -2147413734; + +const int CSSMERR_DL_RECORD_NOT_FOUND = -2147413733; + +const int CSSMERR_DL_MISSING_VALUE = -2147413732; + +const int CSSMERR_DL_UNSUPPORTED_QUERY = -2147413731; + +const int CSSMERR_DL_UNSUPPORTED_QUERY_LIMITS = -2147413730; + +const int CSSMERR_DL_UNSUPPORTED_NUM_SELECTION_PREDS = -2147413729; + +const int CSSMERR_DL_UNSUPPORTED_OPERATOR = -2147413727; + +const int CSSMERR_DL_INVALID_RESULTS_HANDLE = -2147413726; + +const int CSSMERR_DL_INVALID_DB_LOCATION = -2147413725; + +const int CSSMERR_DL_INVALID_ACCESS_REQUEST = -2147413724; + +const int CSSMERR_DL_INVALID_INDEX_INFO = -2147413723; + +const int CSSMERR_DL_INVALID_SELECTION_TAG = -2147413722; + +const int CSSMERR_DL_INVALID_NEW_OWNER = -2147413721; + +const int CSSMERR_DL_INVALID_RECORD_UID = -2147413720; + +const int CSSMERR_DL_INVALID_UNIQUE_INDEX_DATA = -2147413719; + +const int CSSMERR_DL_INVALID_MODIFY_MODE = -2147413718; + +const int CSSMERR_DL_INVALID_OPEN_PARAMETERS = -2147413717; + +const int CSSMERR_DL_RECORD_MODIFIED = -2147413716; + +const int CSSMERR_DL_ENDOFDATA = -2147413715; + +const int CSSMERR_DL_INVALID_QUERY = -2147413714; + +const int CSSMERR_DL_INVALID_VALUE = -2147413713; + +const int CSSMERR_DL_MULTIPLE_VALUES_UNSUPPORTED = -2147413712; + +const int CSSMERR_DL_STALE_UNIQUE_RECORD = -2147413711; + +const int CSSM_WORDID_KEYCHAIN_PROMPT = 65536; + +const int CSSM_WORDID_KEYCHAIN_LOCK = 65537; + +const int CSSM_WORDID_KEYCHAIN_CHANGE_LOCK = 65538; + +const int CSSM_WORDID_PROCESS = 65539; + +const int CSSM_WORDID__RESERVED_1 = 65540; + +const int CSSM_WORDID_SYMMETRIC_KEY = 65541; + +const int CSSM_WORDID_SYSTEM = 65542; + +const int CSSM_WORDID_KEY = 65543; + +const int CSSM_WORDID_PIN = 65544; + +const int CSSM_WORDID_PREAUTH = 65545; + +const int CSSM_WORDID_PREAUTH_SOURCE = 65546; + +const int CSSM_WORDID_ASYMMETRIC_KEY = 65547; + +const int CSSM_WORDID_PARTITION = 65548; + +const int CSSM_WORDID_KEYBAG_KEY = 65549; + +const int CSSM_WORDID__FIRST_UNUSED = 65550; + +const int CSSM_ACL_SUBJECT_TYPE_KEYCHAIN_PROMPT = 65536; + +const int CSSM_ACL_SUBJECT_TYPE_PROCESS = 65539; + +const int CSSM_ACL_SUBJECT_TYPE_CODE_SIGNATURE = 116; + +const int CSSM_ACL_SUBJECT_TYPE_COMMENT = 12; + +const int CSSM_ACL_SUBJECT_TYPE_SYMMETRIC_KEY = 65541; + +const int CSSM_ACL_SUBJECT_TYPE_PREAUTH = 65545; + +const int CSSM_ACL_SUBJECT_TYPE_PREAUTH_SOURCE = 65546; + +const int CSSM_ACL_SUBJECT_TYPE_ASYMMETRIC_KEY = 65547; + +const int CSSM_ACL_SUBJECT_TYPE_PARTITION = 65548; + +const int CSSM_SAMPLE_TYPE_KEYCHAIN_PROMPT = 65536; + +const int CSSM_SAMPLE_TYPE_KEYCHAIN_LOCK = 65537; + +const int CSSM_SAMPLE_TYPE_KEYCHAIN_CHANGE_LOCK = 65538; + +const int CSSM_SAMPLE_TYPE_PROCESS = 65539; + +const int CSSM_SAMPLE_TYPE_COMMENT = 12; + +const int CSSM_SAMPLE_TYPE_RETRY_ID = 85; + +const int CSSM_SAMPLE_TYPE_SYMMETRIC_KEY = 65541; + +const int CSSM_SAMPLE_TYPE_PREAUTH = 65545; + +const int CSSM_SAMPLE_TYPE_ASYMMETRIC_KEY = 65547; + +const int CSSM_SAMPLE_TYPE_KEYBAG_KEY = 65549; + +const int CSSM_ACL_AUTHORIZATION_CHANGE_ACL = 65536; + +const int CSSM_ACL_AUTHORIZATION_CHANGE_OWNER = 65537; + +const int CSSM_ACL_AUTHORIZATION_PARTITION_ID = 65538; + +const int CSSM_ACL_AUTHORIZATION_INTEGRITY = 65539; + +const int CSSM_ACL_AUTHORIZATION_PREAUTH_BASE = 16842752; + +const int CSSM_ACL_AUTHORIZATION_PREAUTH_END = 16908288; + +const int CSSM_ACL_CODE_SIGNATURE_INVALID = 0; + +const int CSSM_ACL_CODE_SIGNATURE_OSX = 1; + +const int CSSM_ACL_MATCH_UID = 1; + +const int CSSM_ACL_MATCH_GID = 2; + +const int CSSM_ACL_MATCH_HONOR_ROOT = 256; + +const int CSSM_ACL_MATCH_BITS = 3; + +const int CSSM_ACL_PROCESS_SELECTOR_CURRENT_VERSION = 257; + +const int CSSM_ACL_KEYCHAIN_PROMPT_CURRENT_VERSION = 257; + +const int CSSM_ACL_KEYCHAIN_PROMPT_REQUIRE_PASSPHRASE = 1; + +const int CSSM_ACL_KEYCHAIN_PROMPT_UNSIGNED = 16; + +const int CSSM_ACL_KEYCHAIN_PROMPT_UNSIGNED_ACT = 32; + +const int CSSM_ACL_KEYCHAIN_PROMPT_INVALID = 64; + +const int CSSM_ACL_KEYCHAIN_PROMPT_INVALID_ACT = 128; + +const int CSSM_ACL_PREAUTH_TRACKING_COUNT_MASK = 255; + +const int CSSM_ACL_PREAUTH_TRACKING_BLOCKED = 0; + +const int CSSM_ACL_PREAUTH_TRACKING_UNKNOWN = 1073741824; + +const int CSSM_ACL_PREAUTH_TRACKING_AUTHORIZED = -2147483648; + +const int CSSM_DB_ACCESS_RESET = 65536; + +const int CSSM_ALGID_APPLE_YARROW = -2147483648; + +const int CSSM_ALGID_AES = -2147483647; + +const int CSSM_ALGID_FEE = -2147483646; + +const int CSSM_ALGID_FEE_MD5 = -2147483645; + +const int CSSM_ALGID_FEE_SHA1 = -2147483644; + +const int CSSM_ALGID_FEED = -2147483643; + +const int CSSM_ALGID_FEEDEXP = -2147483642; + +const int CSSM_ALGID_ASC = -2147483641; + +const int CSSM_ALGID_SHA1HMAC_LEGACY = -2147483640; + +const int CSSM_ALGID_KEYCHAIN_KEY = -2147483639; + +const int CSSM_ALGID_PKCS12_PBE_ENCR = -2147483638; + +const int CSSM_ALGID_PKCS12_PBE_MAC = -2147483637; + +const int CSSM_ALGID_SECURE_PASSPHRASE = -2147483636; + +const int CSSM_ALGID_PBE_OPENSSL_MD5 = -2147483635; + +const int CSSM_ALGID_SHA256 = -2147483634; + +const int CSSM_ALGID_SHA384 = -2147483633; + +const int CSSM_ALGID_SHA512 = -2147483632; + +const int CSSM_ALGID_ENTROPY_DEFAULT = -2147483631; + +const int CSSM_ALGID_SHA224 = -2147483630; + +const int CSSM_ALGID_SHA224WithRSA = -2147483629; + +const int CSSM_ALGID_SHA256WithRSA = -2147483628; + +const int CSSM_ALGID_SHA384WithRSA = -2147483627; + +const int CSSM_ALGID_SHA512WithRSA = -2147483626; + +const int CSSM_ALGID_OPENSSH1 = -2147483625; + +const int CSSM_ALGID_SHA224WithECDSA = -2147483624; + +const int CSSM_ALGID_SHA256WithECDSA = -2147483623; + +const int CSSM_ALGID_SHA384WithECDSA = -2147483622; + +const int CSSM_ALGID_SHA512WithECDSA = -2147483621; + +const int CSSM_ALGID_ECDSA_SPECIFIED = -2147483620; + +const int CSSM_ALGID_ECDH_X963_KDF = -2147483619; + +const int CSSM_ALGID__FIRST_UNUSED = -2147483618; + +const int CSSM_PADDING_APPLE_SSLv2 = -2147483648; + +const int CSSM_KEYBLOB_RAW_FORMAT_VENDOR_DEFINED = -2147483648; + +const int CSSM_KEYBLOB_RAW_FORMAT_X509 = -2147483648; + +const int CSSM_KEYBLOB_RAW_FORMAT_OPENSSH = -2147483647; + +const int CSSM_KEYBLOB_RAW_FORMAT_OPENSSL = -2147483646; + +const int CSSM_KEYBLOB_RAW_FORMAT_OPENSSH2 = -2147483645; + +const int CSSM_CUSTOM_COMMON_ERROR_EXTENT = 224; + +const int CSSM_ERRCODE_NO_USER_INTERACTION = 224; + +const int CSSM_ERRCODE_USER_CANCELED = 225; + +const int CSSM_ERRCODE_SERVICE_NOT_AVAILABLE = 226; + +const int CSSM_ERRCODE_INSUFFICIENT_CLIENT_IDENTIFICATION = 227; + +const int CSSM_ERRCODE_DEVICE_RESET = 228; + +const int CSSM_ERRCODE_DEVICE_FAILED = 229; + +const int CSSM_ERRCODE_IN_DARK_WAKE = 230; + +const int CSSMERR_CSSM_NO_USER_INTERACTION = -2147417888; + +const int CSSMERR_AC_NO_USER_INTERACTION = -2147405600; + +const int CSSMERR_CSP_NO_USER_INTERACTION = -2147415840; + +const int CSSMERR_CL_NO_USER_INTERACTION = -2147411744; + +const int CSSMERR_DL_NO_USER_INTERACTION = -2147413792; + +const int CSSMERR_TP_NO_USER_INTERACTION = -2147409696; + +const int CSSMERR_CSSM_USER_CANCELED = -2147417887; + +const int CSSMERR_AC_USER_CANCELED = -2147405599; + +const int CSSMERR_CSP_USER_CANCELED = -2147415839; + +const int CSSMERR_CL_USER_CANCELED = -2147411743; + +const int CSSMERR_DL_USER_CANCELED = -2147413791; + +const int CSSMERR_TP_USER_CANCELED = -2147409695; + +const int CSSMERR_CSSM_SERVICE_NOT_AVAILABLE = -2147417886; + +const int CSSMERR_AC_SERVICE_NOT_AVAILABLE = -2147405598; + +const int CSSMERR_CSP_SERVICE_NOT_AVAILABLE = -2147415838; + +const int CSSMERR_CL_SERVICE_NOT_AVAILABLE = -2147411742; + +const int CSSMERR_DL_SERVICE_NOT_AVAILABLE = -2147413790; + +const int CSSMERR_TP_SERVICE_NOT_AVAILABLE = -2147409694; + +const int CSSMERR_CSSM_INSUFFICIENT_CLIENT_IDENTIFICATION = -2147417885; + +const int CSSMERR_AC_INSUFFICIENT_CLIENT_IDENTIFICATION = -2147405597; + +const int CSSMERR_CSP_INSUFFICIENT_CLIENT_IDENTIFICATION = -2147415837; + +const int CSSMERR_CL_INSUFFICIENT_CLIENT_IDENTIFICATION = -2147411741; + +const int CSSMERR_DL_INSUFFICIENT_CLIENT_IDENTIFICATION = -2147413789; + +const int CSSMERR_TP_INSUFFICIENT_CLIENT_IDENTIFICATION = -2147409693; + +const int CSSMERR_CSSM_DEVICE_RESET = -2147417884; + +const int CSSMERR_AC_DEVICE_RESET = -2147405596; + +const int CSSMERR_CSP_DEVICE_RESET = -2147415836; + +const int CSSMERR_CL_DEVICE_RESET = -2147411740; + +const int CSSMERR_DL_DEVICE_RESET = -2147413788; + +const int CSSMERR_TP_DEVICE_RESET = -2147409692; + +const int CSSMERR_CSSM_DEVICE_FAILED = -2147417883; + +const int CSSMERR_AC_DEVICE_FAILED = -2147405595; + +const int CSSMERR_CSP_DEVICE_FAILED = -2147415835; + +const int CSSMERR_CL_DEVICE_FAILED = -2147411739; + +const int CSSMERR_DL_DEVICE_FAILED = -2147413787; + +const int CSSMERR_TP_DEVICE_FAILED = -2147409691; + +const int CSSMERR_CSSM_IN_DARK_WAKE = -2147417882; + +const int CSSMERR_AC_IN_DARK_WAKE = -2147405594; + +const int CSSMERR_CSP_IN_DARK_WAKE = -2147415834; + +const int CSSMERR_CL_IN_DARK_WAKE = -2147411738; + +const int CSSMERR_DL_IN_DARK_WAKE = -2147413786; + +const int CSSMERR_TP_IN_DARK_WAKE = -2147409690; + +const int CSSMERR_CSP_APPLE_ADD_APPLICATION_ACL_SUBJECT = -2147415040; + +const int CSSMERR_CSP_APPLE_PUBLIC_KEY_INCOMPLETE = -2147415039; + +const int CSSMERR_CSP_APPLE_SIGNATURE_MISMATCH = -2147415038; + +const int CSSMERR_CSP_APPLE_INVALID_KEY_START_DATE = -2147415037; + +const int CSSMERR_CSP_APPLE_INVALID_KEY_END_DATE = -2147415036; + +const int CSSMERR_CSPDL_APPLE_DL_CONVERSION_ERROR = -2147415035; + +const int CSSMERR_CSP_APPLE_SSLv2_ROLLBACK = -2147415034; + +const int CSSM_DL_DB_RECORD_GENERIC_PASSWORD = -2147483648; + +const int CSSM_DL_DB_RECORD_INTERNET_PASSWORD = -2147483647; + +const int CSSM_DL_DB_RECORD_APPLESHARE_PASSWORD = -2147483646; + +const int CSSM_DL_DB_RECORD_X509_CERTIFICATE = -2147479552; + +const int CSSM_DL_DB_RECORD_USER_TRUST = -2147479551; + +const int CSSM_DL_DB_RECORD_X509_CRL = -2147479550; + +const int CSSM_DL_DB_RECORD_UNLOCK_REFERRAL = -2147479549; + +const int CSSM_DL_DB_RECORD_EXTENDED_ATTRIBUTE = -2147479548; + +const int CSSM_DL_DB_RECORD_METADATA = -2147450880; + +const int CSSM_APPLEFILEDL_TOGGLE_AUTOCOMMIT = 0; + +const int CSSM_APPLEFILEDL_COMMIT = 1; + +const int CSSM_APPLEFILEDL_ROLLBACK = 2; + +const int CSSM_APPLEFILEDL_TAKE_FILE_LOCK = 3; + +const int CSSM_APPLEFILEDL_MAKE_BACKUP = 4; + +const int CSSM_APPLEFILEDL_MAKE_COPY = 5; + +const int CSSM_APPLEFILEDL_DELETE_FILE = 6; + +const int CSSM_APPLE_UNLOCK_TYPE_KEY_DIRECT = 1; + +const int CSSM_APPLE_UNLOCK_TYPE_WRAPPED_PRIVATE = 2; + +const int CSSM_APPLE_UNLOCK_TYPE_KEYBAG = 3; + +const int CSSMERR_APPLEDL_INVALID_OPEN_PARAMETERS = -2147412992; + +const int CSSMERR_APPLEDL_DISK_FULL = -2147412991; + +const int CSSMERR_APPLEDL_QUOTA_EXCEEDED = -2147412990; + +const int CSSMERR_APPLEDL_FILE_TOO_BIG = -2147412989; + +const int CSSMERR_APPLEDL_INVALID_DATABASE_BLOB = -2147412988; + +const int CSSMERR_APPLEDL_INVALID_KEY_BLOB = -2147412987; + +const int CSSMERR_APPLEDL_INCOMPATIBLE_DATABASE_BLOB = -2147412986; + +const int CSSMERR_APPLEDL_INCOMPATIBLE_KEY_BLOB = -2147412985; + +const int CSSMERR_APPLETP_HOSTNAME_MISMATCH = -2147408896; + +const int CSSMERR_APPLETP_UNKNOWN_CRITICAL_EXTEN = -2147408895; + +const int CSSMERR_APPLETP_NO_BASIC_CONSTRAINTS = -2147408894; + +const int CSSMERR_APPLETP_INVALID_CA = -2147408893; + +const int CSSMERR_APPLETP_INVALID_AUTHORITY_ID = -2147408892; + +const int CSSMERR_APPLETP_INVALID_SUBJECT_ID = -2147408891; + +const int CSSMERR_APPLETP_INVALID_KEY_USAGE = -2147408890; + +const int CSSMERR_APPLETP_INVALID_EXTENDED_KEY_USAGE = -2147408889; + +const int CSSMERR_APPLETP_INVALID_ID_LINKAGE = -2147408888; + +const int CSSMERR_APPLETP_PATH_LEN_CONSTRAINT = -2147408887; + +const int CSSMERR_APPLETP_INVALID_ROOT = -2147408886; + +const int CSSMERR_APPLETP_CRL_EXPIRED = -2147408885; + +const int CSSMERR_APPLETP_CRL_NOT_VALID_YET = -2147408884; + +const int CSSMERR_APPLETP_CRL_NOT_FOUND = -2147408883; + +const int CSSMERR_APPLETP_CRL_SERVER_DOWN = -2147408882; + +const int CSSMERR_APPLETP_CRL_BAD_URI = -2147408881; + +const int CSSMERR_APPLETP_UNKNOWN_CERT_EXTEN = -2147408880; + +const int CSSMERR_APPLETP_UNKNOWN_CRL_EXTEN = -2147408879; + +const int CSSMERR_APPLETP_CRL_NOT_TRUSTED = -2147408878; + +const int CSSMERR_APPLETP_CRL_INVALID_ANCHOR_CERT = -2147408877; + +const int CSSMERR_APPLETP_CRL_POLICY_FAIL = -2147408876; + +const int CSSMERR_APPLETP_IDP_FAIL = -2147408875; + +const int CSSMERR_APPLETP_CERT_NOT_FOUND_FROM_ISSUER = -2147408874; + +const int CSSMERR_APPLETP_BAD_CERT_FROM_ISSUER = -2147408873; + +const int CSSMERR_APPLETP_SMIME_EMAIL_ADDRS_NOT_FOUND = -2147408872; + +const int CSSMERR_APPLETP_SMIME_BAD_EXT_KEY_USE = -2147408871; + +const int CSSMERR_APPLETP_SMIME_BAD_KEY_USE = -2147408870; + +const int CSSMERR_APPLETP_SMIME_KEYUSAGE_NOT_CRITICAL = -2147408869; + +const int CSSMERR_APPLETP_SMIME_NO_EMAIL_ADDRS = -2147408868; + +const int CSSMERR_APPLETP_SMIME_SUBJ_ALT_NAME_NOT_CRIT = -2147408867; + +const int CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE = -2147408866; + +const int CSSMERR_APPLETP_OCSP_BAD_RESPONSE = -2147408865; + +const int CSSMERR_APPLETP_OCSP_BAD_REQUEST = -2147408864; + +const int CSSMERR_APPLETP_OCSP_UNAVAILABLE = -2147408863; + +const int CSSMERR_APPLETP_OCSP_STATUS_UNRECOGNIZED = -2147408862; + +const int CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK = -2147408861; + +const int CSSMERR_APPLETP_NETWORK_FAILURE = -2147408860; + +const int CSSMERR_APPLETP_OCSP_NOT_TRUSTED = -2147408859; + +const int CSSMERR_APPLETP_OCSP_INVALID_ANCHOR_CERT = -2147408858; + +const int CSSMERR_APPLETP_OCSP_SIG_ERROR = -2147408857; + +const int CSSMERR_APPLETP_OCSP_NO_SIGNER = -2147408856; + +const int CSSMERR_APPLETP_OCSP_RESP_MALFORMED_REQ = -2147408855; + +const int CSSMERR_APPLETP_OCSP_RESP_INTERNAL_ERR = -2147408854; + +const int CSSMERR_APPLETP_OCSP_RESP_TRY_LATER = -2147408853; + +const int CSSMERR_APPLETP_OCSP_RESP_SIG_REQUIRED = -2147408852; + +const int CSSMERR_APPLETP_OCSP_RESP_UNAUTHORIZED = -2147408851; + +const int CSSMERR_APPLETP_OCSP_NONCE_MISMATCH = -2147408850; + +const int CSSMERR_APPLETP_CS_BAD_CERT_CHAIN_LENGTH = -2147408849; + +const int CSSMERR_APPLETP_CS_NO_BASIC_CONSTRAINTS = -2147408848; + +const int CSSMERR_APPLETP_CS_BAD_PATH_LENGTH = -2147408847; + +const int CSSMERR_APPLETP_CS_NO_EXTENDED_KEY_USAGE = -2147408846; + +const int CSSMERR_APPLETP_CODE_SIGN_DEVELOPMENT = -2147408845; + +const int CSSMERR_APPLETP_RS_BAD_CERT_CHAIN_LENGTH = -2147408844; + +const int CSSMERR_APPLETP_RS_BAD_EXTENDED_KEY_USAGE = -2147408843; + +const int CSSMERR_APPLETP_TRUST_SETTING_DENY = -2147408842; + +const int CSSMERR_APPLETP_INVALID_EMPTY_SUBJECT = -2147408841; + +const int CSSMERR_APPLETP_UNKNOWN_QUAL_CERT_STATEMENT = -2147408840; + +const int CSSMERR_APPLETP_MISSING_REQUIRED_EXTENSION = -2147408839; + +const int CSSMERR_APPLETP_EXT_KEYUSAGE_NOT_CRITICAL = -2147408838; + +const int CSSMERR_APPLETP_IDENTIFIER_MISSING = -2147408837; + +const int CSSMERR_APPLETP_CA_PIN_MISMATCH = -2147408836; + +const int CSSMERR_APPLETP_LEAF_PIN_MISMATCH = -2147408835; + +const int CSSMERR_APPLE_DOTMAC_REQ_QUEUED = -2147408796; + +const int CSSMERR_APPLE_DOTMAC_REQ_REDIRECT = -2147408795; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_ERR = -2147408794; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_PARAM = -2147408793; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_AUTH = -2147408792; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_UNIMPL = -2147408791; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_NOT_AVAIL = -2147408790; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_ALREADY_EXIST = -2147408789; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_SERVICE_ERROR = -2147408788; + +const int CSSMERR_APPLE_DOTMAC_REQ_IS_PENDING = -2147408787; + +const int CSSMERR_APPLE_DOTMAC_NO_REQ_PENDING = -2147408786; + +const int CSSMERR_APPLE_DOTMAC_CSR_VERIFY_FAIL = -2147408785; + +const int CSSMERR_APPLE_DOTMAC_FAILED_CONSISTENCY_CHECK = -2147408784; + +const int CSSM_APPLEDL_OPEN_PARAMETERS_VERSION = 1; + +const int CSSM_APPLECSPDL_DB_LOCK = 0; + +const int CSSM_APPLECSPDL_DB_UNLOCK = 1; + +const int CSSM_APPLECSPDL_DB_GET_SETTINGS = 2; + +const int CSSM_APPLECSPDL_DB_SET_SETTINGS = 3; + +const int CSSM_APPLECSPDL_DB_IS_LOCKED = 4; + +const int CSSM_APPLECSPDL_DB_CHANGE_PASSWORD = 5; + +const int CSSM_APPLECSPDL_DB_GET_HANDLE = 6; + +const int CSSM_APPLESCPDL_CSP_GET_KEYHANDLE = 7; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_8 = 8; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_9 = 9; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_10 = 10; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_11 = 11; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_12 = 12; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_13 = 13; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_14 = 14; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_15 = 15; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_16 = 16; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_17 = 17; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_18 = 18; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_19 = 19; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_20 = 20; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_21 = 21; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_22 = 22; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_23 = 23; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_24 = 24; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_25 = 25; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_26 = 26; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_27 = 27; + +const int CSSM_APPLECSP_KEYDIGEST = 256; + +const int CSSM_APPLECSP_PUBKEY = 257; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_APPLE_CUSTOM = 100; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_OPENSSL = 101; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_OPENSSH1 = 102; + +const int CSSM_ATTRIBUTE_VENDOR_DEFINED = 8388608; + +const int CSSM_ATTRIBUTE_PUBLIC_KEY = 1082130432; + +const int CSSM_ATTRIBUTE_FEE_PRIME_TYPE = 276824065; + +const int CSSM_ATTRIBUTE_FEE_CURVE_TYPE = 276824066; + +const int CSSM_ATTRIBUTE_ASC_OPTIMIZATION = 276824067; + +const int CSSM_ATTRIBUTE_RSA_BLINDING = 276824068; + +const int CSSM_ATTRIBUTE_PARAM_KEY = 1082130437; + +const int CSSM_ATTRIBUTE_PROMPT = 545259526; + +const int CSSM_ATTRIBUTE_ALERT_TITLE = 545259527; + +const int CSSM_ATTRIBUTE_VERIFY_PASSPHRASE = 276824072; + +const int CSSM_FEE_PRIME_TYPE_DEFAULT = 0; + +const int CSSM_FEE_PRIME_TYPE_MERSENNE = 1; + +const int CSSM_FEE_PRIME_TYPE_FEE = 2; + +const int CSSM_FEE_PRIME_TYPE_GENERAL = 3; + +const int CSSM_FEE_CURVE_TYPE_DEFAULT = 0; + +const int CSSM_FEE_CURVE_TYPE_MONTGOMERY = 1; + +const int CSSM_FEE_CURVE_TYPE_WEIERSTRASS = 2; + +const int CSSM_FEE_CURVE_TYPE_ANSI_X9_62 = 3; + +const int CSSM_ASC_OPTIMIZE_DEFAULT = 0; + +const int CSSM_ASC_OPTIMIZE_SIZE = 1; + +const int CSSM_ASC_OPTIMIZE_SECURITY = 2; + +const int CSSM_ASC_OPTIMIZE_TIME = 3; + +const int CSSM_ASC_OPTIMIZE_TIME_SIZE = 4; + +const int CSSM_ASC_OPTIMIZE_ASCII = 5; + +const int CSSM_KEYATTR_PARTIAL = 65536; + +const int CSSM_KEYATTR_PUBLIC_KEY_ENCRYPT = 131072; + +const int CSSM_TP_ACTION_REQUIRE_CRL_PER_CERT = 1; + +const int CSSM_TP_ACTION_FETCH_CRL_FROM_NET = 2; + +const int CSSM_TP_ACTION_CRL_SUFFICIENT = 4; + +const int CSSM_TP_ACTION_REQUIRE_CRL_IF_PRESENT = 8; + +const int CSSM_TP_ACTION_ALLOW_EXPIRED = 1; + +const int CSSM_TP_ACTION_LEAF_IS_CA = 2; + +const int CSSM_TP_ACTION_FETCH_CERT_FROM_NET = 4; + +const int CSSM_TP_ACTION_ALLOW_EXPIRED_ROOT = 8; + +const int CSSM_TP_ACTION_REQUIRE_REV_PER_CERT = 16; + +const int CSSM_TP_ACTION_TRUST_SETTINGS = 32; + +const int CSSM_TP_ACTION_IMPLICIT_ANCHORS = 64; + +const int CSSM_CERT_STATUS_EXPIRED = 1; + +const int CSSM_CERT_STATUS_NOT_VALID_YET = 2; + +const int CSSM_CERT_STATUS_IS_IN_INPUT_CERTS = 4; + +const int CSSM_CERT_STATUS_IS_IN_ANCHORS = 8; + +const int CSSM_CERT_STATUS_IS_ROOT = 16; + +const int CSSM_CERT_STATUS_IS_FROM_NET = 32; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_FOUND_USER = 64; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_FOUND_ADMIN = 128; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_FOUND_SYSTEM = 256; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_TRUST = 512; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_DENY = 1024; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_IGNORED_ERROR = 2048; + +const int CSSM_EVIDENCE_FORM_APPLE_HEADER = -2147483648; + +const int CSSM_EVIDENCE_FORM_APPLE_CERTGROUP = -2147483647; + +const int CSSM_EVIDENCE_FORM_APPLE_CERT_INFO = -2147483646; + +const int CSSM_APPLEX509CL_OBTAIN_CSR = 0; + +const int CSSM_APPLEX509CL_VERIFY_CSR = 1; + +const int kSecSubjectItemAttr = 1937072746; + +const int kSecIssuerItemAttr = 1769173877; + +const int kSecSerialNumberItemAttr = 1936614002; + +const int kSecPublicKeyHashItemAttr = 1752198009; + +const int kSecSubjectKeyIdentifierItemAttr = 1936419172; + +const int kSecCertTypeItemAttr = 1668577648; + +const int kSecCertEncodingItemAttr = 1667591779; + +const int SSL_NULL_WITH_NULL_NULL = 0; + +const int SSL_RSA_WITH_NULL_MD5 = 1; + +const int SSL_RSA_WITH_NULL_SHA = 2; + +const int SSL_RSA_EXPORT_WITH_RC4_40_MD5 = 3; + +const int SSL_RSA_WITH_RC4_128_MD5 = 4; + +const int SSL_RSA_WITH_RC4_128_SHA = 5; + +const int SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 6; + +const int SSL_RSA_WITH_IDEA_CBC_SHA = 7; + +const int SSL_RSA_EXPORT_WITH_DES40_CBC_SHA = 8; + +const int SSL_RSA_WITH_DES_CBC_SHA = 9; + +const int SSL_RSA_WITH_3DES_EDE_CBC_SHA = 10; + +const int SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 11; + +const int SSL_DH_DSS_WITH_DES_CBC_SHA = 12; + +const int SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA = 13; + +const int SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 14; + +const int SSL_DH_RSA_WITH_DES_CBC_SHA = 15; + +const int SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA = 16; + +const int SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 17; + +const int SSL_DHE_DSS_WITH_DES_CBC_SHA = 18; + +const int SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 19; + +const int SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 20; + +const int SSL_DHE_RSA_WITH_DES_CBC_SHA = 21; + +const int SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 22; + +const int SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 = 23; + +const int SSL_DH_anon_WITH_RC4_128_MD5 = 24; + +const int SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 25; + +const int SSL_DH_anon_WITH_DES_CBC_SHA = 26; + +const int SSL_DH_anon_WITH_3DES_EDE_CBC_SHA = 27; + +const int SSL_FORTEZZA_DMS_WITH_NULL_SHA = 28; + +const int SSL_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA = 29; + +const int TLS_RSA_WITH_AES_128_CBC_SHA = 47; + +const int TLS_DH_DSS_WITH_AES_128_CBC_SHA = 48; + +const int TLS_DH_RSA_WITH_AES_128_CBC_SHA = 49; + +const int TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 50; + +const int TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 51; + +const int TLS_DH_anon_WITH_AES_128_CBC_SHA = 52; + +const int TLS_RSA_WITH_AES_256_CBC_SHA = 53; + +const int TLS_DH_DSS_WITH_AES_256_CBC_SHA = 54; + +const int TLS_DH_RSA_WITH_AES_256_CBC_SHA = 55; + +const int TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 56; + +const int TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 57; + +const int TLS_DH_anon_WITH_AES_256_CBC_SHA = 58; + +const int TLS_ECDH_ECDSA_WITH_NULL_SHA = -16383; + +const int TLS_ECDH_ECDSA_WITH_RC4_128_SHA = -16382; + +const int TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA = -16381; + +const int TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA = -16380; + +const int TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = -16379; + +const int TLS_ECDHE_ECDSA_WITH_NULL_SHA = -16378; + +const int TLS_ECDHE_ECDSA_WITH_RC4_128_SHA = -16377; + +const int TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA = -16376; + +const int TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = -16375; + +const int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = -16374; + +const int TLS_ECDH_RSA_WITH_NULL_SHA = -16373; + +const int TLS_ECDH_RSA_WITH_RC4_128_SHA = -16372; + +const int TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA = -16371; + +const int TLS_ECDH_RSA_WITH_AES_128_CBC_SHA = -16370; + +const int TLS_ECDH_RSA_WITH_AES_256_CBC_SHA = -16369; + +const int TLS_ECDHE_RSA_WITH_NULL_SHA = -16368; + +const int TLS_ECDHE_RSA_WITH_RC4_128_SHA = -16367; + +const int TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA = -16366; + +const int TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = -16365; + +const int TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = -16364; + +const int TLS_ECDH_anon_WITH_NULL_SHA = -16363; + +const int TLS_ECDH_anon_WITH_RC4_128_SHA = -16362; + +const int TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA = -16361; + +const int TLS_ECDH_anon_WITH_AES_128_CBC_SHA = -16360; + +const int TLS_ECDH_anon_WITH_AES_256_CBC_SHA = -16359; + +const int TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA = -16331; + +const int TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA = -16330; + +const int TLS_PSK_WITH_CHACHA20_POLY1305_SHA256 = -13141; + +const int TLS_NULL_WITH_NULL_NULL = 0; + +const int TLS_RSA_WITH_NULL_MD5 = 1; + +const int TLS_RSA_WITH_NULL_SHA = 2; + +const int TLS_RSA_WITH_RC4_128_MD5 = 4; + +const int TLS_RSA_WITH_RC4_128_SHA = 5; + +const int TLS_RSA_WITH_3DES_EDE_CBC_SHA = 10; + +const int TLS_RSA_WITH_NULL_SHA256 = 59; + +const int TLS_RSA_WITH_AES_128_CBC_SHA256 = 60; + +const int TLS_RSA_WITH_AES_256_CBC_SHA256 = 61; + +const int TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = 13; + +const int TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = 16; + +const int TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 19; + +const int TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 22; + +const int TLS_DH_DSS_WITH_AES_128_CBC_SHA256 = 62; + +const int TLS_DH_RSA_WITH_AES_128_CBC_SHA256 = 63; + +const int TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 = 64; + +const int TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 103; + +const int TLS_DH_DSS_WITH_AES_256_CBC_SHA256 = 104; + +const int TLS_DH_RSA_WITH_AES_256_CBC_SHA256 = 105; + +const int TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 = 106; + +const int TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 107; + +const int TLS_DH_anon_WITH_RC4_128_MD5 = 24; + +const int TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = 27; + +const int TLS_DH_anon_WITH_AES_128_CBC_SHA256 = 108; + +const int TLS_DH_anon_WITH_AES_256_CBC_SHA256 = 109; + +const int TLS_PSK_WITH_RC4_128_SHA = 138; + +const int TLS_PSK_WITH_3DES_EDE_CBC_SHA = 139; + +const int TLS_PSK_WITH_AES_128_CBC_SHA = 140; + +const int TLS_PSK_WITH_AES_256_CBC_SHA = 141; + +const int TLS_DHE_PSK_WITH_RC4_128_SHA = 142; + +const int TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA = 143; + +const int TLS_DHE_PSK_WITH_AES_128_CBC_SHA = 144; + +const int TLS_DHE_PSK_WITH_AES_256_CBC_SHA = 145; + +const int TLS_RSA_PSK_WITH_RC4_128_SHA = 146; + +const int TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA = 147; + +const int TLS_RSA_PSK_WITH_AES_128_CBC_SHA = 148; + +const int TLS_RSA_PSK_WITH_AES_256_CBC_SHA = 149; + +const int TLS_PSK_WITH_NULL_SHA = 44; + +const int TLS_DHE_PSK_WITH_NULL_SHA = 45; + +const int TLS_RSA_PSK_WITH_NULL_SHA = 46; + +const int TLS_RSA_WITH_AES_128_GCM_SHA256 = 156; + +const int TLS_RSA_WITH_AES_256_GCM_SHA384 = 157; + +const int TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 = 158; + +const int TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 = 159; + +const int TLS_DH_RSA_WITH_AES_128_GCM_SHA256 = 160; + +const int TLS_DH_RSA_WITH_AES_256_GCM_SHA384 = 161; + +const int TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 = 162; + +const int TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 = 163; + +const int TLS_DH_DSS_WITH_AES_128_GCM_SHA256 = 164; + +const int TLS_DH_DSS_WITH_AES_256_GCM_SHA384 = 165; + +const int TLS_DH_anon_WITH_AES_128_GCM_SHA256 = 166; + +const int TLS_DH_anon_WITH_AES_256_GCM_SHA384 = 167; + +const int TLS_PSK_WITH_AES_128_GCM_SHA256 = 168; + +const int TLS_PSK_WITH_AES_256_GCM_SHA384 = 169; + +const int TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 = 170; + +const int TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 = 171; + +const int TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 = 172; + +const int TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 = 173; + +const int TLS_PSK_WITH_AES_128_CBC_SHA256 = 174; + +const int TLS_PSK_WITH_AES_256_CBC_SHA384 = 175; + +const int TLS_PSK_WITH_NULL_SHA256 = 176; + +const int TLS_PSK_WITH_NULL_SHA384 = 177; + +const int TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 = 178; + +const int TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 = 179; + +const int TLS_DHE_PSK_WITH_NULL_SHA256 = 180; + +const int TLS_DHE_PSK_WITH_NULL_SHA384 = 181; + +const int TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 = 182; + +const int TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 = 183; + +const int TLS_RSA_PSK_WITH_NULL_SHA256 = 184; + +const int TLS_RSA_PSK_WITH_NULL_SHA384 = 185; + +const int TLS_AES_128_GCM_SHA256 = 4865; + +const int TLS_AES_256_GCM_SHA384 = 4866; + +const int TLS_CHACHA20_POLY1305_SHA256 = 4867; + +const int TLS_AES_128_CCM_SHA256 = 4868; + +const int TLS_AES_128_CCM_8_SHA256 = 4869; + +const int TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = -16349; + +const int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 = -16348; + +const int TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 = -16347; + +const int TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 = -16346; + +const int TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = -16345; + +const int TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 = -16344; + +const int TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 = -16343; + +const int TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 = -16342; + +const int TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = -16341; + +const int TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = -16340; + +const int TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 = -16339; + +const int TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 = -16338; + +const int TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = -16337; + +const int TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = -16336; + +const int TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 = -16335; + +const int TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 = -16334; + +const int TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = -13144; + +const int TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = -13143; + +const int TLS_EMPTY_RENEGOTIATION_INFO_SCSV = 255; + +const int SSL_RSA_WITH_RC2_CBC_MD5 = -128; + +const int SSL_RSA_WITH_IDEA_CBC_MD5 = -127; + +const int SSL_RSA_WITH_DES_CBC_MD5 = -126; + +const int SSL_RSA_WITH_3DES_EDE_CBC_MD5 = -125; + +const int SSL_NO_SUCH_CIPHERSUITE = -1; + +const int noErr3 = 0; + +const int kNilOptions3 = 0; + +const int kVariableLengthArray3 = 1; + +const int kUnknownType3 = 1061109567; + +const int normal3 = 0; + +const int bold3 = 1; + +const int italic3 = 2; + +const int underline3 = 4; + +const int outline3 = 8; + +const int shadow3 = 16; + +const int condense3 = 32; + +const int extend3 = 64; + +const int developStage3 = 32; + +const int alphaStage3 = 64; + +const int betaStage3 = 96; + +const int finalStage3 = 128; + +const int NSScannedOption3 = 1; + +const int NSCollectorDisabledOption3 = 2; + +const int NSASCIIStringEncoding = 1; + +const int NSNEXTSTEPStringEncoding = 2; + +const int NSJapaneseEUCStringEncoding = 3; + +const int NSUTF8StringEncoding = 4; + +const int NSISOLatin1StringEncoding = 5; + +const int NSSymbolStringEncoding = 6; + +const int NSNonLossyASCIIStringEncoding = 7; + +const int NSShiftJISStringEncoding = 8; + +const int NSISOLatin2StringEncoding = 9; + +const int NSUnicodeStringEncoding = 10; + +const int NSWindowsCP1251StringEncoding = 11; + +const int NSWindowsCP1252StringEncoding = 12; + +const int NSWindowsCP1253StringEncoding = 13; + +const int NSWindowsCP1254StringEncoding = 14; + +const int NSWindowsCP1250StringEncoding = 15; + +const int NSISO2022JPStringEncoding = 21; + +const int NSMacOSRomanStringEncoding = 30; + +const int NSUTF16StringEncoding = 10; + +const int NSUTF16BigEndianStringEncoding = 2415919360; + +const int NSUTF16LittleEndianStringEncoding = 2483028224; + +const int NSUTF32StringEncoding = 2348810496; + +const int NSUTF32BigEndianStringEncoding = 2550137088; + +const int NSUTF32LittleEndianStringEncoding = 2617245952; + +const int NSProprietaryStringEncoding = 65536; + +const int NSOpenStepUnicodeReservedBase = 62464; + +const int noErr4 = 0; + +const int kNilOptions4 = 0; + +const int kVariableLengthArray4 = 1; + +const int kUnknownType4 = 1061109567; + +const int normal4 = 0; + +const int bold4 = 1; + +const int italic4 = 2; + +const int underline4 = 4; + +const int outline4 = 8; + +const int shadow4 = 16; + +const int condense4 = 32; + +const int extend4 = 64; + +const int developStage4 = 32; + +const int alphaStage4 = 64; + +const int betaStage4 = 96; + +const int finalStage4 = 128; + +const int NSScannedOption4 = 1; + +const int NSCollectorDisabledOption4 = 2; + +const int noErr5 = 0; + +const int kNilOptions5 = 0; + +const int kVariableLengthArray5 = 1; + +const int kUnknownType5 = 1061109567; + +const int normal5 = 0; + +const int bold5 = 1; + +const int italic5 = 2; + +const int underline5 = 4; + +const int outline5 = 8; + +const int shadow5 = 16; + +const int condense5 = 32; + +const int extend5 = 64; + +const int developStage5 = 32; + +const int alphaStage5 = 64; + +const int betaStage5 = 96; + +const int finalStage5 = 128; + +const int NSScannedOption5 = 1; + +const int NSCollectorDisabledOption5 = 2; + +const int noErr6 = 0; + +const int kNilOptions6 = 0; + +const int kVariableLengthArray6 = 1; + +const int kUnknownType6 = 1061109567; + +const int normal6 = 0; + +const int bold6 = 1; + +const int italic6 = 2; + +const int underline6 = 4; + +const int outline6 = 8; + +const int shadow6 = 16; + +const int condense6 = 32; + +const int extend6 = 64; + +const int developStage6 = 32; + +const int alphaStage6 = 64; + +const int betaStage6 = 96; + +const int finalStage6 = 128; + +const int NSScannedOption6 = 1; + +const int NSCollectorDisabledOption6 = 2; + +const int noErr7 = 0; + +const int kNilOptions7 = 0; + +const int kVariableLengthArray7 = 1; + +const int kUnknownType7 = 1061109567; + +const int normal7 = 0; + +const int bold7 = 1; + +const int italic7 = 2; + +const int underline7 = 4; + +const int outline7 = 8; + +const int shadow7 = 16; + +const int condense7 = 32; + +const int extend7 = 64; + +const int developStage7 = 32; + +const int alphaStage7 = 64; + +const int betaStage7 = 96; + +const int finalStage7 = 128; + +const int NSScannedOption7 = 1; + +const int NSCollectorDisabledOption7 = 2; + +const int noErr8 = 0; + +const int kNilOptions8 = 0; + +const int kVariableLengthArray8 = 1; + +const int kUnknownType8 = 1061109567; + +const int normal8 = 0; + +const int bold8 = 1; + +const int italic8 = 2; + +const int underline8 = 4; + +const int outline8 = 8; + +const int shadow8 = 16; + +const int condense8 = 32; + +const int extend8 = 64; + +const int developStage8 = 32; + +const int alphaStage8 = 64; + +const int betaStage8 = 96; + +const int finalStage8 = 128; + +const int NSScannedOption8 = 1; + +const int NSCollectorDisabledOption8 = 2; + +const int NSASCIIStringEncoding1 = 1; + +const int NSNEXTSTEPStringEncoding1 = 2; + +const int NSJapaneseEUCStringEncoding1 = 3; + +const int NSUTF8StringEncoding1 = 4; + +const int NSISOLatin1StringEncoding1 = 5; + +const int NSSymbolStringEncoding1 = 6; + +const int NSNonLossyASCIIStringEncoding1 = 7; + +const int NSShiftJISStringEncoding1 = 8; + +const int NSISOLatin2StringEncoding1 = 9; + +const int NSUnicodeStringEncoding1 = 10; + +const int NSWindowsCP1251StringEncoding1 = 11; + +const int NSWindowsCP1252StringEncoding1 = 12; + +const int NSWindowsCP1253StringEncoding1 = 13; + +const int NSWindowsCP1254StringEncoding1 = 14; + +const int NSWindowsCP1250StringEncoding1 = 15; + +const int NSISO2022JPStringEncoding1 = 21; + +const int NSMacOSRomanStringEncoding1 = 30; + +const int NSUTF16StringEncoding1 = 10; + +const int NSUTF16BigEndianStringEncoding1 = 2415919360; + +const int NSUTF16LittleEndianStringEncoding1 = 2483028224; + +const int NSUTF32StringEncoding1 = 2348810496; + +const int NSUTF32BigEndianStringEncoding1 = 2550137088; + +const int NSUTF32LittleEndianStringEncoding1 = 2617245952; + +const int NSProprietaryStringEncoding1 = 65536; + +const int DISPATCH_WALLTIME_NOW1 = -2; + +const int noErr9 = 0; + +const int kNilOptions9 = 0; + +const int kVariableLengthArray9 = 1; + +const int kUnknownType9 = 1061109567; + +const int normal9 = 0; + +const int bold9 = 1; + +const int italic9 = 2; + +const int underline9 = 4; + +const int outline9 = 8; + +const int shadow9 = 16; + +const int condense9 = 32; + +const int extend9 = 64; + +const int developStage9 = 32; + +const int alphaStage9 = 64; + +const int betaStage9 = 96; + +const int finalStage9 = 128; + +const int NSScannedOption9 = 1; + +const int NSCollectorDisabledOption9 = 2; + +const int noErr10 = 0; + +const int kNilOptions10 = 0; + +const int kVariableLengthArray10 = 1; + +const int kUnknownType10 = 1061109567; + +const int normal10 = 0; + +const int bold10 = 1; + +const int italic10 = 2; + +const int underline10 = 4; + +const int outline10 = 8; + +const int shadow10 = 16; + +const int condense10 = 32; + +const int extend10 = 64; + +const int developStage10 = 32; + +const int alphaStage10 = 64; + +const int betaStage10 = 96; + +const int finalStage10 = 128; + +const int NSScannedOption10 = 1; + +const int NSCollectorDisabledOption10 = 2; + +const int noErr11 = 0; + +const int kNilOptions11 = 0; + +const int kVariableLengthArray11 = 1; + +const int kUnknownType11 = 1061109567; + +const int normal11 = 0; + +const int bold11 = 1; + +const int italic11 = 2; + +const int underline11 = 4; + +const int outline11 = 8; + +const int shadow11 = 16; + +const int condense11 = 32; + +const int extend11 = 64; + +const int developStage11 = 32; + +const int alphaStage11 = 64; + +const int betaStage11 = 96; + +const int finalStage11 = 128; + +const int NSScannedOption11 = 1; + +const int NSCollectorDisabledOption11 = 2; + +const int NSASCIIStringEncoding2 = 1; + +const int NSNEXTSTEPStringEncoding2 = 2; + +const int NSJapaneseEUCStringEncoding2 = 3; + +const int NSUTF8StringEncoding2 = 4; + +const int NSISOLatin1StringEncoding2 = 5; + +const int NSSymbolStringEncoding2 = 6; + +const int NSNonLossyASCIIStringEncoding2 = 7; + +const int NSShiftJISStringEncoding2 = 8; + +const int NSISOLatin2StringEncoding2 = 9; + +const int NSUnicodeStringEncoding2 = 10; + +const int NSWindowsCP1251StringEncoding2 = 11; + +const int NSWindowsCP1252StringEncoding2 = 12; + +const int NSWindowsCP1253StringEncoding2 = 13; + +const int NSWindowsCP1254StringEncoding2 = 14; + +const int NSWindowsCP1250StringEncoding2 = 15; + +const int NSISO2022JPStringEncoding2 = 21; + +const int NSMacOSRomanStringEncoding2 = 30; + +const int NSUTF16StringEncoding2 = 10; + +const int NSUTF16BigEndianStringEncoding2 = 2415919360; + +const int NSUTF16LittleEndianStringEncoding2 = 2483028224; + +const int NSUTF32StringEncoding2 = 2348810496; + +const int NSUTF32BigEndianStringEncoding2 = 2550137088; + +const int NSUTF32LittleEndianStringEncoding2 = 2617245952; + +const int NSProprietaryStringEncoding2 = 65536; + +const int NSOpenStepUnicodeReservedBase1 = 62464; + +const int errSecSuccess1 = 0; + +const int errSecUnimplemented1 = -4; + +const int errSecDiskFull1 = -34; + +const int errSecDskFull1 = -34; + +const int errSecIO1 = -36; + +const int errSecOpWr1 = -49; + +const int errSecParam1 = -50; + +const int errSecWrPerm1 = -61; + +const int errSecAllocate1 = -108; + +const int errSecUserCanceled1 = -128; + +const int errSecBadReq1 = -909; + +const int errSecInternalComponent1 = -2070; + +const int errSecCoreFoundationUnknown1 = -4960; + +const int errSecMissingEntitlement1 = -34018; + +const int errSecRestrictedAPI1 = -34020; + +const int errSecNotAvailable1 = -25291; + +const int errSecReadOnly1 = -25292; + +const int errSecAuthFailed1 = -25293; + +const int errSecNoSuchKeychain1 = -25294; + +const int errSecInvalidKeychain1 = -25295; + +const int errSecDuplicateKeychain1 = -25296; + +const int errSecDuplicateCallback1 = -25297; + +const int errSecInvalidCallback1 = -25298; + +const int errSecDuplicateItem1 = -25299; + +const int errSecItemNotFound1 = -25300; + +const int errSecBufferTooSmall1 = -25301; + +const int errSecDataTooLarge1 = -25302; + +const int errSecNoSuchAttr1 = -25303; + +const int errSecInvalidItemRef1 = -25304; + +const int errSecInvalidSearchRef1 = -25305; + +const int errSecNoSuchClass1 = -25306; + +const int errSecNoDefaultKeychain1 = -25307; + +const int errSecInteractionNotAllowed1 = -25308; + +const int errSecReadOnlyAttr1 = -25309; + +const int errSecWrongSecVersion1 = -25310; + +const int errSecKeySizeNotAllowed1 = -25311; + +const int errSecNoStorageModule1 = -25312; + +const int errSecNoCertificateModule1 = -25313; + +const int errSecNoPolicyModule1 = -25314; + +const int errSecInteractionRequired1 = -25315; + +const int errSecDataNotAvailable1 = -25316; + +const int errSecDataNotModifiable1 = -25317; + +const int errSecCreateChainFailed1 = -25318; + +const int errSecInvalidPrefsDomain1 = -25319; + +const int errSecInDarkWake1 = -25320; + +const int errSecACLNotSimple1 = -25240; + +const int errSecPolicyNotFound1 = -25241; + +const int errSecInvalidTrustSetting1 = -25242; + +const int errSecNoAccessForItem1 = -25243; + +const int errSecInvalidOwnerEdit1 = -25244; + +const int errSecTrustNotAvailable1 = -25245; + +const int errSecUnsupportedFormat1 = -25256; + +const int errSecUnknownFormat1 = -25257; + +const int errSecKeyIsSensitive1 = -25258; + +const int errSecMultiplePrivKeys1 = -25259; + +const int errSecPassphraseRequired1 = -25260; + +const int errSecInvalidPasswordRef1 = -25261; + +const int errSecInvalidTrustSettings1 = -25262; + +const int errSecNoTrustSettings1 = -25263; + +const int errSecPkcs12VerifyFailure1 = -25264; + +const int errSecNotSigner1 = -26267; + +const int errSecDecode1 = -26275; + +const int errSecServiceNotAvailable1 = -67585; + +const int errSecInsufficientClientID1 = -67586; + +const int errSecDeviceReset1 = -67587; + +const int errSecDeviceFailed1 = -67588; + +const int errSecAppleAddAppACLSubject1 = -67589; + +const int errSecApplePublicKeyIncomplete1 = -67590; + +const int errSecAppleSignatureMismatch1 = -67591; + +const int errSecAppleInvalidKeyStartDate1 = -67592; + +const int errSecAppleInvalidKeyEndDate1 = -67593; + +const int errSecConversionError1 = -67594; + +const int errSecAppleSSLv2Rollback1 = -67595; + +const int errSecQuotaExceeded1 = -67596; + +const int errSecFileTooBig1 = -67597; + +const int errSecInvalidDatabaseBlob1 = -67598; + +const int errSecInvalidKeyBlob1 = -67599; + +const int errSecIncompatibleDatabaseBlob1 = -67600; + +const int errSecIncompatibleKeyBlob1 = -67601; + +const int errSecHostNameMismatch1 = -67602; + +const int errSecUnknownCriticalExtensionFlag1 = -67603; + +const int errSecNoBasicConstraints1 = -67604; + +const int errSecNoBasicConstraintsCA1 = -67605; + +const int errSecInvalidAuthorityKeyID1 = -67606; + +const int errSecInvalidSubjectKeyID1 = -67607; + +const int errSecInvalidKeyUsageForPolicy1 = -67608; + +const int errSecInvalidExtendedKeyUsage1 = -67609; + +const int errSecInvalidIDLinkage1 = -67610; + +const int errSecPathLengthConstraintExceeded1 = -67611; + +const int errSecInvalidRoot1 = -67612; + +const int errSecCRLExpired1 = -67613; + +const int errSecCRLNotValidYet1 = -67614; + +const int errSecCRLNotFound1 = -67615; + +const int errSecCRLServerDown1 = -67616; + +const int errSecCRLBadURI1 = -67617; + +const int errSecUnknownCertExtension1 = -67618; + +const int errSecUnknownCRLExtension1 = -67619; + +const int errSecCRLNotTrusted1 = -67620; + +const int errSecCRLPolicyFailed1 = -67621; + +const int errSecIDPFailure1 = -67622; + +const int errSecSMIMEEmailAddressesNotFound1 = -67623; + +const int errSecSMIMEBadExtendedKeyUsage1 = -67624; + +const int errSecSMIMEBadKeyUsage1 = -67625; + +const int errSecSMIMEKeyUsageNotCritical1 = -67626; + +const int errSecSMIMENoEmailAddress1 = -67627; + +const int errSecSMIMESubjAltNameNotCritical1 = -67628; + +const int errSecSSLBadExtendedKeyUsage1 = -67629; + +const int errSecOCSPBadResponse1 = -67630; + +const int errSecOCSPBadRequest1 = -67631; + +const int errSecOCSPUnavailable1 = -67632; + +const int errSecOCSPStatusUnrecognized1 = -67633; + +const int errSecEndOfData1 = -67634; + +const int errSecIncompleteCertRevocationCheck1 = -67635; + +const int errSecNetworkFailure1 = -67636; + +const int errSecOCSPNotTrustedToAnchor1 = -67637; + +const int errSecRecordModified1 = -67638; + +const int errSecOCSPSignatureError1 = -67639; + +const int errSecOCSPNoSigner1 = -67640; + +const int errSecOCSPResponderMalformedReq1 = -67641; + +const int errSecOCSPResponderInternalError1 = -67642; + +const int errSecOCSPResponderTryLater1 = -67643; + +const int errSecOCSPResponderSignatureRequired1 = -67644; + +const int errSecOCSPResponderUnauthorized1 = -67645; + +const int errSecOCSPResponseNonceMismatch1 = -67646; + +const int errSecCodeSigningBadCertChainLength1 = -67647; + +const int errSecCodeSigningNoBasicConstraints1 = -67648; + +const int errSecCodeSigningBadPathLengthConstraint1 = -67649; + +const int errSecCodeSigningNoExtendedKeyUsage1 = -67650; + +const int errSecCodeSigningDevelopment1 = -67651; + +const int errSecResourceSignBadCertChainLength1 = -67652; + +const int errSecResourceSignBadExtKeyUsage1 = -67653; + +const int errSecTrustSettingDeny1 = -67654; + +const int errSecInvalidSubjectName1 = -67655; + +const int errSecUnknownQualifiedCertStatement1 = -67656; + +const int errSecMobileMeRequestQueued1 = -67657; + +const int errSecMobileMeRequestRedirected1 = -67658; + +const int errSecMobileMeServerError1 = -67659; + +const int errSecMobileMeServerNotAvailable1 = -67660; + +const int errSecMobileMeServerAlreadyExists1 = -67661; + +const int errSecMobileMeServerServiceErr1 = -67662; + +const int errSecMobileMeRequestAlreadyPending1 = -67663; + +const int errSecMobileMeNoRequestPending1 = -67664; + +const int errSecMobileMeCSRVerifyFailure1 = -67665; + +const int errSecMobileMeFailedConsistencyCheck1 = -67666; + +const int errSecNotInitialized1 = -67667; + +const int errSecInvalidHandleUsage1 = -67668; + +const int errSecPVCReferentNotFound1 = -67669; + +const int errSecFunctionIntegrityFail1 = -67670; + +const int errSecInternalError1 = -67671; + +const int errSecMemoryError1 = -67672; + +const int errSecInvalidData1 = -67673; + +const int errSecMDSError1 = -67674; + +const int errSecInvalidPointer1 = -67675; + +const int errSecSelfCheckFailed1 = -67676; + +const int errSecFunctionFailed1 = -67677; + +const int errSecModuleManifestVerifyFailed1 = -67678; + +const int errSecInvalidGUID1 = -67679; + +const int errSecInvalidHandle1 = -67680; + +const int errSecInvalidDBList1 = -67681; + +const int errSecInvalidPassthroughID1 = -67682; + +const int errSecInvalidNetworkAddress1 = -67683; + +const int errSecCRLAlreadySigned1 = -67684; + +const int errSecInvalidNumberOfFields1 = -67685; + +const int errSecVerificationFailure1 = -67686; + +const int errSecUnknownTag1 = -67687; + +const int errSecInvalidSignature1 = -67688; + +const int errSecInvalidName1 = -67689; + +const int errSecInvalidCertificateRef1 = -67690; + +const int errSecInvalidCertificateGroup1 = -67691; + +const int errSecTagNotFound1 = -67692; + +const int errSecInvalidQuery1 = -67693; + +const int errSecInvalidValue1 = -67694; + +const int errSecCallbackFailed1 = -67695; + +const int errSecACLDeleteFailed1 = -67696; + +const int errSecACLReplaceFailed1 = -67697; + +const int errSecACLAddFailed1 = -67698; + +const int errSecACLChangeFailed1 = -67699; + +const int errSecInvalidAccessCredentials1 = -67700; + +const int errSecInvalidRecord1 = -67701; + +const int errSecInvalidACL1 = -67702; + +const int errSecInvalidSampleValue1 = -67703; + +const int errSecIncompatibleVersion1 = -67704; + +const int errSecPrivilegeNotGranted1 = -67705; + +const int errSecInvalidScope1 = -67706; + +const int errSecPVCAlreadyConfigured1 = -67707; + +const int errSecInvalidPVC1 = -67708; + +const int errSecEMMLoadFailed1 = -67709; + +const int errSecEMMUnloadFailed1 = -67710; + +const int errSecAddinLoadFailed1 = -67711; + +const int errSecInvalidKeyRef1 = -67712; + +const int errSecInvalidKeyHierarchy1 = -67713; + +const int errSecAddinUnloadFailed1 = -67714; + +const int errSecLibraryReferenceNotFound1 = -67715; + +const int errSecInvalidAddinFunctionTable1 = -67716; + +const int errSecInvalidServiceMask1 = -67717; + +const int errSecModuleNotLoaded1 = -67718; + +const int errSecInvalidSubServiceID1 = -67719; + +const int errSecAttributeNotInContext1 = -67720; + +const int errSecModuleManagerInitializeFailed1 = -67721; + +const int errSecModuleManagerNotFound1 = -67722; + +const int errSecEventNotificationCallbackNotFound1 = -67723; + +const int errSecInputLengthError1 = -67724; + +const int errSecOutputLengthError1 = -67725; + +const int errSecPrivilegeNotSupported1 = -67726; + +const int errSecDeviceError1 = -67727; + +const int errSecAttachHandleBusy1 = -67728; + +const int errSecNotLoggedIn1 = -67729; + +const int errSecAlgorithmMismatch1 = -67730; + +const int errSecKeyUsageIncorrect1 = -67731; + +const int errSecKeyBlobTypeIncorrect1 = -67732; + +const int errSecKeyHeaderInconsistent1 = -67733; + +const int errSecUnsupportedKeyFormat1 = -67734; + +const int errSecUnsupportedKeySize1 = -67735; + +const int errSecInvalidKeyUsageMask1 = -67736; + +const int errSecUnsupportedKeyUsageMask1 = -67737; + +const int errSecInvalidKeyAttributeMask1 = -67738; + +const int errSecUnsupportedKeyAttributeMask1 = -67739; + +const int errSecInvalidKeyLabel1 = -67740; + +const int errSecUnsupportedKeyLabel1 = -67741; + +const int errSecInvalidKeyFormat1 = -67742; + +const int errSecUnsupportedVectorOfBuffers1 = -67743; + +const int errSecInvalidInputVector1 = -67744; + +const int errSecInvalidOutputVector1 = -67745; + +const int errSecInvalidContext1 = -67746; + +const int errSecInvalidAlgorithm1 = -67747; + +const int errSecInvalidAttributeKey1 = -67748; + +const int errSecMissingAttributeKey1 = -67749; + +const int errSecInvalidAttributeInitVector1 = -67750; + +const int errSecMissingAttributeInitVector1 = -67751; + +const int errSecInvalidAttributeSalt1 = -67752; + +const int errSecMissingAttributeSalt1 = -67753; + +const int errSecInvalidAttributePadding1 = -67754; + +const int errSecMissingAttributePadding1 = -67755; + +const int errSecInvalidAttributeRandom1 = -67756; + +const int errSecMissingAttributeRandom1 = -67757; + +const int errSecInvalidAttributeSeed1 = -67758; + +const int errSecMissingAttributeSeed1 = -67759; + +const int errSecInvalidAttributePassphrase1 = -67760; + +const int errSecMissingAttributePassphrase1 = -67761; + +const int errSecInvalidAttributeKeyLength1 = -67762; + +const int errSecMissingAttributeKeyLength1 = -67763; + +const int errSecInvalidAttributeBlockSize1 = -67764; + +const int errSecMissingAttributeBlockSize1 = -67765; + +const int errSecInvalidAttributeOutputSize1 = -67766; + +const int errSecMissingAttributeOutputSize1 = -67767; + +const int errSecInvalidAttributeRounds1 = -67768; + +const int errSecMissingAttributeRounds1 = -67769; + +const int errSecInvalidAlgorithmParms1 = -67770; + +const int errSecMissingAlgorithmParms1 = -67771; + +const int errSecInvalidAttributeLabel1 = -67772; + +const int errSecMissingAttributeLabel1 = -67773; + +const int errSecInvalidAttributeKeyType1 = -67774; + +const int errSecMissingAttributeKeyType1 = -67775; + +const int errSecInvalidAttributeMode1 = -67776; + +const int errSecMissingAttributeMode1 = -67777; + +const int errSecInvalidAttributeEffectiveBits1 = -67778; + +const int errSecMissingAttributeEffectiveBits1 = -67779; + +const int errSecInvalidAttributeStartDate1 = -67780; + +const int errSecMissingAttributeStartDate1 = -67781; + +const int errSecInvalidAttributeEndDate1 = -67782; + +const int errSecMissingAttributeEndDate1 = -67783; + +const int errSecInvalidAttributeVersion1 = -67784; + +const int errSecMissingAttributeVersion1 = -67785; + +const int errSecInvalidAttributePrime1 = -67786; + +const int errSecMissingAttributePrime1 = -67787; + +const int errSecInvalidAttributeBase1 = -67788; + +const int errSecMissingAttributeBase1 = -67789; + +const int errSecInvalidAttributeSubprime1 = -67790; + +const int errSecMissingAttributeSubprime1 = -67791; + +const int errSecInvalidAttributeIterationCount1 = -67792; + +const int errSecMissingAttributeIterationCount1 = -67793; + +const int errSecInvalidAttributeDLDBHandle1 = -67794; + +const int errSecMissingAttributeDLDBHandle1 = -67795; + +const int errSecInvalidAttributeAccessCredentials1 = -67796; + +const int errSecMissingAttributeAccessCredentials1 = -67797; + +const int errSecInvalidAttributePublicKeyFormat1 = -67798; + +const int errSecMissingAttributePublicKeyFormat1 = -67799; + +const int errSecInvalidAttributePrivateKeyFormat1 = -67800; + +const int errSecMissingAttributePrivateKeyFormat1 = -67801; + +const int errSecInvalidAttributeSymmetricKeyFormat1 = -67802; + +const int errSecMissingAttributeSymmetricKeyFormat1 = -67803; + +const int errSecInvalidAttributeWrappedKeyFormat1 = -67804; + +const int errSecMissingAttributeWrappedKeyFormat1 = -67805; + +const int errSecStagedOperationInProgress1 = -67806; + +const int errSecStagedOperationNotStarted1 = -67807; + +const int errSecVerifyFailed1 = -67808; + +const int errSecQuerySizeUnknown1 = -67809; + +const int errSecBlockSizeMismatch1 = -67810; + +const int errSecPublicKeyInconsistent1 = -67811; + +const int errSecDeviceVerifyFailed1 = -67812; + +const int errSecInvalidLoginName1 = -67813; + +const int errSecAlreadyLoggedIn1 = -67814; + +const int errSecInvalidDigestAlgorithm1 = -67815; + +const int errSecInvalidCRLGroup1 = -67816; + +const int errSecCertificateCannotOperate1 = -67817; + +const int errSecCertificateExpired1 = -67818; + +const int errSecCertificateNotValidYet1 = -67819; + +const int errSecCertificateRevoked1 = -67820; + +const int errSecCertificateSuspended1 = -67821; + +const int errSecInsufficientCredentials1 = -67822; + +const int errSecInvalidAction1 = -67823; + +const int errSecInvalidAuthority1 = -67824; + +const int errSecVerifyActionFailed1 = -67825; + +const int errSecInvalidCertAuthority1 = -67826; + +const int errSecInvalidCRLAuthority1 = -67827; + +const int errSecInvaldCRLAuthority1 = -67827; + +const int errSecInvalidCRLEncoding1 = -67828; + +const int errSecInvalidCRLType1 = -67829; + +const int errSecInvalidCRL1 = -67830; + +const int errSecInvalidFormType1 = -67831; + +const int errSecInvalidID1 = -67832; + +const int errSecInvalidIdentifier1 = -67833; + +const int errSecInvalidIndex1 = -67834; + +const int errSecInvalidPolicyIdentifiers1 = -67835; + +const int errSecInvalidTimeString1 = -67836; + +const int errSecInvalidReason1 = -67837; + +const int errSecInvalidRequestInputs1 = -67838; + +const int errSecInvalidResponseVector1 = -67839; + +const int errSecInvalidStopOnPolicy1 = -67840; + +const int errSecInvalidTuple1 = -67841; + +const int errSecMultipleValuesUnsupported1 = -67842; + +const int errSecNotTrusted1 = -67843; + +const int errSecNoDefaultAuthority1 = -67844; + +const int errSecRejectedForm1 = -67845; + +const int errSecRequestLost1 = -67846; + +const int errSecRequestRejected1 = -67847; + +const int errSecUnsupportedAddressType1 = -67848; + +const int errSecUnsupportedService1 = -67849; + +const int errSecInvalidTupleGroup1 = -67850; + +const int errSecInvalidBaseACLs1 = -67851; + +const int errSecInvalidTupleCredentials1 = -67852; + +const int errSecInvalidTupleCredendtials1 = -67852; + +const int errSecInvalidEncoding1 = -67853; + +const int errSecInvalidValidityPeriod1 = -67854; + +const int errSecInvalidRequestor1 = -67855; + +const int errSecRequestDescriptor1 = -67856; + +const int errSecInvalidBundleInfo1 = -67857; + +const int errSecInvalidCRLIndex1 = -67858; + +const int errSecNoFieldValues1 = -67859; + +const int errSecUnsupportedFieldFormat1 = -67860; + +const int errSecUnsupportedIndexInfo1 = -67861; + +const int errSecUnsupportedLocality1 = -67862; + +const int errSecUnsupportedNumAttributes1 = -67863; + +const int errSecUnsupportedNumIndexes1 = -67864; + +const int errSecUnsupportedNumRecordTypes1 = -67865; + +const int errSecFieldSpecifiedMultiple1 = -67866; + +const int errSecIncompatibleFieldFormat1 = -67867; + +const int errSecInvalidParsingModule1 = -67868; + +const int errSecDatabaseLocked1 = -67869; + +const int errSecDatastoreIsOpen1 = -67870; + +const int errSecMissingValue1 = -67871; + +const int errSecUnsupportedQueryLimits1 = -67872; + +const int errSecUnsupportedNumSelectionPreds1 = -67873; + +const int errSecUnsupportedOperator1 = -67874; + +const int errSecInvalidDBLocation1 = -67875; + +const int errSecInvalidAccessRequest1 = -67876; + +const int errSecInvalidIndexInfo1 = -67877; + +const int errSecInvalidNewOwner1 = -67878; + +const int errSecInvalidModifyMode1 = -67879; + +const int errSecMissingRequiredExtension1 = -67880; + +const int errSecExtendedKeyUsageNotCritical1 = -67881; + +const int errSecTimestampMissing1 = -67882; + +const int errSecTimestampInvalid1 = -67883; + +const int errSecTimestampNotTrusted1 = -67884; + +const int errSecTimestampServiceNotAvailable1 = -67885; + +const int errSecTimestampBadAlg1 = -67886; + +const int errSecTimestampBadRequest1 = -67887; + +const int errSecTimestampBadDataFormat1 = -67888; + +const int errSecTimestampTimeNotAvailable1 = -67889; + +const int errSecTimestampUnacceptedPolicy1 = -67890; + +const int errSecTimestampUnacceptedExtension1 = -67891; + +const int errSecTimestampAddInfoNotAvailable1 = -67892; + +const int errSecTimestampSystemFailure1 = -67893; + +const int errSecSigningTimeMissing1 = -67894; + +const int errSecTimestampRejection1 = -67895; + +const int errSecTimestampWaiting1 = -67896; + +const int errSecTimestampRevocationWarning1 = -67897; + +const int errSecTimestampRevocationNotification1 = -67898; + +const int errSecCertificatePolicyNotAllowed1 = -67899; + +const int errSecCertificateNameNotAllowed1 = -67900; + +const int errSecCertificateValidityPeriodTooLong1 = -67901; + +const int errSecCertificateIsCA1 = -67902; + +const int errSecCertificateDuplicateExtension1 = -67903; + +const int errSSLProtocol1 = -9800; + +const int errSSLNegotiation1 = -9801; + +const int errSSLFatalAlert1 = -9802; + +const int errSSLWouldBlock1 = -9803; + +const int errSSLSessionNotFound1 = -9804; + +const int errSSLClosedGraceful1 = -9805; + +const int errSSLClosedAbort1 = -9806; + +const int errSSLXCertChainInvalid1 = -9807; + +const int errSSLBadCert1 = -9808; + +const int errSSLCrypto1 = -9809; + +const int errSSLInternal1 = -9810; + +const int errSSLModuleAttach1 = -9811; + +const int errSSLUnknownRootCert1 = -9812; + +const int errSSLNoRootCert1 = -9813; + +const int errSSLCertExpired1 = -9814; + +const int errSSLCertNotYetValid1 = -9815; + +const int errSSLClosedNoNotify1 = -9816; + +const int errSSLBufferOverflow1 = -9817; + +const int errSSLBadCipherSuite1 = -9818; + +const int errSSLPeerUnexpectedMsg1 = -9819; + +const int errSSLPeerBadRecordMac1 = -9820; + +const int errSSLPeerDecryptionFail1 = -9821; + +const int errSSLPeerRecordOverflow1 = -9822; + +const int errSSLPeerDecompressFail1 = -9823; + +const int errSSLPeerHandshakeFail1 = -9824; + +const int errSSLPeerBadCert1 = -9825; + +const int errSSLPeerUnsupportedCert1 = -9826; + +const int errSSLPeerCertRevoked1 = -9827; + +const int errSSLPeerCertExpired1 = -9828; + +const int errSSLPeerCertUnknown1 = -9829; + +const int errSSLIllegalParam1 = -9830; + +const int errSSLPeerUnknownCA1 = -9831; + +const int errSSLPeerAccessDenied1 = -9832; + +const int errSSLPeerDecodeError1 = -9833; + +const int errSSLPeerDecryptError1 = -9834; + +const int errSSLPeerExportRestriction1 = -9835; + +const int errSSLPeerProtocolVersion1 = -9836; + +const int errSSLPeerInsufficientSecurity1 = -9837; + +const int errSSLPeerInternalError1 = -9838; + +const int errSSLPeerUserCancelled1 = -9839; + +const int errSSLPeerNoRenegotiation1 = -9840; + +const int errSSLPeerAuthCompleted1 = -9841; + +const int errSSLClientCertRequested1 = -9842; + +const int errSSLHostNameMismatch1 = -9843; + +const int errSSLConnectionRefused1 = -9844; + +const int errSSLDecryptionFail1 = -9845; + +const int errSSLBadRecordMac1 = -9846; + +const int errSSLRecordOverflow1 = -9847; + +const int errSSLBadConfiguration1 = -9848; + +const int errSSLUnexpectedRecord1 = -9849; + +const int errSSLWeakPeerEphemeralDHKey1 = -9850; + +const int errSSLClientHelloReceived1 = -9851; + +const int errSSLTransportReset1 = -9852; + +const int errSSLNetworkTimeout1 = -9853; + +const int errSSLConfigurationFailed1 = -9854; + +const int errSSLUnsupportedExtension1 = -9855; + +const int errSSLUnexpectedMessage1 = -9856; + +const int errSSLDecompressFail1 = -9857; + +const int errSSLHandshakeFail1 = -9858; + +const int errSSLDecodeError1 = -9859; + +const int errSSLInappropriateFallback1 = -9860; + +const int errSSLMissingExtension1 = -9861; + +const int errSSLBadCertificateStatusResponse1 = -9862; + +const int errSSLCertificateRequired1 = -9863; + +const int errSSLUnknownPSKIdentity1 = -9864; + +const int errSSLUnrecognizedName1 = -9865; + +const int errSSLATSViolation1 = -9880; + +const int errSSLATSMinimumVersionViolation1 = -9881; + +const int errSSLATSCiphersuiteViolation1 = -9882; + +const int errSSLATSMinimumKeySizeViolation1 = -9883; + +const int errSSLATSLeafCertificateHashAlgorithmViolation1 = -9884; + +const int errSSLATSCertificateHashAlgorithmViolation1 = -9885; + +const int errSSLATSCertificateTrustViolation1 = -9886; + +const int errSSLEarlyDataRejected1 = -9890; + +const int OSUnknownByteOrder1 = 0; + +const int OSLittleEndian1 = 1; + +const int OSBigEndian1 = 2; + +const int kCFNotificationDeliverImmediately1 = 1; + +const int kCFNotificationPostToAllSessions1 = 2; + +const int kCFCalendarComponentsWrap1 = 1; + +const int kCFSocketAutomaticallyReenableReadCallBack1 = 1; + +const int kCFSocketAutomaticallyReenableAcceptCallBack1 = 2; + +const int kCFSocketAutomaticallyReenableDataCallBack1 = 3; + +const int kCFSocketAutomaticallyReenableWriteCallBack1 = 8; + +const int kCFSocketLeaveErrors1 = 64; + +const int kCFSocketCloseOnInvalidate1 = 128; + +const int DISPATCH_WALLTIME_NOW2 = -2; + +const int kCFPropertyListReadCorruptError1 = 3840; + +const int kCFPropertyListReadUnknownVersionError1 = 3841; + +const int kCFPropertyListReadStreamError1 = 3842; + +const int kCFPropertyListWriteStreamError1 = 3851; + +const int kCFBundleExecutableArchitectureI3861 = 7; + +const int kCFBundleExecutableArchitecturePPC1 = 18; + +const int kCFBundleExecutableArchitectureX86_641 = 16777223; + +const int kCFBundleExecutableArchitecturePPC641 = 16777234; + +const int kCFBundleExecutableArchitectureARM641 = 16777228; + +const int kCFMessagePortSuccess1 = 0; + +const int kCFMessagePortSendTimeout1 = -1; + +const int kCFMessagePortReceiveTimeout1 = -2; + +const int kCFMessagePortIsInvalid1 = -3; + +const int kCFMessagePortTransportError1 = -4; + +const int kCFMessagePortBecameInvalidError1 = -5; + +const int kCFStringTokenizerUnitWord1 = 0; + +const int kCFStringTokenizerUnitSentence1 = 1; + +const int kCFStringTokenizerUnitParagraph1 = 2; + +const int kCFStringTokenizerUnitLineBreak1 = 3; + +const int kCFStringTokenizerUnitWordBoundary1 = 4; + +const int kCFStringTokenizerAttributeLatinTranscription1 = 65536; + +const int kCFStringTokenizerAttributeLanguage1 = 131072; + +const int kCFFileDescriptorReadCallBack1 = 1; + +const int kCFFileDescriptorWriteCallBack1 = 2; + +const int kCFUserNotificationStopAlertLevel1 = 0; + +const int kCFUserNotificationNoteAlertLevel1 = 1; + +const int kCFUserNotificationCautionAlertLevel1 = 2; + +const int kCFUserNotificationPlainAlertLevel1 = 3; + +const int kCFUserNotificationDefaultResponse1 = 0; + +const int kCFUserNotificationAlternateResponse1 = 1; + +const int kCFUserNotificationOtherResponse1 = 2; + +const int kCFUserNotificationCancelResponse1 = 3; + +const int kCFUserNotificationNoDefaultButtonFlag1 = 32; + +const int kCFUserNotificationUseRadioButtonsFlag1 = 64; + +const int kCFXMLNodeCurrentVersion1 = 1; + +const int CSSM_INVALID_HANDLE1 = 0; + +const int CSSM_FALSE1 = 0; + +const int CSSM_TRUE1 = 1; + +const int CSSM_OK1 = 0; + +const int CSSM_MODULE_STRING_SIZE1 = 64; + +const int CSSM_KEY_HIERARCHY_NONE1 = 0; + +const int CSSM_KEY_HIERARCHY_INTEG1 = 1; + +const int CSSM_KEY_HIERARCHY_EXPORT1 = 2; + +const int CSSM_PVC_NONE1 = 0; + +const int CSSM_PVC_APP1 = 1; + +const int CSSM_PVC_SP1 = 2; + +const int CSSM_PRIVILEGE_SCOPE_NONE1 = 0; + +const int CSSM_PRIVILEGE_SCOPE_PROCESS1 = 1; + +const int CSSM_PRIVILEGE_SCOPE_THREAD1 = 2; + +const int CSSM_SERVICE_CSSM1 = 1; + +const int CSSM_SERVICE_CSP1 = 2; + +const int CSSM_SERVICE_DL1 = 4; + +const int CSSM_SERVICE_CL1 = 8; + +const int CSSM_SERVICE_TP1 = 16; + +const int CSSM_SERVICE_AC1 = 32; + +const int CSSM_SERVICE_KR1 = 64; + +const int CSSM_NOTIFY_INSERT1 = 1; + +const int CSSM_NOTIFY_REMOVE1 = 2; + +const int CSSM_NOTIFY_FAULT1 = 3; + +const int CSSM_ATTACH_READ_ONLY1 = 1; + +const int CSSM_USEE_LAST1 = 255; + +const int CSSM_USEE_NONE1 = 0; + +const int CSSM_USEE_DOMESTIC1 = 1; + +const int CSSM_USEE_FINANCIAL1 = 2; + +const int CSSM_USEE_KRLE1 = 3; + +const int CSSM_USEE_KRENT1 = 4; + +const int CSSM_USEE_SSL1 = 5; + +const int CSSM_USEE_AUTHENTICATION1 = 6; + +const int CSSM_USEE_KEYEXCH1 = 7; + +const int CSSM_USEE_MEDICAL1 = 8; + +const int CSSM_USEE_INSURANCE1 = 9; + +const int CSSM_USEE_WEAK1 = 10; + +const int CSSM_ADDR_NONE1 = 0; + +const int CSSM_ADDR_CUSTOM1 = 1; + +const int CSSM_ADDR_URL1 = 2; + +const int CSSM_ADDR_SOCKADDR1 = 3; + +const int CSSM_ADDR_NAME1 = 4; + +const int CSSM_NET_PROTO_NONE1 = 0; + +const int CSSM_NET_PROTO_CUSTOM1 = 1; + +const int CSSM_NET_PROTO_UNSPECIFIED1 = 2; + +const int CSSM_NET_PROTO_LDAP1 = 3; + +const int CSSM_NET_PROTO_LDAPS1 = 4; + +const int CSSM_NET_PROTO_LDAPNS1 = 5; + +const int CSSM_NET_PROTO_X500DAP1 = 6; + +const int CSSM_NET_PROTO_FTP1 = 7; + +const int CSSM_NET_PROTO_FTPS1 = 8; + +const int CSSM_NET_PROTO_OCSP1 = 9; + +const int CSSM_NET_PROTO_CMP1 = 10; + +const int CSSM_NET_PROTO_CMPS1 = 11; + +const int CSSM_WORDID__UNK_1 = -1; + +const int CSSM_WORDID__NLU_1 = 0; + +const int CSSM_WORDID__STAR_1 = 1; + +const int CSSM_WORDID_A1 = 2; + +const int CSSM_WORDID_ACL1 = 3; + +const int CSSM_WORDID_ALPHA1 = 4; + +const int CSSM_WORDID_B1 = 5; + +const int CSSM_WORDID_BER1 = 6; + +const int CSSM_WORDID_BINARY1 = 7; + +const int CSSM_WORDID_BIOMETRIC1 = 8; + +const int CSSM_WORDID_C1 = 9; + +const int CSSM_WORDID_CANCELED1 = 10; + +const int CSSM_WORDID_CERT1 = 11; + +const int CSSM_WORDID_COMMENT1 = 12; + +const int CSSM_WORDID_CRL1 = 13; + +const int CSSM_WORDID_CUSTOM1 = 14; + +const int CSSM_WORDID_D1 = 15; + +const int CSSM_WORDID_DATE1 = 16; + +const int CSSM_WORDID_DB_DELETE1 = 17; + +const int CSSM_WORDID_DB_EXEC_STORED_QUERY1 = 18; + +const int CSSM_WORDID_DB_INSERT1 = 19; + +const int CSSM_WORDID_DB_MODIFY1 = 20; + +const int CSSM_WORDID_DB_READ1 = 21; + +const int CSSM_WORDID_DBS_CREATE1 = 22; + +const int CSSM_WORDID_DBS_DELETE1 = 23; + +const int CSSM_WORDID_DECRYPT1 = 24; + +const int CSSM_WORDID_DELETE1 = 25; + +const int CSSM_WORDID_DELTA_CRL1 = 26; + +const int CSSM_WORDID_DER1 = 27; + +const int CSSM_WORDID_DERIVE1 = 28; + +const int CSSM_WORDID_DISPLAY1 = 29; + +const int CSSM_WORDID_DO1 = 30; + +const int CSSM_WORDID_DSA1 = 31; + +const int CSSM_WORDID_DSA_SHA11 = 32; + +const int CSSM_WORDID_E1 = 33; + +const int CSSM_WORDID_ELGAMAL1 = 34; + +const int CSSM_WORDID_ENCRYPT1 = 35; + +const int CSSM_WORDID_ENTRY1 = 36; + +const int CSSM_WORDID_EXPORT_CLEAR1 = 37; + +const int CSSM_WORDID_EXPORT_WRAPPED1 = 38; + +const int CSSM_WORDID_G1 = 39; + +const int CSSM_WORDID_GE1 = 40; + +const int CSSM_WORDID_GENKEY1 = 41; + +const int CSSM_WORDID_HASH1 = 42; + +const int CSSM_WORDID_HASHED_PASSWORD1 = 43; + +const int CSSM_WORDID_HASHED_SUBJECT1 = 44; + +const int CSSM_WORDID_HAVAL1 = 45; + +const int CSSM_WORDID_IBCHASH1 = 46; + +const int CSSM_WORDID_IMPORT_CLEAR1 = 47; + +const int CSSM_WORDID_IMPORT_WRAPPED1 = 48; + +const int CSSM_WORDID_INTEL1 = 49; + +const int CSSM_WORDID_ISSUER1 = 50; + +const int CSSM_WORDID_ISSUER_INFO1 = 51; + +const int CSSM_WORDID_K_OF_N1 = 52; + +const int CSSM_WORDID_KEA1 = 53; + +const int CSSM_WORDID_KEYHOLDER1 = 54; + +const int CSSM_WORDID_L1 = 55; + +const int CSSM_WORDID_LE1 = 56; + +const int CSSM_WORDID_LOGIN1 = 57; + +const int CSSM_WORDID_LOGIN_NAME1 = 58; + +const int CSSM_WORDID_MAC1 = 59; + +const int CSSM_WORDID_MD21 = 60; + +const int CSSM_WORDID_MD2WITHRSA1 = 61; + +const int CSSM_WORDID_MD41 = 62; + +const int CSSM_WORDID_MD51 = 63; + +const int CSSM_WORDID_MD5WITHRSA1 = 64; + +const int CSSM_WORDID_N1 = 65; + +const int CSSM_WORDID_NAME1 = 66; + +const int CSSM_WORDID_NDR1 = 67; + +const int CSSM_WORDID_NHASH1 = 68; + +const int CSSM_WORDID_NOT_AFTER1 = 69; + +const int CSSM_WORDID_NOT_BEFORE1 = 70; + +const int CSSM_WORDID_NULL1 = 71; + +const int CSSM_WORDID_NUMERIC1 = 72; + +const int CSSM_WORDID_OBJECT_HASH1 = 73; + +const int CSSM_WORDID_ONE_TIME1 = 74; + +const int CSSM_WORDID_ONLINE1 = 75; + +const int CSSM_WORDID_OWNER1 = 76; + +const int CSSM_WORDID_P1 = 77; + +const int CSSM_WORDID_PAM_NAME1 = 78; + +const int CSSM_WORDID_PASSWORD1 = 79; + +const int CSSM_WORDID_PGP1 = 80; + +const int CSSM_WORDID_PREFIX1 = 81; + +const int CSSM_WORDID_PRIVATE_KEY1 = 82; + +const int CSSM_WORDID_PROMPTED_BIOMETRIC1 = 83; + +const int CSSM_WORDID_PROMPTED_PASSWORD1 = 84; + +const int CSSM_WORDID_PROPAGATE1 = 85; + +const int CSSM_WORDID_PROTECTED_BIOMETRIC1 = 86; + +const int CSSM_WORDID_PROTECTED_PASSWORD1 = 87; + +const int CSSM_WORDID_PROTECTED_PIN1 = 88; + +const int CSSM_WORDID_PUBLIC_KEY1 = 89; + +const int CSSM_WORDID_PUBLIC_KEY_FROM_CERT1 = 90; + +const int CSSM_WORDID_Q1 = 91; + +const int CSSM_WORDID_RANGE1 = 92; + +const int CSSM_WORDID_REVAL1 = 93; + +const int CSSM_WORDID_RIPEMAC1 = 94; + +const int CSSM_WORDID_RIPEMD1 = 95; + +const int CSSM_WORDID_RIPEMD1601 = 96; + +const int CSSM_WORDID_RSA1 = 97; + +const int CSSM_WORDID_RSA_ISO97961 = 98; + +const int CSSM_WORDID_RSA_PKCS2 = 99; + +const int CSSM_WORDID_RSA_PKCS_MD51 = 100; + +const int CSSM_WORDID_RSA_PKCS_SHA11 = 101; + +const int CSSM_WORDID_RSA_PKCS11 = 102; + +const int CSSM_WORDID_RSA_PKCS1_MD51 = 103; + +const int CSSM_WORDID_RSA_PKCS1_SHA11 = 104; + +const int CSSM_WORDID_RSA_PKCS1_SIG1 = 105; + +const int CSSM_WORDID_RSA_RAW1 = 106; + +const int CSSM_WORDID_SDSIV11 = 107; + +const int CSSM_WORDID_SEQUENCE1 = 108; + +const int CSSM_WORDID_SET1 = 109; + +const int CSSM_WORDID_SEXPR1 = 110; + +const int CSSM_WORDID_SHA11 = 111; + +const int CSSM_WORDID_SHA1WITHDSA1 = 112; + +const int CSSM_WORDID_SHA1WITHECDSA1 = 113; + +const int CSSM_WORDID_SHA1WITHRSA1 = 114; + +const int CSSM_WORDID_SIGN1 = 115; + +const int CSSM_WORDID_SIGNATURE1 = 116; + +const int CSSM_WORDID_SIGNED_NONCE1 = 117; + +const int CSSM_WORDID_SIGNED_SECRET1 = 118; + +const int CSSM_WORDID_SPKI1 = 119; + +const int CSSM_WORDID_SUBJECT1 = 120; + +const int CSSM_WORDID_SUBJECT_INFO1 = 121; + +const int CSSM_WORDID_TAG1 = 122; + +const int CSSM_WORDID_THRESHOLD1 = 123; + +const int CSSM_WORDID_TIME1 = 124; + +const int CSSM_WORDID_URI1 = 125; + +const int CSSM_WORDID_VERSION1 = 126; + +const int CSSM_WORDID_X509_ATTRIBUTE1 = 127; + +const int CSSM_WORDID_X509V11 = 128; + +const int CSSM_WORDID_X509V21 = 129; + +const int CSSM_WORDID_X509V31 = 130; + +const int CSSM_WORDID_X9_ATTRIBUTE1 = 131; + +const int CSSM_WORDID_VENDOR_START1 = 65536; + +const int CSSM_WORDID_VENDOR_END1 = 2147418112; + +const int CSSM_LIST_ELEMENT_DATUM1 = 0; + +const int CSSM_LIST_ELEMENT_SUBLIST1 = 1; + +const int CSSM_LIST_ELEMENT_WORDID1 = 2; + +const int CSSM_LIST_TYPE_UNKNOWN1 = 0; + +const int CSSM_LIST_TYPE_CUSTOM1 = 1; + +const int CSSM_LIST_TYPE_SEXPR1 = 2; + +const int CSSM_SAMPLE_TYPE_PASSWORD1 = 79; + +const int CSSM_SAMPLE_TYPE_HASHED_PASSWORD1 = 43; + +const int CSSM_SAMPLE_TYPE_PROTECTED_PASSWORD1 = 87; + +const int CSSM_SAMPLE_TYPE_PROMPTED_PASSWORD1 = 84; + +const int CSSM_SAMPLE_TYPE_SIGNED_NONCE1 = 117; + +const int CSSM_SAMPLE_TYPE_SIGNED_SECRET1 = 118; + +const int CSSM_SAMPLE_TYPE_BIOMETRIC1 = 8; + +const int CSSM_SAMPLE_TYPE_PROTECTED_BIOMETRIC1 = 86; + +const int CSSM_SAMPLE_TYPE_PROMPTED_BIOMETRIC1 = 83; + +const int CSSM_SAMPLE_TYPE_THRESHOLD1 = 123; + +const int CSSM_CERT_UNKNOWN1 = 0; + +const int CSSM_CERT_X_509v11 = 1; + +const int CSSM_CERT_X_509v21 = 2; + +const int CSSM_CERT_X_509v31 = 3; + +const int CSSM_CERT_PGP1 = 4; + +const int CSSM_CERT_SPKI1 = 5; + +const int CSSM_CERT_SDSIv11 = 6; + +const int CSSM_CERT_Intel1 = 8; + +const int CSSM_CERT_X_509_ATTRIBUTE1 = 9; + +const int CSSM_CERT_X9_ATTRIBUTE1 = 10; + +const int CSSM_CERT_TUPLE1 = 11; + +const int CSSM_CERT_ACL_ENTRY1 = 12; + +const int CSSM_CERT_MULTIPLE1 = 32766; + +const int CSSM_CERT_LAST1 = 32767; + +const int CSSM_CL_CUSTOM_CERT_TYPE1 = 32768; + +const int CSSM_CERT_ENCODING_UNKNOWN1 = 0; + +const int CSSM_CERT_ENCODING_CUSTOM1 = 1; + +const int CSSM_CERT_ENCODING_BER1 = 2; + +const int CSSM_CERT_ENCODING_DER1 = 3; + +const int CSSM_CERT_ENCODING_NDR1 = 4; + +const int CSSM_CERT_ENCODING_SEXPR1 = 5; + +const int CSSM_CERT_ENCODING_PGP1 = 6; + +const int CSSM_CERT_ENCODING_MULTIPLE1 = 32766; + +const int CSSM_CERT_ENCODING_LAST1 = 32767; + +const int CSSM_CL_CUSTOM_CERT_ENCODING1 = 32768; + +const int CSSM_CERT_PARSE_FORMAT_NONE1 = 0; + +const int CSSM_CERT_PARSE_FORMAT_CUSTOM1 = 1; + +const int CSSM_CERT_PARSE_FORMAT_SEXPR1 = 2; + +const int CSSM_CERT_PARSE_FORMAT_COMPLEX1 = 3; + +const int CSSM_CERT_PARSE_FORMAT_OID_NAMED1 = 4; + +const int CSSM_CERT_PARSE_FORMAT_TUPLE1 = 5; + +const int CSSM_CERT_PARSE_FORMAT_MULTIPLE1 = 32766; + +const int CSSM_CERT_PARSE_FORMAT_LAST1 = 32767; + +const int CSSM_CL_CUSTOM_CERT_PARSE_FORMAT1 = 32768; + +const int CSSM_CERTGROUP_DATA1 = 0; + +const int CSSM_CERTGROUP_ENCODED_CERT1 = 1; + +const int CSSM_CERTGROUP_PARSED_CERT1 = 2; + +const int CSSM_CERTGROUP_CERT_PAIR1 = 3; + +const int CSSM_ACL_SUBJECT_TYPE_ANY1 = 1; + +const int CSSM_ACL_SUBJECT_TYPE_THRESHOLD1 = 123; + +const int CSSM_ACL_SUBJECT_TYPE_PASSWORD1 = 79; + +const int CSSM_ACL_SUBJECT_TYPE_PROTECTED_PASSWORD1 = 87; + +const int CSSM_ACL_SUBJECT_TYPE_PROMPTED_PASSWORD1 = 84; + +const int CSSM_ACL_SUBJECT_TYPE_PUBLIC_KEY1 = 89; + +const int CSSM_ACL_SUBJECT_TYPE_HASHED_SUBJECT1 = 44; + +const int CSSM_ACL_SUBJECT_TYPE_BIOMETRIC1 = 8; + +const int CSSM_ACL_SUBJECT_TYPE_PROTECTED_BIOMETRIC1 = 86; + +const int CSSM_ACL_SUBJECT_TYPE_PROMPTED_BIOMETRIC1 = 83; + +const int CSSM_ACL_SUBJECT_TYPE_LOGIN_NAME1 = 58; + +const int CSSM_ACL_SUBJECT_TYPE_EXT_PAM_NAME1 = 78; + +const int CSSM_ACL_AUTHORIZATION_TAG_VENDOR_DEFINED_START1 = 65536; + +const int CSSM_ACL_AUTHORIZATION_ANY1 = 1; + +const int CSSM_ACL_AUTHORIZATION_LOGIN1 = 57; + +const int CSSM_ACL_AUTHORIZATION_GENKEY1 = 41; + +const int CSSM_ACL_AUTHORIZATION_DELETE1 = 25; + +const int CSSM_ACL_AUTHORIZATION_EXPORT_WRAPPED1 = 38; + +const int CSSM_ACL_AUTHORIZATION_EXPORT_CLEAR1 = 37; + +const int CSSM_ACL_AUTHORIZATION_IMPORT_WRAPPED1 = 48; + +const int CSSM_ACL_AUTHORIZATION_IMPORT_CLEAR1 = 47; + +const int CSSM_ACL_AUTHORIZATION_SIGN1 = 115; + +const int CSSM_ACL_AUTHORIZATION_ENCRYPT1 = 35; + +const int CSSM_ACL_AUTHORIZATION_DECRYPT1 = 24; + +const int CSSM_ACL_AUTHORIZATION_MAC1 = 59; + +const int CSSM_ACL_AUTHORIZATION_DERIVE1 = 28; + +const int CSSM_ACL_AUTHORIZATION_DBS_CREATE1 = 22; + +const int CSSM_ACL_AUTHORIZATION_DBS_DELETE1 = 23; + +const int CSSM_ACL_AUTHORIZATION_DB_READ1 = 21; + +const int CSSM_ACL_AUTHORIZATION_DB_INSERT1 = 19; + +const int CSSM_ACL_AUTHORIZATION_DB_MODIFY1 = 20; + +const int CSSM_ACL_AUTHORIZATION_DB_DELETE1 = 17; + +const int CSSM_ACL_EDIT_MODE_ADD1 = 1; + +const int CSSM_ACL_EDIT_MODE_DELETE1 = 2; + +const int CSSM_ACL_EDIT_MODE_REPLACE1 = 3; + +const int CSSM_KEYHEADER_VERSION1 = 2; + +const int CSSM_KEYBLOB_RAW1 = 0; + +const int CSSM_KEYBLOB_REFERENCE1 = 2; + +const int CSSM_KEYBLOB_WRAPPED1 = 3; + +const int CSSM_KEYBLOB_OTHER1 = -1; + +const int CSSM_KEYBLOB_RAW_FORMAT_NONE1 = 0; + +const int CSSM_KEYBLOB_RAW_FORMAT_PKCS11 = 1; + +const int CSSM_KEYBLOB_RAW_FORMAT_PKCS31 = 2; + +const int CSSM_KEYBLOB_RAW_FORMAT_MSCAPI1 = 3; + +const int CSSM_KEYBLOB_RAW_FORMAT_PGP1 = 4; + +const int CSSM_KEYBLOB_RAW_FORMAT_FIPS1861 = 5; + +const int CSSM_KEYBLOB_RAW_FORMAT_BSAFE1 = 6; + +const int CSSM_KEYBLOB_RAW_FORMAT_CCA1 = 9; + +const int CSSM_KEYBLOB_RAW_FORMAT_PKCS81 = 10; + +const int CSSM_KEYBLOB_RAW_FORMAT_SPKI1 = 11; + +const int CSSM_KEYBLOB_RAW_FORMAT_OCTET_STRING1 = 12; + +const int CSSM_KEYBLOB_RAW_FORMAT_OTHER1 = -1; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_NONE1 = 0; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_PKCS81 = 1; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_PKCS71 = 2; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_MSCAPI1 = 3; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_OTHER1 = -1; + +const int CSSM_KEYBLOB_REF_FORMAT_INTEGER1 = 0; + +const int CSSM_KEYBLOB_REF_FORMAT_STRING1 = 1; + +const int CSSM_KEYBLOB_REF_FORMAT_SPKI1 = 2; + +const int CSSM_KEYBLOB_REF_FORMAT_OTHER1 = -1; + +const int CSSM_KEYCLASS_PUBLIC_KEY1 = 0; + +const int CSSM_KEYCLASS_PRIVATE_KEY1 = 1; + +const int CSSM_KEYCLASS_SESSION_KEY1 = 2; + +const int CSSM_KEYCLASS_SECRET_PART1 = 3; + +const int CSSM_KEYCLASS_OTHER1 = -1; + +const int CSSM_KEYATTR_RETURN_DEFAULT1 = 0; + +const int CSSM_KEYATTR_RETURN_DATA1 = 268435456; + +const int CSSM_KEYATTR_RETURN_REF1 = 536870912; + +const int CSSM_KEYATTR_RETURN_NONE1 = 1073741824; + +const int CSSM_KEYATTR_PERMANENT1 = 1; + +const int CSSM_KEYATTR_PRIVATE1 = 2; + +const int CSSM_KEYATTR_MODIFIABLE1 = 4; + +const int CSSM_KEYATTR_SENSITIVE1 = 8; + +const int CSSM_KEYATTR_EXTRACTABLE1 = 32; + +const int CSSM_KEYATTR_ALWAYS_SENSITIVE1 = 16; + +const int CSSM_KEYATTR_NEVER_EXTRACTABLE1 = 64; + +const int CSSM_KEYUSE_ANY1 = -2147483648; + +const int CSSM_KEYUSE_ENCRYPT1 = 1; + +const int CSSM_KEYUSE_DECRYPT1 = 2; + +const int CSSM_KEYUSE_SIGN1 = 4; + +const int CSSM_KEYUSE_VERIFY1 = 8; + +const int CSSM_KEYUSE_SIGN_RECOVER1 = 16; + +const int CSSM_KEYUSE_VERIFY_RECOVER1 = 32; + +const int CSSM_KEYUSE_WRAP1 = 64; + +const int CSSM_KEYUSE_UNWRAP1 = 128; + +const int CSSM_KEYUSE_DERIVE1 = 256; + +const int CSSM_ALGID_NONE1 = 0; + +const int CSSM_ALGID_CUSTOM1 = 1; + +const int CSSM_ALGID_DH1 = 2; + +const int CSSM_ALGID_PH1 = 3; + +const int CSSM_ALGID_KEA1 = 4; + +const int CSSM_ALGID_MD21 = 5; + +const int CSSM_ALGID_MD41 = 6; + +const int CSSM_ALGID_MD51 = 7; + +const int CSSM_ALGID_SHA11 = 8; + +const int CSSM_ALGID_NHASH1 = 9; + +const int CSSM_ALGID_HAVAL1 = 10; + +const int CSSM_ALGID_RIPEMD1 = 11; + +const int CSSM_ALGID_IBCHASH1 = 12; + +const int CSSM_ALGID_RIPEMAC1 = 13; + +const int CSSM_ALGID_DES1 = 14; + +const int CSSM_ALGID_DESX1 = 15; + +const int CSSM_ALGID_RDES1 = 16; + +const int CSSM_ALGID_3DES_3KEY_EDE1 = 17; + +const int CSSM_ALGID_3DES_2KEY_EDE1 = 18; + +const int CSSM_ALGID_3DES_1KEY_EEE1 = 19; + +const int CSSM_ALGID_3DES_3KEY1 = 17; + +const int CSSM_ALGID_3DES_3KEY_EEE1 = 20; + +const int CSSM_ALGID_3DES_2KEY1 = 18; + +const int CSSM_ALGID_3DES_2KEY_EEE1 = 21; + +const int CSSM_ALGID_3DES_1KEY1 = 20; + +const int CSSM_ALGID_IDEA1 = 22; + +const int CSSM_ALGID_RC21 = 23; + +const int CSSM_ALGID_RC51 = 24; + +const int CSSM_ALGID_RC41 = 25; + +const int CSSM_ALGID_SEAL1 = 26; + +const int CSSM_ALGID_CAST1 = 27; + +const int CSSM_ALGID_BLOWFISH1 = 28; + +const int CSSM_ALGID_SKIPJACK1 = 29; + +const int CSSM_ALGID_LUCIFER1 = 30; + +const int CSSM_ALGID_MADRYGA1 = 31; + +const int CSSM_ALGID_FEAL1 = 32; + +const int CSSM_ALGID_REDOC1 = 33; + +const int CSSM_ALGID_REDOC31 = 34; + +const int CSSM_ALGID_LOKI1 = 35; + +const int CSSM_ALGID_KHUFU1 = 36; + +const int CSSM_ALGID_KHAFRE1 = 37; + +const int CSSM_ALGID_MMB1 = 38; + +const int CSSM_ALGID_GOST1 = 39; + +const int CSSM_ALGID_SAFER1 = 40; + +const int CSSM_ALGID_CRAB1 = 41; + +const int CSSM_ALGID_RSA1 = 42; + +const int CSSM_ALGID_DSA1 = 43; + +const int CSSM_ALGID_MD5WithRSA1 = 44; + +const int CSSM_ALGID_MD2WithRSA1 = 45; + +const int CSSM_ALGID_ElGamal1 = 46; + +const int CSSM_ALGID_MD2Random1 = 47; + +const int CSSM_ALGID_MD5Random1 = 48; + +const int CSSM_ALGID_SHARandom1 = 49; + +const int CSSM_ALGID_DESRandom1 = 50; + +const int CSSM_ALGID_SHA1WithRSA1 = 51; + +const int CSSM_ALGID_CDMF1 = 52; + +const int CSSM_ALGID_CAST31 = 53; + +const int CSSM_ALGID_CAST51 = 54; + +const int CSSM_ALGID_GenericSecret1 = 55; + +const int CSSM_ALGID_ConcatBaseAndKey1 = 56; + +const int CSSM_ALGID_ConcatKeyAndBase1 = 57; + +const int CSSM_ALGID_ConcatBaseAndData1 = 58; + +const int CSSM_ALGID_ConcatDataAndBase1 = 59; + +const int CSSM_ALGID_XORBaseAndData1 = 60; + +const int CSSM_ALGID_ExtractFromKey1 = 61; + +const int CSSM_ALGID_SSL3PrePrimaryGen1 = 62; + +const int CSSM_ALGID_SSL3PreMasterGen1 = 62; + +const int CSSM_ALGID_SSL3PrimaryDerive1 = 63; + +const int CSSM_ALGID_SSL3MasterDerive1 = 63; + +const int CSSM_ALGID_SSL3KeyAndMacDerive1 = 64; + +const int CSSM_ALGID_SSL3MD5_MAC1 = 65; + +const int CSSM_ALGID_SSL3SHA1_MAC1 = 66; + +const int CSSM_ALGID_PKCS5_PBKDF1_MD51 = 67; + +const int CSSM_ALGID_PKCS5_PBKDF1_MD21 = 68; + +const int CSSM_ALGID_PKCS5_PBKDF1_SHA11 = 69; + +const int CSSM_ALGID_WrapLynks1 = 70; + +const int CSSM_ALGID_WrapSET_OAEP1 = 71; + +const int CSSM_ALGID_BATON1 = 72; + +const int CSSM_ALGID_ECDSA1 = 73; + +const int CSSM_ALGID_MAYFLY1 = 74; + +const int CSSM_ALGID_JUNIPER1 = 75; + +const int CSSM_ALGID_FASTHASH1 = 76; + +const int CSSM_ALGID_3DES1 = 77; + +const int CSSM_ALGID_SSL3MD51 = 78; + +const int CSSM_ALGID_SSL3SHA11 = 79; + +const int CSSM_ALGID_FortezzaTimestamp1 = 80; + +const int CSSM_ALGID_SHA1WithDSA1 = 81; + +const int CSSM_ALGID_SHA1WithECDSA1 = 82; + +const int CSSM_ALGID_DSA_BSAFE1 = 83; + +const int CSSM_ALGID_ECDH1 = 84; + +const int CSSM_ALGID_ECMQV1 = 85; + +const int CSSM_ALGID_PKCS12_SHA1_PBE1 = 86; + +const int CSSM_ALGID_ECNRA1 = 87; + +const int CSSM_ALGID_SHA1WithECNRA1 = 88; + +const int CSSM_ALGID_ECES1 = 89; + +const int CSSM_ALGID_ECAES1 = 90; + +const int CSSM_ALGID_SHA1HMAC1 = 91; + +const int CSSM_ALGID_FIPS186Random1 = 92; + +const int CSSM_ALGID_ECC1 = 93; + +const int CSSM_ALGID_MQV1 = 94; + +const int CSSM_ALGID_NRA1 = 95; + +const int CSSM_ALGID_IntelPlatformRandom1 = 96; + +const int CSSM_ALGID_UTC1 = 97; + +const int CSSM_ALGID_HAVAL31 = 98; + +const int CSSM_ALGID_HAVAL41 = 99; + +const int CSSM_ALGID_HAVAL51 = 100; + +const int CSSM_ALGID_TIGER1 = 101; + +const int CSSM_ALGID_MD5HMAC1 = 102; + +const int CSSM_ALGID_PKCS5_PBKDF21 = 103; + +const int CSSM_ALGID_RUNNING_COUNTER1 = 104; + +const int CSSM_ALGID_LAST1 = 2147483647; + +const int CSSM_ALGID_VENDOR_DEFINED1 = -2147483648; + +const int CSSM_ALGMODE_NONE1 = 0; + +const int CSSM_ALGMODE_CUSTOM1 = 1; + +const int CSSM_ALGMODE_ECB1 = 2; + +const int CSSM_ALGMODE_ECBPad1 = 3; + +const int CSSM_ALGMODE_CBC1 = 4; + +const int CSSM_ALGMODE_CBC_IV81 = 5; + +const int CSSM_ALGMODE_CBCPadIV81 = 6; + +const int CSSM_ALGMODE_CFB1 = 7; + +const int CSSM_ALGMODE_CFB_IV81 = 8; + +const int CSSM_ALGMODE_CFBPadIV81 = 9; + +const int CSSM_ALGMODE_OFB1 = 10; + +const int CSSM_ALGMODE_OFB_IV81 = 11; + +const int CSSM_ALGMODE_OFBPadIV81 = 12; + +const int CSSM_ALGMODE_COUNTER1 = 13; + +const int CSSM_ALGMODE_BC1 = 14; + +const int CSSM_ALGMODE_PCBC1 = 15; + +const int CSSM_ALGMODE_CBCC1 = 16; + +const int CSSM_ALGMODE_OFBNLF1 = 17; + +const int CSSM_ALGMODE_PBC1 = 18; + +const int CSSM_ALGMODE_PFB1 = 19; + +const int CSSM_ALGMODE_CBCPD1 = 20; + +const int CSSM_ALGMODE_PUBLIC_KEY1 = 21; + +const int CSSM_ALGMODE_PRIVATE_KEY1 = 22; + +const int CSSM_ALGMODE_SHUFFLE1 = 23; + +const int CSSM_ALGMODE_ECB641 = 24; + +const int CSSM_ALGMODE_CBC641 = 25; + +const int CSSM_ALGMODE_OFB641 = 26; + +const int CSSM_ALGMODE_CFB321 = 28; + +const int CSSM_ALGMODE_CFB161 = 29; + +const int CSSM_ALGMODE_CFB81 = 30; + +const int CSSM_ALGMODE_WRAP1 = 31; + +const int CSSM_ALGMODE_PRIVATE_WRAP1 = 32; + +const int CSSM_ALGMODE_RELAYX1 = 33; + +const int CSSM_ALGMODE_ECB1281 = 34; + +const int CSSM_ALGMODE_ECB961 = 35; + +const int CSSM_ALGMODE_CBC1281 = 36; + +const int CSSM_ALGMODE_OAEP_HASH1 = 37; + +const int CSSM_ALGMODE_PKCS1_EME_V151 = 38; + +const int CSSM_ALGMODE_PKCS1_EME_OAEP1 = 39; + +const int CSSM_ALGMODE_PKCS1_EMSA_V151 = 40; + +const int CSSM_ALGMODE_ISO_97961 = 41; + +const int CSSM_ALGMODE_X9_311 = 42; + +const int CSSM_ALGMODE_LAST1 = 2147483647; + +const int CSSM_ALGMODE_VENDOR_DEFINED1 = -2147483648; + +const int CSSM_CSP_SOFTWARE1 = 1; + +const int CSSM_CSP_HARDWARE1 = 2; + +const int CSSM_CSP_HYBRID1 = 3; + +const int CSSM_ALGCLASS_NONE1 = 0; + +const int CSSM_ALGCLASS_CUSTOM1 = 1; + +const int CSSM_ALGCLASS_SIGNATURE1 = 2; + +const int CSSM_ALGCLASS_SYMMETRIC1 = 3; + +const int CSSM_ALGCLASS_DIGEST1 = 4; + +const int CSSM_ALGCLASS_RANDOMGEN1 = 5; + +const int CSSM_ALGCLASS_UNIQUEGEN1 = 6; + +const int CSSM_ALGCLASS_MAC1 = 7; + +const int CSSM_ALGCLASS_ASYMMETRIC1 = 8; + +const int CSSM_ALGCLASS_KEYGEN1 = 9; + +const int CSSM_ALGCLASS_DERIVEKEY1 = 10; + +const int CSSM_ATTRIBUTE_DATA_NONE1 = 0; + +const int CSSM_ATTRIBUTE_DATA_UINT321 = 268435456; + +const int CSSM_ATTRIBUTE_DATA_CSSM_DATA1 = 536870912; + +const int CSSM_ATTRIBUTE_DATA_CRYPTO_DATA1 = 805306368; + +const int CSSM_ATTRIBUTE_DATA_KEY1 = 1073741824; + +const int CSSM_ATTRIBUTE_DATA_STRING1 = 1342177280; + +const int CSSM_ATTRIBUTE_DATA_DATE1 = 1610612736; + +const int CSSM_ATTRIBUTE_DATA_RANGE1 = 1879048192; + +const int CSSM_ATTRIBUTE_DATA_ACCESS_CREDENTIALS1 = -2147483648; + +const int CSSM_ATTRIBUTE_DATA_VERSION1 = 16777216; + +const int CSSM_ATTRIBUTE_DATA_DL_DB_HANDLE1 = 33554432; + +const int CSSM_ATTRIBUTE_DATA_KR_PROFILE1 = 50331648; + +const int CSSM_ATTRIBUTE_TYPE_MASK1 = -16777216; + +const int CSSM_ATTRIBUTE_NONE1 = 0; + +const int CSSM_ATTRIBUTE_CUSTOM1 = 536870913; + +const int CSSM_ATTRIBUTE_DESCRIPTION1 = 1342177282; + +const int CSSM_ATTRIBUTE_KEY1 = 1073741827; + +const int CSSM_ATTRIBUTE_INIT_VECTOR1 = 536870916; + +const int CSSM_ATTRIBUTE_SALT1 = 536870917; + +const int CSSM_ATTRIBUTE_PADDING1 = 268435462; + +const int CSSM_ATTRIBUTE_RANDOM1 = 536870919; + +const int CSSM_ATTRIBUTE_SEED1 = 805306376; + +const int CSSM_ATTRIBUTE_PASSPHRASE1 = 805306377; + +const int CSSM_ATTRIBUTE_KEY_LENGTH1 = 268435466; + +const int CSSM_ATTRIBUTE_KEY_LENGTH_RANGE1 = 1879048203; + +const int CSSM_ATTRIBUTE_BLOCK_SIZE1 = 268435468; + +const int CSSM_ATTRIBUTE_OUTPUT_SIZE1 = 268435469; + +const int CSSM_ATTRIBUTE_ROUNDS1 = 268435470; + +const int CSSM_ATTRIBUTE_IV_SIZE1 = 268435471; + +const int CSSM_ATTRIBUTE_ALG_PARAMS1 = 536870928; + +const int CSSM_ATTRIBUTE_LABEL1 = 536870929; + +const int CSSM_ATTRIBUTE_KEY_TYPE1 = 268435474; + +const int CSSM_ATTRIBUTE_MODE1 = 268435475; + +const int CSSM_ATTRIBUTE_EFFECTIVE_BITS1 = 268435476; + +const int CSSM_ATTRIBUTE_START_DATE1 = 1610612757; + +const int CSSM_ATTRIBUTE_END_DATE1 = 1610612758; + +const int CSSM_ATTRIBUTE_KEYUSAGE1 = 268435479; + +const int CSSM_ATTRIBUTE_KEYATTR1 = 268435480; + +const int CSSM_ATTRIBUTE_VERSION1 = 16777241; + +const int CSSM_ATTRIBUTE_PRIME1 = 536870938; + +const int CSSM_ATTRIBUTE_BASE1 = 536870939; + +const int CSSM_ATTRIBUTE_SUBPRIME1 = 536870940; + +const int CSSM_ATTRIBUTE_ALG_ID1 = 268435485; + +const int CSSM_ATTRIBUTE_ITERATION_COUNT1 = 268435486; + +const int CSSM_ATTRIBUTE_ROUNDS_RANGE1 = 1879048223; + +const int CSSM_ATTRIBUTE_KRPROFILE_LOCAL1 = 50331680; + +const int CSSM_ATTRIBUTE_KRPROFILE_REMOTE1 = 50331681; + +const int CSSM_ATTRIBUTE_CSP_HANDLE1 = 268435490; + +const int CSSM_ATTRIBUTE_DL_DB_HANDLE1 = 33554467; + +const int CSSM_ATTRIBUTE_ACCESS_CREDENTIALS1 = -2147483612; + +const int CSSM_ATTRIBUTE_PUBLIC_KEY_FORMAT1 = 268435493; + +const int CSSM_ATTRIBUTE_PRIVATE_KEY_FORMAT1 = 268435494; + +const int CSSM_ATTRIBUTE_SYMMETRIC_KEY_FORMAT1 = 268435495; + +const int CSSM_ATTRIBUTE_WRAPPED_KEY_FORMAT1 = 268435496; + +const int CSSM_PADDING_NONE1 = 0; + +const int CSSM_PADDING_CUSTOM1 = 1; + +const int CSSM_PADDING_ZERO1 = 2; + +const int CSSM_PADDING_ONE1 = 3; + +const int CSSM_PADDING_ALTERNATE1 = 4; + +const int CSSM_PADDING_FF1 = 5; + +const int CSSM_PADDING_PKCS51 = 6; + +const int CSSM_PADDING_PKCS71 = 7; + +const int CSSM_PADDING_CIPHERSTEALING1 = 8; + +const int CSSM_PADDING_RANDOM1 = 9; + +const int CSSM_PADDING_PKCS11 = 10; + +const int CSSM_PADDING_SIGRAW1 = 11; + +const int CSSM_PADDING_VENDOR_DEFINED1 = -2147483648; + +const int CSSM_CSP_TOK_RNG1 = 1; + +const int CSSM_CSP_TOK_CLOCK_EXISTS1 = 64; + +const int CSSM_CSP_RDR_TOKENPRESENT1 = 1; + +const int CSSM_CSP_RDR_EXISTS1 = 2; + +const int CSSM_CSP_RDR_HW1 = 4; + +const int CSSM_CSP_TOK_WRITE_PROTECTED1 = 2; + +const int CSSM_CSP_TOK_LOGIN_REQUIRED1 = 4; + +const int CSSM_CSP_TOK_USER_PIN_INITIALIZED1 = 8; + +const int CSSM_CSP_TOK_PROT_AUTHENTICATION1 = 256; + +const int CSSM_CSP_TOK_USER_PIN_EXPIRED1 = 1048576; + +const int CSSM_CSP_TOK_SESSION_KEY_PASSWORD1 = 2097152; + +const int CSSM_CSP_TOK_PRIVATE_KEY_PASSWORD1 = 4194304; + +const int CSSM_CSP_STORES_PRIVATE_KEYS1 = 16777216; + +const int CSSM_CSP_STORES_PUBLIC_KEYS1 = 33554432; + +const int CSSM_CSP_STORES_SESSION_KEYS1 = 67108864; + +const int CSSM_CSP_STORES_CERTIFICATES1 = 134217728; + +const int CSSM_CSP_STORES_GENERIC1 = 268435456; + +const int CSSM_PKCS_OAEP_MGF_NONE1 = 0; + +const int CSSM_PKCS_OAEP_MGF1_SHA11 = 1; + +const int CSSM_PKCS_OAEP_MGF1_MD51 = 2; + +const int CSSM_PKCS_OAEP_PSOURCE_NONE1 = 0; + +const int CSSM_PKCS_OAEP_PSOURCE_Pspecified1 = 1; + +const int CSSM_VALUE_NOT_AVAILABLE1 = -1; + +const int CSSM_PKCS5_PBKDF2_PRF_HMAC_SHA11 = 0; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTISSUE1 = 1; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTREVOKE1 = 2; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTSUSPEND1 = 3; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTRESUME1 = 4; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTVERIFY1 = 5; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTNOTARIZE1 = 6; + +const int CSSM_TP_AUTHORITY_REQUEST_CERTUSERECOVER1 = 7; + +const int CSSM_TP_AUTHORITY_REQUEST_CRLISSUE1 = 256; + +const int CSSM_TP_KEY_ARCHIVE1 = 1; + +const int CSSM_TP_CERT_PUBLISH1 = 2; + +const int CSSM_TP_CERT_NOTIFY_RENEW1 = 4; + +const int CSSM_TP_CERT_DIR_UPDATE1 = 8; + +const int CSSM_TP_CRL_DISTRIBUTE1 = 16; + +const int CSSM_TP_ACTION_DEFAULT1 = 0; + +const int CSSM_TP_STOP_ON_POLICY1 = 0; + +const int CSSM_TP_STOP_ON_NONE1 = 1; + +const int CSSM_TP_STOP_ON_FIRST_PASS1 = 2; + +const int CSSM_TP_STOP_ON_FIRST_FAIL1 = 3; + +const int CSSM_CRL_PARSE_FORMAT_NONE1 = 0; + +const int CSSM_CRL_PARSE_FORMAT_CUSTOM1 = 1; + +const int CSSM_CRL_PARSE_FORMAT_SEXPR1 = 2; + +const int CSSM_CRL_PARSE_FORMAT_COMPLEX1 = 3; + +const int CSSM_CRL_PARSE_FORMAT_OID_NAMED1 = 4; + +const int CSSM_CRL_PARSE_FORMAT_TUPLE1 = 5; + +const int CSSM_CRL_PARSE_FORMAT_MULTIPLE1 = 32766; + +const int CSSM_CRL_PARSE_FORMAT_LAST1 = 32767; + +const int CSSM_CL_CUSTOM_CRL_PARSE_FORMAT1 = 32768; + +const int CSSM_CRL_TYPE_UNKNOWN1 = 0; + +const int CSSM_CRL_TYPE_X_509v11 = 1; + +const int CSSM_CRL_TYPE_X_509v21 = 2; + +const int CSSM_CRL_TYPE_SPKI1 = 3; + +const int CSSM_CRL_TYPE_MULTIPLE1 = 32766; + +const int CSSM_CRL_ENCODING_UNKNOWN1 = 0; + +const int CSSM_CRL_ENCODING_CUSTOM1 = 1; + +const int CSSM_CRL_ENCODING_BER1 = 2; + +const int CSSM_CRL_ENCODING_DER1 = 3; + +const int CSSM_CRL_ENCODING_BLOOM1 = 4; + +const int CSSM_CRL_ENCODING_SEXPR1 = 5; + +const int CSSM_CRL_ENCODING_MULTIPLE1 = 32766; + +const int CSSM_CRLGROUP_DATA1 = 0; + +const int CSSM_CRLGROUP_ENCODED_CRL1 = 1; + +const int CSSM_CRLGROUP_PARSED_CRL1 = 2; + +const int CSSM_CRLGROUP_CRL_PAIR1 = 3; + +const int CSSM_EVIDENCE_FORM_UNSPECIFIC1 = 0; + +const int CSSM_EVIDENCE_FORM_CERT1 = 1; + +const int CSSM_EVIDENCE_FORM_CRL1 = 2; + +const int CSSM_EVIDENCE_FORM_CERT_ID1 = 3; + +const int CSSM_EVIDENCE_FORM_CRL_ID1 = 4; + +const int CSSM_EVIDENCE_FORM_VERIFIER_TIME1 = 5; + +const int CSSM_EVIDENCE_FORM_CRL_THISTIME1 = 6; + +const int CSSM_EVIDENCE_FORM_CRL_NEXTTIME1 = 7; + +const int CSSM_EVIDENCE_FORM_POLICYINFO1 = 8; + +const int CSSM_EVIDENCE_FORM_TUPLEGROUP1 = 9; + +const int CSSM_TP_CONFIRM_STATUS_UNKNOWN1 = 0; + +const int CSSM_TP_CONFIRM_ACCEPT1 = 1; + +const int CSSM_TP_CONFIRM_REJECT1 = 2; + +const int CSSM_ESTIMATED_TIME_UNKNOWN1 = -1; + +const int CSSM_ELAPSED_TIME_UNKNOWN1 = -1; + +const int CSSM_ELAPSED_TIME_COMPLETE1 = -2; + +const int CSSM_TP_CERTISSUE_STATUS_UNKNOWN1 = 0; + +const int CSSM_TP_CERTISSUE_OK1 = 1; + +const int CSSM_TP_CERTISSUE_OKWITHCERTMODS1 = 2; + +const int CSSM_TP_CERTISSUE_OKWITHSERVICEMODS1 = 3; + +const int CSSM_TP_CERTISSUE_REJECTED1 = 4; + +const int CSSM_TP_CERTISSUE_NOT_AUTHORIZED1 = 5; + +const int CSSM_TP_CERTISSUE_WILL_BE_REVOKED1 = 6; + +const int CSSM_TP_CERTCHANGE_NONE1 = 0; + +const int CSSM_TP_CERTCHANGE_REVOKE1 = 1; + +const int CSSM_TP_CERTCHANGE_HOLD1 = 2; + +const int CSSM_TP_CERTCHANGE_RELEASE1 = 3; + +const int CSSM_TP_CERTCHANGE_REASON_UNKNOWN1 = 0; + +const int CSSM_TP_CERTCHANGE_REASON_KEYCOMPROMISE1 = 1; + +const int CSSM_TP_CERTCHANGE_REASON_CACOMPROMISE1 = 2; + +const int CSSM_TP_CERTCHANGE_REASON_CEASEOPERATION1 = 3; + +const int CSSM_TP_CERTCHANGE_REASON_AFFILIATIONCHANGE1 = 4; + +const int CSSM_TP_CERTCHANGE_REASON_SUPERCEDED1 = 5; + +const int CSSM_TP_CERTCHANGE_REASON_SUSPECTEDCOMPROMISE1 = 6; + +const int CSSM_TP_CERTCHANGE_REASON_HOLDRELEASE1 = 7; + +const int CSSM_TP_CERTCHANGE_STATUS_UNKNOWN1 = 0; + +const int CSSM_TP_CERTCHANGE_OK1 = 1; + +const int CSSM_TP_CERTCHANGE_OKWITHNEWTIME1 = 2; + +const int CSSM_TP_CERTCHANGE_WRONGCA1 = 3; + +const int CSSM_TP_CERTCHANGE_REJECTED1 = 4; + +const int CSSM_TP_CERTCHANGE_NOT_AUTHORIZED1 = 5; + +const int CSSM_TP_CERTVERIFY_UNKNOWN1 = 0; + +const int CSSM_TP_CERTVERIFY_VALID1 = 1; + +const int CSSM_TP_CERTVERIFY_INVALID1 = 2; + +const int CSSM_TP_CERTVERIFY_REVOKED1 = 3; + +const int CSSM_TP_CERTVERIFY_SUSPENDED1 = 4; + +const int CSSM_TP_CERTVERIFY_EXPIRED1 = 5; + +const int CSSM_TP_CERTVERIFY_NOT_VALID_YET1 = 6; + +const int CSSM_TP_CERTVERIFY_INVALID_AUTHORITY1 = 7; + +const int CSSM_TP_CERTVERIFY_INVALID_SIGNATURE1 = 8; + +const int CSSM_TP_CERTVERIFY_INVALID_CERT_VALUE1 = 9; + +const int CSSM_TP_CERTVERIFY_INVALID_CERTGROUP1 = 10; + +const int CSSM_TP_CERTVERIFY_INVALID_POLICY1 = 11; + +const int CSSM_TP_CERTVERIFY_INVALID_POLICY_IDS1 = 12; + +const int CSSM_TP_CERTVERIFY_INVALID_BASIC_CONSTRAINTS1 = 13; + +const int CSSM_TP_CERTVERIFY_INVALID_CRL_DIST_PT1 = 14; + +const int CSSM_TP_CERTVERIFY_INVALID_NAME_TREE1 = 15; + +const int CSSM_TP_CERTVERIFY_UNKNOWN_CRITICAL_EXT1 = 16; + +const int CSSM_TP_CERTNOTARIZE_STATUS_UNKNOWN1 = 0; + +const int CSSM_TP_CERTNOTARIZE_OK1 = 1; + +const int CSSM_TP_CERTNOTARIZE_OKWITHOUTFIELDS1 = 2; + +const int CSSM_TP_CERTNOTARIZE_OKWITHSERVICEMODS1 = 3; + +const int CSSM_TP_CERTNOTARIZE_REJECTED1 = 4; + +const int CSSM_TP_CERTNOTARIZE_NOT_AUTHORIZED1 = 5; + +const int CSSM_TP_CERTRECLAIM_STATUS_UNKNOWN1 = 0; + +const int CSSM_TP_CERTRECLAIM_OK1 = 1; + +const int CSSM_TP_CERTRECLAIM_NOMATCH1 = 2; + +const int CSSM_TP_CERTRECLAIM_REJECTED1 = 3; + +const int CSSM_TP_CERTRECLAIM_NOT_AUTHORIZED1 = 4; + +const int CSSM_TP_CRLISSUE_STATUS_UNKNOWN1 = 0; + +const int CSSM_TP_CRLISSUE_OK1 = 1; + +const int CSSM_TP_CRLISSUE_NOT_CURRENT1 = 2; + +const int CSSM_TP_CRLISSUE_INVALID_DOMAIN1 = 3; + +const int CSSM_TP_CRLISSUE_UNKNOWN_IDENTIFIER1 = 4; + +const int CSSM_TP_CRLISSUE_REJECTED1 = 5; + +const int CSSM_TP_CRLISSUE_NOT_AUTHORIZED1 = 6; + +const int CSSM_TP_FORM_TYPE_GENERIC1 = 0; + +const int CSSM_TP_FORM_TYPE_REGISTRATION1 = 1; + +const int CSSM_CL_TEMPLATE_INTERMEDIATE_CERT1 = 1; + +const int CSSM_CL_TEMPLATE_PKIX_CERTTEMPLATE1 = 2; + +const int CSSM_CERT_BUNDLE_UNKNOWN1 = 0; + +const int CSSM_CERT_BUNDLE_CUSTOM1 = 1; + +const int CSSM_CERT_BUNDLE_PKCS7_SIGNED_DATA1 = 2; + +const int CSSM_CERT_BUNDLE_PKCS7_SIGNED_ENVELOPED_DATA1 = 3; + +const int CSSM_CERT_BUNDLE_PKCS121 = 4; + +const int CSSM_CERT_BUNDLE_PFX1 = 5; + +const int CSSM_CERT_BUNDLE_SPKI_SEQUENCE1 = 6; + +const int CSSM_CERT_BUNDLE_PGP_KEYRING1 = 7; + +const int CSSM_CERT_BUNDLE_LAST1 = 32767; + +const int CSSM_CL_CUSTOM_CERT_BUNDLE_TYPE1 = 32768; + +const int CSSM_CERT_BUNDLE_ENCODING_UNKNOWN1 = 0; + +const int CSSM_CERT_BUNDLE_ENCODING_CUSTOM1 = 1; + +const int CSSM_CERT_BUNDLE_ENCODING_BER1 = 2; + +const int CSSM_CERT_BUNDLE_ENCODING_DER1 = 3; + +const int CSSM_CERT_BUNDLE_ENCODING_SEXPR1 = 4; + +const int CSSM_CERT_BUNDLE_ENCODING_PGP1 = 5; + +const int CSSM_FIELDVALUE_COMPLEX_DATA_TYPE1 = -1; + +const int CSSM_DB_ATTRIBUTE_NAME_AS_STRING1 = 0; + +const int CSSM_DB_ATTRIBUTE_NAME_AS_OID1 = 1; + +const int CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER1 = 2; + +const int CSSM_DB_ATTRIBUTE_FORMAT_STRING1 = 0; + +const int CSSM_DB_ATTRIBUTE_FORMAT_SINT321 = 1; + +const int CSSM_DB_ATTRIBUTE_FORMAT_UINT321 = 2; + +const int CSSM_DB_ATTRIBUTE_FORMAT_BIG_NUM1 = 3; + +const int CSSM_DB_ATTRIBUTE_FORMAT_REAL1 = 4; + +const int CSSM_DB_ATTRIBUTE_FORMAT_TIME_DATE1 = 5; + +const int CSSM_DB_ATTRIBUTE_FORMAT_BLOB1 = 6; + +const int CSSM_DB_ATTRIBUTE_FORMAT_MULTI_UINT321 = 7; + +const int CSSM_DB_ATTRIBUTE_FORMAT_COMPLEX1 = 8; + +const int CSSM_DB_RECORDTYPE_SCHEMA_START1 = 0; + +const int CSSM_DB_RECORDTYPE_SCHEMA_END1 = 4; + +const int CSSM_DB_RECORDTYPE_OPEN_GROUP_START1 = 10; + +const int CSSM_DB_RECORDTYPE_OPEN_GROUP_END1 = 18; + +const int CSSM_DB_RECORDTYPE_APP_DEFINED_START1 = -2147483648; + +const int CSSM_DB_RECORDTYPE_APP_DEFINED_END1 = -1; + +const int CSSM_DL_DB_SCHEMA_INFO1 = 0; + +const int CSSM_DL_DB_SCHEMA_INDEXES1 = 1; + +const int CSSM_DL_DB_SCHEMA_ATTRIBUTES1 = 2; + +const int CSSM_DL_DB_SCHEMA_PARSING_MODULE1 = 3; + +const int CSSM_DL_DB_RECORD_ANY1 = 10; + +const int CSSM_DL_DB_RECORD_CERT1 = 11; + +const int CSSM_DL_DB_RECORD_CRL1 = 12; + +const int CSSM_DL_DB_RECORD_POLICY1 = 13; + +const int CSSM_DL_DB_RECORD_GENERIC1 = 14; + +const int CSSM_DL_DB_RECORD_PUBLIC_KEY1 = 15; + +const int CSSM_DL_DB_RECORD_PRIVATE_KEY1 = 16; + +const int CSSM_DL_DB_RECORD_SYMMETRIC_KEY1 = 17; + +const int CSSM_DL_DB_RECORD_ALL_KEYS1 = 18; + +const int CSSM_DB_CERT_USE_TRUSTED1 = 1; + +const int CSSM_DB_CERT_USE_SYSTEM1 = 2; + +const int CSSM_DB_CERT_USE_OWNER1 = 4; + +const int CSSM_DB_CERT_USE_REVOKED1 = 8; + +const int CSSM_DB_CERT_USE_SIGNING1 = 16; + +const int CSSM_DB_CERT_USE_PRIVACY1 = 32; + +const int CSSM_DB_INDEX_UNIQUE1 = 0; + +const int CSSM_DB_INDEX_NONUNIQUE1 = 1; + +const int CSSM_DB_INDEX_ON_UNKNOWN1 = 0; + +const int CSSM_DB_INDEX_ON_ATTRIBUTE1 = 1; + +const int CSSM_DB_INDEX_ON_RECORD1 = 2; + +const int CSSM_DB_ACCESS_READ1 = 1; + +const int CSSM_DB_ACCESS_WRITE1 = 2; + +const int CSSM_DB_ACCESS_PRIVILEGED1 = 4; + +const int CSSM_DB_MODIFY_ATTRIBUTE_NONE1 = 0; + +const int CSSM_DB_MODIFY_ATTRIBUTE_ADD1 = 1; + +const int CSSM_DB_MODIFY_ATTRIBUTE_DELETE1 = 2; + +const int CSSM_DB_MODIFY_ATTRIBUTE_REPLACE1 = 3; + +const int CSSM_DB_EQUAL1 = 0; + +const int CSSM_DB_NOT_EQUAL1 = 1; + +const int CSSM_DB_LESS_THAN1 = 2; + +const int CSSM_DB_GREATER_THAN1 = 3; + +const int CSSM_DB_CONTAINS1 = 4; + +const int CSSM_DB_CONTAINS_INITIAL_SUBSTRING1 = 5; + +const int CSSM_DB_CONTAINS_FINAL_SUBSTRING1 = 6; + +const int CSSM_DB_NONE1 = 0; + +const int CSSM_DB_AND1 = 1; + +const int CSSM_DB_OR1 = 2; + +const int CSSM_QUERY_TIMELIMIT_NONE1 = 0; + +const int CSSM_QUERY_SIZELIMIT_NONE1 = 0; + +const int CSSM_QUERY_RETURN_DATA1 = 1; + +const int CSSM_DL_UNKNOWN1 = 0; + +const int CSSM_DL_CUSTOM1 = 1; + +const int CSSM_DL_LDAP1 = 2; + +const int CSSM_DL_ODBC1 = 3; + +const int CSSM_DL_PKCS111 = 4; + +const int CSSM_DL_FFS1 = 5; + +const int CSSM_DL_MEMORY1 = 6; + +const int CSSM_DL_REMOTEDIR1 = 7; + +const int CSSM_DB_DATASTORES_UNKNOWN1 = -1; + +const int CSSM_DB_TRANSACTIONAL_MODE1 = 0; + +const int CSSM_DB_FILESYSTEMSCAN_MODE1 = 1; + +const int CSSM_BASE_ERROR1 = -2147418112; + +const int CSSM_ERRORCODE_MODULE_EXTENT1 = 2048; + +const int CSSM_ERRORCODE_CUSTOM_OFFSET1 = 1024; + +const int CSSM_ERRORCODE_COMMON_EXTENT1 = 256; + +const int CSSM_CSSM_BASE_ERROR1 = -2147418112; + +const int CSSM_CSSM_PRIVATE_ERROR1 = -2147417088; + +const int CSSM_CSP_BASE_ERROR1 = -2147416064; + +const int CSSM_CSP_PRIVATE_ERROR1 = -2147415040; + +const int CSSM_DL_BASE_ERROR1 = -2147414016; + +const int CSSM_DL_PRIVATE_ERROR1 = -2147412992; + +const int CSSM_CL_BASE_ERROR1 = -2147411968; + +const int CSSM_CL_PRIVATE_ERROR1 = -2147410944; + +const int CSSM_TP_BASE_ERROR1 = -2147409920; + +const int CSSM_TP_PRIVATE_ERROR1 = -2147408896; + +const int CSSM_KR_BASE_ERROR1 = -2147407872; + +const int CSSM_KR_PRIVATE_ERROR1 = -2147406848; + +const int CSSM_AC_BASE_ERROR1 = -2147405824; + +const int CSSM_AC_PRIVATE_ERROR1 = -2147404800; + +const int CSSM_MDS_BASE_ERROR1 = -2147414016; + +const int CSSM_MDS_PRIVATE_ERROR1 = -2147412992; + +const int CSSMERR_CSSM_INVALID_ADDIN_HANDLE1 = -2147417855; + +const int CSSMERR_CSSM_NOT_INITIALIZED1 = -2147417854; + +const int CSSMERR_CSSM_INVALID_HANDLE_USAGE1 = -2147417853; + +const int CSSMERR_CSSM_PVC_REFERENT_NOT_FOUND1 = -2147417852; + +const int CSSMERR_CSSM_FUNCTION_INTEGRITY_FAIL1 = -2147417851; + +const int CSSM_ERRCODE_INTERNAL_ERROR1 = 1; + +const int CSSM_ERRCODE_MEMORY_ERROR1 = 2; + +const int CSSM_ERRCODE_MDS_ERROR1 = 3; + +const int CSSM_ERRCODE_INVALID_POINTER1 = 4; + +const int CSSM_ERRCODE_INVALID_INPUT_POINTER1 = 5; + +const int CSSM_ERRCODE_INVALID_OUTPUT_POINTER1 = 6; + +const int CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED1 = 7; + +const int CSSM_ERRCODE_SELF_CHECK_FAILED1 = 8; + +const int CSSM_ERRCODE_OS_ACCESS_DENIED1 = 9; + +const int CSSM_ERRCODE_FUNCTION_FAILED1 = 10; + +const int CSSM_ERRCODE_MODULE_MANIFEST_VERIFY_FAILED1 = 11; + +const int CSSM_ERRCODE_INVALID_GUID1 = 12; + +const int CSSM_ERRCODE_OPERATION_AUTH_DENIED1 = 32; + +const int CSSM_ERRCODE_OBJECT_USE_AUTH_DENIED1 = 33; + +const int CSSM_ERRCODE_OBJECT_MANIP_AUTH_DENIED1 = 34; + +const int CSSM_ERRCODE_OBJECT_ACL_NOT_SUPPORTED1 = 35; + +const int CSSM_ERRCODE_OBJECT_ACL_REQUIRED1 = 36; + +const int CSSM_ERRCODE_INVALID_ACCESS_CREDENTIALS1 = 37; + +const int CSSM_ERRCODE_INVALID_ACL_BASE_CERTS1 = 38; + +const int CSSM_ERRCODE_ACL_BASE_CERTS_NOT_SUPPORTED1 = 39; + +const int CSSM_ERRCODE_INVALID_SAMPLE_VALUE1 = 40; + +const int CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED1 = 41; + +const int CSSM_ERRCODE_INVALID_ACL_SUBJECT_VALUE1 = 42; + +const int CSSM_ERRCODE_ACL_SUBJECT_TYPE_NOT_SUPPORTED1 = 43; + +const int CSSM_ERRCODE_INVALID_ACL_CHALLENGE_CALLBACK1 = 44; + +const int CSSM_ERRCODE_ACL_CHALLENGE_CALLBACK_FAILED1 = 45; + +const int CSSM_ERRCODE_INVALID_ACL_ENTRY_TAG1 = 46; + +const int CSSM_ERRCODE_ACL_ENTRY_TAG_NOT_FOUND1 = 47; + +const int CSSM_ERRCODE_INVALID_ACL_EDIT_MODE1 = 48; + +const int CSSM_ERRCODE_ACL_CHANGE_FAILED1 = 49; + +const int CSSM_ERRCODE_INVALID_NEW_ACL_ENTRY1 = 50; + +const int CSSM_ERRCODE_INVALID_NEW_ACL_OWNER1 = 51; + +const int CSSM_ERRCODE_ACL_DELETE_FAILED1 = 52; + +const int CSSM_ERRCODE_ACL_REPLACE_FAILED1 = 53; + +const int CSSM_ERRCODE_ACL_ADD_FAILED1 = 54; + +const int CSSM_ERRCODE_INVALID_CONTEXT_HANDLE1 = 64; + +const int CSSM_ERRCODE_INCOMPATIBLE_VERSION1 = 65; + +const int CSSM_ERRCODE_INVALID_CERTGROUP_POINTER1 = 66; + +const int CSSM_ERRCODE_INVALID_CERT_POINTER1 = 67; + +const int CSSM_ERRCODE_INVALID_CRL_POINTER1 = 68; + +const int CSSM_ERRCODE_INVALID_FIELD_POINTER1 = 69; + +const int CSSM_ERRCODE_INVALID_DATA1 = 70; + +const int CSSM_ERRCODE_CRL_ALREADY_SIGNED1 = 71; + +const int CSSM_ERRCODE_INVALID_NUMBER_OF_FIELDS1 = 72; + +const int CSSM_ERRCODE_VERIFICATION_FAILURE1 = 73; + +const int CSSM_ERRCODE_INVALID_DB_HANDLE1 = 74; + +const int CSSM_ERRCODE_PRIVILEGE_NOT_GRANTED1 = 75; + +const int CSSM_ERRCODE_INVALID_DB_LIST1 = 76; + +const int CSSM_ERRCODE_INVALID_DB_LIST_POINTER1 = 77; + +const int CSSM_ERRCODE_UNKNOWN_FORMAT1 = 78; + +const int CSSM_ERRCODE_UNKNOWN_TAG1 = 79; + +const int CSSM_ERRCODE_INVALID_CSP_HANDLE1 = 80; + +const int CSSM_ERRCODE_INVALID_DL_HANDLE1 = 81; + +const int CSSM_ERRCODE_INVALID_CL_HANDLE1 = 82; + +const int CSSM_ERRCODE_INVALID_TP_HANDLE1 = 83; + +const int CSSM_ERRCODE_INVALID_KR_HANDLE1 = 84; + +const int CSSM_ERRCODE_INVALID_AC_HANDLE1 = 85; + +const int CSSM_ERRCODE_INVALID_PASSTHROUGH_ID1 = 86; + +const int CSSM_ERRCODE_INVALID_NETWORK_ADDR1 = 87; + +const int CSSM_ERRCODE_INVALID_CRYPTO_DATA1 = 88; + +const int CSSMERR_CSSM_INTERNAL_ERROR1 = -2147418111; + +const int CSSMERR_CSSM_MEMORY_ERROR1 = -2147418110; + +const int CSSMERR_CSSM_MDS_ERROR1 = -2147418109; + +const int CSSMERR_CSSM_INVALID_POINTER1 = -2147418108; + +const int CSSMERR_CSSM_INVALID_INPUT_POINTER1 = -2147418107; + +const int CSSMERR_CSSM_INVALID_OUTPUT_POINTER1 = -2147418106; + +const int CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED1 = -2147418105; + +const int CSSMERR_CSSM_SELF_CHECK_FAILED1 = -2147418104; + +const int CSSMERR_CSSM_OS_ACCESS_DENIED1 = -2147418103; + +const int CSSMERR_CSSM_FUNCTION_FAILED1 = -2147418102; + +const int CSSMERR_CSSM_MODULE_MANIFEST_VERIFY_FAILED1 = -2147418101; + +const int CSSMERR_CSSM_INVALID_GUID1 = -2147418100; + +const int CSSMERR_CSSM_INVALID_CONTEXT_HANDLE1 = -2147418048; + +const int CSSMERR_CSSM_INCOMPATIBLE_VERSION1 = -2147418047; + +const int CSSMERR_CSSM_PRIVILEGE_NOT_GRANTED1 = -2147418037; + +const int CSSM_CSSM_BASE_CSSM_ERROR1 = -2147417840; + +const int CSSMERR_CSSM_SCOPE_NOT_SUPPORTED1 = -2147417839; + +const int CSSMERR_CSSM_PVC_ALREADY_CONFIGURED1 = -2147417838; + +const int CSSMERR_CSSM_INVALID_PVC1 = -2147417837; + +const int CSSMERR_CSSM_EMM_LOAD_FAILED1 = -2147417836; + +const int CSSMERR_CSSM_EMM_UNLOAD_FAILED1 = -2147417835; + +const int CSSMERR_CSSM_ADDIN_LOAD_FAILED1 = -2147417834; + +const int CSSMERR_CSSM_INVALID_KEY_HIERARCHY1 = -2147417833; + +const int CSSMERR_CSSM_ADDIN_UNLOAD_FAILED1 = -2147417832; + +const int CSSMERR_CSSM_LIB_REF_NOT_FOUND1 = -2147417831; + +const int CSSMERR_CSSM_INVALID_ADDIN_FUNCTION_TABLE1 = -2147417830; + +const int CSSMERR_CSSM_EMM_AUTHENTICATE_FAILED1 = -2147417829; + +const int CSSMERR_CSSM_ADDIN_AUTHENTICATE_FAILED1 = -2147417828; + +const int CSSMERR_CSSM_INVALID_SERVICE_MASK1 = -2147417827; + +const int CSSMERR_CSSM_MODULE_NOT_LOADED1 = -2147417826; + +const int CSSMERR_CSSM_INVALID_SUBSERVICEID1 = -2147417825; + +const int CSSMERR_CSSM_BUFFER_TOO_SMALL1 = -2147417824; + +const int CSSMERR_CSSM_INVALID_ATTRIBUTE1 = -2147417823; + +const int CSSMERR_CSSM_ATTRIBUTE_NOT_IN_CONTEXT1 = -2147417822; + +const int CSSMERR_CSSM_MODULE_MANAGER_INITIALIZE_FAIL1 = -2147417821; + +const int CSSMERR_CSSM_MODULE_MANAGER_NOT_FOUND1 = -2147417820; + +const int CSSMERR_CSSM_EVENT_NOTIFICATION_CALLBACK_NOT_FOUND1 = -2147417819; + +const int CSSMERR_CSP_INTERNAL_ERROR1 = -2147416063; + +const int CSSMERR_CSP_MEMORY_ERROR1 = -2147416062; + +const int CSSMERR_CSP_MDS_ERROR1 = -2147416061; + +const int CSSMERR_CSP_INVALID_POINTER1 = -2147416060; + +const int CSSMERR_CSP_INVALID_INPUT_POINTER1 = -2147416059; + +const int CSSMERR_CSP_INVALID_OUTPUT_POINTER1 = -2147416058; + +const int CSSMERR_CSP_FUNCTION_NOT_IMPLEMENTED1 = -2147416057; + +const int CSSMERR_CSP_SELF_CHECK_FAILED1 = -2147416056; + +const int CSSMERR_CSP_OS_ACCESS_DENIED1 = -2147416055; + +const int CSSMERR_CSP_FUNCTION_FAILED1 = -2147416054; + +const int CSSMERR_CSP_OPERATION_AUTH_DENIED1 = -2147416032; + +const int CSSMERR_CSP_OBJECT_USE_AUTH_DENIED1 = -2147416031; + +const int CSSMERR_CSP_OBJECT_MANIP_AUTH_DENIED1 = -2147416030; + +const int CSSMERR_CSP_OBJECT_ACL_NOT_SUPPORTED1 = -2147416029; + +const int CSSMERR_CSP_OBJECT_ACL_REQUIRED1 = -2147416028; + +const int CSSMERR_CSP_INVALID_ACCESS_CREDENTIALS1 = -2147416027; + +const int CSSMERR_CSP_INVALID_ACL_BASE_CERTS1 = -2147416026; + +const int CSSMERR_CSP_ACL_BASE_CERTS_NOT_SUPPORTED1 = -2147416025; + +const int CSSMERR_CSP_INVALID_SAMPLE_VALUE1 = -2147416024; + +const int CSSMERR_CSP_SAMPLE_VALUE_NOT_SUPPORTED1 = -2147416023; + +const int CSSMERR_CSP_INVALID_ACL_SUBJECT_VALUE1 = -2147416022; + +const int CSSMERR_CSP_ACL_SUBJECT_TYPE_NOT_SUPPORTED1 = -2147416021; + +const int CSSMERR_CSP_INVALID_ACL_CHALLENGE_CALLBACK1 = -2147416020; + +const int CSSMERR_CSP_ACL_CHALLENGE_CALLBACK_FAILED1 = -2147416019; + +const int CSSMERR_CSP_INVALID_ACL_ENTRY_TAG1 = -2147416018; + +const int CSSMERR_CSP_ACL_ENTRY_TAG_NOT_FOUND1 = -2147416017; + +const int CSSMERR_CSP_INVALID_ACL_EDIT_MODE1 = -2147416016; + +const int CSSMERR_CSP_ACL_CHANGE_FAILED1 = -2147416015; + +const int CSSMERR_CSP_INVALID_NEW_ACL_ENTRY1 = -2147416014; + +const int CSSMERR_CSP_INVALID_NEW_ACL_OWNER1 = -2147416013; + +const int CSSMERR_CSP_ACL_DELETE_FAILED1 = -2147416012; + +const int CSSMERR_CSP_ACL_REPLACE_FAILED1 = -2147416011; + +const int CSSMERR_CSP_ACL_ADD_FAILED1 = -2147416010; + +const int CSSMERR_CSP_INVALID_CONTEXT_HANDLE1 = -2147416000; + +const int CSSMERR_CSP_PRIVILEGE_NOT_GRANTED1 = -2147415989; + +const int CSSMERR_CSP_INVALID_DATA1 = -2147415994; + +const int CSSMERR_CSP_INVALID_PASSTHROUGH_ID1 = -2147415978; + +const int CSSMERR_CSP_INVALID_CRYPTO_DATA1 = -2147415976; + +const int CSSM_CSP_BASE_CSP_ERROR1 = -2147415808; + +const int CSSMERR_CSP_INPUT_LENGTH_ERROR1 = -2147415807; + +const int CSSMERR_CSP_OUTPUT_LENGTH_ERROR1 = -2147415806; + +const int CSSMERR_CSP_PRIVILEGE_NOT_SUPPORTED1 = -2147415805; + +const int CSSMERR_CSP_DEVICE_ERROR1 = -2147415804; + +const int CSSMERR_CSP_DEVICE_MEMORY_ERROR1 = -2147415803; + +const int CSSMERR_CSP_ATTACH_HANDLE_BUSY1 = -2147415802; + +const int CSSMERR_CSP_NOT_LOGGED_IN1 = -2147415801; + +const int CSSMERR_CSP_INVALID_KEY1 = -2147415792; + +const int CSSMERR_CSP_INVALID_KEY_REFERENCE1 = -2147415791; + +const int CSSMERR_CSP_INVALID_KEY_CLASS1 = -2147415790; + +const int CSSMERR_CSP_ALGID_MISMATCH1 = -2147415789; + +const int CSSMERR_CSP_KEY_USAGE_INCORRECT1 = -2147415788; + +const int CSSMERR_CSP_KEY_BLOB_TYPE_INCORRECT1 = -2147415787; + +const int CSSMERR_CSP_KEY_HEADER_INCONSISTENT1 = -2147415786; + +const int CSSMERR_CSP_UNSUPPORTED_KEY_FORMAT1 = -2147415785; + +const int CSSMERR_CSP_UNSUPPORTED_KEY_SIZE1 = -2147415784; + +const int CSSMERR_CSP_INVALID_KEY_POINTER1 = -2147415783; + +const int CSSMERR_CSP_INVALID_KEYUSAGE_MASK1 = -2147415782; + +const int CSSMERR_CSP_UNSUPPORTED_KEYUSAGE_MASK1 = -2147415781; + +const int CSSMERR_CSP_INVALID_KEYATTR_MASK1 = -2147415780; + +const int CSSMERR_CSP_UNSUPPORTED_KEYATTR_MASK1 = -2147415779; + +const int CSSMERR_CSP_INVALID_KEY_LABEL1 = -2147415778; + +const int CSSMERR_CSP_UNSUPPORTED_KEY_LABEL1 = -2147415777; + +const int CSSMERR_CSP_INVALID_KEY_FORMAT1 = -2147415776; + +const int CSSMERR_CSP_INVALID_DATA_COUNT1 = -2147415768; + +const int CSSMERR_CSP_VECTOR_OF_BUFS_UNSUPPORTED1 = -2147415767; + +const int CSSMERR_CSP_INVALID_INPUT_VECTOR1 = -2147415766; + +const int CSSMERR_CSP_INVALID_OUTPUT_VECTOR1 = -2147415765; + +const int CSSMERR_CSP_INVALID_CONTEXT1 = -2147415760; + +const int CSSMERR_CSP_INVALID_ALGORITHM1 = -2147415759; + +const int CSSMERR_CSP_INVALID_ATTR_KEY1 = -2147415754; + +const int CSSMERR_CSP_MISSING_ATTR_KEY1 = -2147415753; + +const int CSSMERR_CSP_INVALID_ATTR_INIT_VECTOR1 = -2147415752; + +const int CSSMERR_CSP_MISSING_ATTR_INIT_VECTOR1 = -2147415751; + +const int CSSMERR_CSP_INVALID_ATTR_SALT1 = -2147415750; + +const int CSSMERR_CSP_MISSING_ATTR_SALT1 = -2147415749; + +const int CSSMERR_CSP_INVALID_ATTR_PADDING1 = -2147415748; + +const int CSSMERR_CSP_MISSING_ATTR_PADDING1 = -2147415747; + +const int CSSMERR_CSP_INVALID_ATTR_RANDOM1 = -2147415746; + +const int CSSMERR_CSP_MISSING_ATTR_RANDOM1 = -2147415745; + +const int CSSMERR_CSP_INVALID_ATTR_SEED1 = -2147415744; + +const int CSSMERR_CSP_MISSING_ATTR_SEED1 = -2147415743; + +const int CSSMERR_CSP_INVALID_ATTR_PASSPHRASE1 = -2147415742; + +const int CSSMERR_CSP_MISSING_ATTR_PASSPHRASE1 = -2147415741; + +const int CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH1 = -2147415740; + +const int CSSMERR_CSP_MISSING_ATTR_KEY_LENGTH1 = -2147415739; + +const int CSSMERR_CSP_INVALID_ATTR_BLOCK_SIZE1 = -2147415738; + +const int CSSMERR_CSP_MISSING_ATTR_BLOCK_SIZE1 = -2147415737; + +const int CSSMERR_CSP_INVALID_ATTR_OUTPUT_SIZE1 = -2147415708; + +const int CSSMERR_CSP_MISSING_ATTR_OUTPUT_SIZE1 = -2147415707; + +const int CSSMERR_CSP_INVALID_ATTR_ROUNDS1 = -2147415706; + +const int CSSMERR_CSP_MISSING_ATTR_ROUNDS1 = -2147415705; + +const int CSSMERR_CSP_INVALID_ATTR_ALG_PARAMS1 = -2147415704; + +const int CSSMERR_CSP_MISSING_ATTR_ALG_PARAMS1 = -2147415703; + +const int CSSMERR_CSP_INVALID_ATTR_LABEL1 = -2147415702; + +const int CSSMERR_CSP_MISSING_ATTR_LABEL1 = -2147415701; + +const int CSSMERR_CSP_INVALID_ATTR_KEY_TYPE1 = -2147415700; + +const int CSSMERR_CSP_MISSING_ATTR_KEY_TYPE1 = -2147415699; + +const int CSSMERR_CSP_INVALID_ATTR_MODE1 = -2147415698; + +const int CSSMERR_CSP_MISSING_ATTR_MODE1 = -2147415697; + +const int CSSMERR_CSP_INVALID_ATTR_EFFECTIVE_BITS1 = -2147415696; + +const int CSSMERR_CSP_MISSING_ATTR_EFFECTIVE_BITS1 = -2147415695; + +const int CSSMERR_CSP_INVALID_ATTR_START_DATE1 = -2147415694; + +const int CSSMERR_CSP_MISSING_ATTR_START_DATE1 = -2147415693; + +const int CSSMERR_CSP_INVALID_ATTR_END_DATE1 = -2147415692; + +const int CSSMERR_CSP_MISSING_ATTR_END_DATE1 = -2147415691; + +const int CSSMERR_CSP_INVALID_ATTR_VERSION1 = -2147415690; + +const int CSSMERR_CSP_MISSING_ATTR_VERSION1 = -2147415689; + +const int CSSMERR_CSP_INVALID_ATTR_PRIME1 = -2147415688; + +const int CSSMERR_CSP_MISSING_ATTR_PRIME1 = -2147415687; + +const int CSSMERR_CSP_INVALID_ATTR_BASE1 = -2147415686; + +const int CSSMERR_CSP_MISSING_ATTR_BASE1 = -2147415685; + +const int CSSMERR_CSP_INVALID_ATTR_SUBPRIME1 = -2147415684; + +const int CSSMERR_CSP_MISSING_ATTR_SUBPRIME1 = -2147415683; + +const int CSSMERR_CSP_INVALID_ATTR_ITERATION_COUNT1 = -2147415682; + +const int CSSMERR_CSP_MISSING_ATTR_ITERATION_COUNT1 = -2147415681; + +const int CSSMERR_CSP_INVALID_ATTR_DL_DB_HANDLE1 = -2147415680; + +const int CSSMERR_CSP_MISSING_ATTR_DL_DB_HANDLE1 = -2147415679; + +const int CSSMERR_CSP_INVALID_ATTR_ACCESS_CREDENTIALS1 = -2147415678; + +const int CSSMERR_CSP_MISSING_ATTR_ACCESS_CREDENTIALS1 = -2147415677; + +const int CSSMERR_CSP_INVALID_ATTR_PUBLIC_KEY_FORMAT1 = -2147415676; + +const int CSSMERR_CSP_MISSING_ATTR_PUBLIC_KEY_FORMAT1 = -2147415675; + +const int CSSMERR_CSP_INVALID_ATTR_PRIVATE_KEY_FORMAT1 = -2147415674; + +const int CSSMERR_CSP_MISSING_ATTR_PRIVATE_KEY_FORMAT1 = -2147415673; + +const int CSSMERR_CSP_INVALID_ATTR_SYMMETRIC_KEY_FORMAT1 = -2147415672; + +const int CSSMERR_CSP_MISSING_ATTR_SYMMETRIC_KEY_FORMAT1 = -2147415671; + +const int CSSMERR_CSP_INVALID_ATTR_WRAPPED_KEY_FORMAT1 = -2147415670; + +const int CSSMERR_CSP_MISSING_ATTR_WRAPPED_KEY_FORMAT1 = -2147415669; + +const int CSSMERR_CSP_STAGED_OPERATION_IN_PROGRESS1 = -2147415736; + +const int CSSMERR_CSP_STAGED_OPERATION_NOT_STARTED1 = -2147415735; + +const int CSSMERR_CSP_VERIFY_FAILED1 = -2147415734; + +const int CSSMERR_CSP_INVALID_SIGNATURE1 = -2147415733; + +const int CSSMERR_CSP_QUERY_SIZE_UNKNOWN1 = -2147415732; + +const int CSSMERR_CSP_BLOCK_SIZE_MISMATCH1 = -2147415731; + +const int CSSMERR_CSP_PRIVATE_KEY_NOT_FOUND1 = -2147415730; + +const int CSSMERR_CSP_PUBLIC_KEY_INCONSISTENT1 = -2147415729; + +const int CSSMERR_CSP_DEVICE_VERIFY_FAILED1 = -2147415728; + +const int CSSMERR_CSP_INVALID_LOGIN_NAME1 = -2147415727; + +const int CSSMERR_CSP_ALREADY_LOGGED_IN1 = -2147415726; + +const int CSSMERR_CSP_PRIVATE_KEY_ALREADY_EXISTS1 = -2147415725; + +const int CSSMERR_CSP_KEY_LABEL_ALREADY_EXISTS1 = -2147415724; + +const int CSSMERR_CSP_INVALID_DIGEST_ALGORITHM1 = -2147415723; + +const int CSSMERR_CSP_CRYPTO_DATA_CALLBACK_FAILED1 = -2147415722; + +const int CSSMERR_TP_INTERNAL_ERROR1 = -2147409919; + +const int CSSMERR_TP_MEMORY_ERROR1 = -2147409918; + +const int CSSMERR_TP_MDS_ERROR1 = -2147409917; + +const int CSSMERR_TP_INVALID_POINTER1 = -2147409916; + +const int CSSMERR_TP_INVALID_INPUT_POINTER1 = -2147409915; + +const int CSSMERR_TP_INVALID_OUTPUT_POINTER1 = -2147409914; + +const int CSSMERR_TP_FUNCTION_NOT_IMPLEMENTED1 = -2147409913; + +const int CSSMERR_TP_SELF_CHECK_FAILED1 = -2147409912; + +const int CSSMERR_TP_OS_ACCESS_DENIED1 = -2147409911; + +const int CSSMERR_TP_FUNCTION_FAILED1 = -2147409910; + +const int CSSMERR_TP_INVALID_CONTEXT_HANDLE1 = -2147409856; + +const int CSSMERR_TP_INVALID_DATA1 = -2147409850; + +const int CSSMERR_TP_INVALID_DB_LIST1 = -2147409844; + +const int CSSMERR_TP_INVALID_CERTGROUP_POINTER1 = -2147409854; + +const int CSSMERR_TP_INVALID_CERT_POINTER1 = -2147409853; + +const int CSSMERR_TP_INVALID_CRL_POINTER1 = -2147409852; + +const int CSSMERR_TP_INVALID_FIELD_POINTER1 = -2147409851; + +const int CSSMERR_TP_INVALID_NETWORK_ADDR1 = -2147409833; + +const int CSSMERR_TP_CRL_ALREADY_SIGNED1 = -2147409849; + +const int CSSMERR_TP_INVALID_NUMBER_OF_FIELDS1 = -2147409848; + +const int CSSMERR_TP_VERIFICATION_FAILURE1 = -2147409847; + +const int CSSMERR_TP_INVALID_DB_HANDLE1 = -2147409846; + +const int CSSMERR_TP_UNKNOWN_FORMAT1 = -2147409842; + +const int CSSMERR_TP_UNKNOWN_TAG1 = -2147409841; + +const int CSSMERR_TP_INVALID_PASSTHROUGH_ID1 = -2147409834; + +const int CSSMERR_TP_INVALID_CSP_HANDLE1 = -2147409840; + +const int CSSMERR_TP_INVALID_DL_HANDLE1 = -2147409839; + +const int CSSMERR_TP_INVALID_CL_HANDLE1 = -2147409838; + +const int CSSMERR_TP_INVALID_DB_LIST_POINTER1 = -2147409843; + +const int CSSM_TP_BASE_TP_ERROR1 = -2147409664; + +const int CSSMERR_TP_INVALID_CALLERAUTH_CONTEXT_POINTER1 = -2147409663; + +const int CSSMERR_TP_INVALID_IDENTIFIER_POINTER1 = -2147409662; + +const int CSSMERR_TP_INVALID_KEYCACHE_HANDLE1 = -2147409661; + +const int CSSMERR_TP_INVALID_CERTGROUP1 = -2147409660; + +const int CSSMERR_TP_INVALID_CRLGROUP1 = -2147409659; + +const int CSSMERR_TP_INVALID_CRLGROUP_POINTER1 = -2147409658; + +const int CSSMERR_TP_AUTHENTICATION_FAILED1 = -2147409657; + +const int CSSMERR_TP_CERTGROUP_INCOMPLETE1 = -2147409656; + +const int CSSMERR_TP_CERTIFICATE_CANT_OPERATE1 = -2147409655; + +const int CSSMERR_TP_CERT_EXPIRED1 = -2147409654; + +const int CSSMERR_TP_CERT_NOT_VALID_YET1 = -2147409653; + +const int CSSMERR_TP_CERT_REVOKED1 = -2147409652; + +const int CSSMERR_TP_CERT_SUSPENDED1 = -2147409651; + +const int CSSMERR_TP_INSUFFICIENT_CREDENTIALS1 = -2147409650; + +const int CSSMERR_TP_INVALID_ACTION1 = -2147409649; + +const int CSSMERR_TP_INVALID_ACTION_DATA1 = -2147409648; + +const int CSSMERR_TP_INVALID_ANCHOR_CERT1 = -2147409646; + +const int CSSMERR_TP_INVALID_AUTHORITY1 = -2147409645; + +const int CSSMERR_TP_VERIFY_ACTION_FAILED1 = -2147409644; + +const int CSSMERR_TP_INVALID_CERTIFICATE1 = -2147409643; + +const int CSSMERR_TP_INVALID_CERT_AUTHORITY1 = -2147409642; + +const int CSSMERR_TP_INVALID_CRL_AUTHORITY1 = -2147409641; + +const int CSSMERR_TP_INVALID_CRL_ENCODING1 = -2147409640; + +const int CSSMERR_TP_INVALID_CRL_TYPE1 = -2147409639; + +const int CSSMERR_TP_INVALID_CRL1 = -2147409638; + +const int CSSMERR_TP_INVALID_FORM_TYPE1 = -2147409637; + +const int CSSMERR_TP_INVALID_ID1 = -2147409636; + +const int CSSMERR_TP_INVALID_IDENTIFIER1 = -2147409635; + +const int CSSMERR_TP_INVALID_INDEX1 = -2147409634; + +const int CSSMERR_TP_INVALID_NAME1 = -2147409633; + +const int CSSMERR_TP_INVALID_POLICY_IDENTIFIERS1 = -2147409632; + +const int CSSMERR_TP_INVALID_TIMESTRING1 = -2147409631; + +const int CSSMERR_TP_INVALID_REASON1 = -2147409630; + +const int CSSMERR_TP_INVALID_REQUEST_INPUTS1 = -2147409629; + +const int CSSMERR_TP_INVALID_RESPONSE_VECTOR1 = -2147409628; + +const int CSSMERR_TP_INVALID_SIGNATURE1 = -2147409627; + +const int CSSMERR_TP_INVALID_STOP_ON_POLICY1 = -2147409626; + +const int CSSMERR_TP_INVALID_CALLBACK1 = -2147409625; + +const int CSSMERR_TP_INVALID_TUPLE1 = -2147409624; + +const int CSSMERR_TP_NOT_SIGNER1 = -2147409623; + +const int CSSMERR_TP_NOT_TRUSTED1 = -2147409622; + +const int CSSMERR_TP_NO_DEFAULT_AUTHORITY1 = -2147409621; + +const int CSSMERR_TP_REJECTED_FORM1 = -2147409620; + +const int CSSMERR_TP_REQUEST_LOST1 = -2147409619; + +const int CSSMERR_TP_REQUEST_REJECTED1 = -2147409618; + +const int CSSMERR_TP_UNSUPPORTED_ADDR_TYPE1 = -2147409617; + +const int CSSMERR_TP_UNSUPPORTED_SERVICE1 = -2147409616; + +const int CSSMERR_TP_INVALID_TUPLEGROUP_POINTER1 = -2147409615; + +const int CSSMERR_TP_INVALID_TUPLEGROUP1 = -2147409614; + +const int CSSMERR_AC_INTERNAL_ERROR1 = -2147405823; + +const int CSSMERR_AC_MEMORY_ERROR1 = -2147405822; + +const int CSSMERR_AC_MDS_ERROR1 = -2147405821; + +const int CSSMERR_AC_INVALID_POINTER1 = -2147405820; + +const int CSSMERR_AC_INVALID_INPUT_POINTER1 = -2147405819; + +const int CSSMERR_AC_INVALID_OUTPUT_POINTER1 = -2147405818; + +const int CSSMERR_AC_FUNCTION_NOT_IMPLEMENTED1 = -2147405817; + +const int CSSMERR_AC_SELF_CHECK_FAILED1 = -2147405816; + +const int CSSMERR_AC_OS_ACCESS_DENIED1 = -2147405815; + +const int CSSMERR_AC_FUNCTION_FAILED1 = -2147405814; + +const int CSSMERR_AC_INVALID_CONTEXT_HANDLE1 = -2147405760; + +const int CSSMERR_AC_INVALID_DATA1 = -2147405754; + +const int CSSMERR_AC_INVALID_DB_LIST1 = -2147405748; + +const int CSSMERR_AC_INVALID_PASSTHROUGH_ID1 = -2147405738; + +const int CSSMERR_AC_INVALID_DL_HANDLE1 = -2147405743; + +const int CSSMERR_AC_INVALID_CL_HANDLE1 = -2147405742; + +const int CSSMERR_AC_INVALID_TP_HANDLE1 = -2147405741; + +const int CSSMERR_AC_INVALID_DB_HANDLE1 = -2147405750; + +const int CSSMERR_AC_INVALID_DB_LIST_POINTER1 = -2147405747; + +const int CSSM_AC_BASE_AC_ERROR1 = -2147405568; + +const int CSSMERR_AC_INVALID_BASE_ACLS1 = -2147405567; + +const int CSSMERR_AC_INVALID_TUPLE_CREDENTIALS1 = -2147405566; + +const int CSSMERR_AC_INVALID_ENCODING1 = -2147405565; + +const int CSSMERR_AC_INVALID_VALIDITY_PERIOD1 = -2147405564; + +const int CSSMERR_AC_INVALID_REQUESTOR1 = -2147405563; + +const int CSSMERR_AC_INVALID_REQUEST_DESCRIPTOR1 = -2147405562; + +const int CSSMERR_CL_INTERNAL_ERROR1 = -2147411967; + +const int CSSMERR_CL_MEMORY_ERROR1 = -2147411966; + +const int CSSMERR_CL_MDS_ERROR1 = -2147411965; + +const int CSSMERR_CL_INVALID_POINTER1 = -2147411964; + +const int CSSMERR_CL_INVALID_INPUT_POINTER1 = -2147411963; + +const int CSSMERR_CL_INVALID_OUTPUT_POINTER1 = -2147411962; + +const int CSSMERR_CL_FUNCTION_NOT_IMPLEMENTED1 = -2147411961; + +const int CSSMERR_CL_SELF_CHECK_FAILED1 = -2147411960; + +const int CSSMERR_CL_OS_ACCESS_DENIED1 = -2147411959; + +const int CSSMERR_CL_FUNCTION_FAILED1 = -2147411958; + +const int CSSMERR_CL_INVALID_CONTEXT_HANDLE1 = -2147411904; + +const int CSSMERR_CL_INVALID_CERTGROUP_POINTER1 = -2147411902; + +const int CSSMERR_CL_INVALID_CERT_POINTER1 = -2147411901; + +const int CSSMERR_CL_INVALID_CRL_POINTER1 = -2147411900; + +const int CSSMERR_CL_INVALID_FIELD_POINTER1 = -2147411899; + +const int CSSMERR_CL_INVALID_DATA1 = -2147411898; + +const int CSSMERR_CL_CRL_ALREADY_SIGNED1 = -2147411897; + +const int CSSMERR_CL_INVALID_NUMBER_OF_FIELDS1 = -2147411896; + +const int CSSMERR_CL_VERIFICATION_FAILURE1 = -2147411895; + +const int CSSMERR_CL_UNKNOWN_FORMAT1 = -2147411890; + +const int CSSMERR_CL_UNKNOWN_TAG1 = -2147411889; + +const int CSSMERR_CL_INVALID_PASSTHROUGH_ID1 = -2147411882; + +const int CSSM_CL_BASE_CL_ERROR1 = -2147411712; + +const int CSSMERR_CL_INVALID_BUNDLE_POINTER1 = -2147411711; + +const int CSSMERR_CL_INVALID_CACHE_HANDLE1 = -2147411710; + +const int CSSMERR_CL_INVALID_RESULTS_HANDLE1 = -2147411709; + +const int CSSMERR_CL_INVALID_BUNDLE_INFO1 = -2147411708; + +const int CSSMERR_CL_INVALID_CRL_INDEX1 = -2147411707; + +const int CSSMERR_CL_INVALID_SCOPE1 = -2147411706; + +const int CSSMERR_CL_NO_FIELD_VALUES1 = -2147411705; + +const int CSSMERR_CL_SCOPE_NOT_SUPPORTED1 = -2147411704; + +const int CSSMERR_DL_INTERNAL_ERROR1 = -2147414015; + +const int CSSMERR_DL_MEMORY_ERROR1 = -2147414014; + +const int CSSMERR_DL_MDS_ERROR1 = -2147414013; + +const int CSSMERR_DL_INVALID_POINTER1 = -2147414012; + +const int CSSMERR_DL_INVALID_INPUT_POINTER1 = -2147414011; + +const int CSSMERR_DL_INVALID_OUTPUT_POINTER1 = -2147414010; + +const int CSSMERR_DL_FUNCTION_NOT_IMPLEMENTED1 = -2147414009; + +const int CSSMERR_DL_SELF_CHECK_FAILED1 = -2147414008; + +const int CSSMERR_DL_OS_ACCESS_DENIED1 = -2147414007; + +const int CSSMERR_DL_FUNCTION_FAILED1 = -2147414006; + +const int CSSMERR_DL_INVALID_CSP_HANDLE1 = -2147413936; + +const int CSSMERR_DL_INVALID_DL_HANDLE1 = -2147413935; + +const int CSSMERR_DL_INVALID_CL_HANDLE1 = -2147413934; + +const int CSSMERR_DL_INVALID_DB_LIST_POINTER1 = -2147413939; + +const int CSSMERR_DL_OPERATION_AUTH_DENIED1 = -2147413984; + +const int CSSMERR_DL_OBJECT_USE_AUTH_DENIED1 = -2147413983; + +const int CSSMERR_DL_OBJECT_MANIP_AUTH_DENIED1 = -2147413982; + +const int CSSMERR_DL_OBJECT_ACL_NOT_SUPPORTED1 = -2147413981; + +const int CSSMERR_DL_OBJECT_ACL_REQUIRED1 = -2147413980; + +const int CSSMERR_DL_INVALID_ACCESS_CREDENTIALS1 = -2147413979; + +const int CSSMERR_DL_INVALID_ACL_BASE_CERTS1 = -2147413978; + +const int CSSMERR_DL_ACL_BASE_CERTS_NOT_SUPPORTED1 = -2147413977; + +const int CSSMERR_DL_INVALID_SAMPLE_VALUE1 = -2147413976; + +const int CSSMERR_DL_SAMPLE_VALUE_NOT_SUPPORTED1 = -2147413975; + +const int CSSMERR_DL_INVALID_ACL_SUBJECT_VALUE1 = -2147413974; + +const int CSSMERR_DL_ACL_SUBJECT_TYPE_NOT_SUPPORTED1 = -2147413973; + +const int CSSMERR_DL_INVALID_ACL_CHALLENGE_CALLBACK1 = -2147413972; + +const int CSSMERR_DL_ACL_CHALLENGE_CALLBACK_FAILED1 = -2147413971; + +const int CSSMERR_DL_INVALID_ACL_ENTRY_TAG1 = -2147413970; + +const int CSSMERR_DL_ACL_ENTRY_TAG_NOT_FOUND1 = -2147413969; + +const int CSSMERR_DL_INVALID_ACL_EDIT_MODE1 = -2147413968; + +const int CSSMERR_DL_ACL_CHANGE_FAILED1 = -2147413967; + +const int CSSMERR_DL_INVALID_NEW_ACL_ENTRY1 = -2147413966; + +const int CSSMERR_DL_INVALID_NEW_ACL_OWNER1 = -2147413965; + +const int CSSMERR_DL_ACL_DELETE_FAILED1 = -2147413964; + +const int CSSMERR_DL_ACL_REPLACE_FAILED1 = -2147413963; + +const int CSSMERR_DL_ACL_ADD_FAILED1 = -2147413962; + +const int CSSMERR_DL_INVALID_DB_HANDLE1 = -2147413942; + +const int CSSMERR_DL_INVALID_PASSTHROUGH_ID1 = -2147413930; + +const int CSSMERR_DL_INVALID_NETWORK_ADDR1 = -2147413929; + +const int CSSM_DL_BASE_DL_ERROR1 = -2147413760; + +const int CSSMERR_DL_DATABASE_CORRUPT1 = -2147413759; + +const int CSSMERR_DL_INVALID_RECORD_INDEX1 = -2147413752; + +const int CSSMERR_DL_INVALID_RECORDTYPE1 = -2147413751; + +const int CSSMERR_DL_INVALID_FIELD_NAME1 = -2147413750; + +const int CSSMERR_DL_UNSUPPORTED_FIELD_FORMAT1 = -2147413749; + +const int CSSMERR_DL_UNSUPPORTED_INDEX_INFO1 = -2147413748; + +const int CSSMERR_DL_UNSUPPORTED_LOCALITY1 = -2147413747; + +const int CSSMERR_DL_UNSUPPORTED_NUM_ATTRIBUTES1 = -2147413746; + +const int CSSMERR_DL_UNSUPPORTED_NUM_INDEXES1 = -2147413745; + +const int CSSMERR_DL_UNSUPPORTED_NUM_RECORDTYPES1 = -2147413744; + +const int CSSMERR_DL_UNSUPPORTED_RECORDTYPE1 = -2147413743; + +const int CSSMERR_DL_FIELD_SPECIFIED_MULTIPLE1 = -2147413742; + +const int CSSMERR_DL_INCOMPATIBLE_FIELD_FORMAT1 = -2147413741; + +const int CSSMERR_DL_INVALID_PARSING_MODULE1 = -2147413740; + +const int CSSMERR_DL_INVALID_DB_NAME1 = -2147413738; + +const int CSSMERR_DL_DATASTORE_DOESNOT_EXIST1 = -2147413737; + +const int CSSMERR_DL_DATASTORE_ALREADY_EXISTS1 = -2147413736; + +const int CSSMERR_DL_DB_LOCKED1 = -2147413735; + +const int CSSMERR_DL_DATASTORE_IS_OPEN1 = -2147413734; + +const int CSSMERR_DL_RECORD_NOT_FOUND1 = -2147413733; + +const int CSSMERR_DL_MISSING_VALUE1 = -2147413732; + +const int CSSMERR_DL_UNSUPPORTED_QUERY1 = -2147413731; + +const int CSSMERR_DL_UNSUPPORTED_QUERY_LIMITS1 = -2147413730; + +const int CSSMERR_DL_UNSUPPORTED_NUM_SELECTION_PREDS1 = -2147413729; + +const int CSSMERR_DL_UNSUPPORTED_OPERATOR1 = -2147413727; + +const int CSSMERR_DL_INVALID_RESULTS_HANDLE1 = -2147413726; + +const int CSSMERR_DL_INVALID_DB_LOCATION1 = -2147413725; + +const int CSSMERR_DL_INVALID_ACCESS_REQUEST1 = -2147413724; + +const int CSSMERR_DL_INVALID_INDEX_INFO1 = -2147413723; + +const int CSSMERR_DL_INVALID_SELECTION_TAG1 = -2147413722; + +const int CSSMERR_DL_INVALID_NEW_OWNER1 = -2147413721; + +const int CSSMERR_DL_INVALID_RECORD_UID1 = -2147413720; + +const int CSSMERR_DL_INVALID_UNIQUE_INDEX_DATA1 = -2147413719; + +const int CSSMERR_DL_INVALID_MODIFY_MODE1 = -2147413718; + +const int CSSMERR_DL_INVALID_OPEN_PARAMETERS1 = -2147413717; + +const int CSSMERR_DL_RECORD_MODIFIED1 = -2147413716; + +const int CSSMERR_DL_ENDOFDATA1 = -2147413715; + +const int CSSMERR_DL_INVALID_QUERY1 = -2147413714; + +const int CSSMERR_DL_INVALID_VALUE1 = -2147413713; + +const int CSSMERR_DL_MULTIPLE_VALUES_UNSUPPORTED1 = -2147413712; + +const int CSSMERR_DL_STALE_UNIQUE_RECORD1 = -2147413711; + +const int CSSM_WORDID_KEYCHAIN_PROMPT1 = 65536; + +const int CSSM_WORDID_KEYCHAIN_LOCK1 = 65537; + +const int CSSM_WORDID_KEYCHAIN_CHANGE_LOCK1 = 65538; + +const int CSSM_WORDID_PROCESS1 = 65539; + +const int CSSM_WORDID__RESERVED_11 = 65540; + +const int CSSM_WORDID_SYMMETRIC_KEY1 = 65541; + +const int CSSM_WORDID_SYSTEM1 = 65542; + +const int CSSM_WORDID_KEY1 = 65543; + +const int CSSM_WORDID_PIN1 = 65544; + +const int CSSM_WORDID_PREAUTH1 = 65545; + +const int CSSM_WORDID_PREAUTH_SOURCE1 = 65546; + +const int CSSM_WORDID_ASYMMETRIC_KEY1 = 65547; + +const int CSSM_WORDID_PARTITION1 = 65548; + +const int CSSM_WORDID_KEYBAG_KEY1 = 65549; + +const int CSSM_WORDID__FIRST_UNUSED1 = 65550; + +const int CSSM_ACL_SUBJECT_TYPE_KEYCHAIN_PROMPT1 = 65536; + +const int CSSM_ACL_SUBJECT_TYPE_PROCESS1 = 65539; + +const int CSSM_ACL_SUBJECT_TYPE_CODE_SIGNATURE1 = 116; + +const int CSSM_ACL_SUBJECT_TYPE_COMMENT1 = 12; + +const int CSSM_ACL_SUBJECT_TYPE_SYMMETRIC_KEY1 = 65541; + +const int CSSM_ACL_SUBJECT_TYPE_PREAUTH1 = 65545; + +const int CSSM_ACL_SUBJECT_TYPE_PREAUTH_SOURCE1 = 65546; + +const int CSSM_ACL_SUBJECT_TYPE_ASYMMETRIC_KEY1 = 65547; + +const int CSSM_ACL_SUBJECT_TYPE_PARTITION1 = 65548; + +const int CSSM_SAMPLE_TYPE_KEYCHAIN_PROMPT1 = 65536; + +const int CSSM_SAMPLE_TYPE_KEYCHAIN_LOCK1 = 65537; + +const int CSSM_SAMPLE_TYPE_KEYCHAIN_CHANGE_LOCK1 = 65538; + +const int CSSM_SAMPLE_TYPE_PROCESS1 = 65539; + +const int CSSM_SAMPLE_TYPE_COMMENT1 = 12; + +const int CSSM_SAMPLE_TYPE_RETRY_ID1 = 85; + +const int CSSM_SAMPLE_TYPE_SYMMETRIC_KEY1 = 65541; + +const int CSSM_SAMPLE_TYPE_PREAUTH1 = 65545; + +const int CSSM_SAMPLE_TYPE_ASYMMETRIC_KEY1 = 65547; + +const int CSSM_SAMPLE_TYPE_KEYBAG_KEY1 = 65549; + +const int CSSM_ACL_AUTHORIZATION_CHANGE_ACL1 = 65536; + +const int CSSM_ACL_AUTHORIZATION_CHANGE_OWNER1 = 65537; + +const int CSSM_ACL_AUTHORIZATION_PARTITION_ID1 = 65538; + +const int CSSM_ACL_AUTHORIZATION_INTEGRITY1 = 65539; + +const int CSSM_ACL_AUTHORIZATION_PREAUTH_BASE1 = 16842752; + +const int CSSM_ACL_AUTHORIZATION_PREAUTH_END1 = 16908288; + +const int CSSM_ACL_CODE_SIGNATURE_INVALID1 = 0; + +const int CSSM_ACL_CODE_SIGNATURE_OSX1 = 1; + +const int CSSM_ACL_MATCH_UID1 = 1; + +const int CSSM_ACL_MATCH_GID1 = 2; + +const int CSSM_ACL_MATCH_HONOR_ROOT1 = 256; + +const int CSSM_ACL_MATCH_BITS1 = 3; + +const int CSSM_ACL_PROCESS_SELECTOR_CURRENT_VERSION1 = 257; + +const int CSSM_ACL_KEYCHAIN_PROMPT_CURRENT_VERSION1 = 257; + +const int CSSM_ACL_KEYCHAIN_PROMPT_REQUIRE_PASSPHRASE1 = 1; + +const int CSSM_ACL_KEYCHAIN_PROMPT_UNSIGNED1 = 16; + +const int CSSM_ACL_KEYCHAIN_PROMPT_UNSIGNED_ACT1 = 32; + +const int CSSM_ACL_KEYCHAIN_PROMPT_INVALID1 = 64; + +const int CSSM_ACL_KEYCHAIN_PROMPT_INVALID_ACT1 = 128; + +const int CSSM_ACL_PREAUTH_TRACKING_COUNT_MASK1 = 255; + +const int CSSM_ACL_PREAUTH_TRACKING_BLOCKED1 = 0; + +const int CSSM_ACL_PREAUTH_TRACKING_UNKNOWN1 = 1073741824; + +const int CSSM_ACL_PREAUTH_TRACKING_AUTHORIZED1 = -2147483648; + +const int CSSM_DB_ACCESS_RESET1 = 65536; + +const int CSSM_ALGID_APPLE_YARROW1 = -2147483648; + +const int CSSM_ALGID_AES1 = -2147483647; + +const int CSSM_ALGID_FEE1 = -2147483646; + +const int CSSM_ALGID_FEE_MD51 = -2147483645; + +const int CSSM_ALGID_FEE_SHA11 = -2147483644; + +const int CSSM_ALGID_FEED1 = -2147483643; + +const int CSSM_ALGID_FEEDEXP1 = -2147483642; + +const int CSSM_ALGID_ASC1 = -2147483641; + +const int CSSM_ALGID_SHA1HMAC_LEGACY1 = -2147483640; + +const int CSSM_ALGID_KEYCHAIN_KEY1 = -2147483639; + +const int CSSM_ALGID_PKCS12_PBE_ENCR1 = -2147483638; + +const int CSSM_ALGID_PKCS12_PBE_MAC1 = -2147483637; + +const int CSSM_ALGID_SECURE_PASSPHRASE1 = -2147483636; + +const int CSSM_ALGID_PBE_OPENSSL_MD51 = -2147483635; + +const int CSSM_ALGID_SHA2561 = -2147483634; + +const int CSSM_ALGID_SHA3841 = -2147483633; + +const int CSSM_ALGID_SHA5121 = -2147483632; + +const int CSSM_ALGID_ENTROPY_DEFAULT1 = -2147483631; + +const int CSSM_ALGID_SHA2241 = -2147483630; + +const int CSSM_ALGID_SHA224WithRSA1 = -2147483629; + +const int CSSM_ALGID_SHA256WithRSA1 = -2147483628; + +const int CSSM_ALGID_SHA384WithRSA1 = -2147483627; + +const int CSSM_ALGID_SHA512WithRSA1 = -2147483626; + +const int CSSM_ALGID_OPENSSH11 = -2147483625; + +const int CSSM_ALGID_SHA224WithECDSA1 = -2147483624; + +const int CSSM_ALGID_SHA256WithECDSA1 = -2147483623; + +const int CSSM_ALGID_SHA384WithECDSA1 = -2147483622; + +const int CSSM_ALGID_SHA512WithECDSA1 = -2147483621; + +const int CSSM_ALGID_ECDSA_SPECIFIED1 = -2147483620; + +const int CSSM_ALGID_ECDH_X963_KDF1 = -2147483619; + +const int CSSM_ALGID__FIRST_UNUSED1 = -2147483618; + +const int CSSM_PADDING_APPLE_SSLv21 = -2147483648; + +const int CSSM_KEYBLOB_RAW_FORMAT_VENDOR_DEFINED1 = -2147483648; + +const int CSSM_KEYBLOB_RAW_FORMAT_X5091 = -2147483648; + +const int CSSM_KEYBLOB_RAW_FORMAT_OPENSSH1 = -2147483647; + +const int CSSM_KEYBLOB_RAW_FORMAT_OPENSSL1 = -2147483646; + +const int CSSM_KEYBLOB_RAW_FORMAT_OPENSSH21 = -2147483645; + +const int CSSM_CUSTOM_COMMON_ERROR_EXTENT1 = 224; + +const int CSSM_ERRCODE_NO_USER_INTERACTION1 = 224; + +const int CSSM_ERRCODE_USER_CANCELED1 = 225; + +const int CSSM_ERRCODE_SERVICE_NOT_AVAILABLE1 = 226; + +const int CSSM_ERRCODE_INSUFFICIENT_CLIENT_IDENTIFICATION1 = 227; + +const int CSSM_ERRCODE_DEVICE_RESET1 = 228; + +const int CSSM_ERRCODE_DEVICE_FAILED1 = 229; + +const int CSSM_ERRCODE_IN_DARK_WAKE1 = 230; + +const int CSSMERR_CSSM_NO_USER_INTERACTION1 = -2147417888; + +const int CSSMERR_AC_NO_USER_INTERACTION1 = -2147405600; + +const int CSSMERR_CSP_NO_USER_INTERACTION1 = -2147415840; + +const int CSSMERR_CL_NO_USER_INTERACTION1 = -2147411744; + +const int CSSMERR_DL_NO_USER_INTERACTION1 = -2147413792; + +const int CSSMERR_TP_NO_USER_INTERACTION1 = -2147409696; + +const int CSSMERR_CSSM_USER_CANCELED1 = -2147417887; + +const int CSSMERR_AC_USER_CANCELED1 = -2147405599; + +const int CSSMERR_CSP_USER_CANCELED1 = -2147415839; + +const int CSSMERR_CL_USER_CANCELED1 = -2147411743; + +const int CSSMERR_DL_USER_CANCELED1 = -2147413791; + +const int CSSMERR_TP_USER_CANCELED1 = -2147409695; + +const int CSSMERR_CSSM_SERVICE_NOT_AVAILABLE1 = -2147417886; + +const int CSSMERR_AC_SERVICE_NOT_AVAILABLE1 = -2147405598; + +const int CSSMERR_CSP_SERVICE_NOT_AVAILABLE1 = -2147415838; + +const int CSSMERR_CL_SERVICE_NOT_AVAILABLE1 = -2147411742; + +const int CSSMERR_DL_SERVICE_NOT_AVAILABLE1 = -2147413790; + +const int CSSMERR_TP_SERVICE_NOT_AVAILABLE1 = -2147409694; + +const int CSSMERR_CSSM_INSUFFICIENT_CLIENT_IDENTIFICATION1 = -2147417885; + +const int CSSMERR_AC_INSUFFICIENT_CLIENT_IDENTIFICATION1 = -2147405597; + +const int CSSMERR_CSP_INSUFFICIENT_CLIENT_IDENTIFICATION1 = -2147415837; + +const int CSSMERR_CL_INSUFFICIENT_CLIENT_IDENTIFICATION1 = -2147411741; + +const int CSSMERR_DL_INSUFFICIENT_CLIENT_IDENTIFICATION1 = -2147413789; + +const int CSSMERR_TP_INSUFFICIENT_CLIENT_IDENTIFICATION1 = -2147409693; + +const int CSSMERR_CSSM_DEVICE_RESET1 = -2147417884; + +const int CSSMERR_AC_DEVICE_RESET1 = -2147405596; + +const int CSSMERR_CSP_DEVICE_RESET1 = -2147415836; + +const int CSSMERR_CL_DEVICE_RESET1 = -2147411740; + +const int CSSMERR_DL_DEVICE_RESET1 = -2147413788; + +const int CSSMERR_TP_DEVICE_RESET1 = -2147409692; + +const int CSSMERR_CSSM_DEVICE_FAILED1 = -2147417883; + +const int CSSMERR_AC_DEVICE_FAILED1 = -2147405595; + +const int CSSMERR_CSP_DEVICE_FAILED1 = -2147415835; + +const int CSSMERR_CL_DEVICE_FAILED1 = -2147411739; + +const int CSSMERR_DL_DEVICE_FAILED1 = -2147413787; + +const int CSSMERR_TP_DEVICE_FAILED1 = -2147409691; + +const int CSSMERR_CSSM_IN_DARK_WAKE1 = -2147417882; + +const int CSSMERR_AC_IN_DARK_WAKE1 = -2147405594; + +const int CSSMERR_CSP_IN_DARK_WAKE1 = -2147415834; + +const int CSSMERR_CL_IN_DARK_WAKE1 = -2147411738; + +const int CSSMERR_DL_IN_DARK_WAKE1 = -2147413786; + +const int CSSMERR_TP_IN_DARK_WAKE1 = -2147409690; + +const int CSSMERR_CSP_APPLE_ADD_APPLICATION_ACL_SUBJECT1 = -2147415040; + +const int CSSMERR_CSP_APPLE_PUBLIC_KEY_INCOMPLETE1 = -2147415039; + +const int CSSMERR_CSP_APPLE_SIGNATURE_MISMATCH1 = -2147415038; + +const int CSSMERR_CSP_APPLE_INVALID_KEY_START_DATE1 = -2147415037; + +const int CSSMERR_CSP_APPLE_INVALID_KEY_END_DATE1 = -2147415036; + +const int CSSMERR_CSPDL_APPLE_DL_CONVERSION_ERROR1 = -2147415035; + +const int CSSMERR_CSP_APPLE_SSLv2_ROLLBACK1 = -2147415034; + +const int CSSM_DL_DB_RECORD_GENERIC_PASSWORD1 = -2147483648; + +const int CSSM_DL_DB_RECORD_INTERNET_PASSWORD1 = -2147483647; + +const int CSSM_DL_DB_RECORD_APPLESHARE_PASSWORD1 = -2147483646; + +const int CSSM_DL_DB_RECORD_X509_CERTIFICATE1 = -2147479552; + +const int CSSM_DL_DB_RECORD_USER_TRUST1 = -2147479551; + +const int CSSM_DL_DB_RECORD_X509_CRL1 = -2147479550; + +const int CSSM_DL_DB_RECORD_UNLOCK_REFERRAL1 = -2147479549; + +const int CSSM_DL_DB_RECORD_EXTENDED_ATTRIBUTE1 = -2147479548; + +const int CSSM_DL_DB_RECORD_METADATA1 = -2147450880; + +const int CSSM_APPLEFILEDL_TOGGLE_AUTOCOMMIT1 = 0; + +const int CSSM_APPLEFILEDL_COMMIT1 = 1; + +const int CSSM_APPLEFILEDL_ROLLBACK1 = 2; + +const int CSSM_APPLEFILEDL_TAKE_FILE_LOCK1 = 3; + +const int CSSM_APPLEFILEDL_MAKE_BACKUP1 = 4; + +const int CSSM_APPLEFILEDL_MAKE_COPY1 = 5; + +const int CSSM_APPLEFILEDL_DELETE_FILE1 = 6; + +const int CSSM_APPLE_UNLOCK_TYPE_KEY_DIRECT1 = 1; + +const int CSSM_APPLE_UNLOCK_TYPE_WRAPPED_PRIVATE1 = 2; + +const int CSSM_APPLE_UNLOCK_TYPE_KEYBAG1 = 3; + +const int CSSMERR_APPLEDL_INVALID_OPEN_PARAMETERS1 = -2147412992; + +const int CSSMERR_APPLEDL_DISK_FULL1 = -2147412991; + +const int CSSMERR_APPLEDL_QUOTA_EXCEEDED1 = -2147412990; + +const int CSSMERR_APPLEDL_FILE_TOO_BIG1 = -2147412989; + +const int CSSMERR_APPLEDL_INVALID_DATABASE_BLOB1 = -2147412988; + +const int CSSMERR_APPLEDL_INVALID_KEY_BLOB1 = -2147412987; + +const int CSSMERR_APPLEDL_INCOMPATIBLE_DATABASE_BLOB1 = -2147412986; + +const int CSSMERR_APPLEDL_INCOMPATIBLE_KEY_BLOB1 = -2147412985; + +const int CSSMERR_APPLETP_HOSTNAME_MISMATCH1 = -2147408896; + +const int CSSMERR_APPLETP_UNKNOWN_CRITICAL_EXTEN1 = -2147408895; + +const int CSSMERR_APPLETP_NO_BASIC_CONSTRAINTS1 = -2147408894; + +const int CSSMERR_APPLETP_INVALID_CA1 = -2147408893; + +const int CSSMERR_APPLETP_INVALID_AUTHORITY_ID1 = -2147408892; + +const int CSSMERR_APPLETP_INVALID_SUBJECT_ID1 = -2147408891; + +const int CSSMERR_APPLETP_INVALID_KEY_USAGE1 = -2147408890; + +const int CSSMERR_APPLETP_INVALID_EXTENDED_KEY_USAGE1 = -2147408889; + +const int CSSMERR_APPLETP_INVALID_ID_LINKAGE1 = -2147408888; + +const int CSSMERR_APPLETP_PATH_LEN_CONSTRAINT1 = -2147408887; + +const int CSSMERR_APPLETP_INVALID_ROOT1 = -2147408886; + +const int CSSMERR_APPLETP_CRL_EXPIRED1 = -2147408885; + +const int CSSMERR_APPLETP_CRL_NOT_VALID_YET1 = -2147408884; + +const int CSSMERR_APPLETP_CRL_NOT_FOUND1 = -2147408883; + +const int CSSMERR_APPLETP_CRL_SERVER_DOWN1 = -2147408882; + +const int CSSMERR_APPLETP_CRL_BAD_URI1 = -2147408881; + +const int CSSMERR_APPLETP_UNKNOWN_CERT_EXTEN1 = -2147408880; + +const int CSSMERR_APPLETP_UNKNOWN_CRL_EXTEN1 = -2147408879; + +const int CSSMERR_APPLETP_CRL_NOT_TRUSTED1 = -2147408878; + +const int CSSMERR_APPLETP_CRL_INVALID_ANCHOR_CERT1 = -2147408877; + +const int CSSMERR_APPLETP_CRL_POLICY_FAIL1 = -2147408876; + +const int CSSMERR_APPLETP_IDP_FAIL1 = -2147408875; + +const int CSSMERR_APPLETP_CERT_NOT_FOUND_FROM_ISSUER1 = -2147408874; + +const int CSSMERR_APPLETP_BAD_CERT_FROM_ISSUER1 = -2147408873; + +const int CSSMERR_APPLETP_SMIME_EMAIL_ADDRS_NOT_FOUND1 = -2147408872; + +const int CSSMERR_APPLETP_SMIME_BAD_EXT_KEY_USE1 = -2147408871; + +const int CSSMERR_APPLETP_SMIME_BAD_KEY_USE1 = -2147408870; + +const int CSSMERR_APPLETP_SMIME_KEYUSAGE_NOT_CRITICAL1 = -2147408869; + +const int CSSMERR_APPLETP_SMIME_NO_EMAIL_ADDRS1 = -2147408868; + +const int CSSMERR_APPLETP_SMIME_SUBJ_ALT_NAME_NOT_CRIT1 = -2147408867; + +const int CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE1 = -2147408866; + +const int CSSMERR_APPLETP_OCSP_BAD_RESPONSE1 = -2147408865; + +const int CSSMERR_APPLETP_OCSP_BAD_REQUEST1 = -2147408864; + +const int CSSMERR_APPLETP_OCSP_UNAVAILABLE1 = -2147408863; + +const int CSSMERR_APPLETP_OCSP_STATUS_UNRECOGNIZED1 = -2147408862; + +const int CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK1 = -2147408861; + +const int CSSMERR_APPLETP_NETWORK_FAILURE1 = -2147408860; + +const int CSSMERR_APPLETP_OCSP_NOT_TRUSTED1 = -2147408859; + +const int CSSMERR_APPLETP_OCSP_INVALID_ANCHOR_CERT1 = -2147408858; + +const int CSSMERR_APPLETP_OCSP_SIG_ERROR1 = -2147408857; + +const int CSSMERR_APPLETP_OCSP_NO_SIGNER1 = -2147408856; + +const int CSSMERR_APPLETP_OCSP_RESP_MALFORMED_REQ1 = -2147408855; + +const int CSSMERR_APPLETP_OCSP_RESP_INTERNAL_ERR1 = -2147408854; + +const int CSSMERR_APPLETP_OCSP_RESP_TRY_LATER1 = -2147408853; + +const int CSSMERR_APPLETP_OCSP_RESP_SIG_REQUIRED1 = -2147408852; + +const int CSSMERR_APPLETP_OCSP_RESP_UNAUTHORIZED1 = -2147408851; + +const int CSSMERR_APPLETP_OCSP_NONCE_MISMATCH1 = -2147408850; + +const int CSSMERR_APPLETP_CS_BAD_CERT_CHAIN_LENGTH1 = -2147408849; + +const int CSSMERR_APPLETP_CS_NO_BASIC_CONSTRAINTS1 = -2147408848; + +const int CSSMERR_APPLETP_CS_BAD_PATH_LENGTH1 = -2147408847; + +const int CSSMERR_APPLETP_CS_NO_EXTENDED_KEY_USAGE1 = -2147408846; + +const int CSSMERR_APPLETP_CODE_SIGN_DEVELOPMENT1 = -2147408845; + +const int CSSMERR_APPLETP_RS_BAD_CERT_CHAIN_LENGTH1 = -2147408844; + +const int CSSMERR_APPLETP_RS_BAD_EXTENDED_KEY_USAGE1 = -2147408843; + +const int CSSMERR_APPLETP_TRUST_SETTING_DENY1 = -2147408842; + +const int CSSMERR_APPLETP_INVALID_EMPTY_SUBJECT1 = -2147408841; + +const int CSSMERR_APPLETP_UNKNOWN_QUAL_CERT_STATEMENT1 = -2147408840; + +const int CSSMERR_APPLETP_MISSING_REQUIRED_EXTENSION1 = -2147408839; + +const int CSSMERR_APPLETP_EXT_KEYUSAGE_NOT_CRITICAL1 = -2147408838; + +const int CSSMERR_APPLETP_IDENTIFIER_MISSING1 = -2147408837; + +const int CSSMERR_APPLETP_CA_PIN_MISMATCH1 = -2147408836; + +const int CSSMERR_APPLETP_LEAF_PIN_MISMATCH1 = -2147408835; + +const int CSSMERR_APPLE_DOTMAC_REQ_QUEUED1 = -2147408796; + +const int CSSMERR_APPLE_DOTMAC_REQ_REDIRECT1 = -2147408795; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_ERR1 = -2147408794; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_PARAM1 = -2147408793; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_AUTH1 = -2147408792; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_UNIMPL1 = -2147408791; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_NOT_AVAIL1 = -2147408790; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_ALREADY_EXIST1 = -2147408789; + +const int CSSMERR_APPLE_DOTMAC_REQ_SERVER_SERVICE_ERROR1 = -2147408788; + +const int CSSMERR_APPLE_DOTMAC_REQ_IS_PENDING1 = -2147408787; + +const int CSSMERR_APPLE_DOTMAC_NO_REQ_PENDING1 = -2147408786; + +const int CSSMERR_APPLE_DOTMAC_CSR_VERIFY_FAIL1 = -2147408785; + +const int CSSMERR_APPLE_DOTMAC_FAILED_CONSISTENCY_CHECK1 = -2147408784; + +const int CSSM_APPLEDL_OPEN_PARAMETERS_VERSION1 = 1; + +const int CSSM_APPLECSPDL_DB_LOCK1 = 0; + +const int CSSM_APPLECSPDL_DB_UNLOCK1 = 1; + +const int CSSM_APPLECSPDL_DB_GET_SETTINGS1 = 2; + +const int CSSM_APPLECSPDL_DB_SET_SETTINGS1 = 3; + +const int CSSM_APPLECSPDL_DB_IS_LOCKED1 = 4; + +const int CSSM_APPLECSPDL_DB_CHANGE_PASSWORD1 = 5; + +const int CSSM_APPLECSPDL_DB_GET_HANDLE1 = 6; + +const int CSSM_APPLESCPDL_CSP_GET_KEYHANDLE1 = 7; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_81 = 8; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_91 = 9; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_101 = 10; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_111 = 11; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_121 = 12; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_131 = 13; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_141 = 14; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_151 = 15; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_161 = 16; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_171 = 17; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_181 = 18; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_191 = 19; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_201 = 20; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_211 = 21; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_221 = 22; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_231 = 23; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_241 = 24; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_251 = 25; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_261 = 26; + +const int CSSM_APPLE_PRIVATE_CSPDL_CODE_271 = 27; + +const int CSSM_APPLECSP_KEYDIGEST1 = 256; + +const int CSSM_APPLECSP_PUBKEY1 = 257; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_APPLE_CUSTOM1 = 100; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_OPENSSL1 = 101; + +const int CSSM_KEYBLOB_WRAPPED_FORMAT_OPENSSH11 = 102; + +const int CSSM_ATTRIBUTE_VENDOR_DEFINED1 = 8388608; + +const int CSSM_ATTRIBUTE_PUBLIC_KEY1 = 1082130432; + +const int CSSM_ATTRIBUTE_FEE_PRIME_TYPE1 = 276824065; + +const int CSSM_ATTRIBUTE_FEE_CURVE_TYPE1 = 276824066; + +const int CSSM_ATTRIBUTE_ASC_OPTIMIZATION1 = 276824067; + +const int CSSM_ATTRIBUTE_RSA_BLINDING1 = 276824068; + +const int CSSM_ATTRIBUTE_PARAM_KEY1 = 1082130437; + +const int CSSM_ATTRIBUTE_PROMPT1 = 545259526; + +const int CSSM_ATTRIBUTE_ALERT_TITLE1 = 545259527; + +const int CSSM_ATTRIBUTE_VERIFY_PASSPHRASE1 = 276824072; + +const int CSSM_FEE_PRIME_TYPE_DEFAULT1 = 0; + +const int CSSM_FEE_PRIME_TYPE_MERSENNE1 = 1; + +const int CSSM_FEE_PRIME_TYPE_FEE1 = 2; + +const int CSSM_FEE_PRIME_TYPE_GENERAL1 = 3; + +const int CSSM_FEE_CURVE_TYPE_DEFAULT1 = 0; + +const int CSSM_FEE_CURVE_TYPE_MONTGOMERY1 = 1; + +const int CSSM_FEE_CURVE_TYPE_WEIERSTRASS1 = 2; + +const int CSSM_FEE_CURVE_TYPE_ANSI_X9_621 = 3; + +const int CSSM_ASC_OPTIMIZE_DEFAULT1 = 0; + +const int CSSM_ASC_OPTIMIZE_SIZE1 = 1; + +const int CSSM_ASC_OPTIMIZE_SECURITY1 = 2; + +const int CSSM_ASC_OPTIMIZE_TIME1 = 3; + +const int CSSM_ASC_OPTIMIZE_TIME_SIZE1 = 4; + +const int CSSM_ASC_OPTIMIZE_ASCII1 = 5; + +const int CSSM_KEYATTR_PARTIAL1 = 65536; + +const int CSSM_KEYATTR_PUBLIC_KEY_ENCRYPT1 = 131072; + +const int CSSM_TP_ACTION_REQUIRE_CRL_PER_CERT1 = 1; + +const int CSSM_TP_ACTION_FETCH_CRL_FROM_NET1 = 2; + +const int CSSM_TP_ACTION_CRL_SUFFICIENT1 = 4; + +const int CSSM_TP_ACTION_REQUIRE_CRL_IF_PRESENT1 = 8; + +const int CSSM_TP_ACTION_ALLOW_EXPIRED1 = 1; + +const int CSSM_TP_ACTION_LEAF_IS_CA1 = 2; + +const int CSSM_TP_ACTION_FETCH_CERT_FROM_NET1 = 4; + +const int CSSM_TP_ACTION_ALLOW_EXPIRED_ROOT1 = 8; + +const int CSSM_TP_ACTION_REQUIRE_REV_PER_CERT1 = 16; + +const int CSSM_TP_ACTION_TRUST_SETTINGS1 = 32; + +const int CSSM_TP_ACTION_IMPLICIT_ANCHORS1 = 64; + +const int CSSM_CERT_STATUS_EXPIRED1 = 1; + +const int CSSM_CERT_STATUS_NOT_VALID_YET1 = 2; + +const int CSSM_CERT_STATUS_IS_IN_INPUT_CERTS1 = 4; + +const int CSSM_CERT_STATUS_IS_IN_ANCHORS1 = 8; + +const int CSSM_CERT_STATUS_IS_ROOT1 = 16; + +const int CSSM_CERT_STATUS_IS_FROM_NET1 = 32; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_FOUND_USER1 = 64; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_FOUND_ADMIN1 = 128; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_FOUND_SYSTEM1 = 256; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_TRUST1 = 512; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_DENY1 = 1024; + +const int CSSM_CERT_STATUS_TRUST_SETTINGS_IGNORED_ERROR1 = 2048; + +const int CSSM_EVIDENCE_FORM_APPLE_HEADER1 = -2147483648; + +const int CSSM_EVIDENCE_FORM_APPLE_CERTGROUP1 = -2147483647; + +const int CSSM_EVIDENCE_FORM_APPLE_CERT_INFO1 = -2147483646; + +const int CSSM_APPLEX509CL_OBTAIN_CSR1 = 0; + +const int CSSM_APPLEX509CL_VERIFY_CSR1 = 1; + +const int kSecSubjectItemAttr1 = 1937072746; + +const int kSecIssuerItemAttr1 = 1769173877; + +const int kSecSerialNumberItemAttr1 = 1936614002; + +const int kSecPublicKeyHashItemAttr1 = 1752198009; + +const int kSecSubjectKeyIdentifierItemAttr1 = 1936419172; + +const int kSecCertTypeItemAttr1 = 1668577648; + +const int kSecCertEncodingItemAttr1 = 1667591779; + +const int SSL_NULL_WITH_NULL_NULL1 = 0; + +const int SSL_RSA_WITH_NULL_MD51 = 1; + +const int SSL_RSA_WITH_NULL_SHA1 = 2; + +const int SSL_RSA_EXPORT_WITH_RC4_40_MD51 = 3; + +const int SSL_RSA_WITH_RC4_128_MD51 = 4; + +const int SSL_RSA_WITH_RC4_128_SHA1 = 5; + +const int SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD51 = 6; + +const int SSL_RSA_WITH_IDEA_CBC_SHA1 = 7; + +const int SSL_RSA_EXPORT_WITH_DES40_CBC_SHA1 = 8; + +const int SSL_RSA_WITH_DES_CBC_SHA1 = 9; + +const int SSL_RSA_WITH_3DES_EDE_CBC_SHA1 = 10; + +const int SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA1 = 11; + +const int SSL_DH_DSS_WITH_DES_CBC_SHA1 = 12; + +const int SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA1 = 13; + +const int SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA1 = 14; + +const int SSL_DH_RSA_WITH_DES_CBC_SHA1 = 15; + +const int SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA1 = 16; + +const int SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA1 = 17; + +const int SSL_DHE_DSS_WITH_DES_CBC_SHA1 = 18; + +const int SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA1 = 19; + +const int SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA1 = 20; + +const int SSL_DHE_RSA_WITH_DES_CBC_SHA1 = 21; + +const int SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA1 = 22; + +const int SSL_DH_anon_EXPORT_WITH_RC4_40_MD51 = 23; + +const int SSL_DH_anon_WITH_RC4_128_MD51 = 24; + +const int SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA1 = 25; + +const int SSL_DH_anon_WITH_DES_CBC_SHA1 = 26; + +const int SSL_DH_anon_WITH_3DES_EDE_CBC_SHA1 = 27; + +const int SSL_FORTEZZA_DMS_WITH_NULL_SHA1 = 28; + +const int SSL_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA1 = 29; + +const int TLS_RSA_WITH_AES_128_CBC_SHA1 = 47; + +const int TLS_DH_DSS_WITH_AES_128_CBC_SHA1 = 48; + +const int TLS_DH_RSA_WITH_AES_128_CBC_SHA1 = 49; + +const int TLS_DHE_DSS_WITH_AES_128_CBC_SHA1 = 50; + +const int TLS_DHE_RSA_WITH_AES_128_CBC_SHA1 = 51; + +const int TLS_DH_anon_WITH_AES_128_CBC_SHA1 = 52; + +const int TLS_RSA_WITH_AES_256_CBC_SHA1 = 53; + +const int TLS_DH_DSS_WITH_AES_256_CBC_SHA1 = 54; + +const int TLS_DH_RSA_WITH_AES_256_CBC_SHA1 = 55; + +const int TLS_DHE_DSS_WITH_AES_256_CBC_SHA1 = 56; + +const int TLS_DHE_RSA_WITH_AES_256_CBC_SHA1 = 57; + +const int TLS_DH_anon_WITH_AES_256_CBC_SHA1 = 58; + +const int TLS_ECDH_ECDSA_WITH_NULL_SHA1 = -16383; + +const int TLS_ECDH_ECDSA_WITH_RC4_128_SHA1 = -16382; + +const int TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA1 = -16381; + +const int TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA1 = -16380; + +const int TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA1 = -16379; + +const int TLS_ECDHE_ECDSA_WITH_NULL_SHA1 = -16378; + +const int TLS_ECDHE_ECDSA_WITH_RC4_128_SHA1 = -16377; + +const int TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA1 = -16376; + +const int TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA1 = -16375; + +const int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA1 = -16374; + +const int TLS_ECDH_RSA_WITH_NULL_SHA1 = -16373; + +const int TLS_ECDH_RSA_WITH_RC4_128_SHA1 = -16372; + +const int TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA1 = -16371; + +const int TLS_ECDH_RSA_WITH_AES_128_CBC_SHA1 = -16370; + +const int TLS_ECDH_RSA_WITH_AES_256_CBC_SHA1 = -16369; + +const int TLS_ECDHE_RSA_WITH_NULL_SHA1 = -16368; + +const int TLS_ECDHE_RSA_WITH_RC4_128_SHA1 = -16367; + +const int TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA1 = -16366; + +const int TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA1 = -16365; + +const int TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA1 = -16364; + +const int TLS_ECDH_anon_WITH_NULL_SHA1 = -16363; + +const int TLS_ECDH_anon_WITH_RC4_128_SHA1 = -16362; + +const int TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA1 = -16361; + +const int TLS_ECDH_anon_WITH_AES_128_CBC_SHA1 = -16360; + +const int TLS_ECDH_anon_WITH_AES_256_CBC_SHA1 = -16359; + +const int TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA1 = -16331; + +const int TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA1 = -16330; + +const int TLS_PSK_WITH_CHACHA20_POLY1305_SHA2561 = -13141; + +const int TLS_NULL_WITH_NULL_NULL1 = 0; + +const int TLS_RSA_WITH_NULL_MD51 = 1; + +const int TLS_RSA_WITH_NULL_SHA1 = 2; + +const int TLS_RSA_WITH_RC4_128_MD51 = 4; + +const int TLS_RSA_WITH_RC4_128_SHA1 = 5; + +const int TLS_RSA_WITH_3DES_EDE_CBC_SHA1 = 10; + +const int TLS_RSA_WITH_NULL_SHA2561 = 59; + +const int TLS_RSA_WITH_AES_128_CBC_SHA2561 = 60; + +const int TLS_RSA_WITH_AES_256_CBC_SHA2561 = 61; + +const int TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA1 = 13; + +const int TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA1 = 16; + +const int TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA1 = 19; + +const int TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA1 = 22; + +const int TLS_DH_DSS_WITH_AES_128_CBC_SHA2561 = 62; + +const int TLS_DH_RSA_WITH_AES_128_CBC_SHA2561 = 63; + +const int TLS_DHE_DSS_WITH_AES_128_CBC_SHA2561 = 64; + +const int TLS_DHE_RSA_WITH_AES_128_CBC_SHA2561 = 103; + +const int TLS_DH_DSS_WITH_AES_256_CBC_SHA2561 = 104; + +const int TLS_DH_RSA_WITH_AES_256_CBC_SHA2561 = 105; + +const int TLS_DHE_DSS_WITH_AES_256_CBC_SHA2561 = 106; + +const int TLS_DHE_RSA_WITH_AES_256_CBC_SHA2561 = 107; + +const int TLS_DH_anon_WITH_RC4_128_MD51 = 24; + +const int TLS_DH_anon_WITH_3DES_EDE_CBC_SHA1 = 27; + +const int TLS_DH_anon_WITH_AES_128_CBC_SHA2561 = 108; + +const int TLS_DH_anon_WITH_AES_256_CBC_SHA2561 = 109; + +const int TLS_PSK_WITH_RC4_128_SHA1 = 138; + +const int TLS_PSK_WITH_3DES_EDE_CBC_SHA1 = 139; + +const int TLS_PSK_WITH_AES_128_CBC_SHA1 = 140; + +const int TLS_PSK_WITH_AES_256_CBC_SHA1 = 141; + +const int TLS_DHE_PSK_WITH_RC4_128_SHA1 = 142; + +const int TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA1 = 143; + +const int TLS_DHE_PSK_WITH_AES_128_CBC_SHA1 = 144; + +const int TLS_DHE_PSK_WITH_AES_256_CBC_SHA1 = 145; + +const int TLS_RSA_PSK_WITH_RC4_128_SHA1 = 146; + +const int TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA1 = 147; + +const int TLS_RSA_PSK_WITH_AES_128_CBC_SHA1 = 148; + +const int TLS_RSA_PSK_WITH_AES_256_CBC_SHA1 = 149; + +const int TLS_PSK_WITH_NULL_SHA1 = 44; + +const int TLS_DHE_PSK_WITH_NULL_SHA1 = 45; + +const int TLS_RSA_PSK_WITH_NULL_SHA1 = 46; + +const int TLS_RSA_WITH_AES_128_GCM_SHA2561 = 156; + +const int TLS_RSA_WITH_AES_256_GCM_SHA3841 = 157; + +const int TLS_DHE_RSA_WITH_AES_128_GCM_SHA2561 = 158; + +const int TLS_DHE_RSA_WITH_AES_256_GCM_SHA3841 = 159; + +const int TLS_DH_RSA_WITH_AES_128_GCM_SHA2561 = 160; + +const int TLS_DH_RSA_WITH_AES_256_GCM_SHA3841 = 161; + +const int TLS_DHE_DSS_WITH_AES_128_GCM_SHA2561 = 162; + +const int TLS_DHE_DSS_WITH_AES_256_GCM_SHA3841 = 163; + +const int TLS_DH_DSS_WITH_AES_128_GCM_SHA2561 = 164; + +const int TLS_DH_DSS_WITH_AES_256_GCM_SHA3841 = 165; + +const int TLS_DH_anon_WITH_AES_128_GCM_SHA2561 = 166; + +const int TLS_DH_anon_WITH_AES_256_GCM_SHA3841 = 167; + +const int TLS_PSK_WITH_AES_128_GCM_SHA2561 = 168; + +const int TLS_PSK_WITH_AES_256_GCM_SHA3841 = 169; + +const int TLS_DHE_PSK_WITH_AES_128_GCM_SHA2561 = 170; + +const int TLS_DHE_PSK_WITH_AES_256_GCM_SHA3841 = 171; + +const int TLS_RSA_PSK_WITH_AES_128_GCM_SHA2561 = 172; + +const int TLS_RSA_PSK_WITH_AES_256_GCM_SHA3841 = 173; + +const int TLS_PSK_WITH_AES_128_CBC_SHA2561 = 174; + +const int TLS_PSK_WITH_AES_256_CBC_SHA3841 = 175; + +const int TLS_PSK_WITH_NULL_SHA2561 = 176; + +const int TLS_PSK_WITH_NULL_SHA3841 = 177; + +const int TLS_DHE_PSK_WITH_AES_128_CBC_SHA2561 = 178; + +const int TLS_DHE_PSK_WITH_AES_256_CBC_SHA3841 = 179; + +const int TLS_DHE_PSK_WITH_NULL_SHA2561 = 180; + +const int TLS_DHE_PSK_WITH_NULL_SHA3841 = 181; + +const int TLS_RSA_PSK_WITH_AES_128_CBC_SHA2561 = 182; + +const int TLS_RSA_PSK_WITH_AES_256_CBC_SHA3841 = 183; + +const int TLS_RSA_PSK_WITH_NULL_SHA2561 = 184; + +const int TLS_RSA_PSK_WITH_NULL_SHA3841 = 185; + +const int TLS_AES_128_GCM_SHA2561 = 4865; + +const int TLS_AES_256_GCM_SHA3841 = 4866; + +const int TLS_CHACHA20_POLY1305_SHA2561 = 4867; + +const int TLS_AES_128_CCM_SHA2561 = 4868; + +const int TLS_AES_128_CCM_8_SHA2561 = 4869; + +const int TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA2561 = -16349; + +const int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA3841 = -16348; + +const int TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA2561 = -16347; + +const int TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA3841 = -16346; + +const int TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA2561 = -16345; + +const int TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA3841 = -16344; + +const int TLS_ECDH_RSA_WITH_AES_128_CBC_SHA2561 = -16343; + +const int TLS_ECDH_RSA_WITH_AES_256_CBC_SHA3841 = -16342; + +const int TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA2561 = -16341; + +const int TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA3841 = -16340; + +const int TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA2561 = -16339; + +const int TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA3841 = -16338; + +const int TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA2561 = -16337; + +const int TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA3841 = -16336; + +const int TLS_ECDH_RSA_WITH_AES_128_GCM_SHA2561 = -16335; + +const int TLS_ECDH_RSA_WITH_AES_256_GCM_SHA3841 = -16334; + +const int TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA2561 = -13144; + +const int TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA2561 = -13143; + +const int TLS_EMPTY_RENEGOTIATION_INFO_SCSV1 = 255; + +const int SSL_RSA_WITH_RC2_CBC_MD51 = -128; + +const int SSL_RSA_WITH_IDEA_CBC_MD51 = -127; + +const int SSL_RSA_WITH_DES_CBC_MD51 = -126; + +const int SSL_RSA_WITH_3DES_EDE_CBC_MD51 = -125; + +const int SSL_NO_SUCH_CIPHERSUITE1 = -1; + +const int __API_TO_BE_DEPRECATED = 100000; + +const int __API_TO_BE_DEPRECATED_MACOS = 100000; + +const int __API_TO_BE_DEPRECATED_IOS = 100000; + +const int __API_TO_BE_DEPRECATED_MACCATALYST = 100000; + +const int __API_TO_BE_DEPRECATED_WATCHOS = 100000; + +const int __API_TO_BE_DEPRECATED_TVOS = 100000; + +const int __API_TO_BE_DEPRECATED_DRIVERKIT = 100000; + +const int __API_TO_BE_DEPRECATED_VISIONOS = 100000; + +const int __MAC_10_0 = 1000; + +const int __MAC_10_1 = 1010; + +const int __MAC_10_2 = 1020; + +const int __MAC_10_3 = 1030; + +const int __MAC_10_4 = 1040; + +const int __MAC_10_5 = 1050; + +const int __MAC_10_6 = 1060; + +const int __MAC_10_7 = 1070; + +const int __MAC_10_8 = 1080; + +const int __MAC_10_9 = 1090; + +const int __MAC_10_10 = 101000; + +const int __MAC_10_10_2 = 101002; + +const int __MAC_10_10_3 = 101003; + +const int __MAC_10_11 = 101100; + +const int __MAC_10_11_2 = 101102; + +const int __MAC_10_11_3 = 101103; + +const int __MAC_10_11_4 = 101104; + +const int __MAC_10_12 = 101200; + +const int __MAC_10_12_1 = 101201; + +const int __MAC_10_12_2 = 101202; + +const int __MAC_10_12_4 = 101204; + +const int __MAC_10_13 = 101300; + +const int __MAC_10_13_1 = 101301; + +const int __MAC_10_13_2 = 101302; + +const int __MAC_10_13_4 = 101304; + +const int __MAC_10_14 = 101400; + +const int __MAC_10_14_1 = 101401; + +const int __MAC_10_14_4 = 101404; + +const int __MAC_10_14_5 = 101405; + +const int __MAC_10_14_6 = 101406; + +const int __MAC_10_15 = 101500; + +const int __MAC_10_15_1 = 101501; + +const int __MAC_10_15_4 = 101504; + +const int __MAC_10_16 = 101600; + +const int __MAC_11_0 = 110000; + +const int __MAC_11_1 = 110100; + +const int __MAC_11_3 = 110300; + +const int __MAC_11_4 = 110400; + +const int __MAC_11_5 = 110500; + +const int __MAC_11_6 = 110600; + +const int __MAC_12_0 = 120000; + +const int __MAC_12_1 = 120100; + +const int __MAC_12_2 = 120200; + +const int __MAC_12_3 = 120300; + +const int __MAC_12_4 = 120400; + +const int __MAC_12_5 = 120500; + +const int __MAC_12_6 = 120600; + +const int __MAC_12_7 = 120700; + +const int __MAC_13_0 = 130000; + +const int __MAC_13_1 = 130100; + +const int __MAC_13_2 = 130200; + +const int __MAC_13_3 = 130300; + +const int __MAC_13_4 = 130400; + +const int __MAC_13_5 = 130500; + +const int __MAC_13_6 = 130600; + +const int __MAC_14_0 = 140000; + +const int __MAC_14_1 = 140100; + +const int __MAC_14_2 = 140200; + +const int __MAC_14_3 = 140300; + +const int __MAC_14_4 = 140400; + +const int __MAC_14_5 = 140500; + +const int __IPHONE_2_0 = 20000; + +const int __IPHONE_2_1 = 20100; + +const int __IPHONE_2_2 = 20200; + +const int __IPHONE_3_0 = 30000; + +const int __IPHONE_3_1 = 30100; + +const int __IPHONE_3_2 = 30200; + +const int __IPHONE_4_0 = 40000; + +const int __IPHONE_4_1 = 40100; + +const int __IPHONE_4_2 = 40200; + +const int __IPHONE_4_3 = 40300; + +const int __IPHONE_5_0 = 50000; + +const int __IPHONE_5_1 = 50100; + +const int __IPHONE_6_0 = 60000; + +const int __IPHONE_6_1 = 60100; + +const int __IPHONE_7_0 = 70000; + +const int __IPHONE_7_1 = 70100; + +const int __IPHONE_8_0 = 80000; + +const int __IPHONE_8_1 = 80100; + +const int __IPHONE_8_2 = 80200; + +const int __IPHONE_8_3 = 80300; + +const int __IPHONE_8_4 = 80400; + +const int __IPHONE_9_0 = 90000; + +const int __IPHONE_9_1 = 90100; + +const int __IPHONE_9_2 = 90200; + +const int __IPHONE_9_3 = 90300; + +const int __IPHONE_10_0 = 100000; + +const int __IPHONE_10_1 = 100100; + +const int __IPHONE_10_2 = 100200; + +const int __IPHONE_10_3 = 100300; + +const int __IPHONE_11_0 = 110000; + +const int __IPHONE_11_1 = 110100; + +const int __IPHONE_11_2 = 110200; + +const int __IPHONE_11_3 = 110300; + +const int __IPHONE_11_4 = 110400; + +const int __IPHONE_12_0 = 120000; + +const int __IPHONE_12_1 = 120100; + +const int __IPHONE_12_2 = 120200; + +const int __IPHONE_12_3 = 120300; + +const int __IPHONE_12_4 = 120400; + +const int __IPHONE_13_0 = 130000; + +const int __IPHONE_13_1 = 130100; + +const int __IPHONE_13_2 = 130200; + +const int __IPHONE_13_3 = 130300; + +const int __IPHONE_13_4 = 130400; + +const int __IPHONE_13_5 = 130500; + +const int __IPHONE_13_6 = 130600; + +const int __IPHONE_13_7 = 130700; + +const int __IPHONE_14_0 = 140000; + +const int __IPHONE_14_1 = 140100; + +const int __IPHONE_14_2 = 140200; + +const int __IPHONE_14_3 = 140300; + +const int __IPHONE_14_5 = 140500; + +const int __IPHONE_14_4 = 140400; + +const int __IPHONE_14_6 = 140600; + +const int __IPHONE_14_7 = 140700; + +const int __IPHONE_14_8 = 140800; + +const int __IPHONE_15_0 = 150000; + +const int __IPHONE_15_1 = 150100; + +const int __IPHONE_15_2 = 150200; + +const int __IPHONE_15_3 = 150300; + +const int __IPHONE_15_4 = 150400; + +const int __IPHONE_15_5 = 150500; + +const int __IPHONE_15_6 = 150600; + +const int __IPHONE_15_7 = 150700; + +const int __IPHONE_15_8 = 150800; + +const int __IPHONE_16_0 = 160000; + +const int __IPHONE_16_1 = 160100; + +const int __IPHONE_16_2 = 160200; + +const int __IPHONE_16_3 = 160300; + +const int __IPHONE_16_4 = 160400; + +const int __IPHONE_16_5 = 160500; + +const int __IPHONE_16_6 = 160600; + +const int __IPHONE_16_7 = 160700; + +const int __IPHONE_17_0 = 170000; + +const int __IPHONE_17_1 = 170100; + +const int __IPHONE_17_2 = 170200; + +const int __IPHONE_17_3 = 170300; + +const int __IPHONE_17_4 = 170400; + +const int __IPHONE_17_5 = 170500; + +const int __WATCHOS_1_0 = 10000; + +const int __WATCHOS_2_0 = 20000; + +const int __WATCHOS_2_1 = 20100; + +const int __WATCHOS_2_2 = 20200; + +const int __WATCHOS_3_0 = 30000; + +const int __WATCHOS_3_1 = 30100; + +const int __WATCHOS_3_1_1 = 30101; + +const int __WATCHOS_3_2 = 30200; + +const int __WATCHOS_4_0 = 40000; + +const int __WATCHOS_4_1 = 40100; + +const int __WATCHOS_4_2 = 40200; + +const int __WATCHOS_4_3 = 40300; + +const int __WATCHOS_5_0 = 50000; + +const int __WATCHOS_5_1 = 50100; + +const int __WATCHOS_5_2 = 50200; + +const int __WATCHOS_5_3 = 50300; + +const int __WATCHOS_6_0 = 60000; + +const int __WATCHOS_6_1 = 60100; + +const int __WATCHOS_6_2 = 60200; + +const int __WATCHOS_7_0 = 70000; + +const int __WATCHOS_7_1 = 70100; + +const int __WATCHOS_7_2 = 70200; + +const int __WATCHOS_7_3 = 70300; + +const int __WATCHOS_7_4 = 70400; + +const int __WATCHOS_7_5 = 70500; + +const int __WATCHOS_7_6 = 70600; + +const int __WATCHOS_8_0 = 80000; + +const int __WATCHOS_8_1 = 80100; + +const int __WATCHOS_8_3 = 80300; + +const int __WATCHOS_8_4 = 80400; + +const int __WATCHOS_8_5 = 80500; + +const int __WATCHOS_8_6 = 80600; + +const int __WATCHOS_8_7 = 80700; + +const int __WATCHOS_8_8 = 80800; + +const int __WATCHOS_9_0 = 90000; + +const int __WATCHOS_9_1 = 90100; + +const int __WATCHOS_9_2 = 90200; + +const int __WATCHOS_9_3 = 90300; + +const int __WATCHOS_9_4 = 90400; + +const int __WATCHOS_9_5 = 90500; + +const int __WATCHOS_9_6 = 90600; + +const int __WATCHOS_10_0 = 100000; + +const int __WATCHOS_10_1 = 100100; + +const int __WATCHOS_10_2 = 100200; + +const int __WATCHOS_10_3 = 100300; + +const int __WATCHOS_10_4 = 100400; + +const int __WATCHOS_10_5 = 100500; + +const int __TVOS_9_0 = 90000; + +const int __TVOS_9_1 = 90100; + +const int __TVOS_9_2 = 90200; + +const int __TVOS_10_0 = 100000; + +const int __TVOS_10_0_1 = 100001; + +const int __TVOS_10_1 = 100100; + +const int __TVOS_10_2 = 100200; + +const int __TVOS_11_0 = 110000; + +const int __TVOS_11_1 = 110100; + +const int __TVOS_11_2 = 110200; + +const int __TVOS_11_3 = 110300; + +const int __TVOS_11_4 = 110400; + +const int __TVOS_12_0 = 120000; + +const int __TVOS_12_1 = 120100; + +const int __TVOS_12_2 = 120200; + +const int __TVOS_12_3 = 120300; + +const int __TVOS_12_4 = 120400; + +const int __TVOS_13_0 = 130000; + +const int __TVOS_13_2 = 130200; + +const int __TVOS_13_3 = 130300; + +const int __TVOS_13_4 = 130400; + +const int __TVOS_14_0 = 140000; + +const int __TVOS_14_1 = 140100; + +const int __TVOS_14_2 = 140200; + +const int __TVOS_14_3 = 140300; + +const int __TVOS_14_5 = 140500; + +const int __TVOS_14_6 = 140600; + +const int __TVOS_14_7 = 140700; + +const int __TVOS_15_0 = 150000; + +const int __TVOS_15_1 = 150100; + +const int __TVOS_15_2 = 150200; + +const int __TVOS_15_3 = 150300; + +const int __TVOS_15_4 = 150400; + +const int __TVOS_15_5 = 150500; + +const int __TVOS_15_6 = 150600; + +const int __TVOS_16_0 = 160000; + +const int __TVOS_16_1 = 160100; + +const int __TVOS_16_2 = 160200; + +const int __TVOS_16_3 = 160300; + +const int __TVOS_16_4 = 160400; + +const int __TVOS_16_5 = 160500; + +const int __TVOS_16_6 = 160600; + +const int __TVOS_17_0 = 170000; + +const int __TVOS_17_1 = 170100; + +const int __TVOS_17_2 = 170200; + +const int __TVOS_17_3 = 170300; + +const int __TVOS_17_4 = 170400; + +const int __TVOS_17_5 = 170500; + +const int __BRIDGEOS_2_0 = 20000; + +const int __BRIDGEOS_3_0 = 30000; + +const int __BRIDGEOS_3_1 = 30100; + +const int __BRIDGEOS_3_4 = 30400; + +const int __BRIDGEOS_4_0 = 40000; + +const int __BRIDGEOS_4_1 = 40100; + +const int __BRIDGEOS_5_0 = 50000; + +const int __BRIDGEOS_5_1 = 50100; + +const int __BRIDGEOS_5_3 = 50300; + +const int __BRIDGEOS_6_0 = 60000; + +const int __BRIDGEOS_6_2 = 60200; + +const int __BRIDGEOS_6_4 = 60400; + +const int __BRIDGEOS_6_5 = 60500; + +const int __BRIDGEOS_6_6 = 60600; + +const int __BRIDGEOS_7_0 = 70000; + +const int __BRIDGEOS_7_1 = 70100; + +const int __BRIDGEOS_7_2 = 70200; + +const int __BRIDGEOS_7_3 = 70300; + +const int __BRIDGEOS_7_4 = 70400; + +const int __BRIDGEOS_7_6 = 70600; + +const int __BRIDGEOS_8_0 = 80000; + +const int __BRIDGEOS_8_1 = 80100; + +const int __BRIDGEOS_8_2 = 80200; + +const int __BRIDGEOS_8_3 = 80300; + +const int __BRIDGEOS_8_4 = 80400; + +const int __BRIDGEOS_8_5 = 80500; + +const int __DRIVERKIT_19_0 = 190000; + +const int __DRIVERKIT_20_0 = 200000; + +const int __DRIVERKIT_21_0 = 210000; + +const int __DRIVERKIT_22_0 = 220000; + +const int __DRIVERKIT_22_4 = 220400; + +const int __DRIVERKIT_22_5 = 220500; + +const int __DRIVERKIT_22_6 = 220600; + +const int __DRIVERKIT_23_0 = 230000; + +const int __DRIVERKIT_23_1 = 230100; + +const int __DRIVERKIT_23_2 = 230200; + +const int __DRIVERKIT_23_3 = 230300; + +const int __DRIVERKIT_23_4 = 230400; + +const int __DRIVERKIT_23_5 = 230500; + +const int __VISIONOS_1_0 = 10000; + +const int __VISIONOS_1_1 = 10100; + +const int __VISIONOS_1_2 = 10200; + +const int MAC_OS_X_VERSION_10_0 = 1000; + +const int MAC_OS_X_VERSION_10_1 = 1010; + +const int MAC_OS_X_VERSION_10_2 = 1020; + +const int MAC_OS_X_VERSION_10_3 = 1030; + +const int MAC_OS_X_VERSION_10_4 = 1040; + +const int MAC_OS_X_VERSION_10_5 = 1050; + +const int MAC_OS_X_VERSION_10_6 = 1060; + +const int MAC_OS_X_VERSION_10_7 = 1070; + +const int MAC_OS_X_VERSION_10_8 = 1080; + +const int MAC_OS_X_VERSION_10_9 = 1090; + +const int MAC_OS_X_VERSION_10_10 = 101000; + +const int MAC_OS_X_VERSION_10_10_2 = 101002; + +const int MAC_OS_X_VERSION_10_10_3 = 101003; + +const int MAC_OS_X_VERSION_10_11 = 101100; + +const int MAC_OS_X_VERSION_10_11_2 = 101102; + +const int MAC_OS_X_VERSION_10_11_3 = 101103; + +const int MAC_OS_X_VERSION_10_11_4 = 101104; + +const int MAC_OS_X_VERSION_10_12 = 101200; + +const int MAC_OS_X_VERSION_10_12_1 = 101201; + +const int MAC_OS_X_VERSION_10_12_2 = 101202; + +const int MAC_OS_X_VERSION_10_12_4 = 101204; + +const int MAC_OS_X_VERSION_10_13 = 101300; + +const int MAC_OS_X_VERSION_10_13_1 = 101301; + +const int MAC_OS_X_VERSION_10_13_2 = 101302; + +const int MAC_OS_X_VERSION_10_13_4 = 101304; + +const int MAC_OS_X_VERSION_10_14 = 101400; + +const int MAC_OS_X_VERSION_10_14_1 = 101401; + +const int MAC_OS_X_VERSION_10_14_4 = 101404; + +const int MAC_OS_X_VERSION_10_14_5 = 101405; + +const int MAC_OS_X_VERSION_10_14_6 = 101406; + +const int MAC_OS_X_VERSION_10_15 = 101500; + +const int MAC_OS_X_VERSION_10_15_1 = 101501; + +const int MAC_OS_X_VERSION_10_15_4 = 101504; + +const int MAC_OS_X_VERSION_10_16 = 101600; + +const int MAC_OS_VERSION_11_0 = 110000; + +const int MAC_OS_VERSION_11_1 = 110100; + +const int MAC_OS_VERSION_11_3 = 110300; + +const int MAC_OS_VERSION_11_4 = 110400; + +const int MAC_OS_VERSION_11_5 = 110500; + +const int MAC_OS_VERSION_11_6 = 110600; + +const int MAC_OS_VERSION_12_0 = 120000; + +const int MAC_OS_VERSION_12_1 = 120100; + +const int MAC_OS_VERSION_12_2 = 120200; + +const int MAC_OS_VERSION_12_3 = 120300; + +const int MAC_OS_VERSION_12_4 = 120400; + +const int MAC_OS_VERSION_12_5 = 120500; + +const int MAC_OS_VERSION_12_6 = 120600; + +const int MAC_OS_VERSION_12_7 = 120700; + +const int MAC_OS_VERSION_13_0 = 130000; + +const int MAC_OS_VERSION_13_1 = 130100; + +const int MAC_OS_VERSION_13_2 = 130200; + +const int MAC_OS_VERSION_13_3 = 130300; + +const int MAC_OS_VERSION_13_4 = 130400; + +const int MAC_OS_VERSION_13_5 = 130500; + +const int MAC_OS_VERSION_13_6 = 130600; + +const int MAC_OS_VERSION_14_0 = 140000; + +const int MAC_OS_VERSION_14_1 = 140100; + +const int MAC_OS_VERSION_14_2 = 140200; + +const int MAC_OS_VERSION_14_3 = 140300; + +const int MAC_OS_VERSION_14_4 = 140400; + +const int MAC_OS_VERSION_14_5 = 140500; + +const int __MAC_OS_X_VERSION_MIN_REQUIRED = 140000; + +const int __MAC_OS_X_VERSION_MAX_ALLOWED = 140500; + +const int __ENABLE_LEGACY_MAC_AVAILABILITY = 1; + +const int __has_safe_buffers = 1; + +const int __DARWIN_ONLY_64_BIT_INO_T = 1; + +const int __DARWIN_ONLY_UNIX_CONFORMANCE = 1; + +const int __DARWIN_ONLY_VERS_1050 = 1; + +const int __DARWIN_UNIX03 = 1; + +const int __DARWIN_64_BIT_INO_T = 1; + +const int __DARWIN_VERS_1050 = 1; + +const int __DARWIN_NON_CANCELABLE = 0; + +const String __DARWIN_SUF_EXTSN = '\$DARWIN_EXTSN'; + +const int __DARWIN_C_ANSI = 4096; + +const int __DARWIN_C_FULL = 900000; + +const int __DARWIN_C_LEVEL = 900000; + +const int __STDC_WANT_LIB_EXT1__ = 1; + +const int __DARWIN_NO_LONG_LONG = 0; + +const int _DARWIN_FEATURE_64_BIT_INODE = 1; + +const int _DARWIN_FEATURE_ONLY_64_BIT_INODE = 1; + +const int _DARWIN_FEATURE_ONLY_VERS_1050 = 1; + +const int _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = 1; + +const int _DARWIN_FEATURE_UNIX_CONFORMANCE = 3; + +const int __has_ptrcheck = 0; + +const int __DARWIN_NULL = 0; + +const int __PTHREAD_SIZE__ = 8176; + +const int __PTHREAD_ATTR_SIZE__ = 56; + +const int __PTHREAD_MUTEXATTR_SIZE__ = 8; + +const int __PTHREAD_MUTEX_SIZE__ = 56; + +const int __PTHREAD_CONDATTR_SIZE__ = 8; + +const int __PTHREAD_COND_SIZE__ = 40; + +const int __PTHREAD_ONCE_SIZE__ = 8; + +const int __PTHREAD_RWLOCK_SIZE__ = 192; + +const int __PTHREAD_RWLOCKATTR_SIZE__ = 16; + +const int __DARWIN_WCHAR_MAX = 2147483647; + +const int __DARWIN_WCHAR_MIN = -2147483648; + +const int __DARWIN_WEOF = -1; + +const int _FORTIFY_SOURCE = 2; + +const int __DARWIN_NSIG = 32; + +const int NSIG = 32; + +const int _ARM_SIGNAL_ = 1; + +const int SIGHUP = 1; + +const int SIGINT = 2; + +const int SIGQUIT = 3; + +const int SIGILL = 4; + +const int SIGTRAP = 5; + +const int SIGABRT = 6; + +const int SIGIOT = 6; + +const int SIGEMT = 7; + +const int SIGFPE = 8; + +const int SIGKILL = 9; + +const int SIGBUS = 10; + +const int SIGSEGV = 11; + +const int SIGSYS = 12; + +const int SIGPIPE = 13; + +const int SIGALRM = 14; + +const int SIGTERM = 15; + +const int SIGURG = 16; + +const int SIGSTOP = 17; + +const int SIGTSTP = 18; + +const int SIGCONT = 19; + +const int SIGCHLD = 20; + +const int SIGTTIN = 21; + +const int SIGTTOU = 22; + +const int SIGIO = 23; + +const int SIGXCPU = 24; + +const int SIGXFSZ = 25; + +const int SIGVTALRM = 26; + +const int SIGPROF = 27; + +const int SIGWINCH = 28; + +const int SIGINFO = 29; + +const int SIGUSR1 = 30; + +const int SIGUSR2 = 31; + +const int USER_ADDR_NULL = 0; + +const int __DARWIN_OPAQUE_ARM_THREAD_STATE64 = 0; + +const int SIGEV_NONE = 0; + +const int SIGEV_SIGNAL = 1; + +const int SIGEV_THREAD = 3; + +const int ILL_NOOP = 0; + +const int ILL_ILLOPC = 1; + +const int ILL_ILLTRP = 2; + +const int ILL_PRVOPC = 3; + +const int ILL_ILLOPN = 4; + +const int ILL_ILLADR = 5; + +const int ILL_PRVREG = 6; + +const int ILL_COPROC = 7; + +const int ILL_BADSTK = 8; + +const int FPE_NOOP = 0; + +const int FPE_FLTDIV = 1; + +const int FPE_FLTOVF = 2; + +const int FPE_FLTUND = 3; + +const int FPE_FLTRES = 4; + +const int FPE_FLTINV = 5; + +const int FPE_FLTSUB = 6; + +const int FPE_INTDIV = 7; + +const int FPE_INTOVF = 8; + +const int SEGV_NOOP = 0; + +const int SEGV_MAPERR = 1; + +const int SEGV_ACCERR = 2; + +const int BUS_NOOP = 0; + +const int BUS_ADRALN = 1; + +const int BUS_ADRERR = 2; + +const int BUS_OBJERR = 3; + +const int TRAP_BRKPT = 1; + +const int TRAP_TRACE = 2; + +const int CLD_NOOP = 0; + +const int CLD_EXITED = 1; + +const int CLD_KILLED = 2; + +const int CLD_DUMPED = 3; + +const int CLD_TRAPPED = 4; + +const int CLD_STOPPED = 5; + +const int CLD_CONTINUED = 6; + +const int POLL_IN = 1; + +const int POLL_OUT = 2; + +const int POLL_MSG = 3; + +const int POLL_ERR = 4; + +const int POLL_PRI = 5; + +const int POLL_HUP = 6; + +const int SA_ONSTACK = 1; + +const int SA_RESTART = 2; + +const int SA_RESETHAND = 4; + +const int SA_NOCLDSTOP = 8; + +const int SA_NODEFER = 16; + +const int SA_NOCLDWAIT = 32; + +const int SA_SIGINFO = 64; + +const int SA_USERTRAMP = 256; + +const int SA_64REGSET = 512; + +const int SA_USERSPACE_MASK = 127; + +const int SIG_BLOCK = 1; + +const int SIG_UNBLOCK = 2; + +const int SIG_SETMASK = 3; + +const int SI_USER = 65537; + +const int SI_QUEUE = 65538; + +const int SI_TIMER = 65539; + +const int SI_ASYNCIO = 65540; + +const int SI_MESGQ = 65541; + +const int SS_ONSTACK = 1; + +const int SS_DISABLE = 4; + +const int MINSIGSTKSZ = 32768; + +const int SIGSTKSZ = 131072; + +const int SV_ONSTACK = 1; + +const int SV_INTERRUPT = 2; + +const int SV_RESETHAND = 4; + +const int SV_NODEFER = 16; + +const int SV_NOCLDSTOP = 8; + +const int SV_SIGINFO = 64; + +const int __WORDSIZE = 64; + +const int INT8_MAX = 127; + +const int INT16_MAX = 32767; + +const int INT32_MAX = 2147483647; + +const int INT64_MAX = 9223372036854775807; + +const int INT8_MIN = -128; + +const int INT16_MIN = -32768; + +const int INT32_MIN = -2147483648; + +const int INT64_MIN = -9223372036854775808; + +const int UINT8_MAX = 255; + +const int UINT16_MAX = 65535; + +const int UINT32_MAX = 4294967295; + +const int UINT64_MAX = -1; + +const int INT_LEAST8_MIN = -128; + +const int INT_LEAST16_MIN = -32768; + +const int INT_LEAST32_MIN = -2147483648; + +const int INT_LEAST64_MIN = -9223372036854775808; + +const int INT_LEAST8_MAX = 127; + +const int INT_LEAST16_MAX = 32767; + +const int INT_LEAST32_MAX = 2147483647; + +const int INT_LEAST64_MAX = 9223372036854775807; + +const int UINT_LEAST8_MAX = 255; + +const int UINT_LEAST16_MAX = 65535; + +const int UINT_LEAST32_MAX = 4294967295; + +const int UINT_LEAST64_MAX = -1; + +const int INT_FAST8_MIN = -128; + +const int INT_FAST16_MIN = -32768; + +const int INT_FAST32_MIN = -2147483648; + +const int INT_FAST64_MIN = -9223372036854775808; + +const int INT_FAST8_MAX = 127; + +const int INT_FAST16_MAX = 32767; + +const int INT_FAST32_MAX = 2147483647; + +const int INT_FAST64_MAX = 9223372036854775807; + +const int UINT_FAST8_MAX = 255; + +const int UINT_FAST16_MAX = 65535; + +const int UINT_FAST32_MAX = 4294967295; + +const int UINT_FAST64_MAX = -1; + +const int INTPTR_MAX = 9223372036854775807; + +const int INTPTR_MIN = -9223372036854775808; + +const int UINTPTR_MAX = -1; + +const int INTMAX_MAX = 9223372036854775807; + +const int UINTMAX_MAX = -1; + +const int INTMAX_MIN = -9223372036854775808; + +const int PTRDIFF_MIN = -9223372036854775808; + +const int PTRDIFF_MAX = 9223372036854775807; + +const int SIZE_MAX = -1; + +const int RSIZE_MAX = 9223372036854775807; + +const int WCHAR_MAX = 2147483647; + +const int WCHAR_MIN = -2147483648; + +const int WINT_MIN = -2147483648; + +const int WINT_MAX = 2147483647; + +const int SIG_ATOMIC_MIN = -2147483648; + +const int SIG_ATOMIC_MAX = 2147483647; + +const int PRIO_PROCESS = 0; + +const int PRIO_PGRP = 1; + +const int PRIO_USER = 2; + +const int PRIO_DARWIN_THREAD = 3; + +const int PRIO_DARWIN_PROCESS = 4; + +const int PRIO_MIN = -20; + +const int PRIO_MAX = 20; + +const int PRIO_DARWIN_BG = 4096; + +const int PRIO_DARWIN_NONUI = 4097; + +const int RUSAGE_SELF = 0; + +const int RUSAGE_CHILDREN = -1; + +const int RUSAGE_INFO_V0 = 0; + +const int RUSAGE_INFO_V1 = 1; + +const int RUSAGE_INFO_V2 = 2; + +const int RUSAGE_INFO_V3 = 3; + +const int RUSAGE_INFO_V4 = 4; + +const int RUSAGE_INFO_V5 = 5; + +const int RUSAGE_INFO_V6 = 6; + +const int RUSAGE_INFO_CURRENT = 6; + +const int RU_PROC_RUNS_RESLIDE = 1; + +const int RLIM_INFINITY = 9223372036854775807; + +const int RLIM_SAVED_MAX = 9223372036854775807; + +const int RLIM_SAVED_CUR = 9223372036854775807; + +const int RLIMIT_CPU = 0; + +const int RLIMIT_FSIZE = 1; + +const int RLIMIT_DATA = 2; + +const int RLIMIT_STACK = 3; + +const int RLIMIT_CORE = 4; + +const int RLIMIT_AS = 5; + +const int RLIMIT_RSS = 5; + +const int RLIMIT_MEMLOCK = 6; + +const int RLIMIT_NPROC = 7; + +const int RLIMIT_NOFILE = 8; + +const int RLIM_NLIMITS = 9; + +const int _RLIMIT_POSIX_FLAG = 4096; + +const int RLIMIT_WAKEUPS_MONITOR = 1; + +const int RLIMIT_CPU_USAGE_MONITOR = 2; + +const int RLIMIT_THREAD_CPULIMITS = 3; + +const int RLIMIT_FOOTPRINT_INTERVAL = 4; + +const int WAKEMON_ENABLE = 1; + +const int WAKEMON_DISABLE = 2; + +const int WAKEMON_GET_PARAMS = 4; + +const int WAKEMON_SET_DEFAULTS = 8; + +const int WAKEMON_MAKE_FATAL = 16; + +const int CPUMON_MAKE_FATAL = 4096; + +const int FOOTPRINT_INTERVAL_RESET = 1; + +const int IOPOL_TYPE_DISK = 0; + +const int IOPOL_TYPE_VFS_ATIME_UPDATES = 2; + +const int IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = 3; + +const int IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = 4; + +const int IOPOL_TYPE_VFS_TRIGGER_RESOLVE = 5; + +const int IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = 6; + +const int IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = 7; + +const int IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = 8; + +const int IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = 9; + +const int IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = 10; + +const int IOPOL_SCOPE_PROCESS = 0; + +const int IOPOL_SCOPE_THREAD = 1; + +const int IOPOL_SCOPE_DARWIN_BG = 2; + +const int IOPOL_DEFAULT = 0; + +const int IOPOL_IMPORTANT = 1; + +const int IOPOL_PASSIVE = 2; + +const int IOPOL_THROTTLE = 3; + +const int IOPOL_UTILITY = 4; + +const int IOPOL_STANDARD = 5; + +const int IOPOL_APPLICATION = 5; + +const int IOPOL_NORMAL = 1; + +const int IOPOL_ATIME_UPDATES_DEFAULT = 0; + +const int IOPOL_ATIME_UPDATES_OFF = 1; + +const int IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = 0; + +const int IOPOL_MATERIALIZE_DATALESS_FILES_OFF = 1; + +const int IOPOL_MATERIALIZE_DATALESS_FILES_ON = 2; + +const int IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = 0; + +const int IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = 1; + +const int IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = 0; + +const int IOPOL_VFS_TRIGGER_RESOLVE_OFF = 1; + +const int IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = 0; + +const int IOPOL_VFS_CONTENT_PROTECTION_IGNORE = 1; + +const int IOPOL_VFS_IGNORE_PERMISSIONS_OFF = 0; + +const int IOPOL_VFS_IGNORE_PERMISSIONS_ON = 1; + +const int IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = 0; + +const int IOPOL_VFS_SKIP_MTIME_UPDATE_ON = 1; + +const int IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = 0; + +const int IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = 1; + +const int IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = 0; + +const int IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = 1; + +const int IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = 0; + +const int IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = 1; + +const int WNOHANG = 1; + +const int WUNTRACED = 2; + +const int WCOREFLAG = 128; + +const int _WSTOPPED = 127; + +const int WEXITED = 4; + +const int WSTOPPED = 8; + +const int WCONTINUED = 16; + +const int WNOWAIT = 32; + +const int WAIT_ANY = -1; + +const int WAIT_MYPGRP = 0; + +const int _QUAD_HIGHWORD = 1; + +const int _QUAD_LOWWORD = 0; + +const int __DARWIN_LITTLE_ENDIAN = 1234; + +const int __DARWIN_BIG_ENDIAN = 4321; + +const int __DARWIN_PDP_ENDIAN = 3412; + +const int __DARWIN_BYTE_ORDER = 1234; + +const int LITTLE_ENDIAN = 1234; + +const int BIG_ENDIAN = 4321; + +const int PDP_ENDIAN = 3412; + +const int BYTE_ORDER = 1234; + +const int NULL = 0; + +const int EXIT_FAILURE = 1; + +const int EXIT_SUCCESS = 0; + +const int RAND_MAX = 2147483647; + +const int MAC_OS_X_VERSION_MIN_REQUIRED = 140000; + +const int MAC_OS_X_VERSION_MAX_ALLOWED = 140000; + +const int __AVAILABILITY_MACROS_USES_AVAILABILITY = 1; + +const int TARGET_OS_RTKIT = 0; + +const int TARGET_RT_LITTLE_ENDIAN = 1; + +const int TARGET_RT_BIG_ENDIAN = 0; + +const int TARGET_RT_64_BIT = 1; + +const int TARGET_RT_MAC_CFM = 0; + +const int TARGET_RT_MAC_MACHO = 1; + +const int TARGET_CPU_ARM64 = 1; + +const int TARGET_CPU_PPC = 0; + +const int TARGET_CPU_PPC64 = 0; + +const int TARGET_CPU_68K = 0; + +const int TARGET_CPU_X86 = 0; + +const int TARGET_CPU_X86_64 = 0; + +const int TARGET_CPU_ARM = 0; + +const int TARGET_CPU_MIPS = 0; + +const int TARGET_CPU_SPARC = 0; + +const int TARGET_CPU_ALPHA = 0; + +const int TARGET_ABI_USES_IOS_VALUES = 1; + +const int __DARWIN_FD_SETSIZE = 1024; + +const int __DARWIN_NBBY = 8; + +const int __DARWIN_NFDBITS = 32; + +const int NBBY = 8; + +const int NFDBITS = 32; + +const int FD_SETSIZE = 1024; + +const int OBJC_API_VERSION = 2; + +const int OBJC_NO_GC = 1; + +const int NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER = 1; + +const int OBJC_OLD_DISPATCH_PROTOTYPES = 0; + +const int __bool_true_false_are_defined = 1; + +const int true1 = 1; + +const int false1 = 0; + +const int OBJC_BOOL_IS_BOOL = 1; + +const int YES = 1; + +const int NO = 0; + +const int NSIntegerMax = 9223372036854775807; + +const int NSIntegerMin = -9223372036854775808; + +const int NSUIntegerMax = -1; + +const int NSINTEGER_DEFINED = 1; + +const int __GNUC_VA_LIST = 1; + +const int __DARWIN_CLK_TCK = 100; + +const int MB_LEN_MAX = 6; + +const int CLK_TCK = 100; + +const int CHAR_BIT = 8; + +const int SCHAR_MAX = 127; + +const int SCHAR_MIN = -128; + +const int UCHAR_MAX = 255; + +const int CHAR_MAX = 127; + +const int CHAR_MIN = -128; + +const int USHRT_MAX = 65535; + +const int SHRT_MAX = 32767; + +const int SHRT_MIN = -32768; + +const int UINT_MAX = 4294967295; + +const int INT_MAX = 2147483647; + +const int INT_MIN = -2147483648; + +const int ULONG_MAX = -1; + +const int LONG_MAX = 9223372036854775807; + +const int LONG_MIN = -9223372036854775808; + +const int ULLONG_MAX = -1; + +const int LLONG_MAX = 9223372036854775807; + +const int LLONG_MIN = -9223372036854775808; + +const int LONG_BIT = 64; + +const int SSIZE_MAX = 9223372036854775807; + +const int WORD_BIT = 32; + +const int SIZE_T_MAX = -1; + +const int UQUAD_MAX = -1; + +const int QUAD_MAX = 9223372036854775807; + +const int QUAD_MIN = -9223372036854775808; + +const int ARG_MAX = 1048576; + +const int CHILD_MAX = 266; + +const int GID_MAX = 2147483647; + +const int LINK_MAX = 32767; + +const int MAX_CANON = 1024; + +const int MAX_INPUT = 1024; + +const int NAME_MAX = 255; + +const int NGROUPS_MAX = 16; + +const int UID_MAX = 2147483647; + +const int OPEN_MAX = 10240; + +const int PATH_MAX = 1024; + +const int PIPE_BUF = 512; + +const int BC_BASE_MAX = 99; + +const int BC_DIM_MAX = 2048; + +const int BC_SCALE_MAX = 99; + +const int BC_STRING_MAX = 1000; + +const int CHARCLASS_NAME_MAX = 14; + +const int COLL_WEIGHTS_MAX = 2; + +const int EQUIV_CLASS_MAX = 2; + +const int EXPR_NEST_MAX = 32; + +const int LINE_MAX = 2048; + +const int RE_DUP_MAX = 255; + +const int NZERO = 20; + +const int _POSIX_ARG_MAX = 4096; + +const int _POSIX_CHILD_MAX = 25; + +const int _POSIX_LINK_MAX = 8; + +const int _POSIX_MAX_CANON = 255; + +const int _POSIX_MAX_INPUT = 255; + +const int _POSIX_NAME_MAX = 14; + +const int _POSIX_NGROUPS_MAX = 8; + +const int _POSIX_OPEN_MAX = 20; + +const int _POSIX_PATH_MAX = 256; + +const int _POSIX_PIPE_BUF = 512; + +const int _POSIX_SSIZE_MAX = 32767; + +const int _POSIX_STREAM_MAX = 8; + +const int _POSIX_TZNAME_MAX = 6; + +const int _POSIX2_BC_BASE_MAX = 99; + +const int _POSIX2_BC_DIM_MAX = 2048; + +const int _POSIX2_BC_SCALE_MAX = 99; + +const int _POSIX2_BC_STRING_MAX = 1000; + +const int _POSIX2_EQUIV_CLASS_MAX = 2; + +const int _POSIX2_EXPR_NEST_MAX = 32; + +const int _POSIX2_LINE_MAX = 2048; + +const int _POSIX2_RE_DUP_MAX = 255; + +const int _POSIX_AIO_LISTIO_MAX = 2; + +const int _POSIX_AIO_MAX = 1; + +const int _POSIX_DELAYTIMER_MAX = 32; + +const int _POSIX_MQ_OPEN_MAX = 8; + +const int _POSIX_MQ_PRIO_MAX = 32; + +const int _POSIX_RTSIG_MAX = 8; + +const int _POSIX_SEM_NSEMS_MAX = 256; + +const int _POSIX_SEM_VALUE_MAX = 32767; + +const int _POSIX_SIGQUEUE_MAX = 32; + +const int _POSIX_TIMER_MAX = 32; + +const int _POSIX_CLOCKRES_MIN = 20000000; + +const int _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4; + +const int _POSIX_THREAD_KEYS_MAX = 128; + +const int _POSIX_THREAD_THREADS_MAX = 64; + +const int PTHREAD_DESTRUCTOR_ITERATIONS = 4; + +const int PTHREAD_KEYS_MAX = 512; + +const int PTHREAD_STACK_MIN = 16384; + +const int _POSIX_HOST_NAME_MAX = 255; + +const int _POSIX_LOGIN_NAME_MAX = 9; + +const int _POSIX_SS_REPL_MAX = 4; + +const int _POSIX_SYMLINK_MAX = 255; + +const int _POSIX_SYMLOOP_MAX = 8; + +const int _POSIX_TRACE_EVENT_NAME_MAX = 30; + +const int _POSIX_TRACE_NAME_MAX = 8; + +const int _POSIX_TRACE_SYS_MAX = 8; + +const int _POSIX_TRACE_USER_EVENT_MAX = 32; + +const int _POSIX_TTY_NAME_MAX = 9; + +const int _POSIX2_CHARCLASS_NAME_MAX = 14; + +const int _POSIX2_COLL_WEIGHTS_MAX = 2; + +const int _POSIX_RE_DUP_MAX = 255; + +const int OFF_MIN = -9223372036854775808; + +const int OFF_MAX = 9223372036854775807; + +const int PASS_MAX = 128; + +const int NL_ARGMAX = 9; + +const int NL_LANGMAX = 14; + +const int NL_MSGMAX = 32767; + +const int NL_NMAX = 1; + +const int NL_SETMAX = 255; + +const int NL_TEXTMAX = 2048; + +const int _XOPEN_IOV_MAX = 16; + +const int IOV_MAX = 1024; + +const int _XOPEN_NAME_MAX = 255; + +const int _XOPEN_PATH_MAX = 1024; + +const int NS_BLOCKS_AVAILABLE = 1; + +const int __COREFOUNDATION_CFAVAILABILITY__ = 1; + +const int API_TO_BE_DEPRECATED = 100000; + +const int API_TO_BE_DEPRECATED_MACOS = 100000; + +const int API_TO_BE_DEPRECATED_IOS = 100000; + +const int API_TO_BE_DEPRECATED_TVOS = 100000; + +const int API_TO_BE_DEPRECATED_WATCHOS = 100000; + +const int API_TO_BE_DEPRECATED_DRIVERKIT = 100000; + +const int API_TO_BE_DEPRECATED_VISIONOS = 100000; + +const int __CF_ENUM_FIXED_IS_AVAILABLE = 1; + +const double NSFoundationVersionNumber10_0 = 397.4; + +const double NSFoundationVersionNumber10_1 = 425.0; + +const double NSFoundationVersionNumber10_1_1 = 425.0; + +const double NSFoundationVersionNumber10_1_2 = 425.0; + +const double NSFoundationVersionNumber10_1_3 = 425.0; + +const double NSFoundationVersionNumber10_1_4 = 425.0; + +const double NSFoundationVersionNumber10_2 = 462.0; + +const double NSFoundationVersionNumber10_2_1 = 462.0; + +const double NSFoundationVersionNumber10_2_2 = 462.0; + +const double NSFoundationVersionNumber10_2_3 = 462.0; + +const double NSFoundationVersionNumber10_2_4 = 462.0; + +const double NSFoundationVersionNumber10_2_5 = 462.0; + +const double NSFoundationVersionNumber10_2_6 = 462.0; + +const double NSFoundationVersionNumber10_2_7 = 462.7; + +const double NSFoundationVersionNumber10_2_8 = 462.7; + +const double NSFoundationVersionNumber10_3 = 500.0; + +const double NSFoundationVersionNumber10_3_1 = 500.0; + +const double NSFoundationVersionNumber10_3_2 = 500.3; + +const double NSFoundationVersionNumber10_3_3 = 500.54; + +const double NSFoundationVersionNumber10_3_4 = 500.56; + +const double NSFoundationVersionNumber10_3_5 = 500.56; + +const double NSFoundationVersionNumber10_3_6 = 500.56; + +const double NSFoundationVersionNumber10_3_7 = 500.56; + +const double NSFoundationVersionNumber10_3_8 = 500.56; + +const double NSFoundationVersionNumber10_3_9 = 500.58; + +const double NSFoundationVersionNumber10_4 = 567.0; + +const double NSFoundationVersionNumber10_4_1 = 567.0; + +const double NSFoundationVersionNumber10_4_2 = 567.12; + +const double NSFoundationVersionNumber10_4_3 = 567.21; + +const double NSFoundationVersionNumber10_4_4_Intel = 567.23; + +const double NSFoundationVersionNumber10_4_4_PowerPC = 567.21; + +const double NSFoundationVersionNumber10_4_5 = 567.25; + +const double NSFoundationVersionNumber10_4_6 = 567.26; + +const double NSFoundationVersionNumber10_4_7 = 567.27; + +const double NSFoundationVersionNumber10_4_8 = 567.28; + +const double NSFoundationVersionNumber10_4_9 = 567.29; + +const double NSFoundationVersionNumber10_4_10 = 567.29; + +const double NSFoundationVersionNumber10_4_11 = 567.36; + +const double NSFoundationVersionNumber10_5 = 677.0; + +const double NSFoundationVersionNumber10_5_1 = 677.1; + +const double NSFoundationVersionNumber10_5_2 = 677.15; + +const double NSFoundationVersionNumber10_5_3 = 677.19; + +const double NSFoundationVersionNumber10_5_4 = 677.19; + +const double NSFoundationVersionNumber10_5_5 = 677.21; + +const double NSFoundationVersionNumber10_5_6 = 677.22; + +const double NSFoundationVersionNumber10_5_7 = 677.24; + +const double NSFoundationVersionNumber10_5_8 = 677.26; + +const double NSFoundationVersionNumber10_6 = 751.0; + +const double NSFoundationVersionNumber10_6_1 = 751.0; + +const double NSFoundationVersionNumber10_6_2 = 751.14; + +const double NSFoundationVersionNumber10_6_3 = 751.21; + +const double NSFoundationVersionNumber10_6_4 = 751.29; + +const double NSFoundationVersionNumber10_6_5 = 751.42; + +const double NSFoundationVersionNumber10_6_6 = 751.53; + +const double NSFoundationVersionNumber10_6_7 = 751.53; + +const double NSFoundationVersionNumber10_6_8 = 751.62; + +const double NSFoundationVersionNumber10_7 = 833.1; + +const double NSFoundationVersionNumber10_7_1 = 833.1; + +const double NSFoundationVersionNumber10_7_2 = 833.2; + +const double NSFoundationVersionNumber10_7_3 = 833.24; + +const double NSFoundationVersionNumber10_7_4 = 833.25; + +const double NSFoundationVersionNumber10_8 = 945.0; + +const double NSFoundationVersionNumber10_8_1 = 945.0; + +const double NSFoundationVersionNumber10_8_2 = 945.11; + +const double NSFoundationVersionNumber10_8_3 = 945.16; + +const double NSFoundationVersionNumber10_8_4 = 945.18; + +const int NSFoundationVersionNumber10_9 = 1056; + +const int NSFoundationVersionNumber10_9_1 = 1056; + +const double NSFoundationVersionNumber10_9_2 = 1056.13; + +const double NSFoundationVersionNumber10_10 = 1151.16; + +const double NSFoundationVersionNumber10_10_1 = 1151.16; + +const double NSFoundationVersionNumber10_10_2 = 1152.14; + +const double NSFoundationVersionNumber10_10_3 = 1153.2; + +const double NSFoundationVersionNumber10_10_4 = 1153.2; + +const int NSFoundationVersionNumber10_10_5 = 1154; + +const int NSFoundationVersionNumber10_10_Max = 1199; + +const int NSFoundationVersionNumber10_11 = 1252; + +const double NSFoundationVersionNumber10_11_1 = 1255.1; + +const double NSFoundationVersionNumber10_11_2 = 1256.1; + +const double NSFoundationVersionNumber10_11_3 = 1256.1; + +const int NSFoundationVersionNumber10_11_4 = 1258; + +const int NSFoundationVersionNumber10_11_Max = 1299; + +const int __COREFOUNDATION_CFBASE__ = 1; + +const int UNIVERSAL_INTERFACES_VERSION = 1024; + +const int PRAGMA_IMPORT = 0; + +const int PRAGMA_ONCE = 0; + +const int PRAGMA_STRUCT_PACK = 1; + +const int PRAGMA_STRUCT_PACKPUSH = 1; + +const int PRAGMA_STRUCT_ALIGN = 0; + +const int PRAGMA_ENUM_PACK = 0; + +const int PRAGMA_ENUM_ALWAYSINT = 0; + +const int PRAGMA_ENUM_OPTIONS = 0; + +const int TYPE_EXTENDED = 0; + +const int TYPE_LONGDOUBLE_IS_DOUBLE = 0; + +const int TYPE_LONGLONG = 1; + +const int FUNCTION_PASCAL = 0; + +const int FUNCTION_DECLSPEC = 0; + +const int FUNCTION_WIN32CC = 0; + +const int TARGET_API_MAC_OS8 = 0; + +const int TARGET_API_MAC_CARBON = 1; + +const int TARGET_API_MAC_OSX = 1; + +const int TARGET_CARBON = 1; + +const int OLDROUTINENAMES = 0; + +const int OPAQUE_TOOLBOX_STRUCTS = 1; + +const int OPAQUE_UPP_TYPES = 1; + +const int ACCESSOR_CALLS_ARE_FUNCTIONS = 1; + +const int CALL_NOT_IN_CARBON = 0; + +const int MIXEDMODE_CALLS_ARE_FUNCTIONS = 1; + +const int ALLOW_OBSOLETE_CARBON_MACMEMORY = 0; + +const int ALLOW_OBSOLETE_CARBON_OSUTILS = 0; + +const int kInvalidID = 0; + +const int TRUE = 1; + +const int FALSE = 0; + +const double kCFCoreFoundationVersionNumber10_0 = 196.4; + +const double kCFCoreFoundationVersionNumber10_0_3 = 196.5; + +const double kCFCoreFoundationVersionNumber10_1 = 226.0; + +const double kCFCoreFoundationVersionNumber10_1_1 = 226.0; + +const double kCFCoreFoundationVersionNumber10_1_2 = 227.2; + +const double kCFCoreFoundationVersionNumber10_1_3 = 227.2; + +const double kCFCoreFoundationVersionNumber10_1_4 = 227.3; + +const double kCFCoreFoundationVersionNumber10_2 = 263.0; + +const double kCFCoreFoundationVersionNumber10_2_1 = 263.1; + +const double kCFCoreFoundationVersionNumber10_2_2 = 263.1; + +const double kCFCoreFoundationVersionNumber10_2_3 = 263.3; + +const double kCFCoreFoundationVersionNumber10_2_4 = 263.3; + +const double kCFCoreFoundationVersionNumber10_2_5 = 263.5; + +const double kCFCoreFoundationVersionNumber10_2_6 = 263.5; + +const double kCFCoreFoundationVersionNumber10_2_7 = 263.5; + +const double kCFCoreFoundationVersionNumber10_2_8 = 263.5; + +const double kCFCoreFoundationVersionNumber10_3 = 299.0; + +const double kCFCoreFoundationVersionNumber10_3_1 = 299.0; + +const double kCFCoreFoundationVersionNumber10_3_2 = 299.0; + +const double kCFCoreFoundationVersionNumber10_3_3 = 299.3; + +const double kCFCoreFoundationVersionNumber10_3_4 = 299.31; + +const double kCFCoreFoundationVersionNumber10_3_5 = 299.31; + +const double kCFCoreFoundationVersionNumber10_3_6 = 299.32; + +const double kCFCoreFoundationVersionNumber10_3_7 = 299.33; + +const double kCFCoreFoundationVersionNumber10_3_8 = 299.33; + +const double kCFCoreFoundationVersionNumber10_3_9 = 299.35; + +const double kCFCoreFoundationVersionNumber10_4 = 368.0; + +const double kCFCoreFoundationVersionNumber10_4_1 = 368.1; + +const double kCFCoreFoundationVersionNumber10_4_2 = 368.11; + +const double kCFCoreFoundationVersionNumber10_4_3 = 368.18; + +const double kCFCoreFoundationVersionNumber10_4_4_Intel = 368.26; + +const double kCFCoreFoundationVersionNumber10_4_4_PowerPC = 368.25; + +const double kCFCoreFoundationVersionNumber10_4_5_Intel = 368.26; + +const double kCFCoreFoundationVersionNumber10_4_5_PowerPC = 368.25; + +const double kCFCoreFoundationVersionNumber10_4_6_Intel = 368.26; + +const double kCFCoreFoundationVersionNumber10_4_6_PowerPC = 368.25; + +const double kCFCoreFoundationVersionNumber10_4_7 = 368.27; + +const double kCFCoreFoundationVersionNumber10_4_8 = 368.27; + +const double kCFCoreFoundationVersionNumber10_4_9 = 368.28; + +const double kCFCoreFoundationVersionNumber10_4_10 = 368.28; + +const double kCFCoreFoundationVersionNumber10_4_11 = 368.31; + +const double kCFCoreFoundationVersionNumber10_5 = 476.0; + +const double kCFCoreFoundationVersionNumber10_5_1 = 476.0; + +const double kCFCoreFoundationVersionNumber10_5_2 = 476.1; + +const double kCFCoreFoundationVersionNumber10_5_3 = 476.13; + +const double kCFCoreFoundationVersionNumber10_5_4 = 476.14; + +const double kCFCoreFoundationVersionNumber10_5_5 = 476.15; + +const double kCFCoreFoundationVersionNumber10_5_6 = 476.17; + +const double kCFCoreFoundationVersionNumber10_5_7 = 476.18; + +const double kCFCoreFoundationVersionNumber10_5_8 = 476.19; + +const double kCFCoreFoundationVersionNumber10_6 = 550.0; + +const double kCFCoreFoundationVersionNumber10_6_1 = 550.0; + +const double kCFCoreFoundationVersionNumber10_6_2 = 550.13; + +const double kCFCoreFoundationVersionNumber10_6_3 = 550.19; + +const double kCFCoreFoundationVersionNumber10_6_4 = 550.29; + +const double kCFCoreFoundationVersionNumber10_6_5 = 550.42; + +const double kCFCoreFoundationVersionNumber10_6_6 = 550.42; + +const double kCFCoreFoundationVersionNumber10_6_7 = 550.42; + +const double kCFCoreFoundationVersionNumber10_6_8 = 550.43; + +const double kCFCoreFoundationVersionNumber10_7 = 635.0; + +const double kCFCoreFoundationVersionNumber10_7_1 = 635.0; + +const double kCFCoreFoundationVersionNumber10_7_2 = 635.15; + +const double kCFCoreFoundationVersionNumber10_7_3 = 635.19; + +const double kCFCoreFoundationVersionNumber10_7_4 = 635.21; + +const double kCFCoreFoundationVersionNumber10_7_5 = 635.21; + +const double kCFCoreFoundationVersionNumber10_8 = 744.0; + +const double kCFCoreFoundationVersionNumber10_8_1 = 744.0; + +const double kCFCoreFoundationVersionNumber10_8_2 = 744.12; + +const double kCFCoreFoundationVersionNumber10_8_3 = 744.18; + +const double kCFCoreFoundationVersionNumber10_8_4 = 744.19; + +const double kCFCoreFoundationVersionNumber10_9 = 855.11; + +const double kCFCoreFoundationVersionNumber10_9_1 = 855.11; + +const double kCFCoreFoundationVersionNumber10_9_2 = 855.14; + +const double kCFCoreFoundationVersionNumber10_10 = 1151.16; + +const double kCFCoreFoundationVersionNumber10_10_1 = 1151.16; + +const int kCFCoreFoundationVersionNumber10_10_2 = 1152; + +const double kCFCoreFoundationVersionNumber10_10_3 = 1153.18; + +const double kCFCoreFoundationVersionNumber10_10_4 = 1153.18; + +const double kCFCoreFoundationVersionNumber10_10_5 = 1153.18; + +const int kCFCoreFoundationVersionNumber10_10_Max = 1199; + +const int kCFCoreFoundationVersionNumber10_11 = 1253; + +const double kCFCoreFoundationVersionNumber10_11_1 = 1255.1; + +const double kCFCoreFoundationVersionNumber10_11_2 = 1256.14; + +const double kCFCoreFoundationVersionNumber10_11_3 = 1256.14; + +const double kCFCoreFoundationVersionNumber10_11_4 = 1258.1; + +const int kCFCoreFoundationVersionNumber10_11_Max = 1299; + +const int ISA_PTRAUTH_DISCRIMINATOR = 27361; + +const double NSTimeIntervalSince1970 = 978307200.0; + +const int __COREFOUNDATION_CFARRAY__ = 1; + +const int OS_OBJECT_HAVE_OBJC_SUPPORT = 0; + +const int OS_OBJECT_USE_OBJC = 0; + +const int OS_OBJECT_SWIFT3 = 0; + +const int OS_OBJECT_USE_OBJC_RETAIN_RELEASE = 0; + +const int SEC_OS_IPHONE = 0; + +const int SEC_OS_OSX = 1; + +const int SEC_OS_OSX_INCLUDES = 1; + +const int SECURITY_TYPE_UNIFICATION = 1; + +const int __COREFOUNDATION_COREFOUNDATION__ = 1; + +const int __COREFOUNDATION__ = 1; + +const String __ASSERT_FILE_NAME = 'temp_for_macros.hpp'; + +const int _CACHED_RUNES = 256; + +const int _CRMASK = -256; + +const String _RUNE_MAGIC_A = 'RuneMagA'; + +const int _CTYPE_A = 256; + +const int _CTYPE_C = 512; + +const int _CTYPE_D = 1024; + +const int _CTYPE_G = 2048; + +const int _CTYPE_L = 4096; + +const int _CTYPE_P = 8192; + +const int _CTYPE_S = 16384; + +const int _CTYPE_U = 32768; + +const int _CTYPE_X = 65536; + +const int _CTYPE_B = 131072; + +const int _CTYPE_R = 262144; + +const int _CTYPE_I = 524288; + +const int _CTYPE_T = 1048576; + +const int _CTYPE_Q = 2097152; + +const int _CTYPE_SW0 = 536870912; + +const int _CTYPE_SW1 = 1073741824; + +const int _CTYPE_SW2 = 2147483648; + +const int _CTYPE_SW3 = 3221225472; + +const int _CTYPE_SWM = 3758096384; + +const int _CTYPE_SWS = 30; + +const int EPERM = 1; + +const int ENOENT = 2; + +const int ESRCH = 3; + +const int EINTR = 4; + +const int EIO = 5; + +const int ENXIO = 6; + +const int E2BIG = 7; + +const int ENOEXEC = 8; + +const int EBADF = 9; + +const int ECHILD = 10; + +const int EDEADLK = 11; + +const int ENOMEM = 12; + +const int EACCES = 13; + +const int EFAULT = 14; + +const int ENOTBLK = 15; + +const int EBUSY = 16; + +const int EEXIST = 17; + +const int EXDEV = 18; + +const int ENODEV = 19; + +const int ENOTDIR = 20; + +const int EISDIR = 21; + +const int EINVAL = 22; + +const int ENFILE = 23; + +const int EMFILE = 24; + +const int ENOTTY = 25; + +const int ETXTBSY = 26; + +const int EFBIG = 27; + +const int ENOSPC = 28; + +const int ESPIPE = 29; + +const int EROFS = 30; + +const int EMLINK = 31; + +const int EPIPE = 32; + +const int EDOM = 33; + +const int ERANGE = 34; + +const int EAGAIN = 35; + +const int EWOULDBLOCK = 35; + +const int EINPROGRESS = 36; + +const int EALREADY = 37; + +const int ENOTSOCK = 38; + +const int EDESTADDRREQ = 39; + +const int EMSGSIZE = 40; + +const int EPROTOTYPE = 41; + +const int ENOPROTOOPT = 42; + +const int EPROTONOSUPPORT = 43; + +const int ESOCKTNOSUPPORT = 44; + +const int ENOTSUP = 45; + +const int EPFNOSUPPORT = 46; + +const int EAFNOSUPPORT = 47; + +const int EADDRINUSE = 48; + +const int EADDRNOTAVAIL = 49; + +const int ENETDOWN = 50; + +const int ENETUNREACH = 51; + +const int ENETRESET = 52; + +const int ECONNABORTED = 53; + +const int ECONNRESET = 54; + +const int ENOBUFS = 55; + +const int EISCONN = 56; + +const int ENOTCONN = 57; + +const int ESHUTDOWN = 58; + +const int ETOOMANYREFS = 59; + +const int ETIMEDOUT = 60; + +const int ECONNREFUSED = 61; + +const int ELOOP = 62; + +const int ENAMETOOLONG = 63; + +const int EHOSTDOWN = 64; + +const int EHOSTUNREACH = 65; + +const int ENOTEMPTY = 66; + +const int EPROCLIM = 67; + +const int EUSERS = 68; + +const int EDQUOT = 69; + +const int ESTALE = 70; + +const int EREMOTE = 71; + +const int EBADRPC = 72; + +const int ERPCMISMATCH = 73; + +const int EPROGUNAVAIL = 74; + +const int EPROGMISMATCH = 75; + +const int EPROCUNAVAIL = 76; + +const int ENOLCK = 77; + +const int ENOSYS = 78; + +const int EFTYPE = 79; + +const int EAUTH = 80; + +const int ENEEDAUTH = 81; + +const int EPWROFF = 82; + +const int EDEVERR = 83; + +const int EOVERFLOW = 84; + +const int EBADEXEC = 85; + +const int EBADARCH = 86; + +const int ESHLIBVERS = 87; + +const int EBADMACHO = 88; + +const int ECANCELED = 89; + +const int EIDRM = 90; + +const int ENOMSG = 91; + +const int EILSEQ = 92; + +const int ENOATTR = 93; + +const int EBADMSG = 94; + +const int EMULTIHOP = 95; + +const int ENODATA = 96; + +const int ENOLINK = 97; + +const int ENOSR = 98; + +const int ENOSTR = 99; + +const int EPROTO = 100; + +const int ETIME = 101; + +const int EOPNOTSUPP = 102; + +const int ENOPOLICY = 103; + +const int ENOTRECOVERABLE = 104; + +const int EOWNERDEAD = 105; + +const int EQFULL = 106; + +const int ELAST = 106; + +const int FLT_EVAL_METHOD = 0; + +const int FLT_RADIX = 2; + +const int FLT_MANT_DIG = 24; + +const int DBL_MANT_DIG = 53; + +const int LDBL_MANT_DIG = 53; + +const int FLT_DIG = 6; + +const int DBL_DIG = 15; + +const int LDBL_DIG = 15; + +const int FLT_MIN_EXP = -125; + +const int DBL_MIN_EXP = -1021; + +const int LDBL_MIN_EXP = -1021; + +const int FLT_MIN_10_EXP = -37; + +const int DBL_MIN_10_EXP = -307; + +const int LDBL_MIN_10_EXP = -307; + +const int FLT_MAX_EXP = 128; + +const int DBL_MAX_EXP = 1024; + +const int LDBL_MAX_EXP = 1024; + +const int FLT_MAX_10_EXP = 38; + +const int DBL_MAX_10_EXP = 308; + +const int LDBL_MAX_10_EXP = 308; + +const double FLT_MAX = 3.4028234663852886e+38; + +const double DBL_MAX = 1.7976931348623157e+308; + +const double LDBL_MAX = 1.7976931348623157e+308; + +const double FLT_EPSILON = 1.1920928955078125e-7; + +const double DBL_EPSILON = 2.220446049250313e-16; + +const double LDBL_EPSILON = 2.220446049250313e-16; + +const double FLT_MIN = 1.1754943508222875e-38; + +const double DBL_MIN = 2.2250738585072014e-308; + +const double LDBL_MIN = 2.2250738585072014e-308; + +const int DECIMAL_DIG = 17; + +const int FLT_HAS_SUBNORM = 1; + +const int DBL_HAS_SUBNORM = 1; + +const int LDBL_HAS_SUBNORM = 1; + +const double FLT_TRUE_MIN = 1.401298464324817e-45; + +const double DBL_TRUE_MIN = 5e-324; + +const double LDBL_TRUE_MIN = 5e-324; + +const int FLT_DECIMAL_DIG = 9; + +const int DBL_DECIMAL_DIG = 17; + +const int LDBL_DECIMAL_DIG = 17; + +const int LC_ALL = 0; + +const int LC_COLLATE = 1; + +const int LC_CTYPE = 2; + +const int LC_MONETARY = 3; + +const int LC_NUMERIC = 4; + +const int LC_TIME = 5; + +const int LC_MESSAGES = 6; + +const int _LC_LAST = 7; + +const double HUGE_VAL = double.infinity; + +const double HUGE_VALF = double.infinity; + +const double HUGE_VALL = double.infinity; + +const double NAN = double.nan; + +const double INFINITY = double.infinity; + +const int FP_NAN = 1; + +const int FP_INFINITE = 2; + +const int FP_ZERO = 3; + +const int FP_NORMAL = 4; + +const int FP_SUBNORMAL = 5; + +const int FP_SUPERNORMAL = 6; + +const int FP_FAST_FMA = 1; + +const int FP_FAST_FMAF = 1; + +const int FP_FAST_FMAL = 1; + +const int FP_ILOGB0 = -2147483648; + +const int FP_ILOGBNAN = -2147483648; + +const int MATH_ERRNO = 1; + +const int MATH_ERREXCEPT = 2; + +const double M_E = 2.718281828459045; + +const double M_LOG2E = 1.4426950408889634; + +const double M_LOG10E = 0.4342944819032518; + +const double M_LN2 = 0.6931471805599453; + +const double M_LN10 = 2.302585092994046; + +const double M_PI = 3.141592653589793; + +const double M_PI_2 = 1.5707963267948966; + +const double M_PI_4 = 0.7853981633974483; + +const double M_1_PI = 0.3183098861837907; + +const double M_2_PI = 0.6366197723675814; + +const double M_2_SQRTPI = 1.1283791670955126; + +const double M_SQRT2 = 1.4142135623730951; + +const double M_SQRT1_2 = 0.7071067811865476; + +const double MAXFLOAT = 3.4028234663852886e+38; + +const int FP_SNAN = 1; + +const int FP_QNAN = 1; + +const double HUGE = 3.4028234663852886e+38; + +const double X_TLOSS = 14148475504056880.0; + +const int DOMAIN = 1; + +const int SING = 2; + +const int OVERFLOW = 3; + +const int UNDERFLOW = 4; + +const int TLOSS = 5; + +const int PLOSS = 6; + +const int _JBLEN = 48; + +const int RENAME_SECLUDE = 1; + +const int RENAME_SWAP = 2; + +const int RENAME_EXCL = 4; + +const int RENAME_RESERVED1 = 8; + +const int RENAME_NOFOLLOW_ANY = 16; + +const int SEEK_SET = 0; + +const int SEEK_CUR = 1; + +const int SEEK_END = 2; + +const int SEEK_HOLE = 3; + +const int SEEK_DATA = 4; + +const int __SLBF = 1; + +const int __SNBF = 2; + +const int __SRD = 4; + +const int __SWR = 8; + +const int __SRW = 16; + +const int __SEOF = 32; + +const int __SERR = 64; + +const int __SMBF = 128; + +const int __SAPP = 256; + +const int __SSTR = 512; + +const int __SOPT = 1024; + +const int __SNPT = 2048; + +const int __SOFF = 4096; + +const int __SMOD = 8192; + +const int __SALC = 16384; + +const int __SIGN = 32768; + +const int _IOFBF = 0; + +const int _IOLBF = 1; + +const int _IONBF = 2; + +const int BUFSIZ = 1024; + +const int EOF = -1; + +const int FOPEN_MAX = 20; + +const int FILENAME_MAX = 1024; + +const String P_tmpdir = '/var/tmp/'; + +const int L_tmpnam = 1024; + +const int TMP_MAX = 308915776; + +const int L_ctermid = 1024; + +const int CLOCKS_PER_SEC = 1000000; + +const int CLOCK_REALTIME = 0; + +const int CLOCK_MONOTONIC = 6; + +const int CLOCK_MONOTONIC_RAW = 4; + +const int CLOCK_MONOTONIC_RAW_APPROX = 5; + +const int CLOCK_UPTIME_RAW = 8; + +const int CLOCK_UPTIME_RAW_APPROX = 9; + +const int CLOCK_PROCESS_CPUTIME_ID = 12; + +const int CLOCK_THREAD_CPUTIME_ID = 16; + +const int TIME_UTC = 1; + +const int __COREFOUNDATION_CFBAG__ = 1; + +const int __COREFOUNDATION_CFBINARYHEAP__ = 1; + +const int __COREFOUNDATION_CFBITVECTOR__ = 1; + +const int __COREFOUNDATION_CFBYTEORDER__ = 1; + +const int CF_USE_OSBYTEORDER_H = 1; + +const int __COREFOUNDATION_CFCALENDAR__ = 1; + +const int __COREFOUNDATION_CFLOCALE__ = 1; + +const int __COREFOUNDATION_CFDICTIONARY__ = 1; + +const int __COREFOUNDATION_CFNOTIFICATIONCENTER__ = 1; + +const int __COREFOUNDATION_CFDATE__ = 1; + +const int __COREFOUNDATION_CFTIMEZONE__ = 1; + +const int __COREFOUNDATION_CFDATA__ = 1; + +const int __COREFOUNDATION_CFSTRING__ = 1; + +const int __COREFOUNDATION_CFCHARACTERSET__ = 1; + +const int __COREFOUNDATION_CFERROR__ = 1; + +const int kCFStringEncodingInvalidId = 4294967295; + +const int __kCFStringInlineBufferLength = 64; + +const int __COREFOUNDATION_CFCGTYPES__ = 1; + +const int CGFLOAT_IS_DOUBLE = 1; + +const double CGFLOAT_MIN = 2.2250738585072014e-308; + +const double CGFLOAT_MAX = 1.7976931348623157e+308; + +const double CGFLOAT_EPSILON = 2.220446049250313e-16; + +const int CGFLOAT_DEFINED = 1; + +const int CGVECTOR_DEFINED = 1; + +const int __COREFOUNDATION_CFDATEFORMATTER__ = 1; + +const int __COREFOUNDATION_CFNUMBER__ = 1; + +const int __COREFOUNDATION_CFNUMBERFORMATTER__ = 1; + +const int __COREFOUNDATION_CFPREFERENCES__ = 1; + +const int __COREFOUNDATION_CFPROPERTYLIST__ = 1; + +const int __COREFOUNDATION_CFSTREAM__ = 1; + +const int __COREFOUNDATION_CFURL__ = 1; + +const int __COREFOUNDATION_CFRUNLOOP__ = 1; + +const int MACH_PORT_NULL = 0; + +const int MACH_PORT_DEAD = 4294967295; + +const int MACH_PORT_RIGHT_SEND = 0; + +const int MACH_PORT_RIGHT_RECEIVE = 1; + +const int MACH_PORT_RIGHT_SEND_ONCE = 2; + +const int MACH_PORT_RIGHT_PORT_SET = 3; + +const int MACH_PORT_RIGHT_DEAD_NAME = 4; + +const int MACH_PORT_RIGHT_LABELH = 5; + +const int MACH_PORT_RIGHT_NUMBER = 6; + +const int MACH_PORT_TYPE_NONE = 0; + +const int MACH_PORT_TYPE_SEND = 65536; + +const int MACH_PORT_TYPE_RECEIVE = 131072; + +const int MACH_PORT_TYPE_SEND_ONCE = 262144; + +const int MACH_PORT_TYPE_PORT_SET = 524288; + +const int MACH_PORT_TYPE_DEAD_NAME = 1048576; + +const int MACH_PORT_TYPE_LABELH = 2097152; + +const int MACH_PORT_TYPE_SEND_RECEIVE = 196608; + +const int MACH_PORT_TYPE_SEND_RIGHTS = 327680; + +const int MACH_PORT_TYPE_PORT_RIGHTS = 458752; + +const int MACH_PORT_TYPE_PORT_OR_DEAD = 1507328; + +const int MACH_PORT_TYPE_ALL_RIGHTS = 2031616; + +const int MACH_PORT_TYPE_DNREQUEST = 2147483648; + +const int MACH_PORT_TYPE_SPREQUEST = 1073741824; + +const int MACH_PORT_TYPE_SPREQUEST_DELAYED = 536870912; + +const int MACH_PORT_SRIGHTS_NONE = 0; + +const int MACH_PORT_SRIGHTS_PRESENT = 1; + +const int MACH_PORT_QLIMIT_ZERO = 0; + +const int MACH_PORT_QLIMIT_BASIC = 5; + +const int MACH_PORT_QLIMIT_SMALL = 16; + +const int MACH_PORT_QLIMIT_LARGE = 1024; + +const int MACH_PORT_QLIMIT_KERNEL = 65534; + +const int MACH_PORT_QLIMIT_MIN = 0; + +const int MACH_PORT_QLIMIT_DEFAULT = 5; + +const int MACH_PORT_QLIMIT_MAX = 1024; + +const int MACH_PORT_STATUS_FLAG_TEMPOWNER = 1; + +const int MACH_PORT_STATUS_FLAG_GUARDED = 2; + +const int MACH_PORT_STATUS_FLAG_STRICT_GUARD = 4; + +const int MACH_PORT_STATUS_FLAG_IMP_DONATION = 8; + +const int MACH_PORT_STATUS_FLAG_REVIVE = 16; + +const int MACH_PORT_STATUS_FLAG_TASKPTR = 32; + +const int MACH_PORT_STATUS_FLAG_GUARD_IMMOVABLE_RECEIVE = 64; + +const int MACH_PORT_STATUS_FLAG_NO_GRANT = 128; + +const int MACH_PORT_LIMITS_INFO = 1; + +const int MACH_PORT_RECEIVE_STATUS = 2; + +const int MACH_PORT_DNREQUESTS_SIZE = 3; + +const int MACH_PORT_TEMPOWNER = 4; + +const int MACH_PORT_IMPORTANCE_RECEIVER = 5; + +const int MACH_PORT_DENAP_RECEIVER = 6; + +const int MACH_PORT_INFO_EXT = 7; + +const int MACH_PORT_GUARD_INFO = 8; + +const int MACH_PORT_SERVICE_THROTTLED = 9; + +const int MACH_PORT_LIMITS_INFO_COUNT = 1; + +const int MACH_PORT_RECEIVE_STATUS_COUNT = 10; + +const int MACH_PORT_DNREQUESTS_SIZE_COUNT = 1; + +const int MACH_PORT_INFO_EXT_COUNT = 17; + +const int MACH_PORT_GUARD_INFO_COUNT = 2; + +const int MACH_PORT_SERVICE_THROTTLED_COUNT = 1; + +const int MACH_SERVICE_PORT_INFO_STRING_NAME_MAX_BUF_LEN = 255; + +const int MACH_SERVICE_PORT_INFO_COUNT = 0; + +const int MPO_CONTEXT_AS_GUARD = 1; + +const int MPO_QLIMIT = 2; + +const int MPO_TEMPOWNER = 4; + +const int MPO_IMPORTANCE_RECEIVER = 8; + +const int MPO_INSERT_SEND_RIGHT = 16; + +const int MPO_STRICT = 32; + +const int MPO_DENAP_RECEIVER = 64; + +const int MPO_IMMOVABLE_RECEIVE = 128; + +const int MPO_FILTER_MSG = 256; + +const int MPO_TG_BLOCK_TRACKING = 512; + +const int MPO_SERVICE_PORT = 1024; + +const int MPO_CONNECTION_PORT = 2048; + +const int MPO_REPLY_PORT = 4096; + +const int MPO_ENFORCE_REPLY_PORT_SEMANTICS = 8192; + +const int MPO_PROVISIONAL_REPLY_PORT = 16384; + +const int MPO_PROVISIONAL_ID_PROT_OPTOUT = 32768; + +const int GUARD_TYPE_MACH_PORT = 1; + +const int MAX_FATAL_kGUARD_EXC_CODE = 128; + +const int MPG_FLAGS_NONE = 0; + +const int MAX_OPTIONAL_kGUARD_EXC_CODE = 524288; + +const int MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_DISP = 72057594037927936; + +const int MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_PORT = 144115188075855872; + +const int MPG_FLAGS_STRICT_REPLY_INVALID_VOUCHER = 288230376151711744; + +const int MPG_FLAGS_STRICT_REPLY_NO_BANK_ATTR = 576460752303423488; + +const int MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA = 1152921504606846976; + +const int MPG_FLAGS_STRICT_REPLY_MASK = -72057594037927936; + +const int MPG_FLAGS_MOD_REFS_PINNED_DEALLOC = 72057594037927936; + +const int MPG_FLAGS_MOD_REFS_PINNED_DESTROY = 144115188075855872; + +const int MPG_FLAGS_MOD_REFS_PINNED_COPYIN = 288230376151711744; + +const int MPG_FLAGS_IMMOVABLE_PINNED = 72057594037927936; + +const int MPG_STRICT = 1; + +const int MPG_IMMOVABLE_RECEIVE = 2; + +const int __COREFOUNDATION_CFSOCKET__ = 1; + +const int _POSIX_VERSION = 200112; + +const int _POSIX2_VERSION = 200112; + +const int _POSIX_VDISABLE = 255; + +const int F_OK = 0; + +const int X_OK = 1; + +const int W_OK = 2; + +const int R_OK = 4; + +const int _READ_OK = 512; + +const int _WRITE_OK = 1024; + +const int _EXECUTE_OK = 2048; + +const int _DELETE_OK = 4096; + +const int _APPEND_OK = 8192; + +const int _RMFILE_OK = 16384; + +const int _RATTR_OK = 32768; + +const int _WATTR_OK = 65536; + +const int _REXT_OK = 131072; + +const int _WEXT_OK = 262144; + +const int _RPERM_OK = 524288; + +const int _WPERM_OK = 1048576; + +const int _CHOWN_OK = 2097152; + +const int _ACCESS_EXTENDED_MASK = 4193792; + +const int L_SET = 0; + +const int L_INCR = 1; + +const int L_XTND = 2; + +const int ACCESSX_MAX_DESCRIPTORS = 100; + +const int ACCESSX_MAX_TABLESIZE = 16384; + +const int _PC_LINK_MAX = 1; + +const int _PC_MAX_CANON = 2; + +const int _PC_MAX_INPUT = 3; + +const int _PC_NAME_MAX = 4; + +const int _PC_PATH_MAX = 5; + +const int _PC_PIPE_BUF = 6; + +const int _PC_CHOWN_RESTRICTED = 7; + +const int _PC_NO_TRUNC = 8; + +const int _PC_VDISABLE = 9; + +const int _PC_NAME_CHARS_MAX = 10; + +const int _PC_CASE_SENSITIVE = 11; + +const int _PC_CASE_PRESERVING = 12; + +const int _PC_EXTENDED_SECURITY_NP = 13; + +const int _PC_AUTH_OPAQUE_NP = 14; + +const int _PC_2_SYMLINKS = 15; + +const int _PC_ALLOC_SIZE_MIN = 16; + +const int _PC_ASYNC_IO = 17; + +const int _PC_FILESIZEBITS = 18; + +const int _PC_PRIO_IO = 19; + +const int _PC_REC_INCR_XFER_SIZE = 20; + +const int _PC_REC_MAX_XFER_SIZE = 21; + +const int _PC_REC_MIN_XFER_SIZE = 22; + +const int _PC_REC_XFER_ALIGN = 23; + +const int _PC_SYMLINK_MAX = 24; + +const int _PC_SYNC_IO = 25; + +const int _PC_XATTR_SIZE_BITS = 26; + +const int _PC_MIN_HOLE_SIZE = 27; + +const int _CS_PATH = 1; + +const int STDIN_FILENO = 0; + +const int STDOUT_FILENO = 1; + +const int STDERR_FILENO = 2; + +const int _XOPEN_VERSION = 600; + +const int _XOPEN_XCU_VERSION = 4; + +const int _POSIX_ADVISORY_INFO = -1; + +const int _POSIX_ASYNCHRONOUS_IO = -1; + +const int _POSIX_BARRIERS = -1; + +const int _POSIX_CHOWN_RESTRICTED = 200112; + +const int _POSIX_CLOCK_SELECTION = -1; + +const int _POSIX_CPUTIME = -1; + +const int _POSIX_FSYNC = 200112; + +const int _POSIX_IPV6 = 200112; + +const int _POSIX_JOB_CONTROL = 200112; + +const int _POSIX_MAPPED_FILES = 200112; + +const int _POSIX_MEMLOCK = -1; + +const int _POSIX_MEMLOCK_RANGE = -1; + +const int _POSIX_MEMORY_PROTECTION = 200112; + +const int _POSIX_MESSAGE_PASSING = -1; + +const int _POSIX_MONOTONIC_CLOCK = -1; + +const int _POSIX_NO_TRUNC = 200112; + +const int _POSIX_PRIORITIZED_IO = -1; + +const int _POSIX_PRIORITY_SCHEDULING = -1; + +const int _POSIX_RAW_SOCKETS = -1; + +const int _POSIX_READER_WRITER_LOCKS = 200112; + +const int _POSIX_REALTIME_SIGNALS = -1; + +const int _POSIX_REGEXP = 200112; + +const int _POSIX_SAVED_IDS = 200112; + +const int _POSIX_SEMAPHORES = -1; + +const int _POSIX_SHARED_MEMORY_OBJECTS = -1; + +const int _POSIX_SHELL = 200112; + +const int _POSIX_SPAWN = 200112; + +const int _POSIX_SPIN_LOCKS = -1; + +const int _POSIX_SPORADIC_SERVER = -1; + +const int _POSIX_SYNCHRONIZED_IO = -1; + +const int _POSIX_THREAD_ATTR_STACKADDR = 200112; + +const int _POSIX_THREAD_ATTR_STACKSIZE = 200112; + +const int _POSIX_THREAD_CPUTIME = -1; + +const int _POSIX_THREAD_PRIO_INHERIT = -1; + +const int _POSIX_THREAD_PRIO_PROTECT = -1; + +const int _POSIX_THREAD_PRIORITY_SCHEDULING = -1; + +const int _POSIX_THREAD_PROCESS_SHARED = 200112; + +const int _POSIX_THREAD_SAFE_FUNCTIONS = 200112; + +const int _POSIX_THREAD_SPORADIC_SERVER = -1; + +const int _POSIX_THREADS = 200112; + +const int _POSIX_TIMEOUTS = -1; + +const int _POSIX_TIMERS = -1; + +const int _POSIX_TRACE = -1; + +const int _POSIX_TRACE_EVENT_FILTER = -1; + +const int _POSIX_TRACE_INHERIT = -1; + +const int _POSIX_TRACE_LOG = -1; + +const int _POSIX_TYPED_MEMORY_OBJECTS = -1; + +const int _POSIX2_C_BIND = 200112; + +const int _POSIX2_C_DEV = 200112; + +const int _POSIX2_CHAR_TERM = 200112; + +const int _POSIX2_FORT_DEV = -1; + +const int _POSIX2_FORT_RUN = 200112; + +const int _POSIX2_LOCALEDEF = 200112; + +const int _POSIX2_PBS = -1; + +const int _POSIX2_PBS_ACCOUNTING = -1; + +const int _POSIX2_PBS_CHECKPOINT = -1; + +const int _POSIX2_PBS_LOCATE = -1; + +const int _POSIX2_PBS_MESSAGE = -1; + +const int _POSIX2_PBS_TRACK = -1; + +const int _POSIX2_SW_DEV = 200112; + +const int _POSIX2_UPE = 200112; + +const int __ILP32_OFF32 = -1; + +const int __ILP32_OFFBIG = -1; + +const int __LP64_OFF64 = 1; + +const int __LPBIG_OFFBIG = 1; + +const int _POSIX_V6_ILP32_OFF32 = -1; + +const int _POSIX_V6_ILP32_OFFBIG = -1; + +const int _POSIX_V6_LP64_OFF64 = 1; + +const int _POSIX_V6_LPBIG_OFFBIG = 1; + +const int _POSIX_V7_ILP32_OFF32 = -1; + +const int _POSIX_V7_ILP32_OFFBIG = -1; + +const int _POSIX_V7_LP64_OFF64 = 1; + +const int _POSIX_V7_LPBIG_OFFBIG = 1; + +const int _V6_ILP32_OFF32 = -1; + +const int _V6_ILP32_OFFBIG = -1; + +const int _V6_LP64_OFF64 = 1; + +const int _V6_LPBIG_OFFBIG = 1; + +const int _XBS5_ILP32_OFF32 = -1; + +const int _XBS5_ILP32_OFFBIG = -1; + +const int _XBS5_LP64_OFF64 = 1; + +const int _XBS5_LPBIG_OFFBIG = 1; + +const int _XOPEN_CRYPT = 1; + +const int _XOPEN_ENH_I18N = 1; + +const int _XOPEN_LEGACY = -1; + +const int _XOPEN_REALTIME = -1; + +const int _XOPEN_REALTIME_THREADS = -1; + +const int _XOPEN_SHM = 1; + +const int _XOPEN_STREAMS = -1; + +const int _XOPEN_UNIX = 1; + +const int _SC_ARG_MAX = 1; + +const int _SC_CHILD_MAX = 2; + +const int _SC_CLK_TCK = 3; + +const int _SC_NGROUPS_MAX = 4; + +const int _SC_OPEN_MAX = 5; + +const int _SC_JOB_CONTROL = 6; + +const int _SC_SAVED_IDS = 7; + +const int _SC_VERSION = 8; + +const int _SC_BC_BASE_MAX = 9; + +const int _SC_BC_DIM_MAX = 10; + +const int _SC_BC_SCALE_MAX = 11; + +const int _SC_BC_STRING_MAX = 12; + +const int _SC_COLL_WEIGHTS_MAX = 13; + +const int _SC_EXPR_NEST_MAX = 14; + +const int _SC_LINE_MAX = 15; + +const int _SC_RE_DUP_MAX = 16; + +const int _SC_2_VERSION = 17; + +const int _SC_2_C_BIND = 18; + +const int _SC_2_C_DEV = 19; + +const int _SC_2_CHAR_TERM = 20; + +const int _SC_2_FORT_DEV = 21; + +const int _SC_2_FORT_RUN = 22; + +const int _SC_2_LOCALEDEF = 23; + +const int _SC_2_SW_DEV = 24; + +const int _SC_2_UPE = 25; + +const int _SC_STREAM_MAX = 26; + +const int _SC_TZNAME_MAX = 27; + +const int _SC_ASYNCHRONOUS_IO = 28; + +const int _SC_PAGESIZE = 29; + +const int _SC_MEMLOCK = 30; + +const int _SC_MEMLOCK_RANGE = 31; + +const int _SC_MEMORY_PROTECTION = 32; + +const int _SC_MESSAGE_PASSING = 33; + +const int _SC_PRIORITIZED_IO = 34; + +const int _SC_PRIORITY_SCHEDULING = 35; + +const int _SC_REALTIME_SIGNALS = 36; + +const int _SC_SEMAPHORES = 37; + +const int _SC_FSYNC = 38; + +const int _SC_SHARED_MEMORY_OBJECTS = 39; + +const int _SC_SYNCHRONIZED_IO = 40; + +const int _SC_TIMERS = 41; + +const int _SC_AIO_LISTIO_MAX = 42; + +const int _SC_AIO_MAX = 43; + +const int _SC_AIO_PRIO_DELTA_MAX = 44; + +const int _SC_DELAYTIMER_MAX = 45; + +const int _SC_MQ_OPEN_MAX = 46; + +const int _SC_MAPPED_FILES = 47; + +const int _SC_RTSIG_MAX = 48; + +const int _SC_SEM_NSEMS_MAX = 49; + +const int _SC_SEM_VALUE_MAX = 50; + +const int _SC_SIGQUEUE_MAX = 51; + +const int _SC_TIMER_MAX = 52; + +const int _SC_NPROCESSORS_CONF = 57; + +const int _SC_NPROCESSORS_ONLN = 58; + +const int _SC_2_PBS = 59; + +const int _SC_2_PBS_ACCOUNTING = 60; + +const int _SC_2_PBS_CHECKPOINT = 61; + +const int _SC_2_PBS_LOCATE = 62; + +const int _SC_2_PBS_MESSAGE = 63; + +const int _SC_2_PBS_TRACK = 64; + +const int _SC_ADVISORY_INFO = 65; + +const int _SC_BARRIERS = 66; + +const int _SC_CLOCK_SELECTION = 67; + +const int _SC_CPUTIME = 68; + +const int _SC_FILE_LOCKING = 69; + +const int _SC_GETGR_R_SIZE_MAX = 70; + +const int _SC_GETPW_R_SIZE_MAX = 71; + +const int _SC_HOST_NAME_MAX = 72; + +const int _SC_LOGIN_NAME_MAX = 73; + +const int _SC_MONOTONIC_CLOCK = 74; + +const int _SC_MQ_PRIO_MAX = 75; + +const int _SC_READER_WRITER_LOCKS = 76; + +const int _SC_REGEXP = 77; + +const int _SC_SHELL = 78; + +const int _SC_SPAWN = 79; + +const int _SC_SPIN_LOCKS = 80; + +const int _SC_SPORADIC_SERVER = 81; + +const int _SC_THREAD_ATTR_STACKADDR = 82; + +const int _SC_THREAD_ATTR_STACKSIZE = 83; + +const int _SC_THREAD_CPUTIME = 84; + +const int _SC_THREAD_DESTRUCTOR_ITERATIONS = 85; + +const int _SC_THREAD_KEYS_MAX = 86; + +const int _SC_THREAD_PRIO_INHERIT = 87; + +const int _SC_THREAD_PRIO_PROTECT = 88; + +const int _SC_THREAD_PRIORITY_SCHEDULING = 89; + +const int _SC_THREAD_PROCESS_SHARED = 90; + +const int _SC_THREAD_SAFE_FUNCTIONS = 91; + +const int _SC_THREAD_SPORADIC_SERVER = 92; + +const int _SC_THREAD_STACK_MIN = 93; + +const int _SC_THREAD_THREADS_MAX = 94; + +const int _SC_TIMEOUTS = 95; + +const int _SC_THREADS = 96; + +const int _SC_TRACE = 97; + +const int _SC_TRACE_EVENT_FILTER = 98; + +const int _SC_TRACE_INHERIT = 99; + +const int _SC_TRACE_LOG = 100; + +const int _SC_TTY_NAME_MAX = 101; + +const int _SC_TYPED_MEMORY_OBJECTS = 102; + +const int _SC_V6_ILP32_OFF32 = 103; + +const int _SC_V6_ILP32_OFFBIG = 104; + +const int _SC_V6_LP64_OFF64 = 105; + +const int _SC_V6_LPBIG_OFFBIG = 106; + +const int _SC_IPV6 = 118; + +const int _SC_RAW_SOCKETS = 119; + +const int _SC_SYMLOOP_MAX = 120; + +const int _SC_ATEXIT_MAX = 107; + +const int _SC_IOV_MAX = 56; + +const int _SC_PAGE_SIZE = 29; + +const int _SC_XOPEN_CRYPT = 108; + +const int _SC_XOPEN_ENH_I18N = 109; + +const int _SC_XOPEN_LEGACY = 110; + +const int _SC_XOPEN_REALTIME = 111; + +const int _SC_XOPEN_REALTIME_THREADS = 112; + +const int _SC_XOPEN_SHM = 113; + +const int _SC_XOPEN_STREAMS = 114; + +const int _SC_XOPEN_UNIX = 115; + +const int _SC_XOPEN_VERSION = 116; + +const int _SC_XOPEN_XCU_VERSION = 121; + +const int _SC_XBS5_ILP32_OFF32 = 122; + +const int _SC_XBS5_ILP32_OFFBIG = 123; + +const int _SC_XBS5_LP64_OFF64 = 124; + +const int _SC_XBS5_LPBIG_OFFBIG = 125; + +const int _SC_SS_REPL_MAX = 126; + +const int _SC_TRACE_EVENT_NAME_MAX = 127; + +const int _SC_TRACE_NAME_MAX = 128; + +const int _SC_TRACE_SYS_MAX = 129; + +const int _SC_TRACE_USER_EVENT_MAX = 130; + +const int _SC_PASS_MAX = 131; + +const int _SC_PHYS_PAGES = 200; + +const int _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2; + +const int _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 3; + +const int _CS_POSIX_V6_ILP32_OFF32_LIBS = 4; + +const int _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 5; + +const int _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 6; + +const int _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 7; + +const int _CS_POSIX_V6_LP64_OFF64_CFLAGS = 8; + +const int _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 9; + +const int _CS_POSIX_V6_LP64_OFF64_LIBS = 10; + +const int _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 11; + +const int _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 12; + +const int _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 13; + +const int _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14; + +const int _CS_XBS5_ILP32_OFF32_CFLAGS = 20; + +const int _CS_XBS5_ILP32_OFF32_LDFLAGS = 21; + +const int _CS_XBS5_ILP32_OFF32_LIBS = 22; + +const int _CS_XBS5_ILP32_OFF32_LINTFLAGS = 23; + +const int _CS_XBS5_ILP32_OFFBIG_CFLAGS = 24; + +const int _CS_XBS5_ILP32_OFFBIG_LDFLAGS = 25; + +const int _CS_XBS5_ILP32_OFFBIG_LIBS = 26; + +const int _CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 27; + +const int _CS_XBS5_LP64_OFF64_CFLAGS = 28; + +const int _CS_XBS5_LP64_OFF64_LDFLAGS = 29; + +const int _CS_XBS5_LP64_OFF64_LIBS = 30; + +const int _CS_XBS5_LP64_OFF64_LINTFLAGS = 31; + +const int _CS_XBS5_LPBIG_OFFBIG_CFLAGS = 32; + +const int _CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 33; + +const int _CS_XBS5_LPBIG_OFFBIG_LIBS = 34; + +const int _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 35; + +const int _CS_DARWIN_USER_DIR = 65536; + +const int _CS_DARWIN_USER_TEMP_DIR = 65537; + +const int _CS_DARWIN_USER_CACHE_DIR = 65538; + +const int F_ULOCK = 0; + +const int F_LOCK = 1; + +const int F_TLOCK = 2; + +const int F_TEST = 3; + +const int SYNC_VOLUME_FULLSYNC = 1; + +const int SYNC_VOLUME_WAIT = 2; + +const int O_RDONLY = 0; + +const int O_WRONLY = 1; + +const int O_RDWR = 2; + +const int O_ACCMODE = 3; + +const int FREAD = 1; + +const int FWRITE = 2; + +const int O_NONBLOCK = 4; + +const int O_APPEND = 8; + +const int O_SYNC = 128; + +const int O_SHLOCK = 16; + +const int O_EXLOCK = 32; + +const int O_ASYNC = 64; + +const int O_FSYNC = 128; + +const int O_NOFOLLOW = 256; + +const int O_CREAT = 512; + +const int O_TRUNC = 1024; + +const int O_EXCL = 2048; + +const int O_EVTONLY = 32768; + +const int O_NOCTTY = 131072; + +const int O_DIRECTORY = 1048576; + +const int O_SYMLINK = 2097152; + +const int O_DSYNC = 4194304; + +const int O_CLOEXEC = 16777216; + +const int O_NOFOLLOW_ANY = 536870912; + +const int O_EXEC = 1073741824; + +const int O_SEARCH = 1074790400; + +const int AT_FDCWD = -2; + +const int AT_EACCESS = 16; + +const int AT_SYMLINK_NOFOLLOW = 32; + +const int AT_SYMLINK_FOLLOW = 64; + +const int AT_REMOVEDIR = 128; + +const int AT_REALDEV = 512; + +const int AT_FDONLY = 1024; + +const int AT_SYMLINK_NOFOLLOW_ANY = 2048; + +const int O_DP_GETRAWENCRYPTED = 1; + +const int O_DP_GETRAWUNENCRYPTED = 2; + +const int O_DP_AUTHENTICATE = 4; + +const int AUTH_OPEN_NOAUTHFD = -1; + +const int FAPPEND = 8; + +const int FASYNC = 64; + +const int FFSYNC = 128; + +const int FFDSYNC = 4194304; + +const int FNONBLOCK = 4; + +const int FNDELAY = 4; + +const int O_NDELAY = 4; + +const int CPF_OVERWRITE = 1; + +const int CPF_IGNORE_MODE = 2; + +const int CPF_MASK = 3; + +const int F_DUPFD = 0; + +const int F_GETFD = 1; + +const int F_SETFD = 2; + +const int F_GETFL = 3; + +const int F_SETFL = 4; + +const int F_GETOWN = 5; + +const int F_SETOWN = 6; + +const int F_GETLK = 7; + +const int F_SETLK = 8; + +const int F_SETLKW = 9; + +const int F_SETLKWTIMEOUT = 10; + +const int F_FLUSH_DATA = 40; + +const int F_CHKCLEAN = 41; + +const int F_PREALLOCATE = 42; + +const int F_SETSIZE = 43; + +const int F_RDADVISE = 44; + +const int F_RDAHEAD = 45; + +const int F_NOCACHE = 48; + +const int F_LOG2PHYS = 49; + +const int F_GETPATH = 50; + +const int F_FULLFSYNC = 51; + +const int F_PATHPKG_CHECK = 52; + +const int F_FREEZE_FS = 53; + +const int F_THAW_FS = 54; + +const int F_GLOBAL_NOCACHE = 55; + +const int F_ADDSIGS = 59; + +const int F_ADDFILESIGS = 61; + +const int F_NODIRECT = 62; + +const int F_GETPROTECTIONCLASS = 63; + +const int F_SETPROTECTIONCLASS = 64; + +const int F_LOG2PHYS_EXT = 65; + +const int F_GETLKPID = 66; + +const int F_SETBACKINGSTORE = 70; + +const int F_GETPATH_MTMINFO = 71; + +const int F_GETCODEDIR = 72; + +const int F_SETNOSIGPIPE = 73; + +const int F_GETNOSIGPIPE = 74; + +const int F_TRANSCODEKEY = 75; + +const int F_SINGLE_WRITER = 76; + +const int F_GETPROTECTIONLEVEL = 77; + +const int F_FINDSIGS = 78; + +const int F_ADDFILESIGS_FOR_DYLD_SIM = 83; + +const int F_BARRIERFSYNC = 85; + +const int F_OFD_SETLK = 90; + +const int F_OFD_SETLKW = 91; + +const int F_OFD_GETLK = 92; + +const int F_OFD_SETLKWTIMEOUT = 93; + +const int F_ADDFILESIGS_RETURN = 97; + +const int F_CHECK_LV = 98; + +const int F_PUNCHHOLE = 99; + +const int F_TRIM_ACTIVE_FILE = 100; + +const int F_SPECULATIVE_READ = 101; + +const int F_GETPATH_NOFIRMLINK = 102; + +const int F_ADDFILESIGS_INFO = 103; + +const int F_ADDFILESUPPL = 104; + +const int F_GETSIGSINFO = 105; + +const int F_SETLEASE = 106; + +const int F_GETLEASE = 107; + +const int F_TRANSFEREXTENTS = 110; + +const int F_ATTRIBUTION_TAG = 111; + +const int FCNTL_FS_SPECIFIC_BASE = 65536; + +const int F_DUPFD_CLOEXEC = 67; + +const int FD_CLOEXEC = 1; + +const int F_RDLCK = 1; + +const int F_UNLCK = 2; + +const int F_WRLCK = 3; + +const int S_IFMT = 61440; + +const int S_IFIFO = 4096; + +const int S_IFCHR = 8192; + +const int S_IFDIR = 16384; + +const int S_IFBLK = 24576; + +const int S_IFREG = 32768; + +const int S_IFLNK = 40960; + +const int S_IFSOCK = 49152; + +const int S_IFWHT = 57344; + +const int S_IRWXU = 448; + +const int S_IRUSR = 256; + +const int S_IWUSR = 128; + +const int S_IXUSR = 64; + +const int S_IRWXG = 56; + +const int S_IRGRP = 32; + +const int S_IWGRP = 16; + +const int S_IXGRP = 8; + +const int S_IRWXO = 7; + +const int S_IROTH = 4; + +const int S_IWOTH = 2; + +const int S_IXOTH = 1; + +const int S_ISUID = 2048; + +const int S_ISGID = 1024; + +const int S_ISVTX = 512; + +const int S_ISTXT = 512; + +const int S_IREAD = 256; + +const int S_IWRITE = 128; + +const int S_IEXEC = 64; + +const int F_ALLOCATECONTIG = 2; + +const int F_ALLOCATEALL = 4; + +const int F_ALLOCATEPERSIST = 8; + +const int F_PEOFPOSMODE = 3; + +const int F_VOLPOSMODE = 4; + +const int USER_FSIGNATURES_CDHASH_LEN = 20; + +const int GETSIGSINFO_PLATFORM_BINARY = 1; + +const int LOCK_SH = 1; + +const int LOCK_EX = 2; + +const int LOCK_NB = 4; + +const int LOCK_UN = 8; + +const int ATTRIBUTION_NAME_MAX = 255; + +const int F_CREATE_TAG = 1; + +const int F_DELETE_TAG = 2; + +const int F_QUERY_TAG = 4; + +const int O_POPUP = 2147483648; + +const int O_ALERT = 536870912; + +const int FILESEC_GUID = 3; + +const int DISPATCH_API_VERSION = 20181008; + +const int __OS_WORKGROUP_ATTR_SIZE__ = 60; + +const int __OS_WORKGROUP_INTERVAL_DATA_SIZE__ = 56; + +const int __OS_WORKGROUP_JOIN_TOKEN_SIZE__ = 36; + +const int _OS_WORKGROUP_ATTR_SIG_DEFAULT_INIT = 799564724; + +const int _OS_WORKGROUP_ATTR_SIG_EMPTY_INIT = 799564740; + +const int _OS_WORKGROUP_INTERVAL_DATA_SIG_INIT = 1386695757; + +const int DISPATCH_SWIFT3_OVERLAY = 0; + +const int TIME_MICROS_MAX = 1000000; + +const int SYSTEM_CLOCK = 0; + +const int CALENDAR_CLOCK = 1; + +const int REALTIME_CLOCK = 0; + +const int CLOCK_GET_TIME_RES = 1; + +const int CLOCK_ALARM_CURRES = 3; + +const int CLOCK_ALARM_MINRES = 4; + +const int CLOCK_ALARM_MAXRES = 5; + +const int NSEC_PER_USEC = 1000; + +const int USEC_PER_SEC = 1000000; + +const int NSEC_PER_SEC = 1000000000; + +const int NSEC_PER_MSEC = 1000000; + +const int ALRMTYPE = 255; + +const int TIME_ABSOLUTE = 0; + +const int TIME_RELATIVE = 1; + +const int MSEC_PER_SEC = 1000; + +const int DISPATCH_TIME_NOW = 0; + +const int DISPATCH_TIME_FOREVER = -1; + +const int QOS_MIN_RELATIVE_PRIORITY = -15; + +const int DISPATCH_APPLY_AUTO_AVAILABLE = 1; + +const int DISPATCH_QUEUE_PRIORITY_HIGH = 2; + +const int DISPATCH_QUEUE_PRIORITY_DEFAULT = 0; + +const int DISPATCH_QUEUE_PRIORITY_LOW = -2; + +const int DISPATCH_QUEUE_PRIORITY_BACKGROUND = -32768; + +const int DISPATCH_QUEUE_SERIAL = 0; + +const int DISPATCH_TARGET_QUEUE_DEFAULT = 0; + +const int DISPATCH_CURRENT_QUEUE_LABEL = 0; + +const int KERN_SUCCESS = 0; + +const int KERN_INVALID_ADDRESS = 1; + +const int KERN_PROTECTION_FAILURE = 2; + +const int KERN_NO_SPACE = 3; + +const int KERN_INVALID_ARGUMENT = 4; + +const int KERN_FAILURE = 5; + +const int KERN_RESOURCE_SHORTAGE = 6; + +const int KERN_NOT_RECEIVER = 7; + +const int KERN_NO_ACCESS = 8; + +const int KERN_MEMORY_FAILURE = 9; + +const int KERN_MEMORY_ERROR = 10; + +const int KERN_ALREADY_IN_SET = 11; + +const int KERN_NOT_IN_SET = 12; + +const int KERN_NAME_EXISTS = 13; + +const int KERN_ABORTED = 14; + +const int KERN_INVALID_NAME = 15; + +const int KERN_INVALID_TASK = 16; + +const int KERN_INVALID_RIGHT = 17; + +const int KERN_INVALID_VALUE = 18; + +const int KERN_UREFS_OVERFLOW = 19; + +const int KERN_INVALID_CAPABILITY = 20; + +const int KERN_RIGHT_EXISTS = 21; + +const int KERN_INVALID_HOST = 22; + +const int KERN_MEMORY_PRESENT = 23; + +const int KERN_MEMORY_DATA_MOVED = 24; + +const int KERN_MEMORY_RESTART_COPY = 25; + +const int KERN_INVALID_PROCESSOR_SET = 26; + +const int KERN_POLICY_LIMIT = 27; + +const int KERN_INVALID_POLICY = 28; + +const int KERN_INVALID_OBJECT = 29; + +const int KERN_ALREADY_WAITING = 30; + +const int KERN_DEFAULT_SET = 31; + +const int KERN_EXCEPTION_PROTECTED = 32; + +const int KERN_INVALID_LEDGER = 33; + +const int KERN_INVALID_MEMORY_CONTROL = 34; + +const int KERN_INVALID_SECURITY = 35; + +const int KERN_NOT_DEPRESSED = 36; + +const int KERN_TERMINATED = 37; + +const int KERN_LOCK_SET_DESTROYED = 38; + +const int KERN_LOCK_UNSTABLE = 39; + +const int KERN_LOCK_OWNED = 40; + +const int KERN_LOCK_OWNED_SELF = 41; + +const int KERN_SEMAPHORE_DESTROYED = 42; + +const int KERN_RPC_SERVER_TERMINATED = 43; + +const int KERN_RPC_TERMINATE_ORPHAN = 44; + +const int KERN_RPC_CONTINUE_ORPHAN = 45; + +const int KERN_NOT_SUPPORTED = 46; + +const int KERN_NODE_DOWN = 47; + +const int KERN_NOT_WAITING = 48; + +const int KERN_OPERATION_TIMED_OUT = 49; + +const int KERN_CODESIGN_ERROR = 50; + +const int KERN_POLICY_STATIC = 51; + +const int KERN_INSUFFICIENT_BUFFER_SIZE = 52; + +const int KERN_DENIED = 53; + +const int KERN_MISSING_KC = 54; + +const int KERN_INVALID_KC = 55; + +const int KERN_NOT_FOUND = 56; + +const int KERN_RETURN_MAX = 256; + +const int MACH_MSG_TIMEOUT_NONE = 0; + +const int MACH_MSGH_BITS_ZERO = 0; + +const int MACH_MSGH_BITS_REMOTE_MASK = 31; + +const int MACH_MSGH_BITS_LOCAL_MASK = 7936; + +const int MACH_MSGH_BITS_VOUCHER_MASK = 2031616; + +const int MACH_MSGH_BITS_PORTS_MASK = 2039583; + +const int MACH_MSGH_BITS_COMPLEX = 2147483648; + +const int MACH_MSGH_BITS_USER = 2149523231; + +const int MACH_MSGH_BITS_RAISEIMP = 536870912; + +const int MACH_MSGH_BITS_DENAP = 536870912; + +const int MACH_MSGH_BITS_IMPHOLDASRT = 268435456; + +const int MACH_MSGH_BITS_DENAPHOLDASRT = 268435456; + +const int MACH_MSGH_BITS_CIRCULAR = 268435456; + +const int MACH_MSGH_BITS_USED = 2954829599; + +const int MACH_MSG_PRIORITY_UNSPECIFIED = 0; + +const int MACH_MSG_TYPE_MOVE_RECEIVE = 16; + +const int MACH_MSG_TYPE_MOVE_SEND = 17; + +const int MACH_MSG_TYPE_MOVE_SEND_ONCE = 18; + +const int MACH_MSG_TYPE_COPY_SEND = 19; + +const int MACH_MSG_TYPE_MAKE_SEND = 20; + +const int MACH_MSG_TYPE_MAKE_SEND_ONCE = 21; + +const int MACH_MSG_TYPE_COPY_RECEIVE = 22; + +const int MACH_MSG_TYPE_DISPOSE_RECEIVE = 24; + +const int MACH_MSG_TYPE_DISPOSE_SEND = 25; + +const int MACH_MSG_TYPE_DISPOSE_SEND_ONCE = 26; + +const int MACH_MSG_PHYSICAL_COPY = 0; + +const int MACH_MSG_VIRTUAL_COPY = 1; + +const int MACH_MSG_ALLOCATE = 2; + +const int MACH_MSG_OVERWRITE = 3; + +const int MACH_MSG_GUARD_FLAGS_NONE = 0; + +const int MACH_MSG_GUARD_FLAGS_IMMOVABLE_RECEIVE = 1; + +const int MACH_MSG_GUARD_FLAGS_UNGUARDED_ON_SEND = 2; + +const int MACH_MSG_GUARD_FLAGS_MASK = 3; + +const int MACH_MSG_PORT_DESCRIPTOR = 0; + +const int MACH_MSG_OOL_DESCRIPTOR = 1; + +const int MACH_MSG_OOL_PORTS_DESCRIPTOR = 2; + +const int MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 3; + +const int MACH_MSG_GUARDED_PORT_DESCRIPTOR = 4; + +const int MACH_MSG_DESCRIPTOR_MAX = 4; + +const int MACH_MSG_TRAILER_FORMAT_0 = 0; + +const int MACH_MSG_FILTER_POLICY_ALLOW = 0; + +const int MACH_MSG_TRAILER_MINIMUM_SIZE = 8; + +const int MAX_TRAILER_SIZE = 68; + +const int MACH_MSG_TRAILER_FORMAT_0_SIZE = 20; + +const int MACH_MSG_SIZE_MAX = 4294967295; + +const int MACH_MSG_SIZE_RELIABLE = 262144; + +const int MACH_MSGH_KIND_NORMAL = 0; + +const int MACH_MSGH_KIND_NOTIFICATION = 1; + +const int MACH_MSG_TYPE_PORT_NONE = 0; + +const int MACH_MSG_TYPE_PORT_NAME = 15; + +const int MACH_MSG_TYPE_PORT_RECEIVE = 16; + +const int MACH_MSG_TYPE_PORT_SEND = 17; + +const int MACH_MSG_TYPE_PORT_SEND_ONCE = 18; + +const int MACH_MSG_TYPE_LAST = 22; + +const int MACH_MSG_TYPE_POLYMORPHIC = 4294967295; + +const int MACH_MSG_OPTION_NONE = 0; + +const int MACH_SEND_MSG = 1; + +const int MACH_RCV_MSG = 2; + +const int MACH_RCV_LARGE = 4; + +const int MACH_RCV_LARGE_IDENTITY = 8; + +const int MACH_SEND_TIMEOUT = 16; + +const int MACH_SEND_OVERRIDE = 32; + +const int MACH_SEND_INTERRUPT = 64; + +const int MACH_SEND_NOTIFY = 128; + +const int MACH_SEND_ALWAYS = 65536; + +const int MACH_SEND_FILTER_NONFATAL = 65536; + +const int MACH_SEND_TRAILER = 131072; + +const int MACH_SEND_NOIMPORTANCE = 262144; + +const int MACH_SEND_NODENAP = 262144; + +const int MACH_SEND_IMPORTANCE = 524288; + +const int MACH_SEND_SYNC_OVERRIDE = 1048576; + +const int MACH_SEND_PROPAGATE_QOS = 2097152; + +const int MACH_SEND_SYNC_USE_THRPRI = 2097152; + +const int MACH_SEND_KERNEL = 4194304; + +const int MACH_SEND_SYNC_BOOTSTRAP_CHECKIN = 8388608; + +const int MACH_RCV_TIMEOUT = 256; + +const int MACH_RCV_NOTIFY = 0; + +const int MACH_RCV_INTERRUPT = 1024; + +const int MACH_RCV_VOUCHER = 2048; + +const int MACH_RCV_OVERWRITE = 0; + +const int MACH_RCV_GUARDED_DESC = 4096; + +const int MACH_RCV_SYNC_WAIT = 16384; + +const int MACH_RCV_SYNC_PEEK = 32768; + +const int MACH_MSG_STRICT_REPLY = 512; + +const int MACH_RCV_TRAILER_NULL = 0; + +const int MACH_RCV_TRAILER_SEQNO = 1; + +const int MACH_RCV_TRAILER_SENDER = 2; + +const int MACH_RCV_TRAILER_AUDIT = 3; + +const int MACH_RCV_TRAILER_CTX = 4; + +const int MACH_RCV_TRAILER_AV = 7; + +const int MACH_RCV_TRAILER_LABELS = 8; + +const int MACH_RCV_TRAILER_MASK = 251658240; + +const int MACH_MSG_SUCCESS = 0; + +const int MACH_MSG_MASK = 15872; + +const int MACH_MSG_IPC_SPACE = 8192; + +const int MACH_MSG_VM_SPACE = 4096; + +const int MACH_MSG_IPC_KERNEL = 2048; + +const int MACH_MSG_VM_KERNEL = 1024; + +const int MACH_SEND_IN_PROGRESS = 268435457; + +const int MACH_SEND_INVALID_DATA = 268435458; + +const int MACH_SEND_INVALID_DEST = 268435459; + +const int MACH_SEND_TIMED_OUT = 268435460; + +const int MACH_SEND_INVALID_VOUCHER = 268435461; + +const int MACH_SEND_INTERRUPTED = 268435463; + +const int MACH_SEND_MSG_TOO_SMALL = 268435464; + +const int MACH_SEND_INVALID_REPLY = 268435465; + +const int MACH_SEND_INVALID_RIGHT = 268435466; + +const int MACH_SEND_INVALID_NOTIFY = 268435467; + +const int MACH_SEND_INVALID_MEMORY = 268435468; + +const int MACH_SEND_NO_BUFFER = 268435469; + +const int MACH_SEND_TOO_LARGE = 268435470; + +const int MACH_SEND_INVALID_TYPE = 268435471; + +const int MACH_SEND_INVALID_HEADER = 268435472; + +const int MACH_SEND_INVALID_TRAILER = 268435473; + +const int MACH_SEND_INVALID_CONTEXT = 268435474; + +const int MACH_SEND_INVALID_OPTIONS = 268435475; + +const int MACH_SEND_INVALID_RT_OOL_SIZE = 268435477; + +const int MACH_SEND_NO_GRANT_DEST = 268435478; + +const int MACH_SEND_MSG_FILTERED = 268435479; + +const int MACH_SEND_AUX_TOO_SMALL = 268435480; + +const int MACH_SEND_AUX_TOO_LARGE = 268435481; + +const int MACH_RCV_IN_PROGRESS = 268451841; + +const int MACH_RCV_INVALID_NAME = 268451842; + +const int MACH_RCV_TIMED_OUT = 268451843; + +const int MACH_RCV_TOO_LARGE = 268451844; + +const int MACH_RCV_INTERRUPTED = 268451845; + +const int MACH_RCV_PORT_CHANGED = 268451846; + +const int MACH_RCV_INVALID_NOTIFY = 268451847; + +const int MACH_RCV_INVALID_DATA = 268451848; + +const int MACH_RCV_PORT_DIED = 268451849; + +const int MACH_RCV_IN_SET = 268451850; + +const int MACH_RCV_HEADER_ERROR = 268451851; + +const int MACH_RCV_BODY_ERROR = 268451852; + +const int MACH_RCV_INVALID_TYPE = 268451853; + +const int MACH_RCV_SCATTER_SMALL = 268451854; + +const int MACH_RCV_INVALID_TRAILER = 268451855; + +const int MACH_RCV_IN_PROGRESS_TIMED = 268451857; + +const int MACH_RCV_INVALID_REPLY = 268451858; + +const int MACH_RCV_INVALID_ARGUMENTS = 268451859; + +const int DISPATCH_MACH_SEND_DEAD = 1; + +const int DISPATCH_MEMORYPRESSURE_NORMAL = 1; + +const int DISPATCH_MEMORYPRESSURE_WARN = 2; + +const int DISPATCH_MEMORYPRESSURE_CRITICAL = 4; + +const int DISPATCH_PROC_EXIT = 2147483648; + +const int DISPATCH_PROC_FORK = 1073741824; + +const int DISPATCH_PROC_EXEC = 536870912; + +const int DISPATCH_PROC_SIGNAL = 134217728; + +const int DISPATCH_VNODE_DELETE = 1; + +const int DISPATCH_VNODE_WRITE = 2; + +const int DISPATCH_VNODE_EXTEND = 4; + +const int DISPATCH_VNODE_ATTRIB = 8; + +const int DISPATCH_VNODE_LINK = 16; + +const int DISPATCH_VNODE_RENAME = 32; + +const int DISPATCH_VNODE_REVOKE = 64; + +const int DISPATCH_VNODE_FUNLOCK = 256; + +const int DISPATCH_TIMER_STRICT = 1; + +const int DISPATCH_ONCE_INLINE_FASTPATH = 1; + +const int DISPATCH_DATA_DESTRUCTOR_DEFAULT = 0; + +const int DISPATCH_IO_STREAM = 0; + +const int DISPATCH_IO_RANDOM = 1; + +const int DISPATCH_IO_STOP = 1; + +const int DISPATCH_IO_STRICT_INTERVAL = 1; + +const int __COREFOUNDATION_CFSET__ = 1; + +const int __COREFOUNDATION_CFSTRINGENCODINGEXT__ = 1; + +const int __COREFOUNDATION_CFTREE__ = 1; + +const int __COREFOUNDATION_CFURLACCESS__ = 1; + +const int __COREFOUNDATION_CFUUID__ = 1; + +const int __COREFOUNDATION_CFUTILITIES__ = 1; + +const int __COREFOUNDATION_CFBUNDLE__ = 1; + +const int CPU_STATE_MAX = 4; + +const int CPU_STATE_USER = 0; + +const int CPU_STATE_SYSTEM = 1; + +const int CPU_STATE_IDLE = 2; + +const int CPU_STATE_NICE = 3; + +const int CPU_ARCH_MASK = 4278190080; + +const int CPU_ARCH_ABI64 = 16777216; + +const int CPU_ARCH_ABI64_32 = 33554432; + +const int CPU_TYPE_ANY = -1; + +const int CPU_TYPE_VAX = 1; + +const int CPU_TYPE_MC680x0 = 6; + +const int CPU_TYPE_X86 = 7; + +const int CPU_TYPE_I386 = 7; + +const int CPU_TYPE_X86_64 = 16777223; + +const int CPU_TYPE_MC98000 = 10; + +const int CPU_TYPE_HPPA = 11; + +const int CPU_TYPE_ARM = 12; + +const int CPU_TYPE_ARM64 = 16777228; + +const int CPU_TYPE_ARM64_32 = 33554444; + +const int CPU_TYPE_MC88000 = 13; + +const int CPU_TYPE_SPARC = 14; + +const int CPU_TYPE_I860 = 15; + +const int CPU_TYPE_POWERPC = 18; + +const int CPU_TYPE_POWERPC64 = 16777234; + +const int CPU_SUBTYPE_MASK = 4278190080; + +const int CPU_SUBTYPE_LIB64 = 2147483648; + +const int CPU_SUBTYPE_PTRAUTH_ABI = 2147483648; + +const int CPU_SUBTYPE_ANY = -1; + +const int CPU_SUBTYPE_MULTIPLE = -1; + +const int CPU_SUBTYPE_LITTLE_ENDIAN = 0; + +const int CPU_SUBTYPE_BIG_ENDIAN = 1; + +const int CPU_THREADTYPE_NONE = 0; + +const int CPU_SUBTYPE_VAX_ALL = 0; + +const int CPU_SUBTYPE_VAX780 = 1; + +const int CPU_SUBTYPE_VAX785 = 2; + +const int CPU_SUBTYPE_VAX750 = 3; + +const int CPU_SUBTYPE_VAX730 = 4; + +const int CPU_SUBTYPE_UVAXI = 5; + +const int CPU_SUBTYPE_UVAXII = 6; + +const int CPU_SUBTYPE_VAX8200 = 7; + +const int CPU_SUBTYPE_VAX8500 = 8; + +const int CPU_SUBTYPE_VAX8600 = 9; + +const int CPU_SUBTYPE_VAX8650 = 10; + +const int CPU_SUBTYPE_VAX8800 = 11; + +const int CPU_SUBTYPE_UVAXIII = 12; + +const int CPU_SUBTYPE_MC680x0_ALL = 1; + +const int CPU_SUBTYPE_MC68030 = 1; + +const int CPU_SUBTYPE_MC68040 = 2; + +const int CPU_SUBTYPE_MC68030_ONLY = 3; + +const int CPU_SUBTYPE_I386_ALL = 3; + +const int CPU_SUBTYPE_386 = 3; + +const int CPU_SUBTYPE_486 = 4; + +const int CPU_SUBTYPE_486SX = 132; + +const int CPU_SUBTYPE_586 = 5; + +const int CPU_SUBTYPE_PENT = 5; + +const int CPU_SUBTYPE_PENTPRO = 22; + +const int CPU_SUBTYPE_PENTII_M3 = 54; + +const int CPU_SUBTYPE_PENTII_M5 = 86; + +const int CPU_SUBTYPE_CELERON = 103; + +const int CPU_SUBTYPE_CELERON_MOBILE = 119; + +const int CPU_SUBTYPE_PENTIUM_3 = 8; + +const int CPU_SUBTYPE_PENTIUM_3_M = 24; + +const int CPU_SUBTYPE_PENTIUM_3_XEON = 40; + +const int CPU_SUBTYPE_PENTIUM_M = 9; + +const int CPU_SUBTYPE_PENTIUM_4 = 10; + +const int CPU_SUBTYPE_PENTIUM_4_M = 26; + +const int CPU_SUBTYPE_ITANIUM = 11; + +const int CPU_SUBTYPE_ITANIUM_2 = 27; + +const int CPU_SUBTYPE_XEON = 12; + +const int CPU_SUBTYPE_XEON_MP = 28; + +const int CPU_SUBTYPE_INTEL_FAMILY_MAX = 15; + +const int CPU_SUBTYPE_INTEL_MODEL_ALL = 0; + +const int CPU_SUBTYPE_X86_ALL = 3; + +const int CPU_SUBTYPE_X86_64_ALL = 3; + +const int CPU_SUBTYPE_X86_ARCH1 = 4; + +const int CPU_SUBTYPE_X86_64_H = 8; + +const int CPU_THREADTYPE_INTEL_HTT = 1; + +const int CPU_SUBTYPE_MIPS_ALL = 0; + +const int CPU_SUBTYPE_MIPS_R2300 = 1; + +const int CPU_SUBTYPE_MIPS_R2600 = 2; + +const int CPU_SUBTYPE_MIPS_R2800 = 3; + +const int CPU_SUBTYPE_MIPS_R2000a = 4; + +const int CPU_SUBTYPE_MIPS_R2000 = 5; + +const int CPU_SUBTYPE_MIPS_R3000a = 6; + +const int CPU_SUBTYPE_MIPS_R3000 = 7; + +const int CPU_SUBTYPE_MC98000_ALL = 0; + +const int CPU_SUBTYPE_MC98601 = 1; + +const int CPU_SUBTYPE_HPPA_ALL = 0; + +const int CPU_SUBTYPE_HPPA_7100 = 0; + +const int CPU_SUBTYPE_HPPA_7100LC = 1; + +const int CPU_SUBTYPE_MC88000_ALL = 0; + +const int CPU_SUBTYPE_MC88100 = 1; + +const int CPU_SUBTYPE_MC88110 = 2; + +const int CPU_SUBTYPE_SPARC_ALL = 0; + +const int CPU_SUBTYPE_I860_ALL = 0; + +const int CPU_SUBTYPE_I860_860 = 1; + +const int CPU_SUBTYPE_POWERPC_ALL = 0; + +const int CPU_SUBTYPE_POWERPC_601 = 1; + +const int CPU_SUBTYPE_POWERPC_602 = 2; + +const int CPU_SUBTYPE_POWERPC_603 = 3; + +const int CPU_SUBTYPE_POWERPC_603e = 4; + +const int CPU_SUBTYPE_POWERPC_603ev = 5; + +const int CPU_SUBTYPE_POWERPC_604 = 6; + +const int CPU_SUBTYPE_POWERPC_604e = 7; + +const int CPU_SUBTYPE_POWERPC_620 = 8; + +const int CPU_SUBTYPE_POWERPC_750 = 9; + +const int CPU_SUBTYPE_POWERPC_7400 = 10; + +const int CPU_SUBTYPE_POWERPC_7450 = 11; + +const int CPU_SUBTYPE_POWERPC_970 = 100; + +const int CPU_SUBTYPE_ARM_ALL = 0; + +const int CPU_SUBTYPE_ARM_V4T = 5; + +const int CPU_SUBTYPE_ARM_V6 = 6; + +const int CPU_SUBTYPE_ARM_V5TEJ = 7; + +const int CPU_SUBTYPE_ARM_XSCALE = 8; + +const int CPU_SUBTYPE_ARM_V7 = 9; + +const int CPU_SUBTYPE_ARM_V7F = 10; + +const int CPU_SUBTYPE_ARM_V7S = 11; + +const int CPU_SUBTYPE_ARM_V7K = 12; + +const int CPU_SUBTYPE_ARM_V8 = 13; + +const int CPU_SUBTYPE_ARM_V6M = 14; + +const int CPU_SUBTYPE_ARM_V7M = 15; + +const int CPU_SUBTYPE_ARM_V7EM = 16; + +const int CPU_SUBTYPE_ARM_V8M = 17; + +const int CPU_SUBTYPE_ARM64_ALL = 0; + +const int CPU_SUBTYPE_ARM64_V8 = 1; + +const int CPU_SUBTYPE_ARM64E = 2; + +const int CPU_SUBTYPE_ARM64_PTR_AUTH_MASK = 251658240; + +const int CPU_SUBTYPE_ARM64_32_ALL = 0; + +const int CPU_SUBTYPE_ARM64_32_V8 = 1; + +const int CPUFAMILY_UNKNOWN = 0; + +const int CPUFAMILY_POWERPC_G3 = 3471054153; + +const int CPUFAMILY_POWERPC_G4 = 2009171118; + +const int CPUFAMILY_POWERPC_G5 = 3983988906; + +const int CPUFAMILY_INTEL_6_13 = 2855483691; + +const int CPUFAMILY_INTEL_PENRYN = 2028621756; + +const int CPUFAMILY_INTEL_NEHALEM = 1801080018; + +const int CPUFAMILY_INTEL_WESTMERE = 1463508716; + +const int CPUFAMILY_INTEL_SANDYBRIDGE = 1418770316; + +const int CPUFAMILY_INTEL_IVYBRIDGE = 526772277; + +const int CPUFAMILY_INTEL_HASWELL = 280134364; + +const int CPUFAMILY_INTEL_BROADWELL = 1479463068; + +const int CPUFAMILY_INTEL_SKYLAKE = 939270559; + +const int CPUFAMILY_INTEL_KABYLAKE = 260141638; + +const int CPUFAMILY_INTEL_ICELAKE = 943936839; + +const int CPUFAMILY_INTEL_COMETLAKE = 486055998; + +const int CPUFAMILY_ARM_9 = 3878847406; + +const int CPUFAMILY_ARM_11 = 2415272152; + +const int CPUFAMILY_ARM_XSCALE = 1404044789; + +const int CPUFAMILY_ARM_12 = 3172666089; + +const int CPUFAMILY_ARM_13 = 214503012; + +const int CPUFAMILY_ARM_14 = 2517073649; + +const int CPUFAMILY_ARM_15 = 2823887818; + +const int CPUFAMILY_ARM_SWIFT = 506291073; + +const int CPUFAMILY_ARM_CYCLONE = 933271106; + +const int CPUFAMILY_ARM_TYPHOON = 747742334; + +const int CPUFAMILY_ARM_TWISTER = 2465937352; + +const int CPUFAMILY_ARM_HURRICANE = 1741614739; + +const int CPUFAMILY_ARM_MONSOON_MISTRAL = 3894312694; + +const int CPUFAMILY_ARM_VORTEX_TEMPEST = 131287967; + +const int CPUFAMILY_ARM_LIGHTNING_THUNDER = 1176831186; + +const int CPUFAMILY_ARM_FIRESTORM_ICESTORM = 458787763; + +const int CPUFAMILY_ARM_BLIZZARD_AVALANCHE = 3660830781; + +const int CPUFAMILY_ARM_EVEREST_SAWTOOTH = 2271604202; + +const int CPUFAMILY_ARM_IBIZA = 4197663070; + +const int CPUFAMILY_ARM_PALMA = 1912690738; + +const int CPUFAMILY_ARM_COLL = 678884789; + +const int CPUFAMILY_ARM_LOBOS = 1598941843; + +const int CPUFAMILY_ARM_DONAN = 1867590060; + +const int CPUSUBFAMILY_UNKNOWN = 0; + +const int CPUSUBFAMILY_ARM_HP = 1; + +const int CPUSUBFAMILY_ARM_HG = 2; + +const int CPUSUBFAMILY_ARM_M = 3; + +const int CPUSUBFAMILY_ARM_HS = 4; + +const int CPUSUBFAMILY_ARM_HC_HD = 5; + +const int CPUSUBFAMILY_ARM_HA = 6; + +const int CPUFAMILY_INTEL_6_23 = 2028621756; + +const int CPUFAMILY_INTEL_6_26 = 1801080018; + +const int __COREFOUNDATION_CFMESSAGEPORT__ = 1; + +const int __COREFOUNDATION_CFPLUGIN__ = 1; + +const int COREFOUNDATION_CFPLUGINCOM_SEPARATE = 1; + +const int __COREFOUNDATION_CFMACHPORT__ = 1; + +const int __COREFOUNDATION_CFATTRIBUTEDSTRING__ = 1; + +const int __COREFOUNDATION_CFURLENUMERATOR__ = 1; + +const int __COREFOUNDATION_CFFILESECURITY__ = 1; + +const int KAUTH_GUID_SIZE = 16; + +const int KAUTH_UID_NONE = 4294967195; + +const int KAUTH_GID_NONE = 4294967195; + +const int KAUTH_NTSID_MAX_AUTHORITIES = 16; + +const int KAUTH_NTSID_HDRSIZE = 8; + +const int KAUTH_EXTLOOKUP_SUCCESS = 0; + +const int KAUTH_EXTLOOKUP_BADRQ = 1; + +const int KAUTH_EXTLOOKUP_FAILURE = 2; + +const int KAUTH_EXTLOOKUP_FATAL = 3; + +const int KAUTH_EXTLOOKUP_INPROG = 100; + +const int KAUTH_EXTLOOKUP_VALID_UID = 1; + +const int KAUTH_EXTLOOKUP_VALID_UGUID = 2; + +const int KAUTH_EXTLOOKUP_VALID_USID = 4; + +const int KAUTH_EXTLOOKUP_VALID_GID = 8; + +const int KAUTH_EXTLOOKUP_VALID_GGUID = 16; + +const int KAUTH_EXTLOOKUP_VALID_GSID = 32; + +const int KAUTH_EXTLOOKUP_WANT_UID = 64; + +const int KAUTH_EXTLOOKUP_WANT_UGUID = 128; + +const int KAUTH_EXTLOOKUP_WANT_USID = 256; + +const int KAUTH_EXTLOOKUP_WANT_GID = 512; + +const int KAUTH_EXTLOOKUP_WANT_GGUID = 1024; + +const int KAUTH_EXTLOOKUP_WANT_GSID = 2048; + +const int KAUTH_EXTLOOKUP_WANT_MEMBERSHIP = 4096; + +const int KAUTH_EXTLOOKUP_VALID_MEMBERSHIP = 8192; + +const int KAUTH_EXTLOOKUP_ISMEMBER = 16384; + +const int KAUTH_EXTLOOKUP_VALID_PWNAM = 32768; + +const int KAUTH_EXTLOOKUP_WANT_PWNAM = 65536; + +const int KAUTH_EXTLOOKUP_VALID_GRNAM = 131072; + +const int KAUTH_EXTLOOKUP_WANT_GRNAM = 262144; + +const int KAUTH_EXTLOOKUP_VALID_SUPGRPS = 524288; + +const int KAUTH_EXTLOOKUP_WANT_SUPGRPS = 1048576; + +const int KAUTH_EXTLOOKUP_REGISTER = 0; + +const int KAUTH_EXTLOOKUP_RESULT = 1; + +const int KAUTH_EXTLOOKUP_WORKER = 2; + +const int KAUTH_EXTLOOKUP_DEREGISTER = 4; + +const int KAUTH_GET_CACHE_SIZES = 8; + +const int KAUTH_SET_CACHE_SIZES = 16; + +const int KAUTH_CLEAR_CACHES = 32; + +const String IDENTITYSVC_ENTITLEMENT = 'com.apple.private.identitysvc'; + +const int KAUTH_ACE_KINDMASK = 15; + +const int KAUTH_ACE_PERMIT = 1; + +const int KAUTH_ACE_DENY = 2; + +const int KAUTH_ACE_AUDIT = 3; + +const int KAUTH_ACE_ALARM = 4; + +const int KAUTH_ACE_INHERITED = 16; + +const int KAUTH_ACE_FILE_INHERIT = 32; + +const int KAUTH_ACE_DIRECTORY_INHERIT = 64; + +const int KAUTH_ACE_LIMIT_INHERIT = 128; + +const int KAUTH_ACE_ONLY_INHERIT = 256; + +const int KAUTH_ACE_SUCCESS = 512; + +const int KAUTH_ACE_FAILURE = 1024; + +const int KAUTH_ACE_INHERIT_CONTROL_FLAGS = 480; + +const int KAUTH_ACE_GENERIC_ALL = 2097152; + +const int KAUTH_ACE_GENERIC_EXECUTE = 4194304; + +const int KAUTH_ACE_GENERIC_WRITE = 8388608; + +const int KAUTH_ACE_GENERIC_READ = 16777216; + +const int KAUTH_ACL_MAX_ENTRIES = 128; + +const int KAUTH_ACL_FLAGS_PRIVATE = 65535; + +const int KAUTH_ACL_DEFER_INHERIT = 65536; + +const int KAUTH_ACL_NO_INHERIT = 131072; + +const int KAUTH_FILESEC_NOACL = 4294967295; + +const int KAUTH_FILESEC_MAGIC = 19710317; + +const int KAUTH_FILESEC_FLAGS_PRIVATE = 65535; + +const int KAUTH_FILESEC_DEFER_INHERIT = 65536; + +const int KAUTH_FILESEC_NO_INHERIT = 131072; + +const String KAUTH_FILESEC_XATTR = 'com.apple.system.Security'; + +const int KAUTH_ENDIAN_HOST = 1; + +const int KAUTH_ENDIAN_DISK = 2; + +const int KAUTH_VNODE_READ_DATA = 2; + +const int KAUTH_VNODE_LIST_DIRECTORY = 2; + +const int KAUTH_VNODE_WRITE_DATA = 4; + +const int KAUTH_VNODE_ADD_FILE = 4; + +const int KAUTH_VNODE_EXECUTE = 8; + +const int KAUTH_VNODE_SEARCH = 8; + +const int KAUTH_VNODE_DELETE = 16; + +const int KAUTH_VNODE_APPEND_DATA = 32; + +const int KAUTH_VNODE_ADD_SUBDIRECTORY = 32; + +const int KAUTH_VNODE_DELETE_CHILD = 64; + +const int KAUTH_VNODE_READ_ATTRIBUTES = 128; + +const int KAUTH_VNODE_WRITE_ATTRIBUTES = 256; + +const int KAUTH_VNODE_READ_EXTATTRIBUTES = 512; + +const int KAUTH_VNODE_WRITE_EXTATTRIBUTES = 1024; + +const int KAUTH_VNODE_READ_SECURITY = 2048; + +const int KAUTH_VNODE_WRITE_SECURITY = 4096; + +const int KAUTH_VNODE_TAKE_OWNERSHIP = 8192; + +const int KAUTH_VNODE_CHANGE_OWNER = 8192; + +const int KAUTH_VNODE_SYNCHRONIZE = 1048576; + +const int KAUTH_VNODE_LINKTARGET = 33554432; + +const int KAUTH_VNODE_CHECKIMMUTABLE = 67108864; + +const int KAUTH_VNODE_ACCESS = 2147483648; + +const int KAUTH_VNODE_NOIMMUTABLE = 1073741824; + +const int KAUTH_VNODE_SEARCHBYANYONE = 536870912; + +const int KAUTH_VNODE_GENERIC_READ_BITS = 2690; + +const int KAUTH_VNODE_GENERIC_WRITE_BITS = 5492; + +const int KAUTH_VNODE_GENERIC_EXECUTE_BITS = 8; + +const int KAUTH_VNODE_GENERIC_ALL_BITS = 8190; + +const int KAUTH_VNODE_WRITE_RIGHTS = 100676980; + +const int __DARWIN_ACL_READ_DATA = 2; + +const int __DARWIN_ACL_LIST_DIRECTORY = 2; + +const int __DARWIN_ACL_WRITE_DATA = 4; + +const int __DARWIN_ACL_ADD_FILE = 4; + +const int __DARWIN_ACL_EXECUTE = 8; + +const int __DARWIN_ACL_SEARCH = 8; + +const int __DARWIN_ACL_DELETE = 16; + +const int __DARWIN_ACL_APPEND_DATA = 32; + +const int __DARWIN_ACL_ADD_SUBDIRECTORY = 32; + +const int __DARWIN_ACL_DELETE_CHILD = 64; + +const int __DARWIN_ACL_READ_ATTRIBUTES = 128; + +const int __DARWIN_ACL_WRITE_ATTRIBUTES = 256; + +const int __DARWIN_ACL_READ_EXTATTRIBUTES = 512; + +const int __DARWIN_ACL_WRITE_EXTATTRIBUTES = 1024; + +const int __DARWIN_ACL_READ_SECURITY = 2048; + +const int __DARWIN_ACL_WRITE_SECURITY = 4096; + +const int __DARWIN_ACL_CHANGE_OWNER = 8192; + +const int __DARWIN_ACL_SYNCHRONIZE = 1048576; + +const int __DARWIN_ACL_EXTENDED_ALLOW = 1; + +const int __DARWIN_ACL_EXTENDED_DENY = 2; + +const int __DARWIN_ACL_ENTRY_INHERITED = 16; + +const int __DARWIN_ACL_ENTRY_FILE_INHERIT = 32; + +const int __DARWIN_ACL_ENTRY_DIRECTORY_INHERIT = 64; + +const int __DARWIN_ACL_ENTRY_LIMIT_INHERIT = 128; + +const int __DARWIN_ACL_ENTRY_ONLY_INHERIT = 256; + +const int __DARWIN_ACL_FLAG_NO_INHERIT = 131072; + +const int ACL_MAX_ENTRIES = 128; + +const int ACL_UNDEFINED_ID = 0; + +const int __COREFOUNDATION_CFSTRINGTOKENIZER__ = 1; + +const int __COREFOUNDATION_CFFILEDESCRIPTOR__ = 1; + +const int __COREFOUNDATION_CFUSERNOTIFICATION__ = 1; + +const int __COREFOUNDATION_CFXMLNODE__ = 1; + +const int __COREFOUNDATION_CFXMLPARSER__ = 1; + +const int _CSSMTYPE_H_ = 1; + +const int _CSSMCONFIG_H_ = 1; + +const int SEC_ASN1_TAG_MASK = 255; + +const int SEC_ASN1_TAGNUM_MASK = 31; + +const int SEC_ASN1_BOOLEAN = 1; + +const int SEC_ASN1_INTEGER = 2; + +const int SEC_ASN1_BIT_STRING = 3; + +const int SEC_ASN1_OCTET_STRING = 4; + +const int SEC_ASN1_NULL = 5; + +const int SEC_ASN1_OBJECT_ID = 6; + +const int SEC_ASN1_OBJECT_DESCRIPTOR = 7; + +const int SEC_ASN1_REAL = 9; + +const int SEC_ASN1_ENUMERATED = 10; + +const int SEC_ASN1_EMBEDDED_PDV = 11; + +const int SEC_ASN1_UTF8_STRING = 12; + +const int SEC_ASN1_SEQUENCE = 16; + +const int SEC_ASN1_SET = 17; + +const int SEC_ASN1_NUMERIC_STRING = 18; + +const int SEC_ASN1_PRINTABLE_STRING = 19; + +const int SEC_ASN1_T61_STRING = 20; + +const int SEC_ASN1_VIDEOTEX_STRING = 21; + +const int SEC_ASN1_IA5_STRING = 22; + +const int SEC_ASN1_UTC_TIME = 23; + +const int SEC_ASN1_GENERALIZED_TIME = 24; + +const int SEC_ASN1_GRAPHIC_STRING = 25; + +const int SEC_ASN1_VISIBLE_STRING = 26; + +const int SEC_ASN1_GENERAL_STRING = 27; + +const int SEC_ASN1_UNIVERSAL_STRING = 28; + +const int SEC_ASN1_BMP_STRING = 30; + +const int SEC_ASN1_HIGH_TAG_NUMBER = 31; + +const int SEC_ASN1_TELETEX_STRING = 20; + +const int SEC_ASN1_METHOD_MASK = 32; + +const int SEC_ASN1_PRIMITIVE = 0; + +const int SEC_ASN1_CONSTRUCTED = 32; + +const int SEC_ASN1_CLASS_MASK = 192; + +const int SEC_ASN1_UNIVERSAL = 0; + +const int SEC_ASN1_APPLICATION = 64; + +const int SEC_ASN1_CONTEXT_SPECIFIC = 128; + +const int SEC_ASN1_PRIVATE = 192; + +const int SEC_ASN1_OPTIONAL = 256; + +const int SEC_ASN1_EXPLICIT = 512; + +const int SEC_ASN1_ANY = 1024; + +const int SEC_ASN1_INLINE = 2048; + +const int SEC_ASN1_POINTER = 4096; + +const int SEC_ASN1_GROUP = 8192; + +const int SEC_ASN1_DYNAMIC = 16384; + +const int SEC_ASN1_SKIP = 32768; + +const int SEC_ASN1_INNER = 65536; + +const int SEC_ASN1_SAVE = 131072; + +const int SEC_ASN1_SKIP_REST = 524288; + +const int SEC_ASN1_CHOICE = 1048576; + +const int SEC_ASN1_SIGNED_INT = 8388608; + +const int SEC_ASN1_SEQUENCE_OF = 8208; + +const int SEC_ASN1_SET_OF = 8209; + +const int SEC_ASN1_ANY_CONTENTS = 66560; + +const int _CSSMAPPLE_H_ = 1; + +const int _CSSMERR_H_ = 1; + +const int _X509DEFS_H_ = 1; + +const int BER_TAG_UNKNOWN = 0; + +const int BER_TAG_BOOLEAN = 1; + +const int BER_TAG_INTEGER = 2; + +const int BER_TAG_BIT_STRING = 3; + +const int BER_TAG_OCTET_STRING = 4; + +const int BER_TAG_NULL = 5; + +const int BER_TAG_OID = 6; + +const int BER_TAG_OBJECT_DESCRIPTOR = 7; + +const int BER_TAG_EXTERNAL = 8; + +const int BER_TAG_REAL = 9; + +const int BER_TAG_ENUMERATED = 10; + +const int BER_TAG_PKIX_UTF8_STRING = 12; + +const int BER_TAG_SEQUENCE = 16; + +const int BER_TAG_SET = 17; + +const int BER_TAG_NUMERIC_STRING = 18; + +const int BER_TAG_PRINTABLE_STRING = 19; + +const int BER_TAG_T61_STRING = 20; + +const int BER_TAG_TELETEX_STRING = 20; + +const int BER_TAG_VIDEOTEX_STRING = 21; + +const int BER_TAG_IA5_STRING = 22; + +const int BER_TAG_UTC_TIME = 23; + +const int BER_TAG_GENERALIZED_TIME = 24; + +const int BER_TAG_GRAPHIC_STRING = 25; + +const int BER_TAG_ISO646_STRING = 26; + +const int BER_TAG_GENERAL_STRING = 27; + +const int BER_TAG_VISIBLE_STRING = 26; + +const int BER_TAG_PKIX_UNIVERSAL_STRING = 28; + +const int BER_TAG_PKIX_BMP_STRING = 30; + +const int CSSM_X509_OPTION_PRESENT = 1; + +const int CSSM_X509_OPTION_NOT_PRESENT = 0; + +const int CE_KU_DigitalSignature = 32768; + +const int CE_KU_NonRepudiation = 16384; + +const int CE_KU_KeyEncipherment = 8192; + +const int CE_KU_DataEncipherment = 4096; + +const int CE_KU_KeyAgreement = 2048; + +const int CE_KU_KeyCertSign = 1024; + +const int CE_KU_CRLSign = 512; + +const int CE_KU_EncipherOnly = 256; + +const int CE_KU_DecipherOnly = 128; + +const int CE_CR_Unspecified = 0; + +const int CE_CR_KeyCompromise = 1; + +const int CE_CR_CACompromise = 2; + +const int CE_CR_AffiliationChanged = 3; + +const int CE_CR_Superseded = 4; + +const int CE_CR_CessationOfOperation = 5; + +const int CE_CR_CertificateHold = 6; + +const int CE_CR_RemoveFromCRL = 8; + +const int CE_CD_Unspecified = 128; + +const int CE_CD_KeyCompromise = 64; + +const int CE_CD_CACompromise = 32; + +const int CE_CD_AffiliationChanged = 16; + +const int CE_CD_Superseded = 8; + +const int CE_CD_CessationOfOperation = 4; + +const int CE_CD_CertificateHold = 2; + +const int CSSM_APPLE_TP_SSL_OPTS_VERSION = 1; + +const int CSSM_APPLE_TP_SSL_CLIENT = 1; + +const int CSSM_APPLE_TP_CRL_OPTS_VERSION = 0; + +const int CSSM_APPLE_TP_SMIME_OPTS_VERSION = 0; + +const int CSSM_APPLE_TP_ACTION_VERSION = 0; + +const int CSSM_TP_APPLE_EVIDENCE_VERSION = 0; + +const int CSSM_EVIDENCE_FORM_APPLE_CUSTOM = 2147483648; + +const String CSSM_APPLE_CRL_END_OF_TIME = '99991231235959'; + +const String kKeychainSuffix = '.keychain'; + +const String kKeychainDbSuffix = '.keychain-db'; + +const String kSystemKeychainName = 'System.keychain'; + +const String kSystemKeychainDir = '/Library/Keychains/'; + +const String kSystemUnlockFile = '/var/db/SystemKey'; + +const String kSystemKeychainPath = '/Library/Keychains/System.keychain'; + +const String CSSM_APPLE_ACL_TAG_PARTITION_ID = '___PARTITION___'; + +const String CSSM_APPLE_ACL_TAG_INTEGRITY = '___INTEGRITY___'; + +const int errSecErrnoBase = 100000; + +const int errSecErrnoLimit = 100255; + +const int errSSLServerAuthCompleted = -9841; + +const int errSSLClientAuthCompleted = -9841; + +const int errSSLLast = -9849; + +const int NSMaximumStringLength = 2147483646; + +const int NS_UNICHAR_IS_EIGHT_BIT = 0; + +const int NSURLResponseUnknownLength = -1; + +const int NSOperationQualityOfServiceUserInteractive = 33; + +const int NSOperationQualityOfServiceUserInitiated = 25; + +const int NSOperationQualityOfServiceUtility = 17; + +const int NSOperationQualityOfServiceBackground = 9; diff --git a/pkgs/cupertino_http/lib/src/utils.dart b/pkgs/cupertino_http/lib/src/utils.dart new file mode 100644 index 0000000000..8712c34dd8 --- /dev/null +++ b/pkgs/cupertino_http/lib/src/utils.dart @@ -0,0 +1,58 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:ffi'; +import 'dart:io'; + +import 'package:objective_c/objective_c.dart'; + +import 'native_cupertino_bindings.dart' as ncb; + +/// Access to symbols that are linked into the process. +/// +/// The "Foundation" framework is linked to Dart so no additional +/// libraries need to be loaded to access those symbols. +final ncb.NativeCupertinoHttp linkedLibs = () { + if (Platform.isMacOS || Platform.isIOS) { + final lib = DynamicLibrary.process(); + return ncb.NativeCupertinoHttp(lib); + } + throw UnsupportedError( + 'Platform ${Platform.operatingSystem} is not supported'); +}(); + +/// Converts a NSDictionary containing NSString keys and NSString values into +/// an equivalent map. +Map stringNSDictionaryToMap(NSDictionary d) { + final m = {}; + final keys = NSArray.castFrom(d.allKeys); + for (var i = 0; i < keys.count; ++i) { + final nsKey = keys.objectAtIndex_(i); + if (!NSString.isInstance(nsKey)) { + throw UnsupportedError('keys must be strings'); + } + final key = NSString.castFrom(nsKey).toString(); + final nsValue = d.objectForKey_(nsKey); + if (nsValue == null || !NSString.isInstance(nsValue)) { + throw UnsupportedError('values must be strings'); + } + final value = NSString.castFrom(nsValue).toString(); + m[key] = value; + } + + return m; +} + +NSArray stringIterableToNSArray(Iterable strings) { + final array = NSMutableArray.arrayWithCapacity_(strings.length); + + var index = 0; + for (var s in strings) { + array.setObject_atIndexedSubscript_(s.toNSString(), index++); + } + return array; +} + +NSURL uriToNSURL(Uri uri) => NSURL.URLWithString_(uri.toString().toNSString())!; +Uri nsurlToUri(NSURL url) => Uri.parse(url.absoluteString!.toString()); diff --git a/pkgs/cupertino_http/pubspec.yaml b/pkgs/cupertino_http/pubspec.yaml new file mode 100644 index 0000000000..a463092423 --- /dev/null +++ b/pkgs/cupertino_http/pubspec.yaml @@ -0,0 +1,34 @@ +name: cupertino_http +version: 2.0.2-wip +description: >- + A macOS/iOS Flutter plugin that provides access to the Foundation URL + Loading System. +repository: https://github.com/dart-lang/http/tree/master/pkgs/cupertino_http + +environment: + sdk: ^3.4.0 + flutter: '>=3.24.0' # If changed, update test matrix. + +dependencies: + async: ^2.5.0 + ffi: ^2.1.0 + flutter: + sdk: flutter + http: ^1.2.0 + http_profile: ^0.1.0 + objective_c: ^4.0.0 + web_socket: ^0.1.0 + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + ffigen: ^16.0.0 + +flutter: + plugin: + platforms: + ios: + ffiPlugin: true + sharedDarwinSource: true + macos: + ffiPlugin: true + sharedDarwinSource: true diff --git a/pkgs/flutter_http_example/.gitignore b/pkgs/flutter_http_example/.gitignore new file mode 100644 index 0000000000..24476c5d1e --- /dev/null +++ b/pkgs/flutter_http_example/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/pkgs/flutter_http_example/.metadata b/pkgs/flutter_http_example/.metadata new file mode 100644 index 0000000000..b41277dd87 --- /dev/null +++ b/pkgs/flutter_http_example/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "367f9ea16bfae1ca451b9cc27c1366870b187ae2" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + - platform: android + create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + - platform: ios + create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + - platform: linux + create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + - platform: macos + create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + - platform: web + create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + - platform: windows + create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/pkgs/flutter_http_example/README.md b/pkgs/flutter_http_example/README.md new file mode 100644 index 0000000000..0877bfb81e --- /dev/null +++ b/pkgs/flutter_http_example/README.md @@ -0,0 +1,41 @@ +# flutter_http_example + +A Flutter sample app that illustrates how to configure and use +[`package:http`](https://pub.dev/packages/http). + +## Goals for this sample + +* Provide you with example code for using `package:http` in Flutter, + including: + + * configuration for multiple platforms. + * using `package:provider` to pass `Client`s through an application. + * writing tests using `MockClient`. + +## The important bits + +### `http_client_factory.dart` + +This library used to create `package:http` `Client`s when the app is run inside +the Dart virtual machine, meaning all platforms except the web browser. + +### `http_client_factory_web.dart` + +This library used to create `package:http` `Client`s when the app is run inside +a web browser. + +Web configuration must be done in a separate library because Dart code cannot +import `dart:ffi` or `dart:io` when run in a web browser. + +### `main.dart` + +This library demonstrates how to: + +* import `http_client_factory.dart` or `http_client_factory_web.dart`, + depending on whether we are targeting the web browser or not. +* share a `package:http` `Client` by using `package:provider`. +* call `package:http` `Client` methods. + +### `widget_test.dart` + +This library demonstrates how to construct tests using `MockClient`. diff --git a/pkgs/flutter_http_example/android/.gitignore b/pkgs/flutter_http_example/android/.gitignore new file mode 100644 index 0000000000..55afd919c6 --- /dev/null +++ b/pkgs/flutter_http_example/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/pkgs/flutter_http_example/android/app/build.gradle b/pkgs/flutter_http_example/android/app/build.gradle new file mode 100644 index 0000000000..a4eb5f2311 --- /dev/null +++ b/pkgs/flutter_http_example/android/app/build.gradle @@ -0,0 +1,67 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +android { + namespace "com.example.flutter_http_example" + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.flutter_http_example" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies {} diff --git a/pkgs/flutter_http_example/android/app/src/debug/AndroidManifest.xml b/pkgs/flutter_http_example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000000..399f6981d5 --- /dev/null +++ b/pkgs/flutter_http_example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/pkgs/flutter_http_example/android/app/src/main/AndroidManifest.xml b/pkgs/flutter_http_example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..51f6e57536 --- /dev/null +++ b/pkgs/flutter_http_example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + diff --git a/pkgs/flutter_http_example/android/app/src/main/kotlin/com/example/flutter_http_example/MainActivity.kt b/pkgs/flutter_http_example/android/app/src/main/kotlin/com/example/flutter_http_example/MainActivity.kt new file mode 100644 index 0000000000..c8dbfa01f3 --- /dev/null +++ b/pkgs/flutter_http_example/android/app/src/main/kotlin/com/example/flutter_http_example/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.flutter_http_example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/pkgs/flutter_http_example/android/app/src/main/res/drawable-v21/launch_background.xml b/pkgs/flutter_http_example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000000..f74085f3f6 --- /dev/null +++ b/pkgs/flutter_http_example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/pkgs/flutter_http_example/android/app/src/main/res/drawable/launch_background.xml b/pkgs/flutter_http_example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000000..304732f884 --- /dev/null +++ b/pkgs/flutter_http_example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/pkgs/flutter_http_example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..db77bb4b7b Binary files /dev/null and b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/pkgs/flutter_http_example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..17987b79bb Binary files /dev/null and b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/pkgs/flutter_http_example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..09d4391482 Binary files /dev/null and b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/pkgs/flutter_http_example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..d5f1c8d34e Binary files /dev/null and b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/pkgs/flutter_http_example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..4d6372eebd Binary files /dev/null and b/pkgs/flutter_http_example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/pkgs/flutter_http_example/android/app/src/main/res/values-night/styles.xml b/pkgs/flutter_http_example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000000..06952be745 --- /dev/null +++ b/pkgs/flutter_http_example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/pkgs/flutter_http_example/android/app/src/main/res/values/styles.xml b/pkgs/flutter_http_example/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000..cb1ef88056 --- /dev/null +++ b/pkgs/flutter_http_example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/pkgs/flutter_http_example/android/app/src/profile/AndroidManifest.xml b/pkgs/flutter_http_example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000000..399f6981d5 --- /dev/null +++ b/pkgs/flutter_http_example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/pkgs/flutter_http_example/android/build.gradle b/pkgs/flutter_http_example/android/build.gradle new file mode 100644 index 0000000000..f7eb7f63ce --- /dev/null +++ b/pkgs/flutter_http_example/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.7.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.3.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/pkgs/flutter_http_example/android/gradle.properties b/pkgs/flutter_http_example/android/gradle.properties new file mode 100644 index 0000000000..94adc3a3f9 --- /dev/null +++ b/pkgs/flutter_http_example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/pkgs/flutter_http_example/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/flutter_http_example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..3c472b99c6 --- /dev/null +++ b/pkgs/flutter_http_example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/pkgs/flutter_http_example/android/settings.gradle b/pkgs/flutter_http_example/android/settings.gradle new file mode 100644 index 0000000000..55c4ca8b10 --- /dev/null +++ b/pkgs/flutter_http_example/android/settings.gradle @@ -0,0 +1,20 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + } + settings.ext.flutterSdkPath = flutterSdkPath() + + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + + plugins { + id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false + } +} + +include ":app" + +apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/pkgs/flutter_http_example/ios/.gitignore b/pkgs/flutter_http_example/ios/.gitignore new file mode 100644 index 0000000000..7a7f9873ad --- /dev/null +++ b/pkgs/flutter_http_example/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/pkgs/flutter_http_example/ios/Flutter/AppFrameworkInfo.plist b/pkgs/flutter_http_example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000000..1dc6cf7652 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 13.0 + + diff --git a/pkgs/flutter_http_example/ios/Flutter/Debug.xcconfig b/pkgs/flutter_http_example/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000000..ec97fc6f30 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/pkgs/flutter_http_example/ios/Flutter/Release.xcconfig b/pkgs/flutter_http_example/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000000..c4855bfe20 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/pkgs/flutter_http_example/ios/Podfile b/pkgs/flutter_http_example/ios/Podfile new file mode 100644 index 0000000000..3e44f9c6f7 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +platform :ios, '13.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.pbxproj b/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..a14d83b242 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,722 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B1448C25079CE55D20090E7 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93328B4024A7886CC6CC2DDD /* Pods_Runner.framework */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 61B31556395186C35F97BF5D /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C17079534AD2CBE4823B8AB /* Pods_RunnerTests.framework */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 236A97BA0F5813CD1920FC16 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 4251B236F12508EAFB1CDADF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 4C17079534AD2CBE4823B8AB /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 91755F2B95DCD0D57CD9CA33 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 93328B4024A7886CC6CC2DDD /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AD8548E7DA6210BD4651A868 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + C262D7CEC60AFDBA943D3587 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + F959075C01F519C8B7CB7566 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 621B34BD5B8B923F614770C7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 61B31556395186C35F97BF5D /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3B1448C25079CE55D20090E7 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + C9FE60B8C6333C2F69900430 /* Pods */, + A4E774287DA6E5C815BF9BA2 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + A4E774287DA6E5C815BF9BA2 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 93328B4024A7886CC6CC2DDD /* Pods_Runner.framework */, + 4C17079534AD2CBE4823B8AB /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + C9FE60B8C6333C2F69900430 /* Pods */ = { + isa = PBXGroup; + children = ( + 91755F2B95DCD0D57CD9CA33 /* Pods-Runner.debug.xcconfig */, + 4251B236F12508EAFB1CDADF /* Pods-Runner.release.xcconfig */, + C262D7CEC60AFDBA943D3587 /* Pods-Runner.profile.xcconfig */, + F959075C01F519C8B7CB7566 /* Pods-RunnerTests.debug.xcconfig */, + AD8548E7DA6210BD4651A868 /* Pods-RunnerTests.release.xcconfig */, + 236A97BA0F5813CD1920FC16 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + C47239DAC40DFB94662F62CC /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + 621B34BD5B8B923F614770C7 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 86DB308CAFB66EE46BD07D10 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 2AC1FEE86C19F56DF01677C5 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 2AC1FEE86C19F56DF01677C5 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 86DB308CAFB66EE46BD07D10 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + C47239DAC40DFB94662F62CC /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F959075C01F519C8B7CB7566 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AD8548E7DA6210BD4651A868 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 236A97BA0F5813CD1920FC16 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..919434a625 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000..f9b0d7c5ea --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/pkgs/flutter_http_example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/pkgs/flutter_http_example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000000..8e3ca5dfe1 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/flutter_http_example/ios/Runner.xcworkspace/contents.xcworkspacedata b/pkgs/flutter_http_example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..21a3cc14c7 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/pkgs/flutter_http_example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/flutter_http_example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/pkgs/flutter_http_example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/pkgs/flutter_http_example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000..f9b0d7c5ea --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/pkgs/flutter_http_example/ios/Runner/AppDelegate.swift b/pkgs/flutter_http_example/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000000..b636303481 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..d36b1fab2d --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000000..dc9ada4725 Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000000..7353c41ecf Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000000..797d452e45 Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000000..6ed2d933e1 Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000000..4cd7b0099c Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000000..fe730945a0 Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000000..321773cd85 Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000000..797d452e45 Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000000..502f463a9b Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000000..0ec3034392 Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000000..0ec3034392 Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000000..e9f5fea27c Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000000..84ac32ae7d Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000000..8953cba090 Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000000..0467bf12aa Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000000..0bedcf2fd4 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000000..9da19eacad Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000000..9da19eacad Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000000..9da19eacad Binary files /dev/null and b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000000..89c2725b70 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/pkgs/flutter_http_example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/pkgs/flutter_http_example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000000..f2e259c7c9 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/flutter_http_example/ios/Runner/Base.lproj/Main.storyboard b/pkgs/flutter_http_example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000000..f3c28516fb --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/flutter_http_example/ios/Runner/Info.plist b/pkgs/flutter_http_example/ios/Runner/Info.plist new file mode 100644 index 0000000000..e9064474b7 --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Flutter Http Example + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + flutter_http_example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/pkgs/flutter_http_example/ios/Runner/Runner-Bridging-Header.h b/pkgs/flutter_http_example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000000..308a2a560b --- /dev/null +++ b/pkgs/flutter_http_example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/pkgs/flutter_http_example/ios/RunnerTests/RunnerTests.swift b/pkgs/flutter_http_example/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000000..86a7c3b1b6 --- /dev/null +++ b/pkgs/flutter_http_example/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/pkgs/flutter_http_example/lib/book.dart b/pkgs/flutter_http_example/lib/book.dart new file mode 100644 index 0000000000..b47ca9e67e --- /dev/null +++ b/pkgs/flutter_http_example/lib/book.dart @@ -0,0 +1,32 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Book { + String title; + String description; + Uri imageUrl; + + Book(this.title, this.description, this.imageUrl); + + static List listFromJson(Map json) { + final books = []; + + if (json['items'] case final List items) { + for (final item in items) { + if (item case {'volumeInfo': final Map volumeInfo}) { + if (volumeInfo + case { + 'title': final String title, + 'description': final String description, + 'imageLinks': {'smallThumbnail': final String thumbnail} + }) { + books.add(Book(title, description, Uri.parse(thumbnail))); + } + } + } + } + + return books; + } +} diff --git a/pkgs/flutter_http_example/lib/http_client_factory.dart b/pkgs/flutter_http_example/lib/http_client_factory.dart new file mode 100644 index 0000000000..51109e520c --- /dev/null +++ b/pkgs/flutter_http_example/lib/http_client_factory.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:cronet_http/cronet_http.dart'; +import 'package:cupertino_http/cupertino_http.dart'; +import 'package:flutter/widgets.dart'; +import 'package:http/http.dart'; +import 'package:http/io_client.dart'; + +const _maxCacheSize = 2 * 1024 * 1024; + +Client httpClient() { + if (Platform.isAndroid) { + WidgetsFlutterBinding.ensureInitialized(); + final engine = CronetEngine.build( + cacheMode: CacheMode.memory, + cacheMaxSize: _maxCacheSize, + userAgent: 'Book Agent'); + return CronetClient.fromCronetEngine(engine); + } + if (Platform.isIOS || Platform.isMacOS) { + final config = URLSessionConfiguration.ephemeralSessionConfiguration() + ..cache = URLCache.withCapacity(memoryCapacity: _maxCacheSize) + ..httpAdditionalHeaders = {'User-Agent': 'Book Agent'}; + return CupertinoClient.fromSessionConfiguration(config); + } + return IOClient(HttpClient()..userAgent = 'Book Agent'); +} diff --git a/pkgs/flutter_http_example/lib/http_client_factory_web.dart b/pkgs/flutter_http_example/lib/http_client_factory_web.dart new file mode 100644 index 0000000000..52a758fe77 --- /dev/null +++ b/pkgs/flutter_http_example/lib/http_client_factory_web.dart @@ -0,0 +1,8 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:fetch_client/fetch_client.dart'; +import 'package:http/http.dart'; + +Client httpClient() => FetchClient(mode: RequestMode.cors); diff --git a/pkgs/flutter_http_example/lib/main.dart b/pkgs/flutter_http_example/lib/main.dart new file mode 100644 index 0000000000..899105b227 --- /dev/null +++ b/pkgs/flutter_http_example/lib/main.dart @@ -0,0 +1,149 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:http/http.dart'; +import 'package:http_image_provider/http_image_provider.dart'; +import 'package:provider/provider.dart'; + +import 'book.dart'; +import 'http_client_factory.dart' + if (dart.library.js_interop) 'http_client_factory_web.dart' as http_factory; + +void main() { + runApp(Provider( + // `Provider` calls its `create` argument once when a `Client` is + // first requested (through `BuildContext.read()`) and uses that + // same instance for all future requests. + // + // Reusing the same `Client` may: + // - reduce memory usage + // - allow caching of fetched URLs + // - allow connections to be persisted + create: (_) => http_factory.httpClient(), + child: const BookSearchApp(), + dispose: (_, client) => client.close())); +} + +class BookSearchApp extends StatelessWidget { + const BookSearchApp({super.key}); + + @override + Widget build(BuildContext context) => const MaterialApp( + // Remove the debug banner. + debugShowCheckedModeBanner: false, + title: 'Book Search', + home: HomePage(), + ); +} + +class HomePage extends StatefulWidget { + const HomePage({super.key}); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + List? _books; + String? _lastQuery; + late Client _client; + + @override + void initState() { + super.initState(); + _client = context.read(); + } + + // Get the list of books matching `query`. + // The `get` call will automatically use the `client` configured in `main`. + Future> _findMatchingBooks(String query) async { + final response = await _client.get( + Uri.https( + 'www.googleapis.com', + '/books/v1/volumes', + {'q': query, 'maxResults': '20', 'printType': 'books'}, + ), + ); + + final json = jsonDecode(utf8.decode(response.bodyBytes)) as Map; + return Book.listFromJson(json); + } + + void _runSearch(String query) async { + _lastQuery = query; + if (query.isEmpty) { + setState(() { + _books = null; + }); + return; + } + + final books = await _findMatchingBooks(query); + // Avoid the situation where a slow-running query finishes late and + // replaces newer search results. + if (query != _lastQuery) return; + setState(() { + _books = books; + }); + } + + @override + Widget build(BuildContext context) { + final searchResult = _books == null + ? const Text('Please enter a query', style: TextStyle(fontSize: 24)) + : _books!.isNotEmpty + ? BookList(_books!) + : const Text('No results found', style: TextStyle(fontSize: 24)); + + return Scaffold( + appBar: AppBar(title: const Text('Book Search')), + body: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + const SizedBox(height: 20), + TextField( + onChanged: _runSearch, + decoration: const InputDecoration( + labelText: 'Search', + suffixIcon: Icon(Icons.search), + ), + ), + const SizedBox(height: 20), + Expanded(child: searchResult), + ], + ), + ), + ); + } +} + +class BookList extends StatefulWidget { + final List books; + const BookList(this.books, {super.key}); + + @override + State createState() => _BookListState(); +} + +class _BookListState extends State { + @override + Widget build(BuildContext context) => ListView.builder( + itemCount: widget.books.length, + itemBuilder: (context, index) => Card( + key: ValueKey(widget.books[index].title), + child: ListTile( + leading: Image( + image: HttpImageProvider( + widget.books[index].imageUrl.replace(scheme: 'https'), + client: context.read())), + title: Text(widget.books[index].title), + subtitle: Text(widget.books[index].description), + ), + ), + ); +} diff --git a/pkgs/flutter_http_example/linux/.gitignore b/pkgs/flutter_http_example/linux/.gitignore new file mode 100644 index 0000000000..d3896c9844 --- /dev/null +++ b/pkgs/flutter_http_example/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/pkgs/flutter_http_example/linux/CMakeLists.txt b/pkgs/flutter_http_example/linux/CMakeLists.txt new file mode 100644 index 0000000000..c9b5dd6ca9 --- /dev/null +++ b/pkgs/flutter_http_example/linux/CMakeLists.txt @@ -0,0 +1,139 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.10) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "flutter_http_example") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.flutter_http_example") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Define the application target. To change its name, change BINARY_NAME above, +# not the value here, or `flutter run` will no longer work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/pkgs/flutter_http_example/linux/flutter/CMakeLists.txt b/pkgs/flutter_http_example/linux/flutter/CMakeLists.txt new file mode 100644 index 0000000000..d5bd01648a --- /dev/null +++ b/pkgs/flutter_http_example/linux/flutter/CMakeLists.txt @@ -0,0 +1,88 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/pkgs/flutter_http_example/linux/flutter/generated_plugin_registrant.cc b/pkgs/flutter_http_example/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000000..e71a16d23d --- /dev/null +++ b/pkgs/flutter_http_example/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/pkgs/flutter_http_example/linux/flutter/generated_plugin_registrant.h b/pkgs/flutter_http_example/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000000..e0f0a47bc0 --- /dev/null +++ b/pkgs/flutter_http_example/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/pkgs/flutter_http_example/linux/flutter/generated_plugins.cmake b/pkgs/flutter_http_example/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000000..be1ee3e5b4 --- /dev/null +++ b/pkgs/flutter_http_example/linux/flutter/generated_plugins.cmake @@ -0,0 +1,24 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST + jni +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/pkgs/flutter_http_example/linux/main.cc b/pkgs/flutter_http_example/linux/main.cc new file mode 100644 index 0000000000..e7c5c54370 --- /dev/null +++ b/pkgs/flutter_http_example/linux/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/pkgs/flutter_http_example/linux/my_application.cc b/pkgs/flutter_http_example/linux/my_application.cc new file mode 100644 index 0000000000..19681d123c --- /dev/null +++ b/pkgs/flutter_http_example/linux/my_application.cc @@ -0,0 +1,104 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "flutter_http_example"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "flutter_http_example"); + } + + gtk_window_set_default_size(window, 1280, 720); + gtk_widget_show(GTK_WIDGET(window)); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/pkgs/flutter_http_example/linux/my_application.h b/pkgs/flutter_http_example/linux/my_application.h new file mode 100644 index 0000000000..72271d5e41 --- /dev/null +++ b/pkgs/flutter_http_example/linux/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/pkgs/flutter_http_example/macos/.gitignore b/pkgs/flutter_http_example/macos/.gitignore new file mode 100644 index 0000000000..746adbb6b9 --- /dev/null +++ b/pkgs/flutter_http_example/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/pkgs/flutter_http_example/macos/Flutter/Flutter-Debug.xcconfig b/pkgs/flutter_http_example/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000000..4b81f9b2d2 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/pkgs/flutter_http_example/macos/Flutter/Flutter-Release.xcconfig b/pkgs/flutter_http_example/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000000..5caa9d1579 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/pkgs/flutter_http_example/macos/Flutter/GeneratedPluginRegistrant.swift b/pkgs/flutter_http_example/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000000..cccf817a52 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,10 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { +} diff --git a/pkgs/flutter_http_example/macos/Podfile b/pkgs/flutter_http_example/macos/Podfile new file mode 100644 index 0000000000..b52666a103 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.15' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/pkgs/flutter_http_example/macos/Runner.xcodeproj/project.pbxproj b/pkgs/flutter_http_example/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..02b4091aa8 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,791 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 6CD517E234CF360701C08A8A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0591765108BEADEC34532D04 /* Pods_Runner.framework */; }; + 6E1ABF5DCC1A42E71A734FBC /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40BBC97A1163C755D4A704A2 /* Pods_RunnerTests.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0591765108BEADEC34532D04 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* flutter_http_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = flutter_http_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 40BBC97A1163C755D4A704A2 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 551FEB853C026A902F0A92E6 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 78519086C5EEDD58132888E3 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 7AA9FD2C114520277F572574 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 94B1D590F47CFBED674D1E29 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + 9DBC0FAE0731CAA1D0B0070A /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + A9635687BEA632F3738488B1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6E1ABF5DCC1A42E71A734FBC /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6CD517E234CF360701C08A8A /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + B9ADB9664E4467E254712B67 /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* flutter_http_example.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + B9ADB9664E4467E254712B67 /* Pods */ = { + isa = PBXGroup; + children = ( + A9635687BEA632F3738488B1 /* Pods-Runner.debug.xcconfig */, + 78519086C5EEDD58132888E3 /* Pods-Runner.release.xcconfig */, + 7AA9FD2C114520277F572574 /* Pods-Runner.profile.xcconfig */, + 9DBC0FAE0731CAA1D0B0070A /* Pods-RunnerTests.debug.xcconfig */, + 551FEB853C026A902F0A92E6 /* Pods-RunnerTests.release.xcconfig */, + 94B1D590F47CFBED674D1E29 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 0591765108BEADEC34532D04 /* Pods_Runner.framework */, + 40BBC97A1163C755D4A704A2 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + D6B96CFD862468F06D71CD1E /* [CP] Check Pods Manifest.lock */, + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 06AE03905AE54589A920DA1D /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + 07BDB66C6CC1CF49E12920D9 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* flutter_http_example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 06AE03905AE54589A920DA1D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 07BDB66C6CC1CF49E12920D9 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + D6B96CFD862468F06D71CD1E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9DBC0FAE0731CAA1D0B0070A /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/flutter_http_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/flutter_http_example"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 551FEB853C026A902F0A92E6 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/flutter_http_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/flutter_http_example"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 94B1D590F47CFBED674D1E29 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/flutter_http_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/flutter_http_example"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/pkgs/flutter_http_example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/flutter_http_example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/pkgs/flutter_http_example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/pkgs/flutter_http_example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000000..a88e082977 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/flutter_http_example/macos/Runner.xcworkspace/contents.xcworkspacedata b/pkgs/flutter_http_example/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..21a3cc14c7 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/pkgs/flutter_http_example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/pkgs/flutter_http_example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/pkgs/flutter_http_example/macos/Runner/AppDelegate.swift b/pkgs/flutter_http_example/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000000..8e02df2888 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@main +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..a2ec33f19f --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000000..82b6f9d9a3 Binary files /dev/null and b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000000..13b35eba55 Binary files /dev/null and b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000000..0a3f5fa40f Binary files /dev/null and b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000000..bdb57226d5 Binary files /dev/null and b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000000..f083318e09 Binary files /dev/null and b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000000..326c0e72c9 Binary files /dev/null and b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000000..2f1632cfdd Binary files /dev/null and b/pkgs/flutter_http_example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/pkgs/flutter_http_example/macos/Runner/Base.lproj/MainMenu.xib b/pkgs/flutter_http_example/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000000..80e867a4e0 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/flutter_http_example/macos/Runner/Configs/AppInfo.xcconfig b/pkgs/flutter_http_example/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000000..fa03c5ae28 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = flutter_http_example + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHttpExample + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. diff --git a/pkgs/flutter_http_example/macos/Runner/Configs/Debug.xcconfig b/pkgs/flutter_http_example/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000000..36b0fd9464 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/pkgs/flutter_http_example/macos/Runner/Configs/Release.xcconfig b/pkgs/flutter_http_example/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000000..dff4f49561 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/pkgs/flutter_http_example/macos/Runner/Configs/Warnings.xcconfig b/pkgs/flutter_http_example/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000000..42bcbf4780 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/pkgs/flutter_http_example/macos/Runner/DebugProfile.entitlements b/pkgs/flutter_http_example/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000000..08c3ab17cc --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,14 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + com.apple.security.network.client + + + diff --git a/pkgs/flutter_http_example/macos/Runner/Info.plist b/pkgs/flutter_http_example/macos/Runner/Info.plist new file mode 100644 index 0000000000..4789daa6a4 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/pkgs/flutter_http_example/macos/Runner/MainFlutterWindow.swift b/pkgs/flutter_http_example/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000000..3cc05eb234 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/pkgs/flutter_http_example/macos/Runner/Release.entitlements b/pkgs/flutter_http_example/macos/Runner/Release.entitlements new file mode 100644 index 0000000000..ee95ab7e58 --- /dev/null +++ b/pkgs/flutter_http_example/macos/Runner/Release.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + diff --git a/pkgs/flutter_http_example/macos/RunnerTests/RunnerTests.swift b/pkgs/flutter_http_example/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000000..5418c9f539 --- /dev/null +++ b/pkgs/flutter_http_example/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import FlutterMacOS +import Cocoa +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/pkgs/flutter_http_example/mono_pkg.yaml b/pkgs/flutter_http_example/mono_pkg.yaml new file mode 100644 index 0000000000..8d8070e17c --- /dev/null +++ b/pkgs/flutter_http_example/mono_pkg.yaml @@ -0,0 +1,14 @@ +sdk: + - stable + +stages: + - analyze_and_format: + - analyze: --fatal-infos + - format: + - unit_test: + - test: + os: + - macos + - windows + - test: --platform chrome + - command: flutter test diff --git a/pkgs/flutter_http_example/pubspec.yaml b/pkgs/flutter_http_example/pubspec.yaml new file mode 100644 index 0000000000..92844828d2 --- /dev/null +++ b/pkgs/flutter_http_example/pubspec.yaml @@ -0,0 +1,31 @@ +name: flutter_http_example +version: 1.0.0 +description: Demonstrates how to use package:http in a Flutter app. + +publish_to: 'none' + +environment: + sdk: ^3.0.0 + flutter: '>=3.10.0' + +dependencies: + cronet_http: ^1.0.0 + cupertino_http: ^2.0.0 + cupertino_icons: ^1.0.2 + fetch_client: ^1.0.2 + flutter: + sdk: flutter + http: ^1.0.0 + http_image_provider: ^1.0.0 + provider: ^6.0.5 + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + flutter_test: + sdk: flutter + integration_test: + sdk: flutter + test: ^1.21.1 + +flutter: + uses-material-design: true diff --git a/pkgs/flutter_http_example/test/widget_test.dart b/pkgs/flutter_http_example/test/widget_test.dart new file mode 100644 index 0000000000..f890a1bb11 --- /dev/null +++ b/pkgs/flutter_http_example/test/widget_test.dart @@ -0,0 +1,74 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter_http_example/main.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart'; +import 'package:http/testing.dart'; +import 'package:provider/provider.dart'; + +const _singleBookResponse = ''' +{ + "items": [ + { + "volumeInfo": { + "title": "Flutter Cookbook", + "description": "Write, test, and publish your web, desktop...", + "imageLinks": { + "smallThumbnail": "http://thumbnailurl/" + } + } + } + ] +} +'''; + +final _dummyPngImage = base64Decode( + 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmM' + 'IQAAAABJRU5ErkJggg==', +); + +void main() { + Widget app(Client client) => Provider( + create: (_) => client, + child: const BookSearchApp(), + dispose: (_, client) => client.close()); + + testWidgets('test initial load', (WidgetTester tester) async { + final mockClient = MockClient( + (request) async => throw StateError('unexpected HTTP request')); + + await tester.pumpWidget(app(mockClient)); + + expect(find.text('Please enter a query'), findsOneWidget); + }); + + testWidgets('test search with one result', (WidgetTester tester) async { + final mockClient = MockClient((request) async { + if (request.url.path == '/books/v1/volumes' && + request.url.queryParameters['q'] == 'Flutter') { + return Response(_singleBookResponse, 200); + } else if (request.url == Uri.https('thumbnailurl', '/')) { + return Response.bytes(_dummyPngImage, 200, + headers: const {'Content-Type': 'image/png'}); + } + return Response('', 404); + }); + + await tester.pumpWidget(app(mockClient)); + await tester.enterText(find.byType(TextField), 'Flutter'); + await tester.pump(); + + // The book title. + expect(find.text('Flutter Cookbook'), findsOneWidget); + // The book description. + expect( + find.text('Write, test, and publish your web, desktop...', + skipOffstage: false), + findsOneWidget); + }); +} diff --git a/pkgs/flutter_http_example/web/favicon.png b/pkgs/flutter_http_example/web/favicon.png new file mode 100644 index 0000000000..8aaa46ac1a Binary files /dev/null and b/pkgs/flutter_http_example/web/favicon.png differ diff --git a/pkgs/flutter_http_example/web/icons/Icon-192.png b/pkgs/flutter_http_example/web/icons/Icon-192.png new file mode 100644 index 0000000000..b749bfef07 Binary files /dev/null and b/pkgs/flutter_http_example/web/icons/Icon-192.png differ diff --git a/pkgs/flutter_http_example/web/icons/Icon-512.png b/pkgs/flutter_http_example/web/icons/Icon-512.png new file mode 100644 index 0000000000..88cfd48dff Binary files /dev/null and b/pkgs/flutter_http_example/web/icons/Icon-512.png differ diff --git a/pkgs/flutter_http_example/web/icons/Icon-maskable-192.png b/pkgs/flutter_http_example/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000000..eb9b4d76e5 Binary files /dev/null and b/pkgs/flutter_http_example/web/icons/Icon-maskable-192.png differ diff --git a/pkgs/flutter_http_example/web/icons/Icon-maskable-512.png b/pkgs/flutter_http_example/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000000..d69c56691f Binary files /dev/null and b/pkgs/flutter_http_example/web/icons/Icon-maskable-512.png differ diff --git a/pkgs/flutter_http_example/web/index.html b/pkgs/flutter_http_example/web/index.html new file mode 100644 index 0000000000..b0f056a01e --- /dev/null +++ b/pkgs/flutter_http_example/web/index.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + flutter_http_example + + + + + + + + + + diff --git a/pkgs/flutter_http_example/web/manifest.json b/pkgs/flutter_http_example/web/manifest.json new file mode 100644 index 0000000000..900ad68eb2 --- /dev/null +++ b/pkgs/flutter_http_example/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "flutter_http_example", + "short_name": "flutter_http_example", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/pkgs/flutter_http_example/windows/.gitignore b/pkgs/flutter_http_example/windows/.gitignore new file mode 100644 index 0000000000..d492d0d98c --- /dev/null +++ b/pkgs/flutter_http_example/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/pkgs/flutter_http_example/windows/CMakeLists.txt b/pkgs/flutter_http_example/windows/CMakeLists.txt new file mode 100644 index 0000000000..434abaa0c1 --- /dev/null +++ b/pkgs/flutter_http_example/windows/CMakeLists.txt @@ -0,0 +1,102 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(flutter_http_example LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "flutter_http_example") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) + +# Define build configuration option. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() +# Define settings for the Profile build mode. +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/pkgs/flutter_http_example/windows/flutter/CMakeLists.txt b/pkgs/flutter_http_example/windows/flutter/CMakeLists.txt new file mode 100644 index 0000000000..930d2071a3 --- /dev/null +++ b/pkgs/flutter_http_example/windows/flutter/CMakeLists.txt @@ -0,0 +1,104 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + windows-x64 $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/pkgs/flutter_http_example/windows/flutter/generated_plugin_registrant.cc b/pkgs/flutter_http_example/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000000..8b6d4680af --- /dev/null +++ b/pkgs/flutter_http_example/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/pkgs/flutter_http_example/windows/flutter/generated_plugin_registrant.h b/pkgs/flutter_http_example/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000000..dc139d85a9 --- /dev/null +++ b/pkgs/flutter_http_example/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/pkgs/flutter_http_example/windows/flutter/generated_plugins.cmake b/pkgs/flutter_http_example/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000000..3ad69c6125 --- /dev/null +++ b/pkgs/flutter_http_example/windows/flutter/generated_plugins.cmake @@ -0,0 +1,24 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST + jni +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/pkgs/flutter_http_example/windows/runner/CMakeLists.txt b/pkgs/flutter_http_example/windows/runner/CMakeLists.txt new file mode 100644 index 0000000000..394917c053 --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/pkgs/flutter_http_example/windows/runner/Runner.rc b/pkgs/flutter_http_example/windows/runner/Runner.rc new file mode 100644 index 0000000000..62d99f8b07 --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD +#else +#define VERSION_AS_NUMBER 1,0,0,0 +#endif + +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "flutter_http_example" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "flutter_http_example" "\0" + VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "flutter_http_example.exe" "\0" + VALUE "ProductName", "flutter_http_example" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/pkgs/flutter_http_example/windows/runner/flutter_window.cpp b/pkgs/flutter_http_example/windows/runner/flutter_window.cpp new file mode 100644 index 0000000000..955ee3038f --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/flutter_window.cpp @@ -0,0 +1,71 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/pkgs/flutter_http_example/windows/runner/flutter_window.h b/pkgs/flutter_http_example/windows/runner/flutter_window.h new file mode 100644 index 0000000000..6da0652f05 --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/pkgs/flutter_http_example/windows/runner/main.cpp b/pkgs/flutter_http_example/windows/runner/main.cpp new file mode 100644 index 0000000000..9924ed3777 --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.Create(L"flutter_http_example", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/pkgs/flutter_http_example/windows/runner/resource.h b/pkgs/flutter_http_example/windows/runner/resource.h new file mode 100644 index 0000000000..66a65d1e4a --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/pkgs/flutter_http_example/windows/runner/resources/app_icon.ico b/pkgs/flutter_http_example/windows/runner/resources/app_icon.ico new file mode 100644 index 0000000000..c04e20caf6 Binary files /dev/null and b/pkgs/flutter_http_example/windows/runner/resources/app_icon.ico differ diff --git a/pkgs/flutter_http_example/windows/runner/runner.exe.manifest b/pkgs/flutter_http_example/windows/runner/runner.exe.manifest new file mode 100644 index 0000000000..a42ea7687c --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/runner.exe.manifest @@ -0,0 +1,20 @@ + + + + + PerMonitorV2 + + + + + + + + + + + + + + + diff --git a/pkgs/flutter_http_example/windows/runner/utils.cpp b/pkgs/flutter_http_example/windows/runner/utils.cpp new file mode 100644 index 0000000000..b2b08734db --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/utils.cpp @@ -0,0 +1,65 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length <= 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/pkgs/flutter_http_example/windows/runner/utils.h b/pkgs/flutter_http_example/windows/runner/utils.h new file mode 100644 index 0000000000..3879d54755 --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/pkgs/flutter_http_example/windows/runner/win32_window.cpp b/pkgs/flutter_http_example/windows/runner/win32_window.cpp new file mode 100644 index 0000000000..60608d0fe5 --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/win32_window.cpp @@ -0,0 +1,288 @@ +#include "win32_window.h" + +#include +#include + +#include "resource.h" + +namespace { + +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + } + FreeLibrary(user32_module); +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registrar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + UpdateTheme(window); + + return OnCreate(); +} + +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/pkgs/flutter_http_example/windows/runner/win32_window.h b/pkgs/flutter_http_example/windows/runner/win32_window.h new file mode 100644 index 0000000000..e901dde684 --- /dev/null +++ b/pkgs/flutter_http_example/windows/runner/win32_window.h @@ -0,0 +1,102 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates a win32 window with |title| that is positioned and sized using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_ diff --git a/pkgs/http/CHANGELOG.md b/pkgs/http/CHANGELOG.md new file mode 100644 index 0000000000..bbedcd21cc --- /dev/null +++ b/pkgs/http/CHANGELOG.md @@ -0,0 +1,255 @@ +## 1.3.0-wip + +* Fixed unintended HTML tags in doc comments. +* Switched `BrowserClient` to use Fetch API instead of `XMLHttpRequest`. + +## 1.2.2 + +* Require package `web: '>=0.5.0 <2.0.0'`. + +## 1.2.1 + +* Require Dart `^3.3` +* Require `package:web` `^0.5.0`. + +## 1.2.0 + +* Add `MockClient.pngResponse`, which makes it easier to fake image responses. +* Added the ability to fetch the URL of the response through `BaseResponseWithUrl`. +* Add the ability to get headers as a `Map` to + `BaseResponse`. + +## 1.1.2 + +* Allow `web: '>=0.3.0 <0.5.0'`. + +## 1.1.1 + +* `BrowserClient` throws `ClientException` when the `'Content-Length'` header + is invalid. +* `IOClient` trims trailing whitespace on header values. +* Require Dart 3.2 +* Browser: support Wasm by using `package:web`. + +## 1.1.0 + +* Add better error messages for `SocketException`s when using `IOClient`. +* Make `StreamedRequest.sink` a `StreamSink`. This makes `request.sink.close()` + return a `Future` instead of `void`, but the returned future should _not_ be + awaited. The Future returned from `sink.close()` may only complete after the + request has been sent. + +## 1.0.0 + +* Requires Dart 3.0 or later. +* Add `base`, `final`, and `interface` modifiers to some classes. + +## 0.13.6 + +* `BrowserClient` throws an exception if `send` is called after `close`. +* If `no_default_http_client=true` is set in the environment then disk usage + is reduced in some circumstances. +* Require Dart 2.19 + +## 0.13.5 + +* Allow async callbacks in RetryClient. +* In `MockHttpClient` use the callback returned `Response.request` instead of + the argument value to give more control to the callback. This may be breaking + for callbacks which return incomplete Responses and relied on the default. + +## 0.13.4 + +* Throw a more useful error when a client is used after it has been closed. +* Require Dart 2.14. + +## 0.13.3 + +* Validate that the `method` parameter of BaseRequest is a valid "token". + +## 0.13.2 + +* Add `package:http/retry.dart` with `RetryClient`. This is the same + implementation as `package:http_retry` which will be discontinued. + +## 0.13.1 + +* Fix code samples in `README` to pass a `Uri` instance. + +## 0.13.0 + +* Migrate to null safety. +* Add `const` constructor to `ByteStream`. +* Migrate `BrowserClient` from `blob` to `arraybuffer`. +* **Breaking** All APIs which previously allowed a `String` or `Uri` to be + passed now require a `Uri`. +* **Breaking** Added a `body` and `encoding` argument to `Client.delete`. This + is only breaking for implementations which override that method. + +## 0.12.2 + +* Fix error handler callback type for response stream errors to avoid masking + root causes. + +## 0.12.1 + +* Add `IOStreamedResponse` which includes the ability to detach the socket. + When sending a request with an `IOClient` the response will be an + `IOStreamedResponse`. +* Remove dependency on `package:async`. + +## 0.12.0+4 + +* Fix a bug setting the `'content-type'` header in `MultipartRequest`. + +## 0.12.0+3 + +* Documentation fixes. + +## 0.12.0+2 + +* Documentation fixes. + +## 0.12.0 + +### New Features + +* The regular `Client` factory constructor is now usable anywhere that `dart:io` + or `dart:html` are available, and will give you an `IoClient` or + `BrowserClient` respectively. +* The `package:http/http.dart` import is now safe to use on the web (or + anywhere that either `dart:io` or `dart:html` are available). + +### Breaking Changes + +* In order to use or reference the `IoClient` directly, you will need to import + the new `package:http/io_client.dart` import. This is typically only necessary + if you are passing a custom `HttpClient` instance to the constructor, in which + case you are already giving up support for web. + +## 0.11.3+17 + +* Use new Dart 2 constant names. This branch is only for allowing existing + code to keep running under Dart 2. + +## 0.11.3+16 + +* Stop depending on the `stack_trace` package. + +## 0.11.3+15 + +* Declare support for `async` 2.0.0. + +## 0.11.3+14 + +* Remove single quote ("'" - ASCII 39) from boundary characters. + Causes issues with Google Cloud Storage. + +## 0.11.3+13 + +* remove boundary characters that package:http_parser cannot parse. + +## 0.11.3+12 + +* Don't quote the boundary header for `MultipartRequest`. This is more + compatible with server quirks. + +## 0.11.3+11 + +* Fix the SDK constraint to only include SDK versions that support importing + `dart:io` everywhere. + +## 0.11.3+10 + +* Stop using `dart:mirrors`. + +## 0.11.3+9 + +* Remove an extra newline in multipart chunks. + +## 0.11.3+8 + +* Properly specify `Content-Transfer-Encoding` for multipart chunks. + +## 0.11.3+7 + +* Declare compatibility with `http_parser` 3.0.0. + +## 0.11.3+6 + +* Fix one more strong mode warning in `http/testing.dart`. + +## 0.11.3+5 + +* Fix some lingering strong mode warnings. + +## 0.11.3+4 + +* Fix all strong mode warnings. + +## 0.11.3+3 + +* Support `http_parser` 2.0.0. + +## 0.11.3+2 + +* Require Dart SDK >= 1.9.0 + +* Eliminate many uses of `Chain.track` from the `stack_trace` package. + +## 0.11.3+1 + +* Support `http_parser` 1.0.0. + +## 0.11.3 + +* Add a `Client.patch` shortcut method and a matching top-level `patch` method. + +## 0.11.2 + +* Add a `BrowserClient.withCredentials` property. + +## 0.11.1+3 + +* Properly namespace an internal library name. + +## 0.11.1+2 + +* Widen the version constraint on `unittest`. + +## 0.11.1+1 + +* Widen the version constraint for `stack_trace`. + +## 0.11.1 + +* Expose the `IOClient` class which wraps a `dart:io` `HttpClient`. + +## 0.11.0+1 + +* Fix a bug in handling errors in decoding XMLHttpRequest responses for + `BrowserClient`. + +## 0.11.0 + +* The package no longer depends on `dart:io`. The `BrowserClient` class in + `package:http/browser_client.dart` can now be used to make requests on the + browser. + +* Change `MultipartFile.contentType` from `dart:io`'s `ContentType` type to + `http_parser`'s `MediaType` type. + +* Exceptions are now of type `ClientException` rather than `dart:io`'s + `HttpException`. + +## 0.10.0 + +* Make `BaseRequest.contentLength` and `BaseResponse.contentLength` use `null` + to indicate an unknown content length rather than -1. + +* The `contentLength` parameter to `new BaseResponse` is now named rather than + positional. + +* Make request headers case-insensitive. + +* Make `MultipartRequest` more closely adhere to browsers' encoding conventions. diff --git a/pkgs/http/LICENSE b/pkgs/http/LICENSE new file mode 100644 index 0000000000..000cd7beca --- /dev/null +++ b/pkgs/http/LICENSE @@ -0,0 +1,27 @@ +Copyright 2014, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. diff --git a/pkgs/http/README.md b/pkgs/http/README.md new file mode 100644 index 0000000000..7cc9f43fbb --- /dev/null +++ b/pkgs/http/README.md @@ -0,0 +1,294 @@ +[![pub package](https://img.shields.io/pub/v/http.svg)](https://pub.dev/packages/http) +[![package publisher](https://img.shields.io/pub/publisher/http.svg)](https://pub.dev/packages/http/publisher) + +A composable, Future-based library for making HTTP requests. + +This package contains a set of high-level functions and classes that make it +easy to consume HTTP resources. It's multi-platform (mobile, desktop, and +browser) and supports multiple implementations. + +## Using + +The easiest way to use this library is via the top-level functions. They allow +you to make individual HTTP requests with minimal hassle: + +```dart +import 'package:http/http.dart' as http; + +var url = Uri.https('example.com', 'whatsit/create'); +var response = await http.post(url, body: {'name': 'doodle', 'color': 'blue'}); +print('Response status: ${response.statusCode}'); +print('Response body: ${response.body}'); + +print(await http.read(Uri.https('example.com', 'foobar.txt'))); +``` + +> [!NOTE] +> Flutter applications may require +> [additional configuration](https://docs.flutter.dev/data-and-backend/networking#platform-notes) +> to make HTTP requests. + +If you're making multiple requests to the same server, you can keep open a +persistent connection by using a [Client][] rather than making one-off requests. +If you do this, make sure to close the client when you're done: + +```dart +var client = http.Client(); +try { + var response = await client.post( + Uri.https('example.com', 'whatsit/create'), + body: {'name': 'doodle', 'color': 'blue'}); + var decodedResponse = jsonDecode(utf8.decode(response.bodyBytes)) as Map; + var uri = Uri.parse(decodedResponse['uri'] as String); + print(await client.get(uri)); +} finally { + client.close(); +} +``` + +> [!TIP] +> For detailed background information and practical usage examples, see: +> - [Dart Development: Fetch data from the internet](https://dart.dev/tutorials/server/fetch-data) +> - [Flutter Cookbook: Fetch data from the internet](https://docs.flutter.dev/cookbook/networking/fetch-data) +> - [The Flutter HTTP example application][flutterhttpexample] + +You can also exert more fine-grained control over your requests and responses by +creating [Request][] or [StreamedRequest][] objects yourself and passing them to +[Client.send][]. + +[Request]: https://pub.dev/documentation/http/latest/http/Request-class.html +[StreamedRequest]: https://pub.dev/documentation/http/latest/http/StreamedRequest-class.html +[Client.send]: https://pub.dev/documentation/http/latest/http/Client/send.html + +This package is designed to be composable. This makes it easy for external +libraries to work with one another to add behavior to it. Libraries wishing to +add behavior should create a subclass of [BaseClient][] that wraps another +[Client][] and adds the desired behavior: + +[BaseClient]: https://pub.dev/documentation/http/latest/http/BaseClient-class.html +[Client]: https://pub.dev/documentation/http/latest/http/Client-class.html + +```dart +class UserAgentClient extends http.BaseClient { + final String userAgent; + final http.Client _inner; + + UserAgentClient(this.userAgent, this._inner); + + Future send(http.BaseRequest request) { + request.headers['user-agent'] = userAgent; + return _inner.send(request); + } +} +``` + +## Retrying requests + +`package:http/retry.dart` provides a class [`RetryClient`][RetryClient] to wrap +an underlying [`http.Client`][Client] which transparently retries failing +requests. + +[RetryClient]: https://pub.dev/documentation/http/latest/retry/RetryClient-class.html +[Client]: https://pub.dev/documentation/http/latest/http/Client-class.html + +```dart +import 'package:http/http.dart' as http; +import 'package:http/retry.dart'; + +Future main() async { + final client = RetryClient(http.Client()); + try { + print(await client.read(Uri.http('example.org', ''))); + } finally { + client.close(); + } +} +``` + +By default, this retries any request whose response has status code 503 +Temporary Failure up to three retries. It waits 500ms before the first retry, +and increases the delay by 1.5x each time. All of this can be customized using +the [`RetryClient()`][new RetryClient] constructor. + +[new RetryClient]: https://pub.dev/documentation/http/latest/retry/RetryClient/RetryClient.html + +## Choosing an implementation + +There are multiple implementations of the `package:http` [`Client`][client] interface. By default, `package:http` uses [`BrowserClient`][browserclient] on the web and [`IOClient`][ioclient] on all other platforms. You can choose a different [`Client`][client] implementation based on the needs of your application. + +You can change implementations without changing your application code, except +for a few lines of [configuration](#2-configure-the-http-client). + +Some well-supported implementations are: + +| Implementation | Supported Platforms | SDK | Caching | HTTP3/QUIC | Platform Native | +| -------------- | ------------------- | ----| ------- | ---------- | --------------- | +| `package:http` — [`IOClient`][ioclient] | Android, iOS, Linux, macOS, Windows | Dart, Flutter | ❌ | ❌ | ❌ | +| `package:http` — [`BrowserClient`][browserclient] | Web | Dart, Flutter | ― | ✅︎ | ✅︎ | Dart, Flutter | +| [`package:cupertino_http`][cupertinohttp] — [`CupertinoClient`][cupertinoclient] | iOS, macOS | Flutter | ✅︎ | ✅︎ | ✅︎ | +| [`package:cronet_http`][cronethttp] — [`CronetClient`][cronetclient] | Android | Flutter | ✅︎ | ✅︎ | ― | +| [`package:fetch_client`][fetch] — [`FetchClient`][fetchclient] | Web | Dart, Flutter | ✅︎ | ✅︎ | ✅︎ | + +> [!TIP] +> If you are writing a Dart package or Flutter plugin that uses +> `package:http`, you should not depend on a particular [`Client`][client] +> implementation. Let the application author decide what implementation is +> best for their project. You can make that easier by accepting an explicit +> [`Client`][client] argument. For example: +> +> ```dart +> Future fetchAlbum({Client? client}) async { +> client ??= Client(); +> ... +> } +> ``` + +## Configuration + +To use an HTTP client implementation other than the default, you must: +1. Add the HTTP client as a dependency. +2. Configure the HTTP client. +3. Connect the HTTP client to the code that uses it. + +### 1. Add the HTTP client as a dependency. + +To add a package compatible with the Dart SDK to your project, use `dart pub add`. + +For example: + +```terminal +# Replace "fetch_client" with the package that you want to use. +dart pub add fetch_client +``` + +To add a package that requires the Flutter SDK, use `flutter pub add`. + +For example: + +```terminal +# Replace "cupertino_http" with the package that you want to use. +flutter pub add cupertino_http +``` + +### 2. Configure the HTTP client. + +Different `package:http` [`Client`][client] implementations may require +different configuration options. + +Add a function that returns a correctly configured [`Client`][client]. You can +return a different [`Client`][client] on different platforms. + +For example: + +```dart +Client httpClient() { + if (Platform.isAndroid) { + final engine = CronetEngine.build( + cacheMode: CacheMode.memory, + cacheMaxSize: 1000000); + return CronetClient.fromCronetEngine(engine); + } + if (Platform.isIOS || Platform.isMacOS) { + final config = URLSessionConfiguration.ephemeralSessionConfiguration() + ..cache = URLCache.withCapacity(memoryCapacity: 1000000); + return CupertinoClient.fromSessionConfiguration(config); + } + return IOClient(); +} +``` + +> [!TIP] +> [The Flutter HTTP example application][flutterhttpexample] demonstrates +> configuration best practices. + +#### Supporting browser and native + +If your application can be run in the browser and natively, you must put your +browser and native configurations in separate files and import the correct file +based on the platform. + +For example: + +```dart +// -- http_client_factory.dart +Client httpClient() { + if (Platform.isAndroid) { + return CronetClient.defaultCronetEngine(); + } + if (Platform.isIOS || Platform.isMacOS) { + return CupertinoClient.defaultSessionConfiguration(); + } + return IOClient(); +} +``` + +```dart +// -- http_client_factory_web.dart +Client httpClient() => FetchClient(); +``` + +```dart +// -- main.dart +import 'http_client_factory.dart' + if (dart.library.js_interop) 'http_client_factory_web.dart' + +// The correct `httpClient` will be available. +``` + +### 3. Connect the HTTP client to the code that uses it. + +The best way to pass [`Client`][client] to the places that use it is +explicitly through arguments. + +For example: + +```dart +void main() { + final client = httpClient(); + fetchAlbum(client, ...); +} +``` + +When using the Flutter SDK, you can use a one of many +[state management approaches][flutterstatemanagement]. + +> [!TIP] +> [The Flutter HTTP example application][flutterhttpexample] demonstrates +> how to make the configured [`Client`][client] available using +> [`package:provider`][provider] and +> [`package:http_image_provider`][http_image_provider]. + +When using the Dart SDK, you can use [`runWithClient`][runwithclient] to +ensure that the correct [`Client`][client] is used when explicit argument +passing is not an option. For example, if you depend on code that uses +top-level functions (e.g. `http.post`) or calls the +[`Client()`][clientconstructor] constructor. When an [Isolate][isolate] is +spawned, it does not inherit any variables from the calling Zone, so +`runWithClient` needs to be used in each Isolate that uses `package:http`. + +You can ensure that only the `Client` that you have explicitly configured is +used by defining `no_default_http_client=true` in the environment. This will +also allow the default `Client` implementation to be removed, resulting in +a reduced application size. + +```terminal +$ flutter build appbundle --dart-define=no_default_http_client=true ... +$ dart compile exe --define=no_default_http_client=true ... +``` + +[browserclient]: https://pub.dev/documentation/http/latest/browser_client/BrowserClient-class.html +[client]: https://pub.dev/documentation/http/latest/http/Client-class.html +[clientconstructor]: https://pub.dev/documentation/http/latest/http/Client/Client.html +[cupertinohttp]: https://pub.dev/packages/cupertino_http +[cupertinoclient]: https://pub.dev/documentation/cupertino_http/latest/cupertino_http/CupertinoClient-class.html +[cronethttp]: https://pub.dev/packages/cronet_http +[cronetclient]: https://pub.dev/documentation/cronet_http/latest/cronet_http/CronetClient-class.html +[fetch]: https://pub.dev/packages/fetch_client +[fetchclient]: https://pub.dev/documentation/fetch_client/latest/fetch_client/FetchClient-class.html +[flutterhttpexample]: https://github.com/dart-lang/http/tree/master/pkgs/flutter_http_example +[http_image_provider]: https://pub.dev/documentation/http_image_provider +[ioclient]: https://pub.dev/documentation/http/latest/io_client/IOClient-class.html +[isolate]: https://dart.dev/language/concurrency#how-isolates-work +[flutterstatemanagement]: https://docs.flutter.dev/data-and-backend/state-mgmt/options +[provider]: https://pub.dev/packages/provider +[runwithclient]: https://pub.dev/documentation/http/latest/http/runWithClient.html diff --git a/pkgs/http/example/main.dart b/pkgs/http/example/main.dart new file mode 100644 index 0000000000..34149188ba --- /dev/null +++ b/pkgs/http/example/main.dart @@ -0,0 +1,21 @@ +import 'dart:convert' as convert; + +import 'package:http/http.dart' as http; + +void main(List arguments) async { + // This example uses the Google Books API to search for books about http. + // https://developers.google.com/books/docs/overview + var url = + Uri.https('www.googleapis.com', '/books/v1/volumes', {'q': '{http}'}); + + // Await the http get response, then decode the json-formatted response. + var response = await http.get(url); + if (response.statusCode == 200) { + var jsonResponse = + convert.jsonDecode(response.body) as Map; + var itemCount = jsonResponse['totalItems']; + print('Number of books about http: $itemCount.'); + } else { + print('Request failed with status: ${response.statusCode}.'); + } +} diff --git a/pkgs/http/example/retry.dart b/pkgs/http/example/retry.dart new file mode 100644 index 0000000000..92a3fb2afc --- /dev/null +++ b/pkgs/http/example/retry.dart @@ -0,0 +1,15 @@ +// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http/http.dart' as http; +import 'package:http/retry.dart'; + +Future main() async { + final client = RetryClient(http.Client()); + try { + print(await client.read(Uri.http('example.org', ''))); + } finally { + client.close(); + } +} diff --git a/pkgs/http/lib/browser_client.dart b/pkgs/http/lib/browser_client.dart new file mode 100644 index 0000000000..2cd0e5c7a4 --- /dev/null +++ b/pkgs/http/lib/browser_client.dart @@ -0,0 +1,5 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'src/browser_client.dart' show BrowserClient; diff --git a/pkgs/http/lib/http.dart b/pkgs/http/lib/http.dart new file mode 100644 index 0000000000..317a2c17f3 --- /dev/null +++ b/pkgs/http/lib/http.dart @@ -0,0 +1,171 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// A composable, [Future]-based library for making HTTP requests. +library; + +import 'dart:convert'; +import 'dart:typed_data'; + +import 'src/client.dart'; +import 'src/exception.dart'; +import 'src/request.dart'; +import 'src/response.dart'; +import 'src/streamed_request.dart'; + +export 'src/base_client.dart'; +export 'src/base_request.dart'; +export 'src/base_response.dart' + show BaseResponse, BaseResponseWithUrl, HeadersWithSplitValues; +export 'src/byte_stream.dart'; +export 'src/client.dart' hide zoneClient; +export 'src/exception.dart'; +export 'src/multipart_file.dart'; +export 'src/multipart_request.dart'; +export 'src/request.dart'; +export 'src/response.dart'; +export 'src/streamed_request.dart'; +export 'src/streamed_response.dart' show StreamedResponse; + +/// Sends an HTTP HEAD request with the given headers to the given URL. +/// +/// This automatically initializes a new [Client] and closes that client once +/// the request is complete. If you're planning on making multiple requests to +/// the same server, you should use a single [Client] for all of those requests. +/// +/// For more fine-grained control over the request, use [Request] instead. +Future head(Uri url, {Map? headers}) => + _withClient((client) => client.head(url, headers: headers)); + +/// Sends an HTTP GET request with the given headers to the given URL. +/// +/// This automatically initializes a new [Client] and closes that client once +/// the request is complete. If you're planning on making multiple requests to +/// the same server, you should use a single [Client] for all of those requests. +/// +/// For more fine-grained control over the request, use [Request] instead. +Future get(Uri url, {Map? headers}) => + _withClient((client) => client.get(url, headers: headers)); + +/// Sends an HTTP POST request with the given headers and body to the given URL. +/// +/// [body] sets the body of the request. It can be a `String`, a `List` or +/// a `Map`. If it's a `String`, it's encoded using [encoding] +/// and used as the body of the request. The content-type of the request will +/// default to "text/plain". +/// +/// If [body] is a `List`, it's used as a list of bytes for the body of the +/// request. +/// +/// If [body] is a `Map`, it's encoded as form fields using [encoding]. The +/// content-type of the request will be set to +/// `"application/x-www-form-urlencoded"`; this cannot be overridden. +/// +/// [encoding] defaults to [utf8]. +/// +/// For more fine-grained control over the request, use [Request] or +/// [StreamedRequest] instead. +Future post(Uri url, + {Map? headers, Object? body, Encoding? encoding}) => + _withClient((client) => + client.post(url, headers: headers, body: body, encoding: encoding)); + +/// Sends an HTTP PUT request with the given headers and body to the given URL. +/// +/// [body] sets the body of the request. It can be a `String`, a `List` or +/// a `Map`. If it's a `String`, it's encoded using [encoding] +/// and used as the body of the request. The content-type of the request will +/// default to "text/plain". +/// +/// If [body] is a `List`, it's used as a list of bytes for the body of the +/// request. +/// +/// If [body] is a `Map`, it's encoded as form fields using [encoding]. The +/// content-type of the request will be set to +/// `"application/x-www-form-urlencoded"`; this cannot be overridden. +/// +/// [encoding] defaults to [utf8]. +/// +/// For more fine-grained control over the request, use [Request] or +/// [StreamedRequest] instead. +Future put(Uri url, + {Map? headers, Object? body, Encoding? encoding}) => + _withClient((client) => + client.put(url, headers: headers, body: body, encoding: encoding)); + +/// Sends an HTTP PATCH request with the given headers and body to the given +/// URL. +/// +/// [body] sets the body of the request. It can be a `String`, a `List` or +/// a `Map`. If it's a `String`, it's encoded using [encoding] +/// and used as the body of the request. The content-type of the request will +/// default to "text/plain". +/// +/// If [body] is a `List`, it's used as a list of bytes for the body of the +/// request. +/// +/// If [body] is a `Map`, it's encoded as form fields using [encoding]. The +/// content-type of the request will be set to +/// `"application/x-www-form-urlencoded"`; this cannot be overridden. +/// +/// [encoding] defaults to [utf8]. +/// +/// For more fine-grained control over the request, use [Request] or +/// [StreamedRequest] instead. +Future patch(Uri url, + {Map? headers, Object? body, Encoding? encoding}) => + _withClient((client) => + client.patch(url, headers: headers, body: body, encoding: encoding)); + +/// Sends an HTTP DELETE request with the given headers to the given URL. +/// +/// This automatically initializes a new [Client] and closes that client once +/// the request is complete. If you're planning on making multiple requests to +/// the same server, you should use a single [Client] for all of those requests. +/// +/// For more fine-grained control over the request, use [Request] instead. +Future delete(Uri url, + {Map? headers, Object? body, Encoding? encoding}) => + _withClient((client) => + client.delete(url, headers: headers, body: body, encoding: encoding)); + +/// Sends an HTTP GET request with the given headers to the given URL and +/// returns a Future that completes to the body of the response as a [String]. +/// +/// The Future will emit a [ClientException] if the response doesn't have a +/// success status code. +/// +/// This automatically initializes a new [Client] and closes that client once +/// the request is complete. If you're planning on making multiple requests to +/// the same server, you should use a single [Client] for all of those requests. +/// +/// For more fine-grained control over the request and response, use [Request] +/// instead. +Future read(Uri url, {Map? headers}) => + _withClient((client) => client.read(url, headers: headers)); + +/// Sends an HTTP GET request with the given headers to the given URL and +/// returns a Future that completes to the body of the response as a list of +/// bytes. +/// +/// The Future will emit a [ClientException] if the response doesn't have a +/// success status code. +/// +/// This automatically initializes a new [Client] and closes that client once +/// the request is complete. If you're planning on making multiple requests to +/// the same server, you should use a single [Client] for all of those requests. +/// +/// For more fine-grained control over the request and response, use [Request] +/// instead. +Future readBytes(Uri url, {Map? headers}) => + _withClient((client) => client.readBytes(url, headers: headers)); + +Future _withClient(Future Function(Client) fn) async { + var client = Client(); + try { + return await fn(client); + } finally { + client.close(); + } +} diff --git a/pkgs/http/lib/io_client.dart b/pkgs/http/lib/io_client.dart new file mode 100644 index 0000000000..4c92b94c4e --- /dev/null +++ b/pkgs/http/lib/io_client.dart @@ -0,0 +1,6 @@ +// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'src/io_client.dart' show IOClient; +export 'src/io_streamed_response.dart' show IOStreamedResponse; diff --git a/pkgs/http/lib/retry.dart b/pkgs/http/lib/retry.dart new file mode 100644 index 0000000000..dedba9a9e7 --- /dev/null +++ b/pkgs/http/lib/retry.dart @@ -0,0 +1,162 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:math' as math; + +import 'package:async/async.dart'; + +import 'http.dart'; + +/// An HTTP client wrapper that automatically retries failing requests. +/// +/// NOTE: [RetryClient] makes a copy of the request data in order to support +/// resending it. This can cause a lot of memory usage when sending a large +/// [StreamedRequest]. +final class RetryClient extends BaseClient { + /// The wrapped client. + final Client _inner; + + /// The number of times a request should be retried. + final int _retries; + + /// The callback that determines whether a request should be retried. + final FutureOr Function(BaseResponse) _when; + + /// The callback that determines whether a request when an error is thrown. + final FutureOr Function(Object, StackTrace) _whenError; + + /// The callback that determines how long to wait before retrying a request. + final Duration Function(int) _delay; + + /// The callback to call to indicate that a request is being retried. + final FutureOr Function(BaseRequest, BaseResponse?, int)? _onRetry; + + /// Creates a client wrapping [_inner] that retries HTTP requests. + /// + /// This retries a failing request [retries] times (3 by default). Note that + /// `n` retries means that the request will be sent at most `n + 1` times. + /// + /// By default, this retries requests whose responses have status code 503 + /// Temporary Failure. If [when] is passed, it retries any request for whose + /// response [when] returns `true`. If [whenError] is passed, it also retries + /// any request that throws an error for which [whenError] returns `true`. + /// + /// By default, this waits 500ms between the original request and the first + /// retry, then increases the delay by 1.5x for each subsequent retry. If + /// [delay] is passed, it's used to determine the time to wait before the + /// given (zero-based) retry. + /// + /// If [onRetry] is passed, it's called immediately before each retry so that + /// the client has a chance to perform side effects like logging. The + /// `response` parameter will be null if the request was retried due to an + /// error for which [whenError] returned `true`. + RetryClient( + this._inner, { + int retries = 3, + FutureOr Function(BaseResponse) when = _defaultWhen, + FutureOr Function(Object, StackTrace) whenError = _defaultWhenError, + Duration Function(int retryCount) delay = _defaultDelay, + FutureOr Function(BaseRequest, BaseResponse?, int retryCount)? + onRetry, + }) : _retries = retries, + _when = when, + _whenError = whenError, + _delay = delay, + _onRetry = onRetry { + RangeError.checkNotNegative(_retries, 'retries'); + } + + /// Like [RetryClient.new], but with a pre-computed list of [delays] + /// between each retry. + /// + /// This will retry a request at most `delays.length` times, using each delay + /// in order. It will wait for `delays[0]` after the initial request, + /// `delays[1]` after the first retry, and so on. + RetryClient.withDelays( + Client inner, + Iterable delays, { + FutureOr Function(BaseResponse) when = _defaultWhen, + FutureOr Function(Object, StackTrace) whenError = _defaultWhenError, + FutureOr Function(BaseRequest, BaseResponse?, int retryCount)? + onRetry, + }) : this._withDelays( + inner, + delays.toList(), + when: when, + whenError: whenError, + onRetry: onRetry, + ); + + RetryClient._withDelays( + Client inner, + List delays, { + required FutureOr Function(BaseResponse) when, + required FutureOr Function(Object, StackTrace) whenError, + required FutureOr Function(BaseRequest, BaseResponse?, int)? onRetry, + }) : this( + inner, + retries: delays.length, + delay: (retryCount) => delays[retryCount], + when: when, + whenError: whenError, + onRetry: onRetry, + ); + + @override + Future send(BaseRequest request) async { + final splitter = StreamSplitter(request.finalize()); + + var i = 0; + for (;;) { + StreamedResponse? response; + try { + response = await _inner.send(_copyRequest(request, splitter.split())); + } catch (error, stackTrace) { + if (i == _retries || !await _whenError(error, stackTrace)) rethrow; + } + + if (response != null) { + if (i == _retries || !await _when(response)) return response; + + // Make sure the response stream is listened to so that we don't leave + // dangling connections. + _unawaited(response.stream.listen((_) {}).cancel().catchError((_) {})); + } + + await Future.delayed(_delay(i)); + await _onRetry?.call(request, response, i); + i++; + } + } + + /// Returns a copy of [original] with the given [body]. + StreamedRequest _copyRequest(BaseRequest original, Stream> body) { + final request = StreamedRequest(original.method, original.url) + ..contentLength = original.contentLength + ..followRedirects = original.followRedirects + ..headers.addAll(original.headers) + ..maxRedirects = original.maxRedirects + ..persistentConnection = original.persistentConnection; + + body.listen(request.sink.add, + onError: request.sink.addError, + onDone: request.sink.close, + cancelOnError: true); + + return request; + } + + @override + void close() => _inner.close(); +} + +bool _defaultWhen(BaseResponse response) => response.statusCode == 503; + +bool _defaultWhenError(Object error, StackTrace stackTrace) => false; + +Duration _defaultDelay(int retryCount) => + const Duration(milliseconds: 500) * math.pow(1.5, retryCount); + +void _unawaited(Future? f) {} diff --git a/pkgs/http/lib/src/base_client.dart b/pkgs/http/lib/src/base_client.dart new file mode 100644 index 0000000000..48a7f92fe9 --- /dev/null +++ b/pkgs/http/lib/src/base_client.dart @@ -0,0 +1,108 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:typed_data'; + +import 'base_request.dart'; +import 'byte_stream.dart'; +import 'client.dart'; +import 'exception.dart'; +import 'request.dart'; +import 'response.dart'; +import 'streamed_response.dart'; + +/// The abstract base class for an HTTP client. +/// +/// This is a mixin-style class; subclasses only need to implement [send] and +/// maybe [close], and then they get various convenience methods for free. +abstract mixin class BaseClient implements Client { + @override + Future head(Uri url, {Map? headers}) => + _sendUnstreamed('HEAD', url, headers); + + @override + Future get(Uri url, {Map? headers}) => + _sendUnstreamed('GET', url, headers); + + @override + Future post(Uri url, + {Map? headers, Object? body, Encoding? encoding}) => + _sendUnstreamed('POST', url, headers, body, encoding); + + @override + Future put(Uri url, + {Map? headers, Object? body, Encoding? encoding}) => + _sendUnstreamed('PUT', url, headers, body, encoding); + + @override + Future patch(Uri url, + {Map? headers, Object? body, Encoding? encoding}) => + _sendUnstreamed('PATCH', url, headers, body, encoding); + + @override + Future delete(Uri url, + {Map? headers, Object? body, Encoding? encoding}) => + _sendUnstreamed('DELETE', url, headers, body, encoding); + + @override + Future read(Uri url, {Map? headers}) async { + final response = await get(url, headers: headers); + _checkResponseSuccess(url, response); + return response.body; + } + + @override + Future readBytes(Uri url, {Map? headers}) async { + final response = await get(url, headers: headers); + _checkResponseSuccess(url, response); + return response.bodyBytes; + } + + /// Sends an HTTP request and asynchronously returns the response. + /// + /// Implementers should call [BaseRequest.finalize] to get the body of the + /// request as a [ByteStream]. They shouldn't make any assumptions about the + /// state of the stream; it could have data written to it asynchronously at a + /// later point, or it could already be closed when it's returned. Any + /// internal HTTP errors should be wrapped as [ClientException]s. + @override + Future send(BaseRequest request); + + /// Sends a non-streaming [Request] and returns a non-streaming [Response]. + Future _sendUnstreamed( + String method, Uri url, Map? headers, + [Object? body, Encoding? encoding]) async { + var request = Request(method, url); + + if (headers != null) request.headers.addAll(headers); + if (encoding != null) request.encoding = encoding; + if (body != null) { + if (body is String) { + request.body = body; + } else if (body is List) { + request.bodyBytes = body.cast(); + } else if (body is Map) { + request.bodyFields = body.cast(); + } else { + throw ArgumentError('Invalid request body "$body".'); + } + } + + return Response.fromStream(await send(request)); + } + + /// Throws an error if [response] is not successful. + void _checkResponseSuccess(Uri url, Response response) { + if (response.statusCode < 400) return; + var message = 'Request to $url failed with status ${response.statusCode}'; + if (response.reasonPhrase != null) { + message = '$message: ${response.reasonPhrase}'; + } + throw ClientException('$message.', url); + } + + @override + void close() {} +} diff --git a/pkgs/http/lib/src/base_request.dart b/pkgs/http/lib/src/base_request.dart new file mode 100644 index 0000000000..4b165c7587 --- /dev/null +++ b/pkgs/http/lib/src/base_request.dart @@ -0,0 +1,168 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:collection'; + +import 'package:meta/meta.dart'; + +import '../http.dart' show ClientException, get; +import 'base_client.dart'; +import 'base_response.dart'; +import 'byte_stream.dart'; +import 'client.dart'; +import 'streamed_response.dart'; +import 'utils.dart'; + +/// The base class for HTTP requests. +/// +/// Subclasses of [BaseRequest] can be constructed manually and passed to +/// [BaseClient.send], which allows the user to provide fine-grained control +/// over the request properties. However, usually it's easier to use convenience +/// methods like [get] or [BaseClient.get]. +abstract class BaseRequest { + /// The HTTP method of the request. + /// + /// Most commonly "GET" or "POST", less commonly "HEAD", "PUT", or "DELETE". + /// Non-standard method names are also supported. + final String method; + + /// The URL to which the request will be sent. + final Uri url; + + /// The size of the request body, in bytes. + /// + /// This defaults to `null`, which indicates that the size of the request is + /// not known in advance. May not be assigned a negative value. + int? get contentLength => _contentLength; + int? _contentLength; + + set contentLength(int? value) { + if (value != null && value < 0) { + throw ArgumentError('Invalid content length $value.'); + } + _checkFinalized(); + _contentLength = value; + } + + /// Whether a persistent connection should be maintained with the server. + /// + /// Defaults to true. + bool get persistentConnection => _persistentConnection; + bool _persistentConnection = true; + + set persistentConnection(bool value) { + _checkFinalized(); + _persistentConnection = value; + } + + /// Whether the client should follow redirects while resolving this request. + /// + /// Defaults to true. + bool get followRedirects => _followRedirects; + bool _followRedirects = true; + + set followRedirects(bool value) { + _checkFinalized(); + _followRedirects = value; + } + + /// The maximum number of redirects to follow when [followRedirects] is true. + /// + /// If this number is exceeded the [BaseResponse] future will signal a + /// [ClientException]. Defaults to 5. + int get maxRedirects => _maxRedirects; + int _maxRedirects = 5; + + set maxRedirects(int value) { + _checkFinalized(); + _maxRedirects = value; + } + + // TODO(nweiz): automatically parse cookies from headers + + // TODO(nweiz): make this a HttpHeaders object + final Map headers; + + /// Whether [finalize] has been called. + bool get finalized => _finalized; + bool _finalized = false; + + static final _tokenRE = RegExp(r"^[\w!#%&'*+\-.^`|~]+$"); + static String _validateMethod(String method) { + if (!_tokenRE.hasMatch(method)) { + throw ArgumentError.value(method, 'method', 'Not a valid method'); + } + return method; + } + + BaseRequest(String method, this.url) + : method = _validateMethod(method), + headers = LinkedHashMap( + equals: (key1, key2) => key1.toLowerCase() == key2.toLowerCase(), + hashCode: (key) => key.toLowerCase().hashCode); + + /// Finalizes the HTTP request in preparation for it being sent. + /// + /// Freezes all mutable fields and returns a single-subscription [ByteStream] + /// that emits the body of the request. + /// + /// The base implementation of this returns an empty [ByteStream]; + /// subclasses are responsible for creating the return value, which should be + /// single-subscription to ensure that no data is dropped. They should also + /// freeze any additional mutable fields they add that don't make sense to + /// change after the request headers are sent. + @mustCallSuper + ByteStream finalize() { + // TODO(nweiz): freeze headers + if (finalized) throw StateError("Can't finalize a finalized Request."); + _finalized = true; + return const ByteStream(Stream.empty()); + } + + /// Sends this request. + /// + /// This automatically initializes a new [Client] and closes that client once + /// the request is complete. If you're planning on making multiple requests to + /// the same server, you should use a single [Client] for all of those + /// requests. + Future send() async { + var client = Client(); + + try { + var response = await client.send(this); + var stream = onDone(response.stream, client.close); + + if (response case BaseResponseWithUrl(:final url)) { + return StreamedResponseV2(ByteStream(stream), response.statusCode, + contentLength: response.contentLength, + request: response.request, + headers: response.headers, + isRedirect: response.isRedirect, + url: url, + persistentConnection: response.persistentConnection, + reasonPhrase: response.reasonPhrase); + } else { + return StreamedResponse(ByteStream(stream), response.statusCode, + contentLength: response.contentLength, + request: response.request, + headers: response.headers, + isRedirect: response.isRedirect, + persistentConnection: response.persistentConnection, + reasonPhrase: response.reasonPhrase); + } + } catch (_) { + client.close(); + rethrow; + } + } + + /// Throws an error if this request has been finalized. + void _checkFinalized() { + if (!finalized) return; + throw StateError("Can't modify a finalized Request."); + } + + @override + String toString() => '$method $url'; +} diff --git a/pkgs/http/lib/src/base_response.dart b/pkgs/http/lib/src/base_response.dart new file mode 100644 index 0000000000..39934ceea9 --- /dev/null +++ b/pkgs/http/lib/src/base_response.dart @@ -0,0 +1,172 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'base_client.dart'; +import 'base_request.dart'; +import 'client.dart'; +import 'response.dart'; +import 'streamed_response.dart'; + +/// The base class for HTTP responses. +/// +/// Subclasses of [BaseResponse] are usually not constructed manually; instead, +/// they're returned by [BaseClient.send] or other HTTP client methods. +abstract class BaseResponse { + /// The (frozen) request that triggered this response. + final BaseRequest? request; + + /// The HTTP status code for this response. + final int statusCode; + + /// The reason phrase associated with the status code. + final String? reasonPhrase; + + /// The size of the response body, in bytes. + /// + /// If the size of the request is not known in advance, this is `null`. + final int? contentLength; + + // TODO(nweiz): automatically parse cookies from headers + + /// The HTTP headers returned by the server. + /// + /// The header names are converted to lowercase and stored with their + /// associated header values. + /// + /// If the server returns multiple headers with the same name then the header + /// values will be associated with a single key and seperated by commas and + /// possibly whitespace. For example: + /// ```dart + /// // HTTP/1.1 200 OK + /// // Fruit: Apple + /// // Fruit: Banana + /// // Fruit: Grape + /// final values = response.headers['fruit']!.split(RegExp(r'\s*,\s*')); + /// // values = ['Apple', 'Banana', 'Grape'] + /// ``` + /// + /// To retrieve the header values as a `List`, use + /// [HeadersWithSplitValues.headersSplitValues]. + /// + /// If a header value contains whitespace then that whitespace may be replaced + /// by a single space. Leading and trailing whitespace in header values are + /// always removed. + final Map headers; + + final bool isRedirect; + + /// Whether the server requested that a persistent connection be maintained. + final bool persistentConnection; + + BaseResponse(this.statusCode, + {this.contentLength, + this.request, + this.headers = const {}, + this.isRedirect = false, + this.persistentConnection = true, + this.reasonPhrase}) { + if (statusCode < 100) { + throw ArgumentError('Invalid status code $statusCode.'); + } else if (contentLength != null && contentLength! < 0) { + throw ArgumentError('Invalid content length $contentLength.'); + } + } +} + +/// A [BaseResponse] with a [url] field. +/// +/// [Client] methods that return a [BaseResponse] subclass, such as [Response] +/// or [StreamedResponse], **may** return a [BaseResponseWithUrl]. +/// +/// For example: +/// +/// ```dart +/// final client = Client(); +/// final response = client.get(Uri.https('example.com', '/')); +/// Uri? finalUri; +/// if (response case BaseResponseWithUrl(:final url)) { +/// finalUri = url; +/// } +/// // Do something with `finalUri`. +/// client.close(); +/// ``` +/// +/// [url] will be added to [BaseResponse] when `package:http` version 2 is +/// released and this mixin will be deprecated. +abstract interface class BaseResponseWithUrl implements BaseResponse { + /// The [Uri] of the response returned by the server. + /// + /// If no redirects were followed, [url] will be the same as the requested + /// [Uri]. + /// + /// If redirects were followed, [url] will be the [Uri] of the last redirect + /// that was followed. + abstract final Uri url; +} + +/// "token" as defined in RFC 2616, 2.2 +/// See https://datatracker.ietf.org/doc/html/rfc2616#section-2.2 +const _tokenChars = r"!#$%&'*+\-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`" + 'abcdefghijklmnopqrstuvwxyz|~'; + +/// Splits comma-seperated header values. +var _headerSplitter = RegExp(r'[ \t]*,[ \t]*'); + +/// Splits comma-seperated "Set-Cookie" header values. +/// +/// Set-Cookie strings can contain commas. In particular, the following +/// productions defined in RFC-6265, section 4.1.1: +/// - `` e.g. "Expires=Sun, 06 Nov 1994 08:49:37 GMT" +/// - `` e.g. "Path=somepath," +/// - `` e.g. "AnyString,Really," +/// +/// Some values are ambiguous e.g. +/// "Set-Cookie: lang=en; Path=/foo/" +/// "Set-Cookie: SID=x23" +/// and: +/// "Set-Cookie: lang=en; Path=/foo/,SID=x23" +/// would both be result in `response.headers` => "lang=en; Path=/foo/,SID=x23" +/// +/// The idea behind this regex is that `,=` is more likely to +/// start a new `` than be part of `` or +/// ``. +/// +/// See https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1 +var _setCookieSplitter = RegExp(r'[ \t]*,[ \t]*(?=[' + _tokenChars + r']+=)'); + +extension HeadersWithSplitValues on BaseResponse { + /// The HTTP headers returned by the server. + /// + /// The header names are converted to lowercase and stored with their + /// associated header values. + /// + /// Cookies can be parsed using the dart:io `Cookie` class: + /// + /// ```dart + /// import "dart:io"; + /// import "package:http/http.dart"; + /// + /// void main() async { + /// final response = await Client().get(Uri.https('example.com', '/')); + /// final cookies = [ + /// for (var value i + /// in response.headersSplitValues['set-cookie'] ?? []) + /// Cookie.fromSetCookieValue(value) + /// ]; + Map> get headersSplitValues { + var headersWithFieldLists = >{}; + headers.forEach((key, value) { + if (!value.contains(',')) { + headersWithFieldLists[key] = [value]; + } else { + if (key == 'set-cookie') { + headersWithFieldLists[key] = value.split(_setCookieSplitter); + } else { + headersWithFieldLists[key] = value.split(_headerSplitter); + } + } + }); + return headersWithFieldLists; + } +} diff --git a/pkgs/http/lib/src/boundary_characters.dart b/pkgs/http/lib/src/boundary_characters.dart new file mode 100644 index 0000000000..5dcc6013c1 --- /dev/null +++ b/pkgs/http/lib/src/boundary_characters.dart @@ -0,0 +1,80 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// All character codes that are valid in multipart boundaries. +/// +/// This is the intersection of the characters allowed in the `bcharsnospace` +/// production defined in [RFC 2046][] and those allowed in the `token` +/// production defined in [RFC 1521][]. +/// +/// [RFC 2046]: http://tools.ietf.org/html/rfc2046#section-5.1.1. +/// [RFC 1521]: https://tools.ietf.org/html/rfc1521#section-4 +const List boundaryCharacters = [ + 43, + 95, + 45, + 46, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122 +]; diff --git a/pkgs/http/lib/src/browser_client.dart b/pkgs/http/lib/src/browser_client.dart new file mode 100644 index 0000000000..f19bddb464 --- /dev/null +++ b/pkgs/http/lib/src/browser_client.dart @@ -0,0 +1,186 @@ +// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:js_interop'; + +import 'package:web/web.dart' + show + AbortController, + HeadersInit, + ReadableStreamDefaultReader, + RequestInit, + Response, + window; + +import 'base_client.dart'; +import 'base_request.dart'; +import 'exception.dart'; +import 'streamed_response.dart'; + +/// Create a [BrowserClient]. +/// +/// Used from conditional imports, matches the definition in `client_stub.dart`. +BaseClient createClient() { + if (const bool.fromEnvironment('no_default_http_client')) { + throw StateError('no_default_http_client was defined but runWithClient ' + 'was not used to configure a Client implementation.'); + } + return BrowserClient(); +} + +/// A `package:web`-based HTTP client that runs in the browser and is backed by +/// [`window.fetch`](https://fetch.spec.whatwg.org/). +/// +/// This client inherits some limitations of `window.fetch`: +/// +/// - [BaseRequest.persistentConnection] is ignored; +/// - Setting [BaseRequest.followRedirects] to `false` will cause +/// [ClientException] when a redirect is encountered; +/// - The value of [BaseRequest.maxRedirects] is ignored. +/// +/// Responses are streamed but requests are not. A request will only be sent +/// once all the data is available. +class BrowserClient extends BaseClient { + final _abortController = AbortController(); + + /// Whether to send credentials such as cookies or authorization headers for + /// cross-site requests. + /// + /// Defaults to `false`. + bool withCredentials = false; + + bool _isClosed = false; + + /// Sends an HTTP request and asynchronously returns the response. + @override + Future send(BaseRequest request) async { + if (_isClosed) { + throw ClientException( + 'HTTP request failed. Client is already closed.', request.url); + } + + final bodyBytes = await request.finalize().toBytes(); + try { + final response = await window + .fetch( + '${request.url}'.toJS, + RequestInit( + method: request.method, + body: bodyBytes.isNotEmpty ? bodyBytes.toJS : null, + credentials: withCredentials ? 'include' : 'same-origin', + headers: { + if (request.contentLength case final contentLength?) + 'content-length': contentLength, + for (var header in request.headers.entries) + header.key: header.value, + }.jsify()! as HeadersInit, + signal: _abortController.signal, + redirect: request.followRedirects ? 'follow' : 'error', + ), + ) + .toDart; + + final contentLengthHeader = response.headers.get('content-length'); + + final contentLength = contentLengthHeader != null + ? int.tryParse(contentLengthHeader) + : null; + + if (contentLength == null && contentLengthHeader != null) { + throw ClientException( + 'Invalid content-length header [$contentLengthHeader].', + request.url, + ); + } + + final headers = {}; + (response.headers as _IterableHeaders) + .forEach((String value, String header, [JSAny? _]) { + headers[header.toLowerCase()] = value; + }.toJS); + + return StreamedResponseV2( + _readBody(request, response), + response.status, + headers: headers, + request: request, + contentLength: contentLength, + url: Uri.parse(response.url), + reasonPhrase: response.statusText, + ); + } catch (e, st) { + _rethrowAsClientException(e, st, request); + } + } + + /// Closes the client. + /// + /// This terminates all active requests. + @override + void close() { + _isClosed = true; + _abortController.abort(); + } +} + +Never _rethrowAsClientException(Object e, StackTrace st, BaseRequest request) { + if (e is! ClientException) { + var message = e.toString(); + if (message.startsWith('TypeError: ')) { + message = message.substring('TypeError: '.length); + } + e = ClientException(message, request.url); + } + Error.throwWithStackTrace(e, st); +} + +Stream> _readBody(BaseRequest request, Response response) async* { + final bodyStreamReader = + response.body?.getReader() as ReadableStreamDefaultReader?; + + if (bodyStreamReader == null) { + return; + } + + var isDone = false, isError = false; + try { + while (true) { + final chunk = await bodyStreamReader.read().toDart; + if (chunk.done) { + isDone = true; + break; + } + yield (chunk.value! as JSUint8Array).toDart; + } + } catch (e, st) { + isError = true; + _rethrowAsClientException(e, st, request); + } finally { + if (!isDone) { + try { + // catchError here is a temporary workaround for + // http://dartbug.com/57046: an exception from cancel() will + // clobber an exception which is currently in flight. + await bodyStreamReader + .cancel() + .toDart + .catchError((_) => null, test: (_) => isError); + } catch (e, st) { + // If we have already encountered an error swallow the + // error from cancel and simply let the original error to be + // rethrown. + if (!isError) { + _rethrowAsClientException(e, st, request); + } + } + } + } +} + +/// Workaround for `Headers` not providing a way to iterate the headers. +@JS() +extension type _IterableHeaders._(JSObject _) implements JSObject { + external void forEach(JSFunction fn); +} diff --git a/pkgs/http/lib/src/byte_stream.dart b/pkgs/http/lib/src/byte_stream.dart new file mode 100644 index 0000000000..d8ae4dc4d2 --- /dev/null +++ b/pkgs/http/lib/src/byte_stream.dart @@ -0,0 +1,37 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +/// A stream of chunks of bytes representing a single piece of data. +final class ByteStream extends StreamView> { + const ByteStream(super.stream); + + /// Returns a single-subscription byte stream that will emit the given bytes + /// in a single chunk. + factory ByteStream.fromBytes(List bytes) => + ByteStream(Stream.value(bytes)); + + /// Collects the data of this stream in a [Uint8List]. + Future toBytes() { + var completer = Completer(); + var sink = ByteConversionSink.withCallback( + (bytes) => completer.complete(Uint8List.fromList(bytes))); + listen(sink.add, + onError: completer.completeError, + onDone: sink.close, + cancelOnError: true); + return completer.future; + } + + /// Collect the data of this stream in a [String], decoded according to + /// [encoding], which defaults to `UTF8`. + Future bytesToString([Encoding encoding = utf8]) => + encoding.decodeStream(this); + + Stream toStringStream([Encoding encoding = utf8]) => + encoding.decoder.bind(this); +} diff --git a/pkgs/http/lib/src/client.dart b/pkgs/http/lib/src/client.dart new file mode 100644 index 0000000000..8ee554a241 --- /dev/null +++ b/pkgs/http/lib/src/client.dart @@ -0,0 +1,232 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:meta/meta.dart'; + +import '../http.dart' as http; +import 'base_client.dart'; +import 'base_request.dart'; +import 'client_stub.dart' + if (dart.library.js_interop) 'browser_client.dart' + if (dart.library.io) 'io_client.dart'; +import 'exception.dart'; +import 'response.dart'; +import 'streamed_response.dart'; + +/// The interface for HTTP clients that take care of maintaining persistent +/// connections across multiple requests to the same server. +/// +/// If you only need to send a single request, it's usually easier to use +/// [http.head], [http.get], [http.post], [http.put], [http.patch], or +/// [http.delete] instead. +/// +/// All methods will emit a [ClientException] if there is a transport-level +/// failure when communication with the server. For example, if the server could +/// not be reached. +/// +/// When creating an HTTP client class with additional functionality, you must +/// extend [BaseClient] rather than [Client]. In most cases, you can wrap +/// another instance of [Client] and add functionality on top of that. This +/// allows all classes implementing [Client] to be mutually composable. +abstract interface class Client { + /// Creates a new platform appropriate client. + /// + /// Creates an `IOClient` if `dart:io` is available and a `BrowserClient` if + /// `dart:js_interop` is available, otherwise it will throw an unsupported + /// error. + factory Client() => zoneClient ?? createClient(); + + /// Sends an HTTP HEAD request with the given headers to the given URL. + /// + /// For more fine-grained control over the request, use [send] instead. + Future head(Uri url, {Map? headers}); + + /// Sends an HTTP GET request with the given headers to the given URL. + /// + /// For more fine-grained control over the request, use [send] instead. + Future get(Uri url, {Map? headers}); + + /// Sends an HTTP POST request with the given headers and body to the given + /// URL. + /// + /// [body] sets the body of the request. It can be a `String`, a `List` + /// or a `Map`. + /// + /// If [body] is a `String`, it's encoded using [encoding] and used as the + /// body of the request. The content-type of the request will default to + /// "text/plain". + /// + /// If [body] is a `List`, it's used as a list of bytes for the body of the + /// request. + /// + /// If [body] is a `Map`, it's encoded as form fields using [encoding]. The + /// content-type of the request will be set to + /// `"application/x-www-form-urlencoded"`; this cannot be overridden. + /// + /// [encoding] defaults to [utf8]. + /// + /// For more fine-grained control over the request, use [send] instead. + Future post(Uri url, + {Map? headers, Object? body, Encoding? encoding}); + + /// Sends an HTTP PUT request with the given headers and body to the given + /// URL. + /// + /// [body] sets the body of the request. It can be a `String`, a `List` + /// or a `Map`. If it's a `String`, it's encoded using + /// [encoding] and used as the body of the request. The content-type of the + /// request will default to "text/plain". + /// + /// If [body] is a `List`, it's used as a list of bytes for the body of the + /// request. + /// + /// If [body] is a `Map`, it's encoded as form fields using [encoding]. The + /// content-type of the request will be set to + /// `"application/x-www-form-urlencoded"`; this cannot be overridden. + /// + /// [encoding] defaults to [utf8]. + /// + /// For more fine-grained control over the request, use [send] instead. + Future put(Uri url, + {Map? headers, Object? body, Encoding? encoding}); + + /// Sends an HTTP PATCH request with the given headers and body to the given + /// URL. + /// + /// [body] sets the body of the request. It can be a `String`, a `List` + /// or a `Map`. If it's a `String`, it's encoded using + /// [encoding] and used as the body of the request. The content-type of the + /// request will default to "text/plain". + /// + /// If [body] is a `List`, it's used as a list of bytes for the body of the + /// request. + /// + /// If [body] is a `Map`, it's encoded as form fields using [encoding]. The + /// content-type of the request will be set to + /// `"application/x-www-form-urlencoded"`; this cannot be overridden. + /// + /// [encoding] defaults to [utf8]. + /// + /// For more fine-grained control over the request, use [send] instead. + Future patch(Uri url, + {Map? headers, Object? body, Encoding? encoding}); + + /// Sends an HTTP DELETE request with the given headers to the given URL. + /// + /// For more fine-grained control over the request, use [send] instead. + Future delete(Uri url, + {Map? headers, Object? body, Encoding? encoding}); + + /// Sends an HTTP GET request with the given headers to the given URL and + /// returns a Future that completes to the body of the response as a String. + /// + /// The Future will emit a [ClientException] if the response doesn't have a + /// success status code. + /// + /// For more fine-grained control over the request and response, use [send] or + /// [get] instead. + Future read(Uri url, {Map? headers}); + + /// Sends an HTTP GET request with the given headers to the given URL and + /// returns a Future that completes to the body of the response as a list of + /// bytes. + /// + /// The Future will emit a [ClientException] if the response doesn't have a + /// success status code. + /// + /// For more fine-grained control over the request and response, use [send] or + /// [get] instead. + Future readBytes(Uri url, {Map? headers}); + + /// Sends an HTTP request and asynchronously returns the response. + Future send(BaseRequest request); + + /// Closes the client and cleans up any resources associated with it. + /// + /// Some clients maintain a pool of network connections that will not be + /// disconnected until the client is closed. This may cause programs using + /// using the Dart SDK (`dart run`, `dart test`, `dart compile`, etc.) to + /// not terminate until the client is closed. Programs run using the Flutter + /// SDK can still terminate even with an active connection pool. + /// + /// Once [close] is called, no other methods should be called. If [close] is + /// called while other asynchronous methods are running, the behavior is + /// undefined. + void close(); +} + +/// The [Client] for the current [Zone], if one has been set. +/// +/// NOTE: This property is explicitly hidden from the public API. +@internal +Client? get zoneClient { + final client = Zone.current[#_clientToken]; + return client == null ? null : (client as Client Function())(); +} + +/// Runs [body] in its own [Zone] with the [Client] returned by [clientFactory] +/// set as the default [Client]. +/// +/// For example: +/// +/// ``` +/// class MyAndroidHttpClient extends BaseClient { +/// @override +/// Future send(http.BaseRequest request) { +/// // your implementation here +/// } +/// } +/// +/// void main() { +/// var clientFactory = Client.new; // Constructs the default client. +/// if (Platform.isAndroid) { +/// clientFactory = MyAndroidHttpClient.new; +/// } +/// runWithClient(myFunction, clientFactory); +/// } +/// +/// void myFunction() { +/// // Uses the `Client` configured in `main`. +/// final response = await get(Uri.https('www.example.com', '')); +/// final client = Client(); +/// } +/// ``` +/// +/// The [Client] returned by [clientFactory] is used by the [Client.new] factory +/// and the convenience HTTP functions (e.g. [http.get]). If [clientFactory] +/// returns `Client()` then the default [Client] is used. +/// +/// Only fresh `Client` instances using the default constructor are impacted. +/// HTTP requests made using `dart:io` or `dart:html` APIs, +/// or using specifically instantiated client implementations, are not affected. +/// +/// If [runWithClient] is used and the environment defines +/// `no_default_http_client=true` then generated binaries may be smaller e.g. +/// ```shell +/// $ dart compile exe --define=no_default_http_client=true ... +/// ``` +/// +/// If `no_default_http_client=true` is set then any call to the [Client] +/// factory (i.e. `Client()`) outside of the [Zone] created by [runWithClient] +/// will throw [StateError]. +/// +/// > [!IMPORTANT] +/// > Flutter does not guarantee that callbacks are executed in a particular +/// > [Zone]. +/// > +/// > Instead of using [runWithClient], Flutter developers can use a framework, +/// > such as [`package:provider`](https://pub.dev/packages/provider), to make +/// > a [Client] available throughout their applications. +/// > +/// > See the +/// > [Flutter Http Example](https://github.com/dart-lang/http/tree/master/pkgs/flutter_http_example). +R runWithClient(R Function() body, Client Function() clientFactory, + {ZoneSpecification? zoneSpecification}) => + runZoned(body, + zoneValues: {#_clientToken: Zone.current.bindCallback(clientFactory)}, + zoneSpecification: zoneSpecification); diff --git a/pkgs/http/lib/src/client_stub.dart b/pkgs/http/lib/src/client_stub.dart new file mode 100644 index 0000000000..6384fd0a3f --- /dev/null +++ b/pkgs/http/lib/src/client_stub.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'base_client.dart'; + +/// Implemented in `browser_client.dart` and `io_client.dart`. +BaseClient createClient() => throw UnsupportedError( + 'Cannot create a client without dart:js_interop or dart:io.'); diff --git a/pkgs/http/lib/src/exception.dart b/pkgs/http/lib/src/exception.dart new file mode 100644 index 0000000000..5d47155f30 --- /dev/null +++ b/pkgs/http/lib/src/exception.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// An exception caused by an error in a pkg/http client. +class ClientException implements Exception { + final String message; + + /// The URL of the HTTP request or response that failed. + final Uri? uri; + + ClientException(this.message, [this.uri]); + + @override + String toString() { + if (uri != null) { + return 'ClientException: $message, uri=$uri'; + } else { + return 'ClientException: $message'; + } + } +} diff --git a/pkgs/http/lib/src/io_client.dart b/pkgs/http/lib/src/io_client.dart new file mode 100644 index 0000000000..fe4834bb24 --- /dev/null +++ b/pkgs/http/lib/src/io_client.dart @@ -0,0 +1,171 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'base_client.dart'; +import 'base_request.dart'; +import 'base_response.dart'; +import 'client.dart'; +import 'exception.dart'; +import 'io_streamed_response.dart'; + +/// Create an [IOClient]. +/// +/// Used from conditional imports, matches the definition in `client_stub.dart`. +BaseClient createClient() { + if (const bool.fromEnvironment('no_default_http_client')) { + throw StateError('no_default_http_client was defined but runWithClient ' + 'was not used to configure a Client implementation.'); + } + return IOClient(); +} + +/// Exception thrown when the underlying [HttpClient] throws a +/// [SocketException]. +/// +/// Implements [SocketException] to avoid breaking existing users of +/// [IOClient] that may catch that exception. +class _ClientSocketException extends ClientException + implements SocketException { + final SocketException cause; + _ClientSocketException(SocketException e, Uri uri) + : cause = e, + super(e.message, uri); + + @override + InternetAddress? get address => cause.address; + + @override + OSError? get osError => cause.osError; + + @override + int? get port => cause.port; + + @override + String toString() => 'ClientException with $cause, uri=$uri'; +} + +class _IOStreamedResponseV2 extends IOStreamedResponse + implements BaseResponseWithUrl { + @override + final Uri url; + + _IOStreamedResponseV2(super.stream, super.statusCode, + {required this.url, + super.contentLength, + super.request, + super.headers, + super.isRedirect, + super.persistentConnection, + super.reasonPhrase, + super.inner}); +} + +/// A `dart:io`-based HTTP [Client]. +/// +/// If there is a socket-level failure when communicating with the server +/// (for example, if the server could not be reached), [IOClient] will emit a +/// [ClientException] that also implements [SocketException]. This allows +/// callers to get more detailed exception information for socket-level +/// failures, if desired. +/// +/// For example: +/// ```dart +/// final client = http.Client(); +/// late String data; +/// try { +/// data = await client.read(Uri.https('example.com', '')); +/// } on SocketException catch (e) { +/// // Exception is transport-related, check `e.osError` for more details. +/// } on http.ClientException catch (e) { +/// // Exception is HTTP-related (e.g. the server returned a 404 status code). +/// // If the handler for `SocketException` were removed then all exceptions +/// // would be caught by this handler. +/// } +/// ``` +class IOClient extends BaseClient { + /// The underlying `dart:io` HTTP client. + HttpClient? _inner; + + /// Create a new `dart:io`-based HTTP [Client]. + /// + /// If [inner] is provided then it can be used to provide configuration + /// options for the client. + /// + /// For example: + /// ```dart + /// final httpClient = HttpClient() + /// ..userAgent = 'Book Agent' + /// ..idleTimeout = const Duration(seconds: 5); + /// final client = IOClient(httpClient); + /// ``` + IOClient([HttpClient? inner]) : _inner = inner ?? HttpClient(); + + /// Sends an HTTP request and asynchronously returns the response. + @override + Future send(BaseRequest request) async { + if (_inner == null) { + throw ClientException( + 'HTTP request failed. Client is already closed.', request.url); + } + + var stream = request.finalize(); + + try { + var ioRequest = (await _inner!.openUrl(request.method, request.url)) + ..followRedirects = request.followRedirects + ..maxRedirects = request.maxRedirects + ..contentLength = (request.contentLength ?? -1) + ..persistentConnection = request.persistentConnection; + request.headers.forEach((name, value) { + ioRequest.headers.set(name, value); + }); + + var response = await stream.pipe(ioRequest) as HttpClientResponse; + + var headers = {}; + response.headers.forEach((key, values) { + // TODO: Remove trimRight() when + // https://github.com/dart-lang/sdk/issues/53005 is resolved and the + // package:http SDK constraint requires that version or later. + headers[key] = values.map((value) => value.trimRight()).join(','); + }); + + return _IOStreamedResponseV2( + response.handleError((Object error) { + final httpException = error as HttpException; + throw ClientException(httpException.message, httpException.uri); + }, test: (error) => error is HttpException), + response.statusCode, + contentLength: + response.contentLength == -1 ? null : response.contentLength, + request: request, + headers: headers, + isRedirect: response.isRedirect, + url: response.redirects.isNotEmpty + ? response.redirects.last.location + : request.url, + persistentConnection: response.persistentConnection, + reasonPhrase: response.reasonPhrase, + inner: response); + } on SocketException catch (error) { + throw _ClientSocketException(error, request.url); + } on HttpException catch (error) { + throw ClientException(error.message, error.uri); + } + } + + /// Closes the client. + /// + /// Terminates all active connections. If a client remains unclosed, the Dart + /// process may not terminate. + @override + void close() { + if (_inner != null) { + _inner!.close(force: true); + _inner = null; + } + } +} diff --git a/pkgs/http/lib/src/io_streamed_response.dart b/pkgs/http/lib/src/io_streamed_response.dart new file mode 100644 index 0000000000..95b818c2b3 --- /dev/null +++ b/pkgs/http/lib/src/io_streamed_response.dart @@ -0,0 +1,33 @@ +// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'streamed_response.dart'; + +/// An HTTP response where the response body is received asynchronously after +/// the headers have been received. +class IOStreamedResponse extends StreamedResponse { + final HttpClientResponse? _inner; + + /// Creates a new streaming response. + /// + /// [stream] should be a single-subscription stream. + /// + /// If [inner] is not provided, [detachSocket] will throw. + IOStreamedResponse(super.stream, super.statusCode, + {super.contentLength, + super.request, + super.headers, + super.isRedirect, + super.persistentConnection, + super.reasonPhrase, + HttpClientResponse? inner}) + : _inner = inner; + + /// Detaches the underlying socket from the HTTP server. + /// + /// Will throw if `inner` was not set or `null` when `this` was created. + Future detachSocket() async => _inner!.detachSocket(); +} diff --git a/pkgs/http/lib/src/mock_client.dart b/pkgs/http/lib/src/mock_client.dart new file mode 100644 index 0000000000..52f108a577 --- /dev/null +++ b/pkgs/http/lib/src/mock_client.dart @@ -0,0 +1,102 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'base_client.dart'; +import 'base_request.dart'; +import 'byte_stream.dart'; +import 'request.dart'; +import 'response.dart'; +import 'streamed_request.dart'; +import 'streamed_response.dart'; + +final _pngImageData = base64Decode( + 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDw' + 'AEhQGAhKmMIQAAAABJRU5ErkJggg==', +); + +// TODO(nweiz): once Dart has some sort of Rack- or WSGI-like standard for +// server APIs, MockClient should conform to it. + +/// A mock HTTP client designed for use when testing code that uses +/// [BaseClient]. +/// +/// This client allows you to define a handler callback for all requests that +/// are made through it so that you can mock a server without having to send +/// real HTTP requests. +class MockClient extends BaseClient { + /// The handler for receiving [StreamedRequest]s and sending + /// [StreamedResponse]s. + final MockClientStreamHandler _handler; + + MockClient._(this._handler); + + /// Creates a [MockClient] with a handler that receives [Request]s and sends + /// [Response]s. + MockClient(MockClientHandler fn) + : this._((baseRequest, bodyStream) async { + final bodyBytes = await bodyStream.toBytes(); + var request = Request(baseRequest.method, baseRequest.url) + ..persistentConnection = baseRequest.persistentConnection + ..followRedirects = baseRequest.followRedirects + ..maxRedirects = baseRequest.maxRedirects + ..headers.addAll(baseRequest.headers) + ..bodyBytes = bodyBytes + ..finalize(); + + final response = await fn(request); + return StreamedResponse( + ByteStream.fromBytes(response.bodyBytes), response.statusCode, + contentLength: response.contentLength, + request: response.request, + headers: response.headers, + isRedirect: response.isRedirect, + persistentConnection: response.persistentConnection, + reasonPhrase: response.reasonPhrase); + }); + + /// Creates a [MockClient] with a handler that receives [StreamedRequest]s and + /// sends [StreamedResponse]s. + MockClient.streaming(MockClientStreamHandler fn) + : this._((request, bodyStream) async { + final response = await fn(request, bodyStream); + return StreamedResponse(response.stream, response.statusCode, + contentLength: response.contentLength, + request: response.request, + headers: response.headers, + isRedirect: response.isRedirect, + persistentConnection: response.persistentConnection, + reasonPhrase: response.reasonPhrase); + }); + + @override + Future send(BaseRequest request) async { + var bodyStream = request.finalize(); + return await _handler(request, bodyStream); + } + + /// Return a response containing a PNG image. + static Response pngResponse({BaseRequest? request}) { + final headers = { + 'content-type': 'image/png', + 'content-length': '${_pngImageData.length}' + }; + + return Response.bytes(_pngImageData, 200, + request: request, headers: headers, reasonPhrase: 'OK'); + } +} + +/// A handler function that receives [StreamedRequest]s and sends +/// [StreamedResponse]s. +/// +/// Note that [request] will be finalized. +typedef MockClientStreamHandler = Future Function( + BaseRequest request, ByteStream bodyStream); + +/// A handler function that receives [Request]s and sends [Response]s. +/// +/// Note that [request] will be finalized. +typedef MockClientHandler = Future Function(Request request); diff --git a/pkgs/http/lib/src/multipart_file.dart b/pkgs/http/lib/src/multipart_file.dart new file mode 100644 index 0000000000..47ed3c96ac --- /dev/null +++ b/pkgs/http/lib/src/multipart_file.dart @@ -0,0 +1,107 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:http_parser/http_parser.dart'; + +import 'byte_stream.dart'; +import 'multipart_file_stub.dart' if (dart.library.io) 'multipart_file_io.dart'; +import 'multipart_request.dart'; +import 'utils.dart'; + +/// A file to be uploaded as part of a [MultipartRequest]. +/// +/// This doesn't need to correspond to a physical file. +class MultipartFile { + /// The name of the form field for the file. + final String field; + + /// The size of the file in bytes. + /// + /// This must be known in advance, even if this file is created from a + /// [ByteStream]. + final int length; + + /// The basename of the file. + /// + /// May be `null`. + final String? filename; + + /// The content-type of the file. + /// + /// Defaults to `application/octet-stream`. + final MediaType contentType; + + /// The stream that will emit the file's contents. + final ByteStream _stream; + + /// Whether [finalize] has been called. + bool get isFinalized => _isFinalized; + bool _isFinalized = false; + + /// Creates a new [MultipartFile] from a chunked [Stream] of bytes. + /// + /// The length of the file in bytes must be known in advance. If it's not, + /// read the data from the stream and use [MultipartFile.fromBytes] instead. + /// + /// [contentType] currently defaults to `application/octet-stream`, but in the + /// future may be inferred from [filename]. + MultipartFile(this.field, Stream> stream, this.length, + {this.filename, MediaType? contentType}) + : _stream = toByteStream(stream), + contentType = contentType ?? MediaType('application', 'octet-stream'); + + /// Creates a new [MultipartFile] from a byte array. + /// + /// [contentType] currently defaults to `application/octet-stream`, but in the + /// future may be inferred from [filename]. + factory MultipartFile.fromBytes(String field, List value, + {String? filename, MediaType? contentType}) { + var stream = ByteStream.fromBytes(value); + return MultipartFile(field, stream, value.length, + filename: filename, contentType: contentType); + } + + /// Creates a new [MultipartFile] from a string. + /// + /// The encoding to use when translating [value] into bytes is taken from + /// [contentType] if it has a charset set. Otherwise, it defaults to UTF-8. + /// [contentType] currently defaults to `text/plain; charset=utf-8`, but in + /// the future may be inferred from [filename]. + factory MultipartFile.fromString(String field, String value, + {String? filename, MediaType? contentType}) { + contentType ??= MediaType('text', 'plain'); + var encoding = encodingForContentTypeHeader(contentType, utf8); + contentType = contentType.change(parameters: {'charset': encoding.name}); + + return MultipartFile.fromBytes(field, encoding.encode(value), + filename: filename, contentType: contentType); + } + + // TODO(nweiz): Infer the content-type from the filename. + /// Creates a new [MultipartFile] from a path to a file on disk. + /// + /// [filename] defaults to the basename of [filePath]. [contentType] currently + /// defaults to `application/octet-stream`, but in the future may be inferred + /// from [filename]. + /// + /// Throws an [UnsupportedError] if `dart:io` isn't supported in this + /// environment. + static Future fromPath(String field, String filePath, + {String? filename, MediaType? contentType}) => + multipartFileFromPath(field, filePath, + filename: filename, contentType: contentType); + + // Finalizes the file in preparation for it being sent as part of a + // [MultipartRequest]. This returns a [ByteStream] that should emit the body + // of the file. The stream may be closed to indicate an empty file. + ByteStream finalize() { + if (isFinalized) { + throw StateError("Can't finalize a finalized MultipartFile."); + } + _isFinalized = true; + return _stream; + } +} diff --git a/pkgs/http/lib/src/multipart_file_io.dart b/pkgs/http/lib/src/multipart_file_io.dart new file mode 100644 index 0000000000..fdb1071355 --- /dev/null +++ b/pkgs/http/lib/src/multipart_file_io.dart @@ -0,0 +1,21 @@ +// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:http_parser/http_parser.dart'; + +import 'byte_stream.dart'; +import 'multipart_file.dart'; + +Future multipartFileFromPath(String field, String filePath, + {String? filename, MediaType? contentType}) async { + late var segments = Uri.file(filePath).pathSegments; + filename ??= segments.isEmpty ? '' : segments.last; + var file = File(filePath); + var length = await file.length(); + var stream = ByteStream(file.openRead()); + return MultipartFile(field, stream, length, + filename: filename, contentType: contentType); +} diff --git a/pkgs/http/lib/src/multipart_file_stub.dart b/pkgs/http/lib/src/multipart_file_stub.dart new file mode 100644 index 0000000000..326914b50d --- /dev/null +++ b/pkgs/http/lib/src/multipart_file_stub.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http_parser/http_parser.dart'; + +import 'multipart_file.dart'; + +Future multipartFileFromPath(String field, String filePath, + {String? filename, MediaType? contentType}) => + throw UnsupportedError( + 'MultipartFile is only supported where dart:io is available.'); diff --git a/pkgs/http/lib/src/multipart_request.dart b/pkgs/http/lib/src/multipart_request.dart new file mode 100644 index 0000000000..79525421fb --- /dev/null +++ b/pkgs/http/lib/src/multipart_request.dart @@ -0,0 +1,162 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:math'; + +import 'base_request.dart'; +import 'boundary_characters.dart'; +import 'byte_stream.dart'; +import 'multipart_file.dart'; +import 'utils.dart'; + +final _newlineRegExp = RegExp(r'\r\n|\r|\n'); + +/// A `multipart/form-data` request. +/// +/// Such a request has both string [fields], which function as normal form +/// fields, and (potentially streamed) binary [files]. +/// +/// This request automatically sets the Content-Type header to +/// `multipart/form-data`. This value will override any value set by the user. +/// +/// var uri = Uri.https('example.com', 'create'); +/// var request = http.MultipartRequest('POST', uri) +/// ..fields['user'] = 'nweiz@google.com' +/// ..files.add(await http.MultipartFile.fromPath( +/// 'package', 'build/package.tar.gz', +/// contentType: MediaType('application', 'x-tar'))); +/// var response = await request.send(); +/// if (response.statusCode == 200) print('Uploaded!'); +class MultipartRequest extends BaseRequest { + /// The total length of the multipart boundaries used when building the + /// request body. + /// + /// According to http://tools.ietf.org/html/rfc1341.html, this can't be longer + /// than 70. + static const int _boundaryLength = 70; + + static final Random _random = Random(); + + /// The form fields to send for this request. + final fields = {}; + + /// The list of files to upload for this request. + final files = []; + + MultipartRequest(super.method, super.url); + + /// The total length of the request body, in bytes. + /// + /// This is calculated from [fields] and [files] and cannot be set manually. + @override + int get contentLength { + var length = 0; + + fields.forEach((name, value) { + length += '--'.length + + _boundaryLength + + '\r\n'.length + + utf8.encode(_headerForField(name, value)).length + + utf8.encode(value).length + + '\r\n'.length; + }); + + for (var file in files) { + length += '--'.length + + _boundaryLength + + '\r\n'.length + + utf8.encode(_headerForFile(file)).length + + file.length + + '\r\n'.length; + } + + return length + '--'.length + _boundaryLength + '--\r\n'.length; + } + + @override + set contentLength(int? value) { + throw UnsupportedError('Cannot set the contentLength property of ' + 'multipart requests.'); + } + + /// Freezes all mutable fields and returns a single-subscription [ByteStream] + /// that will emit the request body. + @override + ByteStream finalize() { + // TODO: freeze fields and files + final boundary = _boundaryString(); + headers['content-type'] = 'multipart/form-data; boundary=$boundary'; + super.finalize(); + return ByteStream(_finalize(boundary)); + } + + Stream> _finalize(String boundary) async* { + const line = [13, 10]; // \r\n + final separator = utf8.encode('--$boundary\r\n'); + final close = utf8.encode('--$boundary--\r\n'); + + for (var field in fields.entries) { + yield separator; + yield utf8.encode(_headerForField(field.key, field.value)); + yield utf8.encode(field.value); + yield line; + } + + for (final file in files) { + yield separator; + yield utf8.encode(_headerForFile(file)); + yield* file.finalize(); + yield line; + } + yield close; + } + + /// Returns the header string for a field. + /// + /// The return value is guaranteed to contain only ASCII characters. + String _headerForField(String name, String value) { + var header = + 'content-disposition: form-data; name="${_browserEncode(name)}"'; + if (!isPlainAscii(value)) { + header = '$header\r\n' + 'content-type: text/plain; charset=utf-8\r\n' + 'content-transfer-encoding: binary'; + } + return '$header\r\n\r\n'; + } + + /// Returns the header string for a file. + /// + /// The return value is guaranteed to contain only ASCII characters. + String _headerForFile(MultipartFile file) { + var header = 'content-type: ${file.contentType}\r\n' + 'content-disposition: form-data; name="${_browserEncode(file.field)}"'; + + if (file.filename != null) { + header = '$header; filename="${_browserEncode(file.filename!)}"'; + } + return '$header\r\n\r\n'; + } + + /// Encode [value] in the same way browsers do. + String _browserEncode(String value) => + // http://tools.ietf.org/html/rfc2388 mandates some complex encodings for + // field names and file names, but in practice user agents seem not to + // follow this at all. Instead, they URL-encode `\r`, `\n`, and `\r\n` as + // `\r\n`; URL-encode `"`; and do nothing else (even for `%` or non-ASCII + // characters). We follow their behavior. + value.replaceAll(_newlineRegExp, '%0D%0A').replaceAll('"', '%22'); + + /// Returns a randomly-generated multipart boundary string + String _boundaryString() { + var prefix = 'dart-http-boundary-'; + var list = List.generate( + _boundaryLength - prefix.length, + (index) => + boundaryCharacters[_random.nextInt(boundaryCharacters.length)], + growable: false); + return '$prefix${String.fromCharCodes(list)}'; + } +} diff --git a/pkgs/http/lib/src/request.dart b/pkgs/http/lib/src/request.dart new file mode 100644 index 0000000000..c15e55169d --- /dev/null +++ b/pkgs/http/lib/src/request.dart @@ -0,0 +1,184 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:http_parser/http_parser.dart'; + +import 'base_request.dart'; +import 'byte_stream.dart'; +import 'utils.dart'; + +/// An HTTP request where the entire request body is known in advance. +class Request extends BaseRequest { + /// The size of the request body, in bytes. This is calculated from + /// [bodyBytes]. + /// + /// The content length cannot be set for [Request], since it's automatically + /// calculated from [bodyBytes]. + @override + int get contentLength => bodyBytes.length; + + @override + set contentLength(int? value) { + throw UnsupportedError('Cannot set the contentLength property of ' + 'non-streaming Request objects.'); + } + + /// The default encoding to use when converting between [bodyBytes] and + /// [body]. + /// + /// This is only used if [encoding] hasn't been manually set and if the + /// content-type header has no encoding information. + Encoding _defaultEncoding; + + /// The encoding used for the request. + /// + /// This encoding is used when converting between [bodyBytes] and [body]. + /// + /// If the request has a `Content-Type` header and that header has a `charset` + /// parameter, that parameter's value is used as the encoding. Otherwise, if + /// [encoding] has been set manually, that encoding is used. If that hasn't + /// been set either, this defaults to [utf8]. + /// + /// If the `charset` parameter's value is not a known [Encoding], reading this + /// will throw a [FormatException]. + /// + /// If the request has a `Content-Type` header, setting this will set the + /// charset parameter on that header. + Encoding get encoding { + if (_contentType == null || + !_contentType!.parameters.containsKey('charset')) { + return _defaultEncoding; + } + return requiredEncodingForCharset(_contentType!.parameters['charset']!); + } + + set encoding(Encoding value) { + _checkFinalized(); + _defaultEncoding = value; + var contentType = _contentType; + if (contentType == null) return; + _contentType = contentType.change(parameters: {'charset': value.name}); + } + + // TODO(nweiz): make this return a read-only view + /// The bytes comprising the body of the request. + /// + /// This is converted to and from [body] using [encoding]. + /// + /// This list should only be set, not modified in place. + /// + /// Unlike [body], setting [bodyBytes] does not implicitly set a + /// `Content-Type` header. + /// + /// ```dart + /// final request = Request('GET', Uri.https('example.com', 'whatsit/create')) + /// ..bodyBytes = utf8.encode(jsonEncode({})) + /// ..headers['content-type'] = 'application/json'; + /// ``` + Uint8List get bodyBytes => _bodyBytes; + Uint8List _bodyBytes; + + set bodyBytes(List value) { + _checkFinalized(); + _bodyBytes = toUint8List(value); + } + + /// The body of the request as a string. + /// + /// This is converted to and from [bodyBytes] using [encoding]. + /// + /// When this is set, if the request does not yet have a `Content-Type` + /// header, one will be added with the type `text/plain`. Then the `charset` + /// parameter of the `Content-Type` header (whether new or pre-existing) will + /// be set to [encoding] if it wasn't already set. + /// + /// To set the body of the request, without setting the `Content-Type` header, + /// use [bodyBytes]. + String get body => encoding.decode(bodyBytes); + + set body(String value) { + bodyBytes = encoding.encode(value); + var contentType = _contentType; + if (contentType == null) { + _contentType = MediaType('text', 'plain', {'charset': encoding.name}); + } else if (!contentType.parameters.containsKey('charset')) { + _contentType = contentType.change(parameters: {'charset': encoding.name}); + } + } + + /// The form-encoded fields in the body of the request as a map from field + /// names to values. + /// + /// The form-encoded body is converted to and from [bodyBytes] using + /// [encoding] (in the same way as [body]). + /// + /// If the request doesn't have a `Content-Type` header of + /// `application/x-www-form-urlencoded`, reading this will throw a + /// [StateError]. + /// + /// If the request has a `Content-Type` header with a type other than + /// `application/x-www-form-urlencoded`, setting this will throw a + /// [StateError]. Otherwise, the content type will be set to + /// `application/x-www-form-urlencoded`. + /// + /// This map should only be set, not modified in place. + Map get bodyFields { + var contentType = _contentType; + if (contentType == null || + contentType.mimeType != 'application/x-www-form-urlencoded') { + throw StateError('Cannot access the body fields of a Request without ' + 'content-type "application/x-www-form-urlencoded".'); + } + + return Uri.splitQueryString(body, encoding: encoding); + } + + set bodyFields(Map fields) { + var contentType = _contentType; + if (contentType == null) { + _contentType = MediaType('application', 'x-www-form-urlencoded'); + } else if (contentType.mimeType != 'application/x-www-form-urlencoded') { + throw StateError('Cannot set the body fields of a Request with ' + 'content-type "${contentType.mimeType}".'); + } + + body = mapToQuery(fields, encoding: encoding); + } + + Request(super.method, super.url) + : _defaultEncoding = utf8, + _bodyBytes = Uint8List(0); + + /// Freezes all mutable fields and returns a single-subscription [ByteStream] + /// containing the request body. + @override + ByteStream finalize() { + super.finalize(); + return ByteStream.fromBytes(bodyBytes); + } + + /// The `Content-Type` header of the request (if it exists) as a [MediaType]. + MediaType? get _contentType { + var contentType = headers['content-type']; + if (contentType == null) return null; + return MediaType.parse(contentType); + } + + set _contentType(MediaType? value) { + if (value == null) { + headers.remove('content-type'); + } else { + headers['content-type'] = value.toString(); + } + } + + /// Throw an error if this request has been finalized. + void _checkFinalized() { + if (!finalized) return; + throw StateError("Can't modify a finalized Request."); + } +} diff --git a/pkgs/http/lib/src/response.dart b/pkgs/http/lib/src/response.dart new file mode 100644 index 0000000000..585583eb22 --- /dev/null +++ b/pkgs/http/lib/src/response.dart @@ -0,0 +1,79 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:http_parser/http_parser.dart'; + +import 'base_request.dart'; +import 'base_response.dart'; +import 'streamed_response.dart'; +import 'utils.dart'; + +/// An HTTP response where the entire response body is known in advance. +class Response extends BaseResponse { + /// The bytes comprising the body of this response. + final Uint8List bodyBytes; + + /// The body of the response as a string. + /// + /// This is converted from [bodyBytes] using the `charset` parameter of the + /// `Content-Type` header field, if available. If it's unavailable or if the + /// encoding name is unknown, [utf8] is used by default, as per + /// [RFC3629][]. + /// + /// [RFC3629]:https://www.rfc-editor.org/rfc/rfc3629. + String get body => _encodingForHeaders(headers).decode(bodyBytes); + + /// Creates a new HTTP response with a string body. + Response(String body, int statusCode, + {BaseRequest? request, + Map headers = const {}, + bool isRedirect = false, + bool persistentConnection = true, + String? reasonPhrase}) + : this.bytes(_encodingForHeaders(headers).encode(body), statusCode, + request: request, + headers: headers, + isRedirect: isRedirect, + persistentConnection: persistentConnection, + reasonPhrase: reasonPhrase); + + /// Create a new HTTP response with a byte array body. + Response.bytes(List bodyBytes, super.statusCode, + {super.request, super.headers, super.isRedirect, super.persistentConnection, super.reasonPhrase}) + : bodyBytes = toUint8List(bodyBytes), + super(contentLength: bodyBytes.length); + + /// Creates a new HTTP response by waiting for the full body to become + /// available from a [StreamedResponse]. + static Future fromStream(StreamedResponse response) async { + final body = await response.stream.toBytes(); + return Response.bytes(body, response.statusCode, + request: response.request, + headers: response.headers, + isRedirect: response.isRedirect, + persistentConnection: response.persistentConnection, + reasonPhrase: response.reasonPhrase); + } +} + +/// Returns the encoding to use for a response with the given headers. +/// +/// If the `Content-Type` header specifies a charset, it will use that charset. +/// If no charset is provided or the charset is unknown: +/// - Defaults to [utf8] if the `Content-Type` is `application/json` (since JSON is defined to use UTF-8 by default). +/// - Otherwise, defaults to [latin1] for compatibility. +Encoding _encodingForHeaders(Map headers) => + encodingForContentTypeHeader(_contentTypeForHeaders(headers)); + +/// Returns the [MediaType] object for the given headers' content-type. +/// +/// Defaults to `application/octet-stream`. +MediaType _contentTypeForHeaders(Map headers) { + var contentType = headers['content-type']; + if (contentType != null) return MediaType.parse(contentType); + return MediaType('application', 'octet-stream'); +} diff --git a/pkgs/http/lib/src/streamed_request.dart b/pkgs/http/lib/src/streamed_request.dart new file mode 100644 index 0000000000..d10386e263 --- /dev/null +++ b/pkgs/http/lib/src/streamed_request.dart @@ -0,0 +1,55 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'base_client.dart'; +import 'base_request.dart'; +import 'byte_stream.dart'; + +/// An HTTP request where the request body is sent asynchronously after the +/// connection has been established and the headers have been sent. +/// +/// When the request is sent via [BaseClient.send], only the headers and +/// whatever data has already been written to [StreamedRequest.sink] will be +/// sent immediately. More data will be sent as soon as it's written to +/// [StreamedRequest.sink], and when the sink is closed the request will end. +/// +/// For example: +/// ```dart +/// final request = http.StreamedRequest('POST', Uri.http('example.com', '')) +/// ..contentLength = 10 +/// ..sink.add([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); +/// +/// // The sink must be closed to end the request. +/// // The Future returned from `close()` may not complete until after the +/// // request is sent, and it should not be awaited. +/// unawaited(request.sink.close()); +/// final response = await request.send(); +/// ``` +class StreamedRequest extends BaseRequest { + /// The sink to which to write data that will be sent as the request body. + /// + /// This may be safely written to before the request is sent; the data will be + /// buffered. + /// + /// Closing this signals the end of the request. + StreamSink> get sink => _controller.sink; + + /// The controller for [sink], from which [BaseRequest] will read data for + /// [finalize]. + final StreamController> _controller; + + /// Creates a new streaming request. + StreamedRequest(super.method, super.url) + : _controller = StreamController>(sync: true); + + /// Freezes all mutable fields and returns a single-subscription [ByteStream] + /// that emits the data being written to [sink]. + @override + ByteStream finalize() { + super.finalize(); + return ByteStream(_controller.stream); + } +} diff --git a/pkgs/http/lib/src/streamed_response.dart b/pkgs/http/lib/src/streamed_response.dart new file mode 100644 index 0000000000..44389d7061 --- /dev/null +++ b/pkgs/http/lib/src/streamed_response.dart @@ -0,0 +1,45 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'base_response.dart'; +import 'byte_stream.dart'; +import 'utils.dart'; + +/// An HTTP response where the response body is received asynchronously after +/// the headers have been received. +class StreamedResponse extends BaseResponse { + /// The stream from which the response body data can be read. + /// + /// This should always be a single-subscription stream. + final ByteStream stream; + + /// Creates a new streaming response. + /// + /// [stream] should be a single-subscription stream. + StreamedResponse(Stream> stream, super.statusCode, + {super.contentLength, + super.request, + super.headers, + super.isRedirect, + super.persistentConnection, + super.reasonPhrase}) + : stream = toByteStream(stream); +} + +/// This class is private to `package:http` and will be removed when +/// `package:http` v2 is released. +class StreamedResponseV2 extends StreamedResponse + implements BaseResponseWithUrl { + @override + final Uri url; + + StreamedResponseV2(super.stream, super.statusCode, + {required this.url, + super.contentLength, + super.request, + super.headers, + super.isRedirect, + super.persistentConnection, + super.reasonPhrase}); +} diff --git a/pkgs/http/lib/src/utils.dart b/pkgs/http/lib/src/utils.dart new file mode 100644 index 0000000000..e7277eb3ee --- /dev/null +++ b/pkgs/http/lib/src/utils.dart @@ -0,0 +1,78 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:http_parser/http_parser.dart'; + +import 'byte_stream.dart'; + +/// Converts a [Map] from parameter names to values to a URL query string. +/// +/// mapToQuery({"foo": "bar", "baz": "bang"}); +/// //=> "foo=bar&baz=bang" +String mapToQuery(Map map, {required Encoding encoding}) => map.entries + .map((e) => '${Uri.encodeQueryComponent(e.key, encoding: encoding)}' + '=${Uri.encodeQueryComponent(e.value, encoding: encoding)}') + .join('&'); + +/// Determines the appropriate [Encoding] based on the given [contentTypeHeader]. +/// +/// - If the `Content-Type` is `application/json` and no charset is specified, it defaults to [utf8]. +/// - If a charset is specified in the parameters, it attempts to find a matching [Encoding]. +/// - If no charset is specified or the charset is unknown, it falls back to the provided [fallback], which defaults to [latin1]. +Encoding encodingForContentTypeHeader(MediaType contentTypeHeader, [Encoding fallback = latin1]) { + final charset = contentTypeHeader.parameters['charset']; + + // Default to utf8 for application/json when charset is unspecified. + if (contentTypeHeader.type == 'application' && contentTypeHeader.subtype == 'json' && charset == null) { + return utf8; + } + + // Attempt to find the encoding or fall back to the default. + return charset != null ? Encoding.getByName(charset) ?? fallback : fallback; +} + +/// Returns the [Encoding] that corresponds to [charset]. +/// +/// Throws a [FormatException] if no [Encoding] was found that corresponds to +/// [charset]. +Encoding requiredEncodingForCharset(String charset) => + Encoding.getByName(charset) ?? (throw FormatException('Unsupported encoding "$charset".')); + +/// A regular expression that matches strings that are composed entirely of +/// ASCII-compatible characters. +final _asciiOnly = RegExp(r'^[\x00-\x7F]+$'); + +/// Returns whether [string] is composed entirely of ASCII-compatible +/// characters. +bool isPlainAscii(String string) => _asciiOnly.hasMatch(string); + +/// Converts [input] into a [Uint8List]. +/// +/// If [input] is a [TypedData], this just returns a view on [input]. +Uint8List toUint8List(List input) { + if (input is Uint8List) return input; + if (input case TypedData data) { + return Uint8List.view(data.buffer); + } + return Uint8List.fromList(input); +} + +ByteStream toByteStream(Stream> stream) { + if (stream is ByteStream) return stream; + return ByteStream(stream); +} + +/// Calls [onDone] once [stream] (a single-subscription [Stream]) is finished. +/// +/// The return value, also a single-subscription [Stream] should be used in +/// place of [stream] after calling this method. +Stream onDone(Stream stream, void Function() onDone) => + stream.transform(StreamTransformer.fromHandlers(handleDone: (sink) { + sink.close(); + onDone(); + })); diff --git a/pkgs/http/lib/testing.dart b/pkgs/http/lib/testing.dart new file mode 100644 index 0000000000..4ff7bf862e --- /dev/null +++ b/pkgs/http/lib/testing.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// This library contains testing classes for the HTTP library. +/// +/// The [MockClient] class is a drop-in replacement for `http.Client` that +/// allows test code to set up a local request handler in order to fake a server +/// that responds to HTTP requests: +/// +/// import 'dart:convert'; +/// import 'package:http/testing.dart'; +/// +/// var client = MockClient((request) async { +/// if (request.url.path != "/data.json") { +/// return Response("", 404); +/// } +/// return Response( +/// json.encode({ +/// 'numbers': [1, 4, 15, 19, 214] +/// }), +/// 200, +/// headers: {'content-type': 'application/json'}); +/// }); +library; + +import 'src/mock_client.dart'; + +export 'src/mock_client.dart'; diff --git a/pkgs/http/mono_pkg.yaml b/pkgs/http/mono_pkg.yaml new file mode 100644 index 0000000000..06f79d9816 --- /dev/null +++ b/pkgs/http/mono_pkg.yaml @@ -0,0 +1,22 @@ +sdk: +- pubspec +- dev + +stages: +- analyze_and_format: + - analyze: --fatal-infos + - format: + sdk: + - dev +- unit_test: + - test: --platform vm + os: + - linux + - test: --platform chrome + os: + - linux + - command: dart run --define=no_default_http_client=true test/no_default_http_client_test.dart + os: + - linux + - test: --test-randomize-ordering-seed=random -p chrome -c dart2wasm + sdk: dev diff --git a/pkgs/http/pubspec.yaml b/pkgs/http/pubspec.yaml new file mode 100644 index 0000000000..9685a17148 --- /dev/null +++ b/pkgs/http/pubspec.yaml @@ -0,0 +1,27 @@ +name: http +version: 1.3.0-wip +description: A composable, multi-platform, Future-based API for HTTP requests. +repository: https://github.com/dart-lang/http/tree/master/pkgs/http + +topics: + - http + - network + - protocols + +environment: + sdk: ^3.4.0 + +dependencies: + async: ^2.5.0 + http_parser: ^4.0.0 + meta: ^1.3.0 + web: '>=0.5.0 <2.0.0' + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + fake_async: ^1.2.0 + http_client_conformance_tests: + path: ../http_client_conformance_tests/ + shelf: ^1.1.0 + stream_channel: ^2.1.1 + test: ^1.21.2 diff --git a/pkgs/http/test/html/client_conformance_test.dart b/pkgs/http/test/html/client_conformance_test.dart new file mode 100644 index 0000000000..4400c6a8a1 --- /dev/null +++ b/pkgs/http/test/html/client_conformance_test.dart @@ -0,0 +1,19 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('browser') +library; + +import 'package:http/browser_client.dart'; +import 'package:http_client_conformance_tests/http_client_conformance_tests.dart'; +import 'package:test/test.dart'; + +void main() { + testAll(BrowserClient.new, + redirectAlwaysAllowed: true, + canStreamRequestBody: false, + canStreamResponseBody: true, + canWorkInIsolates: false, + supportsMultipartRequest: false); +} diff --git a/pkgs/http/test/html/client_test.dart b/pkgs/http/test/html/client_test.dart new file mode 100644 index 0000000000..f62e75c119 --- /dev/null +++ b/pkgs/http/test/html/client_test.dart @@ -0,0 +1,42 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('browser') +library; + +import 'dart:async'; + +import 'package:http/browser_client.dart'; +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +import 'utils.dart'; + +void main() { + test('#send a StreamedRequest', () async { + var client = BrowserClient(); + var request = http.StreamedRequest('POST', echoUrl); + + var responseFuture = client.send(request); + request.sink.add('{"hello": "world"}'.codeUnits); + unawaited(request.sink.close()); + + var response = await responseFuture; + var bytesString = await response.stream.bytesToString(); + client.close(); + + expect(bytesString, equals('{"hello": "world"}')); + }, skip: 'Need to fix server tests for browser'); + + test('#send with an invalid URL', () { + var client = BrowserClient(); + var url = Uri.http('http.invalid', ''); + var request = http.StreamedRequest('POST', url); + + expect(client.send(request), throwsClientException()); + + request.sink.add('{"hello": "world"}'.codeUnits); + request.sink.close(); + }); +} diff --git a/pkgs/http/test/html/streamed_request_test.dart b/pkgs/http/test/html/streamed_request_test.dart new file mode 100644 index 0000000000..1668656046 --- /dev/null +++ b/pkgs/http/test/html/streamed_request_test.dart @@ -0,0 +1,40 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('browser') +library; + +import 'dart:async'; + +import 'package:http/browser_client.dart'; +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +import 'utils.dart'; + +void main() { + group('contentLength', () { + test("works when it's set", () async { + var request = http.StreamedRequest('POST', echoUrl) + ..contentLength = 10 + ..sink.add([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + unawaited(request.sink.close()); + + final response = await BrowserClient().send(request); + + expect(await response.stream.toBytes(), + equals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])); + }); + + test("works when it's not set", () async { + var request = http.StreamedRequest('POST', echoUrl); + request.sink.add([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + unawaited(request.sink.close()); + + final response = await BrowserClient().send(request); + expect(await response.stream.toBytes(), + equals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])); + }); + }, skip: 'Need to fix server tests for browser'); +} diff --git a/pkgs/http/test/html/utils.dart b/pkgs/http/test/html/utils.dart new file mode 100644 index 0000000000..3d92698a54 --- /dev/null +++ b/pkgs/http/test/html/utils.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:web/web.dart' show window; + +export '../utils.dart'; + +/// The test server's echo URL. +Uri get echoUrl => + Uri.parse('${window.location.protocol}//${window.location.host}/echo'); diff --git a/pkgs/http/test/http_retry_test.dart b/pkgs/http/test/http_retry_test.dart new file mode 100644 index 0000000000..da51154c4a --- /dev/null +++ b/pkgs/http/test/http_retry_test.dart @@ -0,0 +1,255 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:fake_async/fake_async.dart'; +import 'package:http/http.dart'; +import 'package:http/retry.dart'; +import 'package:http/testing.dart'; +import 'package:test/test.dart'; + +void main() { + group("doesn't retry when", () { + test('a request has a non-503 error code', () async { + final client = RetryClient( + MockClient(expectAsync1((_) async => Response('', 502), count: 1))); + final response = await client.get(Uri.http('example.org', '')); + expect(response.statusCode, equals(502)); + }); + + test("a request doesn't match when()", () async { + final client = RetryClient( + MockClient(expectAsync1((_) async => Response('', 503), count: 1)), + when: (_) => false); + final response = await client.get(Uri.http('example.org', '')); + expect(response.statusCode, equals(503)); + }); + + test('retries is 0', () async { + final client = RetryClient( + MockClient(expectAsync1((_) async => Response('', 503), count: 1)), + retries: 0); + final response = await client.get(Uri.http('example.org', '')); + expect(response.statusCode, equals(503)); + }); + }); + + test('retries on a 503 by default', () async { + var count = 0; + final client = RetryClient( + MockClient(expectAsync1((request) async { + count++; + return count < 2 ? Response('', 503) : Response('', 200); + }, count: 2)), + delay: (_) => Duration.zero); + + final response = await client.get(Uri.http('example.org', '')); + expect(response.statusCode, equals(200)); + }); + + test('retries on any request where when() returns true', () async { + var count = 0; + final client = RetryClient( + MockClient(expectAsync1((request) async { + count++; + return Response('', 503, + headers: {'retry': count < 2 ? 'true' : 'false'}); + }, count: 2)), + when: (response) => response.headers['retry'] == 'true', + delay: (_) => Duration.zero); + + final response = await client.get(Uri.http('example.org', '')); + expect(response.headers, containsPair('retry', 'false')); + expect(response.statusCode, equals(503)); + }); + + test('retries on any request where whenError() returns true', () async { + var count = 0; + final client = RetryClient( + MockClient(expectAsync1((request) async { + count++; + if (count < 2) throw StateError('oh no'); + return Response('', 200); + }, count: 2)), + whenError: (error, _) => + error is StateError && error.message == 'oh no', + delay: (_) => Duration.zero); + + final response = await client.get(Uri.http('example.org', '')); + expect(response.statusCode, equals(200)); + }); + + test("doesn't retry a request where whenError() returns false", () async { + final client = RetryClient( + MockClient(expectAsync1((request) async => throw StateError('oh no'))), + whenError: (error, _) => error == 'oh yeah', + delay: (_) => Duration.zero); + + expect(client.get(Uri.http('example.org', '')), + throwsA(isStateError.having((e) => e.message, 'message', 'oh no'))); + }); + + test('retries three times by default', () async { + final client = RetryClient( + MockClient(expectAsync1((_) async => Response('', 503), count: 4)), + delay: (_) => Duration.zero); + final response = await client.get(Uri.http('example.org', '')); + expect(response.statusCode, equals(503)); + }); + + test('retries the given number of times', () async { + final client = RetryClient( + MockClient(expectAsync1((_) async => Response('', 503), count: 13)), + retries: 12, + delay: (_) => Duration.zero); + final response = await client.get(Uri.http('example.org', '')); + expect(response.statusCode, equals(503)); + }); + + test('waits 1.5x as long each time by default', () { + FakeAsync().run((fake) { + var count = 0; + final client = RetryClient(MockClient(expectAsync1((_) async { + count++; + if (count == 1) { + expect(fake.elapsed, equals(Duration.zero)); + } else if (count == 2) { + expect(fake.elapsed, equals(const Duration(milliseconds: 500))); + } else if (count == 3) { + expect(fake.elapsed, equals(const Duration(milliseconds: 1250))); + } else if (count == 4) { + expect(fake.elapsed, equals(const Duration(milliseconds: 2375))); + } + + return Response('', 503); + }, count: 4))); + + expect(client.get(Uri.http('example.org', '')), completes); + fake.elapse(const Duration(minutes: 10)); + }); + }); + + test('waits according to the delay parameter', () { + FakeAsync().run((fake) { + var count = 0; + final client = RetryClient( + MockClient(expectAsync1((_) async { + count++; + if (count == 1) { + expect(fake.elapsed, equals(Duration.zero)); + } else if (count == 2) { + expect(fake.elapsed, equals(Duration.zero)); + } else if (count == 3) { + expect(fake.elapsed, equals(const Duration(seconds: 1))); + } else if (count == 4) { + expect(fake.elapsed, equals(const Duration(seconds: 3))); + } + + return Response('', 503); + }, count: 4)), + delay: (requestCount) => Duration(seconds: requestCount)); + + expect(client.get(Uri.http('example.org', '')), completes); + fake.elapse(const Duration(minutes: 10)); + }); + }); + + test('waits according to the delay list', () { + FakeAsync().run((fake) { + var count = 0; + final client = RetryClient.withDelays( + MockClient(expectAsync1((_) async { + count++; + if (count == 1) { + expect(fake.elapsed, equals(Duration.zero)); + } else if (count == 2) { + expect(fake.elapsed, equals(const Duration(seconds: 1))); + } else if (count == 3) { + expect(fake.elapsed, equals(const Duration(seconds: 61))); + } else if (count == 4) { + expect(fake.elapsed, equals(const Duration(seconds: 73))); + } + + return Response('', 503); + }, count: 4)), + const [ + Duration(seconds: 1), + Duration(minutes: 1), + Duration(seconds: 12) + ]); + + expect(client.get(Uri.http('example.org', '')), completes); + fake.elapse(const Duration(minutes: 10)); + }); + }); + + test('calls onRetry for each retry', () async { + var count = 0; + final client = RetryClient( + MockClient(expectAsync1((_) async => Response('', 503), count: 3)), + retries: 2, + delay: (_) => Duration.zero, + onRetry: expectAsync3((request, response, retryCount) { + expect(request.url, equals(Uri.http('example.org', ''))); + expect(response?.statusCode, equals(503)); + expect(retryCount, equals(count)); + count++; + }, count: 2)); + final response = await client.get(Uri.http('example.org', '')); + expect(response.statusCode, equals(503)); + }); + + test('copies all request attributes for each attempt', () async { + final client = RetryClient.withDelays( + MockClient(expectAsync1((request) async { + expect(request.contentLength, equals(5)); + expect(request.followRedirects, isFalse); + expect(request.headers, containsPair('foo', 'bar')); + expect(request.maxRedirects, equals(12)); + expect(request.method, equals('POST')); + expect(request.persistentConnection, isFalse); + expect(request.url, equals(Uri.http('example.org', ''))); + expect(request.body, equals('hello')); + return Response('', 503); + }, count: 2)), + [Duration.zero]); + + final request = Request('POST', Uri.http('example.org', '')) + ..body = 'hello' + ..followRedirects = false + ..headers['foo'] = 'bar' + ..maxRedirects = 12 + ..persistentConnection = false; + + final response = await client.send(request); + expect(response.statusCode, equals(503)); + }); + + test('async when, whenError and onRetry', () async { + final client = RetryClient( + MockClient(expectAsync1( + (request) async => request.headers['Authorization'] != null + ? Response('', 200) + : Response('', 401), + count: 2)), + retries: 1, + delay: (_) => Duration.zero, + when: (response) async { + await Future.delayed(const Duration(milliseconds: 500)); + return response.statusCode == 401; + }, + whenError: (error, stackTrace) async { + await Future.delayed(const Duration(milliseconds: 500)); + return false; + }, + onRetry: (request, response, retryCount) async { + expect(response?.statusCode, equals(401)); + await Future.delayed(const Duration(milliseconds: 500)); + request.headers['Authorization'] = 'Bearer TOKEN'; + }, + ); + + final response = await client.get(Uri.http('example.org', '')); + expect(response.statusCode, equals(200)); + }); +} diff --git a/pkgs/http/test/io/client_conformance_test.dart b/pkgs/http/test/io/client_conformance_test.dart new file mode 100644 index 0000000000..65368e57a0 --- /dev/null +++ b/pkgs/http/test/io/client_conformance_test.dart @@ -0,0 +1,18 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('vm') +library; + +import 'package:http/io_client.dart'; +import 'package:http_client_conformance_tests/http_client_conformance_tests.dart'; +import 'package:test/test.dart'; + +void main() { + testAll( + IOClient.new, preservesMethodCase: false, // https://dartbug.com/54187 + canReceiveSetCookieHeaders: true, + canSendCookieHeaders: true, + ); +} diff --git a/pkgs/http/test/io/client_test.dart b/pkgs/http/test/io/client_test.dart new file mode 100644 index 0000000000..fd426a8b3f --- /dev/null +++ b/pkgs/http/test/io/client_test.dart @@ -0,0 +1,188 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('vm') +library; + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:http/http.dart' as http; +import 'package:http/io_client.dart' as http_io; +import 'package:test/test.dart'; + +import '../utils.dart'; + +class TestClient extends http.BaseClient { + @override + Future send(http.BaseRequest request) { + throw UnimplementedError(); + } +} + +class TestClient2 extends http.BaseClient { + @override + Future send(http.BaseRequest request) { + throw UnimplementedError(); + } +} + +void main() { + late Uri serverUrl; + setUpAll(() async { + serverUrl = await startServer(); + }); + + test('#send a StreamedRequest', () async { + var client = http.Client(); + var request = http.StreamedRequest('POST', serverUrl) + ..headers[HttpHeaders.contentTypeHeader] = + 'application/json; charset=utf-8' + ..headers[HttpHeaders.userAgentHeader] = 'Dart'; + + var responseFuture = client.send(request); + request.sink.add('{"hello": "world"}'.codeUnits); + unawaited(request.sink.close()); + + var response = await responseFuture; + + expect(response.request, equals(request)); + expect(response.statusCode, equals(200)); + expect(response.headers['single'], equals('value')); + // dart:io internally normalizes outgoing headers so that they never + // have multiple headers with the same name, so there's no way to test + // whether we handle that case correctly. + + var bytesString = await response.stream.bytesToString(); + client.close(); + expect( + bytesString, + parse(equals({ + 'method': 'POST', + 'path': '/', + 'headers': { + 'content-type': ['application/json; charset=utf-8'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'transfer-encoding': ['chunked'] + }, + 'body': '{"hello": "world"}' + }))); + }); + + test('#send a StreamedRequest with a custom client', () async { + var ioClient = HttpClient(); + var client = http_io.IOClient(ioClient); + var request = http.StreamedRequest('POST', serverUrl) + ..headers[HttpHeaders.contentTypeHeader] = + 'application/json; charset=utf-8' + ..headers[HttpHeaders.userAgentHeader] = 'Dart'; + + var responseFuture = client.send(request); + request.sink.add('{"hello": "world"}'.codeUnits); + unawaited(request.sink.close()); + + var response = await responseFuture; + + expect(response.request, equals(request)); + expect(response.statusCode, equals(200)); + expect(response.headers['single'], equals('value')); + // dart:io internally normalizes outgoing headers so that they never + // have multiple headers with the same name, so there's no way to test + // whether we handle that case correctly. + + var bytesString = await response.stream.bytesToString(); + client.close(); + expect( + bytesString, + parse(equals({ + 'method': 'POST', + 'path': '/', + 'headers': { + 'content-type': ['application/json; charset=utf-8'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'transfer-encoding': ['chunked'] + }, + 'body': '{"hello": "world"}' + }))); + }); + + test('#send with an invalid URL', () { + var client = http.Client(); + var url = Uri.http('http.invalid', ''); + var request = http.StreamedRequest('POST', url); + request.headers[HttpHeaders.contentTypeHeader] = + 'application/json; charset=utf-8'; + + expect( + client.send(request), + throwsA(allOf( + isA().having((e) => e.uri, 'uri', url), + isA().having( + (e) => e.toString(), + 'SocketException.toString', + matches('ClientException with SocketException.*,' + ' uri=http://http.invalid'))))); + + request.sink.add('{"hello": "world"}'.codeUnits); + request.sink.close(); + }); + + test('sends a MultipartRequest with correct content-type header', () async { + var client = http.Client(); + var request = http.MultipartRequest('POST', serverUrl); + + var response = await client.send(request); + + var bytesString = await response.stream.bytesToString(); + client.close(); + + var headers = (jsonDecode(bytesString) as Map)['headers'] + as Map; + var contentType = (headers['content-type'] as List).single; + expect(contentType, startsWith('multipart/form-data; boundary=')); + }); + + test('detachSocket returns a socket from an IOStreamedResponse', () async { + var ioClient = HttpClient(); + var client = http_io.IOClient(ioClient); + var request = http.Request('GET', serverUrl); + + var response = await client.send(request); + var socket = await response.detachSocket(); + + expect(socket, isNotNull); + }); + + test('runWithClient', () { + final client = http.runWithClient(http.Client.new, TestClient.new); + expect(client, isA()); + }); + + test('runWithClient Client() return', () { + final client = http.runWithClient(http.Client.new, http.Client.new); + expect(client, isA()); + }); + + test('runWithClient nested', () { + late final http.Client client; + late final http.Client nestedClient; + http.runWithClient(() { + http.runWithClient(() => nestedClient = http.Client(), TestClient2.new); + client = http.Client(); + }, TestClient.new); + expect(client, isA()); + expect(nestedClient, isA()); + }); + + test('runWithClient recursion', () { + // Verify that calling the http.Client() factory inside nested Zones does + // not provoke an infinite recursion. + http.runWithClient(() { + http.runWithClient(http.Client.new, http.Client.new); + }, http.Client.new); + }); +} diff --git a/pkgs/http/test/io/http_test.dart b/pkgs/http/test/io/http_test.dart new file mode 100644 index 0000000000..3f9aad815e --- /dev/null +++ b/pkgs/http/test/io/http_test.dart @@ -0,0 +1,495 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('vm') +library; + +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +import '../utils.dart'; + +class TestClient extends http.BaseClient { + @override + Future send(http.BaseRequest request) { + throw UnimplementedError(); + } +} + +void main() { + late Uri serverUrl; + setUpAll(() async { + serverUrl = await startServer(); + }); + + group('http.', () { + test('head', () async { + var response = await http.head(serverUrl); + expect(response.statusCode, equals(200)); + expect(response.body, equals('')); + }); + + test('head runWithClient', () { + expect( + () => http.runWithClient(() => http.head(serverUrl), TestClient.new), + throwsUnimplementedError); + }); + + test('get', () async { + var response = await http.get(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(allOf( + containsPair('method', 'GET'), + containsPair('path', '/'), + containsPair( + 'headers', + allOf( + containsPair('accept-encoding', ['gzip']), + containsPair('user-agent', ['Dart']), + containsPair('x-random-header', ['Value']), + containsPair('x-other-header', ['Other Value'])))))); + }); + + test('get runWithClient', () { + expect( + () => http.runWithClient(() => http.get(serverUrl), TestClient.new), + throwsUnimplementedError); + }); + + test('post', () async { + var response = await http.post(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'Content-Type': 'text/plain', + 'User-Agent': 'Dart' + }); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'POST', + 'path': '/', + 'headers': { + 'accept-encoding': ['gzip'], + 'content-length': ['0'], + 'content-type': ['text/plain'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + } + }))); + }); + + test('post with string', () async { + var response = await http.post(serverUrl, + headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }, + body: 'request body'); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'POST', + 'path': '/', + 'headers': { + 'content-type': ['text/plain; charset=utf-8'], + 'content-length': ['12'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + }, + 'body': 'request body' + }))); + }); + + test('post with bytes', () async { + var response = await http.post(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }, body: [ + 104, + 101, + 108, + 108, + 111 + ]); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'POST', + 'path': '/', + 'headers': { + 'content-length': ['5'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + }, + 'body': [104, 101, 108, 108, 111] + }))); + }); + + test('post with fields', () async { + var response = await http.post(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }, body: { + 'some-field': 'value', + 'other-field': 'other value' + }); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'POST', + 'path': '/', + 'headers': { + 'content-type': [ + 'application/x-www-form-urlencoded; charset=utf-8' + ], + 'content-length': ['40'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + }, + 'body': 'some-field=value&other-field=other+value' + }))); + }); + + test('post runWithClient', () { + expect( + () => http.runWithClient( + () => http.post(serverUrl, body: 'testing'), TestClient.new), + throwsUnimplementedError); + }); + + test('put', () async { + var response = await http.put(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'Content-Type': 'text/plain', + 'User-Agent': 'Dart' + }); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'PUT', + 'path': '/', + 'headers': { + 'accept-encoding': ['gzip'], + 'content-length': ['0'], + 'content-type': ['text/plain'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + } + }))); + }); + + test('put with string', () async { + var response = await http.put(serverUrl, + headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }, + body: 'request body'); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'PUT', + 'path': '/', + 'headers': { + 'content-type': ['text/plain; charset=utf-8'], + 'content-length': ['12'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + }, + 'body': 'request body' + }))); + }); + + test('put with bytes', () async { + var response = await http.put(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }, body: [ + 104, + 101, + 108, + 108, + 111 + ]); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'PUT', + 'path': '/', + 'headers': { + 'content-length': ['5'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + }, + 'body': [104, 101, 108, 108, 111] + }))); + }); + + test('put with fields', () async { + var response = await http.put(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }, body: { + 'some-field': 'value', + 'other-field': 'other value' + }); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'PUT', + 'path': '/', + 'headers': { + 'content-type': [ + 'application/x-www-form-urlencoded; charset=utf-8' + ], + 'content-length': ['40'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + }, + 'body': 'some-field=value&other-field=other+value' + }))); + }); + + test('put runWithClient', () { + expect( + () => http.runWithClient( + () => http.put(serverUrl, body: 'testing'), TestClient.new), + throwsUnimplementedError); + }); + + test('patch', () async { + var response = await http.patch(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'Content-Type': 'text/plain', + 'User-Agent': 'Dart' + }); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'PATCH', + 'path': '/', + 'headers': { + 'accept-encoding': ['gzip'], + 'content-length': ['0'], + 'content-type': ['text/plain'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + } + }))); + }); + + test('patch with string', () async { + var response = await http.patch(serverUrl, + headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }, + body: 'request body'); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'PATCH', + 'path': '/', + 'headers': { + 'content-type': ['text/plain; charset=utf-8'], + 'content-length': ['12'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + }, + 'body': 'request body' + }))); + }); + + test('patch with bytes', () async { + var response = await http.patch(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }, body: [ + 104, + 101, + 108, + 108, + 111 + ]); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'PATCH', + 'path': '/', + 'headers': { + 'content-length': ['5'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + }, + 'body': [104, 101, 108, 108, 111] + }))); + }); + + test('patch with fields', () async { + var response = await http.patch(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }, body: { + 'some-field': 'value', + 'other-field': 'other value' + }); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(equals({ + 'method': 'PATCH', + 'path': '/', + 'headers': { + 'content-type': [ + 'application/x-www-form-urlencoded; charset=utf-8' + ], + 'content-length': ['40'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'x-random-header': ['Value'], + 'x-other-header': ['Other Value'] + }, + 'body': 'some-field=value&other-field=other+value' + }))); + }); + + test('delete', () async { + var response = await http.delete(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }); + expect(response.statusCode, equals(200)); + expect( + response.body, + parse(allOf( + containsPair('method', 'DELETE'), + containsPair('path', '/'), + containsPair( + 'headers', + allOf( + containsPair('accept-encoding', ['gzip']), + containsPair('user-agent', ['Dart']), + containsPair('x-random-header', ['Value']), + containsPair('x-other-header', ['Other Value'])))))); + }); + + test('patch runWithClient', () { + expect( + () => http.runWithClient( + () => http.patch(serverUrl, body: 'testing'), TestClient.new), + throwsUnimplementedError); + }); + + test('read', () async { + var response = await http.read(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }); + expect( + response, + parse(allOf( + containsPair('method', 'GET'), + containsPair('path', '/'), + containsPair( + 'headers', + allOf( + containsPair('accept-encoding', ['gzip']), + containsPair('user-agent', ['Dart']), + containsPair('x-random-header', ['Value']), + containsPair('x-other-header', ['Other Value'])))))); + }); + + test('read throws an error for a 4** status code', () { + expect(http.read(serverUrl.resolve('/error')), throwsClientException()); + }); + + test('read runWithClient', () { + expect( + () => http.runWithClient(() => http.read(serverUrl), TestClient.new), + throwsUnimplementedError); + }); + + test('readBytes', () async { + var bytes = await http.readBytes(serverUrl, headers: { + 'X-Random-Header': 'Value', + 'X-Other-Header': 'Other Value', + 'User-Agent': 'Dart' + }); + + expect( + String.fromCharCodes(bytes), + parse(allOf( + containsPair('method', 'GET'), + containsPair('path', '/'), + containsPair( + 'headers', + allOf( + containsPair('accept-encoding', ['gzip']), + containsPair('user-agent', ['Dart']), + containsPair('x-random-header', ['Value']), + containsPair('x-other-header', ['Other Value'])))))); + }); + + test('readBytes throws an error for a 4** status code', () { + expect( + http.readBytes(serverUrl.resolve('/error')), throwsClientException()); + }); + + test('readBytes runWithClient', () { + expect( + () => http.runWithClient( + () => http.readBytes(serverUrl), TestClient.new), + throwsUnimplementedError); + }); + }); +} diff --git a/pkgs/http/test/io/multipart_test.dart b/pkgs/http/test/io/multipart_test.dart new file mode 100644 index 0000000000..3ab90c27cb --- /dev/null +++ b/pkgs/http/test/io/multipart_test.dart @@ -0,0 +1,39 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('vm') +library; + +import 'dart:io'; + +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +import '../utils.dart'; + +void main() { + late Directory tempDir; + setUp(() { + tempDir = Directory.systemTemp.createTempSync('http_test_'); + }); + + tearDown(() => tempDir.deleteSync(recursive: true)); + + test('with a file from disk', () async { + var fileUri = tempDir.uri.resolve('test-file'); + File.fromUri(fileUri).writeAsStringSync('hello'); + var file = await http.MultipartFile.fromPath('file', fileUri.toFilePath()); + var request = http.MultipartRequest('POST', dummyUrl); + request.files.add(file); + + expect(request, bodyMatches(''' + --{{boundary}} + content-type: application/octet-stream + content-disposition: form-data; name="file"; filename="test-file" + + hello + --{{boundary}}-- + ''')); + }); +} diff --git a/pkgs/http/test/io/request_test.dart b/pkgs/http/test/io/request_test.dart new file mode 100644 index 0000000000..226781fbeb --- /dev/null +++ b/pkgs/http/test/io/request_test.dart @@ -0,0 +1,75 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('vm') +library; + +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +import '../utils.dart'; + +void main() { + late Uri serverUrl; + setUpAll(() async { + serverUrl = await startServer(); + }); + + test('send happy case', () async { + final request = http.Request('GET', serverUrl) + ..body = 'hello' + ..headers['User-Agent'] = 'Dart'; + + final response = await request.send(); + + expect(response.statusCode, equals(200)); + final bytesString = await response.stream.bytesToString(); + expect( + bytesString, + parse(equals({ + 'method': 'GET', + 'path': '/', + 'headers': { + 'content-type': ['text/plain; charset=utf-8'], + 'accept-encoding': ['gzip'], + 'user-agent': ['Dart'], + 'content-length': ['5'] + }, + 'body': 'hello', + }))); + }); + + test('without redirects', () async { + final request = http.Request('GET', serverUrl.resolve('/redirect')) + ..followRedirects = false; + final response = await request.send(); + + expect(response.statusCode, equals(302)); + expect( + response, + isA() + .having((r) => r.url, 'url', serverUrl.resolve('/redirect'))); + }); + + test('with redirects', () async { + final request = http.Request('GET', serverUrl.resolve('/redirect')); + final response = await request.send(); + expect(response.statusCode, equals(200)); + final bytesString = await response.stream.bytesToString(); + expect(bytesString, parse(containsPair('path', '/'))); + expect( + response, + isA() + .having((r) => r.url, 'url', serverUrl.resolve('/'))); + }); + + test('exceeding max redirects', () async { + final request = http.Request('GET', serverUrl.resolve('/loop?1')) + ..maxRedirects = 2; + expect( + request.send(), + throwsA(isA() + .having((e) => e.message, 'message', 'Redirect limit exceeded'))); + }); +} diff --git a/pkgs/http/test/io/streamed_request_test.dart b/pkgs/http/test/io/streamed_request_test.dart new file mode 100644 index 0000000000..f0e990c767 --- /dev/null +++ b/pkgs/http/test/io/streamed_request_test.dart @@ -0,0 +1,53 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('vm') +library; + +import 'dart:async'; +import 'dart:convert'; + +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +import '../utils.dart'; + +void main() { + late Uri serverUrl; + setUpAll(() async { + serverUrl = await startServer(); + }); + + group('contentLength', () { + test('controls the Content-Length header', () async { + var request = http.StreamedRequest('POST', serverUrl) + ..contentLength = 10 + ..sink.add([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + unawaited(request.sink.close()); + var response = await request.send(); + expect( + await utf8.decodeStream(response.stream), + parse( + containsPair('headers', containsPair('content-length', ['10'])))); + }); + + test('defaults to sending no Content-Length', () async { + var request = http.StreamedRequest('POST', serverUrl); + request.sink.add([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + unawaited(request.sink.close()); + var response = await request.send(); + expect(await utf8.decodeStream(response.stream), + parse(containsPair('headers', isNot(contains('content-length'))))); + }); + }); + + // Regression test. + test('.send() with a response with no content length', () async { + var request = + http.StreamedRequest('GET', serverUrl.resolve('/no-content-length')); + unawaited(request.sink.close()); + var response = await request.send(); + expect(await utf8.decodeStream(response.stream), equals('body')); + }); +} diff --git a/pkgs/http/test/mock_client_test.dart b/pkgs/http/test/mock_client_test.dart new file mode 100644 index 0000000000..625285cb33 --- /dev/null +++ b/pkgs/http/test/mock_client_test.dart @@ -0,0 +1,68 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:http/http.dart' as http; +import 'package:http/src/request.dart'; +import 'package:http/testing.dart'; +import 'package:test/test.dart'; + +import 'utils.dart'; + +void main() { + test('handles a request', () async { + var client = MockClient((request) async => http.Response( + json.encode(request.bodyFields), 200, + request: request, headers: {'content-type': 'application/json'})); + + var response = await client.post(Uri.http('example.com', '/foo'), + body: {'field1': 'value1', 'field2': 'value2'}); + expect( + response.body, parse(equals({'field1': 'value1', 'field2': 'value2'}))); + }); + + test('handles a streamed request', () async { + var client = MockClient.streaming((request, bodyStream) async { + var bodyString = await bodyStream.bytesToString(); + var stream = + Stream.fromIterable(['Request body was "$bodyString"'.codeUnits]); + return http.StreamedResponse(stream, 200); + }); + + var uri = Uri.http('example.com', '/foo'); + var request = http.Request('POST', uri)..body = 'hello, world'; + var streamedResponse = await client.send(request); + var response = await http.Response.fromStream(streamedResponse); + expect(response.body, equals('Request body was "hello, world"')); + }); + + test('handles a request with no body', () async { + var client = MockClient((_) async => http.Response('you did it', 200)); + + expect(await client.read(Uri.http('example.com', '/foo')), + equals('you did it')); + }); + + test('pngResponse with default options', () { + final response = MockClient.pngResponse(); + expect(response.statusCode, 200); + expect(response.bodyBytes.take(8), + [137, 80, 78, 71, 13, 10, 26, 10] // PNG header + ); + expect(response.request, null); + expect(response.headers, containsPair('content-type', 'image/png')); + }); + + test('pngResponse with request', () { + final request = Request('GET', Uri.https('example.com')); + final response = MockClient.pngResponse(request: request); + expect(response.statusCode, 200); + expect(response.bodyBytes.take(8), + [137, 80, 78, 71, 13, 10, 26, 10] // PNG header + ); + expect(response.request, request); + expect(response.headers, containsPair('content-type', 'image/png')); + }); +} diff --git a/pkgs/http/test/multipart_test.dart b/pkgs/http/test/multipart_test.dart new file mode 100644 index 0000000000..951e99017a --- /dev/null +++ b/pkgs/http/test/multipart_test.dart @@ -0,0 +1,249 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http/http.dart' as http; +import 'package:http/src/boundary_characters.dart'; +import 'package:http_parser/http_parser.dart'; +import 'package:test/test.dart'; + +import 'utils.dart'; + +void main() { + test('empty', () { + var request = http.MultipartRequest('POST', dummyUrl); + expect(request, bodyMatches(''' + --{{boundary}}-- + ''')); + }); + + test('boundary characters', () { + var testBoundary = String.fromCharCodes(boundaryCharacters); + var contentType = MediaType.parse('text/plain; boundary=$testBoundary'); + var boundary = contentType.parameters['boundary']; + expect(boundary, testBoundary); + }); + + test('with fields and files', () { + var request = http.MultipartRequest('POST', dummyUrl); + request.fields['field1'] = 'value1'; + request.fields['field2'] = 'value2'; + request.files.add(http.MultipartFile.fromString('file1', 'contents1', + filename: 'filename1.txt')); + request.files.add(http.MultipartFile.fromString('file2', 'contents2')); + + expect(request, bodyMatches(''' + --{{boundary}} + content-disposition: form-data; name="field1" + + value1 + --{{boundary}} + content-disposition: form-data; name="field2" + + value2 + --{{boundary}} + content-type: text/plain; charset=utf-8 + content-disposition: form-data; name="file1"; filename="filename1.txt" + + contents1 + --{{boundary}} + content-type: text/plain; charset=utf-8 + content-disposition: form-data; name="file2" + + contents2 + --{{boundary}}-- + ''')); + }); + + test('with a unicode field name', () { + var request = http.MultipartRequest('POST', dummyUrl); + request.fields['fïēld'] = 'value'; + + expect(request, bodyMatches(''' + --{{boundary}} + content-disposition: form-data; name="fïēld" + + value + --{{boundary}}-- + ''')); + }); + + test('with a field name with newlines', () { + var request = http.MultipartRequest('POST', dummyUrl); + request.fields['foo\nbar\rbaz\r\nbang'] = 'value'; + + expect(request, bodyMatches(''' + --{{boundary}} + content-disposition: form-data; name="foo%0D%0Abar%0D%0Abaz%0D%0Abang" + + value + --{{boundary}}-- + ''')); + }); + + test('with a field name with a quote', () { + var request = http.MultipartRequest('POST', dummyUrl); + request.fields['foo"bar'] = 'value'; + + expect(request, bodyMatches(''' + --{{boundary}} + content-disposition: form-data; name="foo%22bar" + + value + --{{boundary}}-- + ''')); + }); + + test('with a unicode field value', () { + var request = http.MultipartRequest('POST', dummyUrl); + request.fields['field'] = 'vⱥlūe'; + + expect(request, bodyMatches(''' + --{{boundary}} + content-disposition: form-data; name="field" + content-type: text/plain; charset=utf-8 + content-transfer-encoding: binary + + vⱥlūe + --{{boundary}}-- + ''')); + }); + + test('with a unicode filename', () { + var request = http.MultipartRequest('POST', dummyUrl); + request.files.add(http.MultipartFile.fromString('file', 'contents', + filename: 'fïlēname.txt')); + + expect(request, bodyMatches(''' + --{{boundary}} + content-type: text/plain; charset=utf-8 + content-disposition: form-data; name="file"; filename="fïlēname.txt" + + contents + --{{boundary}}-- + ''')); + }); + + test('with a filename with newlines', () { + var request = http.MultipartRequest('POST', dummyUrl); + request.files.add(http.MultipartFile.fromString('file', 'contents', + filename: 'foo\nbar\rbaz\r\nbang')); + + expect(request, bodyMatches(''' + --{{boundary}} + content-type: text/plain; charset=utf-8 + content-disposition: form-data; name="file"; filename="foo%0D%0Abar%0D%0Abaz%0D%0Abang" + + contents + --{{boundary}}-- + ''')); + }); + + test('with a filename with a quote', () { + var request = http.MultipartRequest('POST', dummyUrl); + request.files.add( + http.MultipartFile.fromString('file', 'contents', filename: 'foo"bar')); + + expect(request, bodyMatches(''' + --{{boundary}} + content-type: text/plain; charset=utf-8 + content-disposition: form-data; name="file"; filename="foo%22bar" + + contents + --{{boundary}}-- + ''')); + }); + + test('with a string file with a content-type but no charset', () { + var request = http.MultipartRequest('POST', dummyUrl); + var file = http.MultipartFile.fromString('file', '{"hello": "world"}', + contentType: MediaType('application', 'json')); + request.files.add(file); + + expect(request, bodyMatches(''' + --{{boundary}} + content-type: application/json; charset=utf-8 + content-disposition: form-data; name="file" + + {"hello": "world"} + --{{boundary}}-- + ''')); + }); + + test('with a file with a iso-8859-1 body', () { + var request = http.MultipartRequest('POST', dummyUrl); + // "Ã¥" encoded as ISO-8859-1 and then read as UTF-8 results in "å". + var file = http.MultipartFile.fromString('file', 'non-ascii: "Ã¥"', + contentType: MediaType('text', 'plain', {'charset': 'iso-8859-1'})); + request.files.add(file); + + expect(request, bodyMatches(''' + --{{boundary}} + content-type: text/plain; charset=iso-8859-1 + content-disposition: form-data; name="file" + + non-ascii: "å" + --{{boundary}}-- + ''')); + }); + + test('with a stream file', () { + var request = http.MultipartRequest('POST', dummyUrl); + var controller = StreamController>(sync: true); + request.files.add(http.MultipartFile('file', controller.stream, 5)); + + expect(request, bodyMatches(''' + --{{boundary}} + content-type: application/octet-stream + content-disposition: form-data; name="file" + + hello + --{{boundary}}-- + ''')); + + controller + ..add([104, 101, 108, 108, 111]) + ..close(); + }); + + test('with an empty stream file', () { + var request = http.MultipartRequest('POST', dummyUrl); + var controller = StreamController>(sync: true); + request.files.add(http.MultipartFile('file', controller.stream, 0)); + + expect(request, bodyMatches(''' + --{{boundary}} + content-type: application/octet-stream + content-disposition: form-data; name="file" + + + --{{boundary}}-- + ''')); + + controller.close(); + }); + + test('with a byte file', () { + var request = http.MultipartRequest('POST', dummyUrl); + var file = http.MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); + request.files.add(file); + + expect(request, bodyMatches(''' + --{{boundary}} + content-type: application/octet-stream + content-disposition: form-data; name="file" + + hello + --{{boundary}}-- + ''')); + }); + + test('with a file that has an error', () async { + var file = http.MultipartFile( + 'file', Future>.error('error').asStream(), 1); + var request = http.MultipartRequest('POST', dummyUrl)..files.add(file); + expect(request.finalize().drain(), throwsA('error')); + }); +} diff --git a/pkgs/http/test/no_default_http_client_test.dart b/pkgs/http/test/no_default_http_client_test.dart new file mode 100644 index 0000000000..c51e98fa15 --- /dev/null +++ b/pkgs/http/test/no_default_http_client_test.dart @@ -0,0 +1,18 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +/// Tests that no [http.Client] is provided by default when run with +/// `--define=no_default_http_client=true`. +void main() { + test('Client()', () { + if (const bool.fromEnvironment('no_default_http_client')) { + expect(http.Client.new, throwsA(isA())); + } else { + expect(http.Client(), isA()); + } + }); +} diff --git a/pkgs/http/test/request_test.dart b/pkgs/http/test/request_test.dart new file mode 100644 index 0000000000..59cb0988c5 --- /dev/null +++ b/pkgs/http/test/request_test.dart @@ -0,0 +1,343 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +import 'utils.dart'; + +void main() { + group('#contentLength', () { + test('is computed from bodyBytes', () { + var request = http.Request('POST', dummyUrl)..bodyBytes = [1, 2, 3, 4, 5]; + expect(request.contentLength, equals(5)); + request.bodyBytes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + expect(request.contentLength, equals(10)); + }); + + test('is computed from body', () { + var request = http.Request('POST', dummyUrl)..body = 'hello'; + expect(request.contentLength, equals(5)); + request.body = 'hello, world'; + expect(request.contentLength, equals(12)); + }); + + test('is not directly mutable', () { + var request = http.Request('POST', dummyUrl); + expect(() => request.contentLength = 50, throwsUnsupportedError); + }); + }); + + group('#encoding', () { + test('defaults to utf-8', () { + var request = http.Request('POST', dummyUrl); + expect(request.encoding.name, equals(utf8.name)); + }); + + test('can be set', () { + var request = http.Request('POST', dummyUrl)..encoding = latin1; + expect(request.encoding.name, equals(latin1.name)); + }); + + test('is based on the content-type charset if it exists', () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = 'text/plain; charset=iso-8859-1'; + expect(request.encoding.name, equals(latin1.name)); + }); + + test('remains the default if the content-type charset is set and unset', + () { + var request = http.Request('POST', dummyUrl) + ..encoding = latin1 + ..headers['Content-Type'] = 'text/plain; charset=utf-8'; + expect(request.encoding.name, equals(utf8.name)); + + request.headers.remove('Content-Type'); + expect(request.encoding.name, equals(latin1.name)); + }); + + test('throws an error if the content-type charset is unknown', () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = + 'text/plain; charset=not-a-real-charset'; + expect(() => request.encoding, throwsFormatException); + }); + }); + + group('#bodyBytes', () { + test('defaults to empty', () { + var request = http.Request('POST', dummyUrl); + expect(request.bodyBytes, isEmpty); + }); + + test('can be set', () { + var request = http.Request('POST', dummyUrl) + ..bodyBytes = [104, 101, 108, 108, 111]; + expect(request.bodyBytes, equals([104, 101, 108, 108, 111])); + }); + + test('changes when body changes', () { + var request = http.Request('POST', dummyUrl)..body = 'hello'; + expect(request.bodyBytes, equals([104, 101, 108, 108, 111])); + }); + }); + + group('#body', () { + test('defaults to empty', () { + var request = http.Request('POST', dummyUrl); + expect(request.body, isEmpty); + }); + + test('can be set', () { + var request = http.Request('POST', dummyUrl)..body = 'hello'; + expect(request.body, equals('hello')); + }); + + test('changes when bodyBytes changes', () { + var request = http.Request('POST', dummyUrl) + ..bodyBytes = [104, 101, 108, 108, 111]; + expect(request.body, equals('hello')); + }); + + test('is encoded according to the given encoding', () { + var request = http.Request('POST', dummyUrl) + ..encoding = latin1 + ..body = 'föøbãr'; + expect(request.bodyBytes, equals([102, 246, 248, 98, 227, 114])); + }); + + test('is decoded according to the given encoding', () { + var request = http.Request('POST', dummyUrl) + ..encoding = latin1 + ..bodyBytes = [102, 246, 248, 98, 227, 114]; + expect(request.body, equals('föøbãr')); + }); + }); + + group('#bodyFields', () { + test("can't be read without setting the content-type", () { + var request = http.Request('POST', dummyUrl); + expect(() => request.bodyFields, throwsStateError); + }); + + test("can't be read with the wrong content-type", () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = 'text/plain'; + expect(() => request.bodyFields, throwsStateError); + }); + + test("can't be set with the wrong content-type", () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = 'text/plain'; + expect(() => request.bodyFields = {}, throwsStateError); + }); + + test('defaults to empty', () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = 'application/x-www-form-urlencoded'; + expect(request.bodyFields, isEmpty); + }); + + test('can be set with no content-type', () { + var request = http.Request('POST', dummyUrl) + ..bodyFields = {'hello': 'world'}; + expect(request.bodyFields, equals({'hello': 'world'})); + }); + + test('changes when body changes', () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = 'application/x-www-form-urlencoded'; + request.body = 'key%201=value&key+2=other%2bvalue'; + expect(request.bodyFields, + equals({'key 1': 'value', 'key 2': 'other+value'})); + }); + + test('is encoded according to the given encoding', () { + var request = http.Request('POST', dummyUrl) + ..headers['Content-Type'] = 'application/x-www-form-urlencoded' + ..encoding = latin1 + ..bodyFields = {'föø': 'bãr'}; + expect(request.body, equals('f%F6%F8=b%E3r')); + }); + + test('is decoded according to the given encoding', () { + var request = http.Request('POST', dummyUrl) + ..headers['Content-Type'] = 'application/x-www-form-urlencoded' + ..encoding = latin1 + ..body = 'f%F6%F8=b%E3r'; + expect(request.bodyFields, equals({'föø': 'bãr'})); + }); + }); + + group('content-type header', () { + test('defaults to empty', () { + var request = http.Request('POST', dummyUrl); + expect(request.headers['Content-Type'], isNull); + }); + + test('defaults to empty if only encoding is set', () { + var request = http.Request('POST', dummyUrl)..encoding = latin1; + expect(request.headers['Content-Type'], isNull); + }); + + test('name is case insensitive', () { + var request = http.Request('POST', dummyUrl); + request.headers['CoNtEnT-tYpE'] = 'application/json'; + expect(request.headers, containsPair('content-type', 'application/json')); + }); + + test( + 'is set to application/x-www-form-urlencoded with charset utf-8 if ' + 'bodyFields is set', () { + var request = http.Request('POST', dummyUrl) + ..bodyFields = {'hello': 'world'}; + expect(request.headers['Content-Type'], + equals('application/x-www-form-urlencoded; charset=utf-8')); + }); + + test( + 'is set to application/x-www-form-urlencoded with the given charset ' + 'if bodyFields and encoding are set', () { + var request = http.Request('POST', dummyUrl) + ..encoding = latin1 + ..bodyFields = {'hello': 'world'}; + expect(request.headers['Content-Type'], + equals('application/x-www-form-urlencoded; charset=iso-8859-1')); + }); + + test( + 'is set to text/plain and the given encoding if body and encoding are ' + 'both set', () { + var request = http.Request('POST', dummyUrl) + ..encoding = latin1 + ..body = 'hello, world'; + expect(request.headers['Content-Type'], + equals('text/plain; charset=iso-8859-1')); + }); + + test('is modified to include utf-8 if body is set', () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = 'application/json'; + request.body = '{"hello": "world"}'; + expect(request.headers['Content-Type'], + equals('application/json; charset=utf-8')); + }); + + test('is modified to include the given encoding if encoding is set', () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = 'application/json'; + request.encoding = latin1; + expect(request.headers['Content-Type'], + equals('application/json; charset=iso-8859-1')); + }); + + test('has its charset overridden by an explicit encoding', () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = 'application/json; charset=utf-8'; + request.encoding = latin1; + expect(request.headers['Content-Type'], + equals('application/json; charset=iso-8859-1')); + }); + + test("doesn't have its charset overridden by setting bodyFields", () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = + 'application/x-www-form-urlencoded; charset=iso-8859-1'; + request.bodyFields = {'hello': 'world'}; + expect(request.headers['Content-Type'], + equals('application/x-www-form-urlencoded; charset=iso-8859-1')); + }); + + test("doesn't have its charset overridden by setting body", () { + var request = http.Request('POST', dummyUrl); + request.headers['Content-Type'] = 'application/json; charset=iso-8859-1'; + request.body = '{"hello": "world"}'; + expect(request.headers['Content-Type'], + equals('application/json; charset=iso-8859-1')); + }); + }); + + group('#finalize', () { + test('returns a stream that emits the request body', () { + var request = http.Request('POST', dummyUrl)..body = 'Hello, world!'; + expect(request.finalize().bytesToString(), + completion(equals('Hello, world!'))); + }); + + test('freezes #persistentConnection', () { + var request = http.Request('POST', dummyUrl)..finalize(); + + expect(request.persistentConnection, isTrue); + expect(() => request.persistentConnection = false, throwsStateError); + }); + + test('freezes #followRedirects', () { + var request = http.Request('POST', dummyUrl)..finalize(); + + expect(request.followRedirects, isTrue); + expect(() => request.followRedirects = false, throwsStateError); + }); + + test('freezes #maxRedirects', () { + var request = http.Request('POST', dummyUrl)..finalize(); + + expect(request.maxRedirects, equals(5)); + expect(() => request.maxRedirects = 10, throwsStateError); + }); + + test('freezes #encoding', () { + var request = http.Request('POST', dummyUrl)..finalize(); + + expect(request.encoding.name, equals(utf8.name)); + expect(() => request.encoding = ascii, throwsStateError); + }); + + test('freezes #bodyBytes', () { + var request = http.Request('POST', dummyUrl) + ..bodyBytes = [1, 2, 3] + ..finalize(); + + expect(request.bodyBytes, equals([1, 2, 3])); + expect(() => request.bodyBytes = [4, 5, 6], throwsStateError); + }); + + test('freezes #body', () { + var request = http.Request('POST', dummyUrl) + ..body = 'hello' + ..finalize(); + + expect(request.body, equals('hello')); + expect(() => request.body = 'goodbye', throwsStateError); + }); + + test('freezes #bodyFields', () { + var request = http.Request('POST', dummyUrl) + ..bodyFields = {'hello': 'world'} + ..finalize(); + + expect(request.bodyFields, equals({'hello': 'world'})); + expect(() => request.bodyFields = {}, throwsStateError); + }); + + test("can't be called twice", () { + var request = http.Request('POST', dummyUrl)..finalize(); + expect(request.finalize, throwsStateError); + }); + }); + + group('#toString()', () { + test('includes the method and URL', () { + var request = http.Request('POST', dummyUrl); + expect(request.toString(), 'POST $dummyUrl'); + }); + }); + + group('#method', () { + test('must be a token', () { + expect(() => http.Request('LLAMA[0]', dummyUrl), throwsArgumentError); + }); + }); +} diff --git a/pkgs/http/test/response_test.dart b/pkgs/http/test/response_test.dart new file mode 100644 index 0000000000..6f56f0af0d --- /dev/null +++ b/pkgs/http/test/response_test.dart @@ -0,0 +1,137 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +void main() { + group('()', () { + test('sets body', () { + var response = http.Response('Hello, world!', 200); + expect(response.body, equals('Hello, world!')); + }); + + test('sets bodyBytes', () { + var response = http.Response('Hello, world!', 200); + expect(response.bodyBytes, equals([72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33])); + }); + + test('respects the inferred encoding', () { + var response = http.Response('föøbãr', 200, headers: {'content-type': 'text/plain; charset=iso-8859-1'}); + expect(response.bodyBytes, equals([102, 246, 248, 98, 227, 114])); + }); + + test('test empty charset', () { + var response = http.Response('{"foo":"Привет, мир!"}', 200, headers: {'content-type': 'application/json'}); + expect(response.body, equals('{"foo":"Привет, мир!"}')); + }); + }); + + group('.bytes()', () { + test('sets body', () { + var response = http.Response.bytes([104, 101, 108, 108, 111], 200); + expect(response.body, equals('hello')); + }); + + test('sets bodyBytes', () { + var response = http.Response.bytes([104, 101, 108, 108, 111], 200); + expect(response.bodyBytes, equals([104, 101, 108, 108, 111])); + }); + + test('respects the inferred encoding', () { + var response = http.Response.bytes([102, 246, 248, 98, 227, 114], 200, + headers: {'content-type': 'text/plain; charset=iso-8859-1'}); + expect(response.body, equals('föøbãr')); + }); + }); + + group('.fromStream()', () { + test('sets body', () async { + var controller = StreamController>(sync: true); + var streamResponse = http.StreamedResponse(controller.stream, 200, contentLength: 13); + controller + ..add([72, 101, 108, 108, 111, 44, 32]) + ..add([119, 111, 114, 108, 100, 33]); + unawaited(controller.close()); + var response = await http.Response.fromStream(streamResponse); + expect(response.body, equals('Hello, world!')); + }); + + test('sets bodyBytes', () async { + var controller = StreamController>(sync: true); + var streamResponse = http.StreamedResponse(controller.stream, 200, contentLength: 5); + controller.add([104, 101, 108, 108, 111]); + unawaited(controller.close()); + var response = await http.Response.fromStream(streamResponse); + expect(response.bodyBytes, equals([104, 101, 108, 108, 111])); + }); + }); + + group('.headersSplitValues', () { + test('no headers', () async { + var response = http.Response('Hello, world!', 200); + expect(response.headersSplitValues, const >{}); + }); + + test('one header', () async { + var response = http.Response('Hello, world!', 200, headers: {'fruit': 'apple'}); + expect(response.headersSplitValues, const { + 'fruit': ['apple'] + }); + }); + + test('two headers', () async { + var response = http.Response('Hello, world!', 200, headers: {'fruit': 'apple,banana'}); + expect(response.headersSplitValues, const { + 'fruit': ['apple', 'banana'] + }); + }); + + test('two headers with lots of spaces', () async { + var response = http.Response('Hello, world!', 200, headers: {'fruit': 'apple \t , \tbanana'}); + expect(response.headersSplitValues, const { + 'fruit': ['apple', 'banana'] + }); + }); + + test('one set-cookie', () async { + var response = http.Response('Hello, world!', 200, + headers: {'set-cookie': 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT'}); + expect(response.headersSplitValues, const { + 'set-cookie': ['id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT'] + }); + }); + + test('two set-cookie, with comma in expires', () async { + var response = http.Response('Hello, world!', 200, headers: { + // ignore: missing_whitespace_between_adjacent_strings + 'set-cookie': 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT,' + 'sessionId=e8bb43229de9; Domain=foo.example.com' + }); + expect(response.headersSplitValues, const { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }); + }); + + test('two set-cookie, with lots of commas', () async { + var response = http.Response('Hello, world!', 200, headers: { + 'set-cookie': + // ignore: missing_whitespace_between_adjacent_strings + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO,' + 'sessionId=e8bb43229de9; Domain=foo.example.com' + }); + expect(response.headersSplitValues, const { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }); + }); + }); +} diff --git a/pkgs/http/test/streamed_request_test.dart b/pkgs/http/test/streamed_request_test.dart new file mode 100644 index 0000000000..4baa3e603e --- /dev/null +++ b/pkgs/http/test/streamed_request_test.dart @@ -0,0 +1,33 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http/http.dart' as http; +import 'package:test/test.dart'; + +import 'utils.dart'; + +void main() { + group('contentLength', () { + test('defaults to null', () { + var request = http.StreamedRequest('POST', dummyUrl); + expect(request.contentLength, isNull); + }); + + test('disallows negative values', () { + var request = http.StreamedRequest('POST', dummyUrl); + expect(() => request.contentLength = -1, throwsArgumentError); + }); + + test('is frozen by finalize()', () { + var request = http.StreamedRequest('POST', dummyUrl)..finalize(); + expect(() => request.contentLength = 10, throwsStateError); + }); + }); + group('#method', () { + test('must be a token', () { + expect(() => http.StreamedRequest('SUPER LLAMA', dummyUrl), + throwsArgumentError); + }); + }); +} diff --git a/pkgs/http/test/stub_server.dart b/pkgs/http/test/stub_server.dart new file mode 100644 index 0000000000..a53f77d375 --- /dev/null +++ b/pkgs/http/test/stub_server.dart @@ -0,0 +1,100 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:http/http.dart'; +import 'package:http/src/utils.dart'; +import 'package:stream_channel/stream_channel.dart'; + +void hybridMain(StreamChannel channel) async { + final server = await HttpServer.bind('localhost', 0); + final url = Uri.http('localhost:${server.port}', ''); + server.listen((request) async { + var path = request.uri.path; + var response = request.response; + + if (path == '/error') { + response + ..statusCode = 400 + ..contentLength = 0; + unawaited(response.close()); + return; + } + + if (path == '/loop') { + var n = int.parse(request.uri.query); + response + ..statusCode = 302 + ..headers.set('location', url.resolve('/loop?${n + 1}').toString()) + ..contentLength = 0; + unawaited(response.close()); + return; + } + + if (path == '/redirect') { + response + ..statusCode = 302 + ..headers.set('location', url.resolve('/').toString()) + ..contentLength = 0; + unawaited(response.close()); + return; + } + + if (path == '/no-content-length') { + response + ..statusCode = 200 + ..contentLength = -1 + ..write('body'); + unawaited(response.close()); + return; + } + + var requestBodyBytes = await ByteStream(request).toBytes(); + var encodingName = request.uri.queryParameters['response-encoding']; + var outputEncoding = + encodingName == null ? ascii : requiredEncodingForCharset(encodingName); + + response.headers.contentType = + ContentType('application', 'json', charset: outputEncoding.name); + response.headers.set('single', 'value'); + + dynamic requestBody; + if (requestBodyBytes.isEmpty) { + requestBody = null; + } else if (request.headers.contentType?.charset != null) { + var encoding = + requiredEncodingForCharset(request.headers.contentType!.charset!); + requestBody = encoding.decode(requestBodyBytes); + } else { + requestBody = requestBodyBytes; + } + + final headers = >{}; + + request.headers.forEach((name, values) { + // These headers are automatically generated by dart:io, so we don't + // want to test them here. + if (name == 'cookie' || name == 'host') return; + + headers[name] = values; + }); + + var content = { + 'method': request.method, + 'path': request.uri.path, + if (requestBody != null) 'body': requestBody, + 'headers': headers, + }; + + var body = json.encode(content); + response + ..contentLength = body.length + ..write(body); + unawaited(response.close()); + }); + channel.sink.add(server.port); +} diff --git a/pkgs/http/test/utils.dart b/pkgs/http/test/utils.dart new file mode 100644 index 0000000000..d4c319f73f --- /dev/null +++ b/pkgs/http/test/utils.dart @@ -0,0 +1,128 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:http/http.dart' as http; +import 'package:http_parser/http_parser.dart'; +import 'package:test/test.dart'; + +/// A dummy URL for constructing requests that won't be sent. +Uri get dummyUrl => Uri.http('dart.dev', ''); + +/// Removes eight spaces of leading indentation from a multiline string. +/// +/// Note that this is very sensitive to how the literals are styled. They should +/// be: +/// ''' +/// Text starts on own line. Lines up with subsequent lines. +/// Lines are indented exactly 8 characters from the left margin. +/// Close is on the same line.''' +/// +/// This does nothing if text is only a single line. +// TODO(nweiz): Make this auto-detect the indentation level from the first +// non-whitespace line. +String cleanUpLiteral(String text) { + var lines = text.split('\n'); + if (lines.length <= 1) return text; + + for (var j = 0; j < lines.length; j++) { + if (lines[j].length > 8) { + lines[j] = lines[j].substring(8, lines[j].length); + } else { + lines[j] = ''; + } + } + + return lines.join('\n'); +} + +/// A matcher that matches JSON that parses to a value that matches the inner +/// matcher. +Matcher parse(Matcher matcher) => _Parse(matcher); + +class _Parse extends Matcher { + final Matcher _matcher; + + _Parse(this._matcher); + + @override + bool matches(Object? item, Map matchState) { + if (item is String) { + dynamic parsed; + try { + parsed = json.decode(item); + } catch (e) { + return false; + } + + return _matcher.matches(parsed, matchState); + } + return false; + } + + @override + Description describe(Description description) => + description.add('parses to a value that ').addDescriptionOf(_matcher); +} + +/// A matcher that validates the body of a multipart request after finalization. +/// +/// The string "{{boundary}}" in [pattern] will be replaced by the boundary +/// string for the request, and LF newlines will be replaced with CRLF. +/// Indentation will be normalized. +Matcher bodyMatches(String pattern) => _BodyMatches(pattern); + +class _BodyMatches extends Matcher { + final String _pattern; + + _BodyMatches(this._pattern); + + @override + bool matches(Object? item, Map matchState) { + if (item is http.MultipartRequest) { + return completes.matches(_checks(item), matchState); + } + + return false; + } + + Future _checks(http.MultipartRequest item) async { + var bodyBytes = await item.finalize().toBytes(); + var body = utf8.decode(bodyBytes); + var contentType = MediaType.parse(item.headers['content-type']!); + var boundary = contentType.parameters['boundary']!; + var expected = cleanUpLiteral(_pattern) + .replaceAll('\n', '\r\n') + .replaceAll('{{boundary}}', boundary); + + expect(body, equals(expected)); + expect(item.contentLength, equals(bodyBytes.length)); + } + + @override + Description describe(Description description) => + description.add('has a body that matches "$_pattern"'); +} + +/// A matcher that matches function or future that throws a +/// [http.ClientException] with the given [message]. +/// +/// [message] can be a String or a [Matcher]. +Matcher throwsClientException([String? message]) { + var exception = isA(); + if (message != null) { + exception = exception.having((e) => e.message, 'message', message); + } + return throwsA(exception); +} + +/// Spawn an isolate in the test runner with an http server. +/// +/// The server isolate will be killed on teardown. +Future startServer() async { + final channel = spawnHybridUri(Uri(path: '/test/stub_server.dart')); + final port = await channel.stream.first as int; + return Uri.http('localhost:$port', ''); +} diff --git a/pkgs/http2/.gitignore b/pkgs/http2/.gitignore new file mode 100644 index 0000000000..ac98e87d12 --- /dev/null +++ b/pkgs/http2/.gitignore @@ -0,0 +1,4 @@ +# Don’t commit the following directories created by pub. +.dart_tool +.packages +pubspec.lock diff --git a/pkgs/http2/.test_config b/pkgs/http2/.test_config new file mode 100644 index 0000000000..2fa4b96b0e --- /dev/null +++ b/pkgs/http2/.test_config @@ -0,0 +1,5 @@ +{ + "test_package": { + "platforms" : ["vm"] + } +} diff --git a/pkgs/http2/AUTHORS b/pkgs/http2/AUTHORS new file mode 100644 index 0000000000..93b7228f05 --- /dev/null +++ b/pkgs/http2/AUTHORS @@ -0,0 +1,8 @@ +# Below is a list of people and organizations that have contributed +# to the project. Names should be added to the list like so: +# +# Name/Organization + +Google Inc. <*@google.com> + +Alexandre Ardhuin diff --git a/pkgs/http2/CHANGELOG.md b/pkgs/http2/CHANGELOG.md new file mode 100644 index 0000000000..6e482a92b3 --- /dev/null +++ b/pkgs/http2/CHANGELOG.md @@ -0,0 +1,115 @@ +## 2.3.1 + +- Require Dart 3.2 +- Add topics to `pubspec.yaml` +- Move to `dart-lang/http` monorepo. + +## 2.3.0 + +- Only send updates on frames and pings being received when there are listeners, as to not fill up memory. + +## 2.2.0 + +- Transform headers to lowercase. +- Expose pings to connection to enable the KEEPALIVE feature for gRPC. + +## 2.1.0 + +- Require Dart `3.0.0` +- Require Dart `2.17.0`. +- Send `WINDOW_UPDATE` frames for the connection to account for data being sent on closed streams until the `RST_STREAM` has been processed. + +## 2.0.1 + +- Simplify the implementation of `MultiProtocolHttpServer.close`. +- Require Dart `2.15.0`. + +## 2.0.0 + +* Migrate to null safety. + +## 1.0.1 + +* Add `TransportConnection.onInitialPeerSettingsReceived` which fires when + initial SETTINGS frame is received from the peer. + +## 1.0.0 + +* Graduate package to 1.0. +* `package:http2/http2.dart` now reexports `package:http2/transport.dart`. + +## 0.1.9 + +* Discard messages incoming after stream cancellation. + +## 0.1.8+2 + +* On connection termination, try to dispatch existing messages, thereby avoiding + terminating existing streams. + +* Fix `ClientTransportConnection.isOpen` to return `false` if we have exhausted + the number of max-concurrent-streams. + +## 0.1.8+1 + +* Switch all uppercase constants from `dart:convert` to lowercase. + +## 0.1.8 + +* More changes required for making tests pass under Dart 2.0 runtime. +* Modify sdk constraint to require '>=2.0.0-dev.40.0'. + +## 0.1.7 + +* Fixes for Dart 2.0. + +## 0.1.6 + +* Strong mode fixes and other cleanup. + +## 0.1.5 + +* Removed use of new `Function` syntax, since it isn't fully supported in Dart + 1.24. + +## 0.1.4 + +* Added an `onActiveStateChanged` callback to `Connection`, which is invoked when + the connection changes state from idle to active or from active to idle. This + can be used to implement an idle connection timeout. + +## 0.1.3 + +* Fixed a bug where a closed window would not open correctly due to an increase + in initial window size. + +## 0.1.2 + +* The endStream bit is now set on the requested frame, instead of on an empty + data frame following it. +* Added an `onTerminated` hook that is called when a TransportStream receives + a RST_STREAM frame. + +## 0.1.1+2 + +* Add errorCode to exception toString message. + +## 0.1.1+1 + +* Fixing a performance issue in case the underlying socket is not writeable +* Allow clients of MultiProtocolHttpServer to supply [http.ServerSettings] +* Allow the draft version 'h2-14' in the ALPN protocol negogiation. + +## 0.1.1 + +* Adding support for MultiProtocolHttpServer in the + `package:http2/multiprotocol_server.dart` library + +## 0.1.0 + +* First version of a HTTP/2 transport implementation in the + `package:http2/transport.dart` library + +## 0.0.1 + +- Initial version diff --git a/pkgs/http2/LICENSE b/pkgs/http2/LICENSE new file mode 100644 index 0000000000..dbd2843a08 --- /dev/null +++ b/pkgs/http2/LICENSE @@ -0,0 +1,27 @@ +Copyright 2015, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. diff --git a/pkgs/http2/README.md b/pkgs/http2/README.md new file mode 100644 index 0000000000..edb75c99d6 --- /dev/null +++ b/pkgs/http2/README.md @@ -0,0 +1,55 @@ +[![pub package](https://img.shields.io/pub/v/http2.svg)](https://pub.dev/packages/http2) +[![package publisher](https://img.shields.io/pub/publisher/http2.svg)](https://pub.dev/packages/http2/publisher) + +This library provides an http/2 interface on top of a bidirectional stream of bytes. + +## Usage + +Here is a minimal example of connecting to a http/2 capable server, requesting +a resource and iterating over the response. + +```dart +import 'dart:convert'; +import 'dart:io'; + +import 'package:http2/http2.dart'; + +Future main() async { + final uri = Uri.parse('https://www.google.com/'); + + final transport = ClientTransportConnection.viaSocket( + await SecureSocket.connect( + uri.host, + uri.port, + supportedProtocols: ['h2'], + ), + ); + + final stream = transport.makeRequest( + [ + Header.ascii(':method', 'GET'), + Header.ascii(':path', uri.path), + Header.ascii(':scheme', uri.scheme), + Header.ascii(':authority', uri.host), + ], + endStream: true, + ); + + await for (var message in stream.incomingMessages) { + if (message is HeadersStreamMessage) { + for (var header in message.headers) { + final name = utf8.decode(header.name); + final value = utf8.decode(header.value); + print('Header: $name: $value'); + } + } else if (message is DataStreamMessage) { + // Use [message.bytes] (but respect 'content-encoding' header) + } + } + await transport.finish(); +} +``` + +An example with better error handling is available [here][example]. + +See the [API docs][api] for more details. diff --git a/pkgs/http2/analysis_options.yaml b/pkgs/http2/analysis_options.yaml new file mode 100644 index 0000000000..9f9fe93611 --- /dev/null +++ b/pkgs/http2/analysis_options.yaml @@ -0,0 +1,9 @@ +# https://dart.dev/tools/analysis#the-analysis-options-file +include: package:dart_flutter_team_lints/analysis_options.yaml + +analyzer: + language: + strict-casts: true + errors: + # Disabled as there are several dozen violations. + constant_identifier_names: ignore diff --git a/pkgs/http2/dart_test.yaml b/pkgs/http2/dart_test.yaml new file mode 100644 index 0000000000..7bcbfc9ae6 --- /dev/null +++ b/pkgs/http2/dart_test.yaml @@ -0,0 +1,2 @@ +tags: + flaky: # Tests that should be run as a separate job on Travis diff --git a/pkgs/http2/example/display_headers.dart b/pkgs/http2/example/display_headers.dart new file mode 100644 index 0000000000..42dbf22b79 --- /dev/null +++ b/pkgs/http2/example/display_headers.dart @@ -0,0 +1,67 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:http2/transport.dart'; + +void main(List args) async { + if (args.length != 1) { + print('Usage: dart display_headers.dart '); + exit(1); + } + + var uriArg = args[0]; + + if (!uriArg.startsWith('https://')) { + print('URI must start with https://'); + exit(1); + } + + var uri = Uri.parse(uriArg); + + var socket = await connect(uri); + + // The default client settings will disable server pushes. We + // therefore do not need to deal with [stream.peerPushes]. + var transport = ClientTransportConnection.viaSocket(socket); + + var headers = [ + Header.ascii(':method', 'GET'), + Header.ascii(':path', uri.path), + Header.ascii(':scheme', uri.scheme), + Header.ascii(':authority', uri.host), + ]; + + var stream = transport.makeRequest(headers, endStream: true); + await for (var message in stream.incomingMessages) { + if (message is HeadersStreamMessage) { + for (var header in message.headers) { + var name = utf8.decode(header.name); + var value = utf8.decode(header.value); + print('$name: $value'); + } + } else if (message is DataStreamMessage) { + // Use [message.bytes] (but respect 'content-encoding' header) + } + } + await transport.finish(); +} + +Future connect(Uri uri) async { + var useSSL = uri.scheme == 'https'; + if (useSSL) { + var secureSocket = await SecureSocket.connect(uri.host, uri.port, + supportedProtocols: ['h2']); + if (secureSocket.selectedProtocol != 'h2') { + throw Exception('Failed to negogiate http/2 via alpn. Maybe server ' + "doesn't support http/2."); + } + return secureSocket; + } else { + return await Socket.connect(uri.host, uri.port); + } +} diff --git a/pkgs/http2/lib/http2.dart b/pkgs/http2/lib/http2.dart new file mode 100644 index 0000000000..3f1ed78404 --- /dev/null +++ b/pkgs/http2/lib/http2.dart @@ -0,0 +1,48 @@ +// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// This library provides an http/2 interface on top of a bidirectional stream +/// of bytes. +/// +/// The client and server sides can be created via [ClientTransportStream] and +/// [ServerTransportStream] respectively. Both sides can be configured via +/// settings (see [ClientSettings] and [ServerSettings]). The settings will be +/// communicated to the remote peer (if necessary) and will be valid during the +/// entire lifetime of the connection. +/// +/// A http/2 transport allows a client to open a bidirectional stream (see +/// [ClientTransportConnection.makeRequest]) and a server can open (or push) a +/// unidirectional stream to the client via [ServerTransportStream.push]. +/// +/// In both cases (unidirectional and bidirectional stream), one can send +/// headers and data to the other side (via [HeadersStreamMessage] and +/// [DataStreamMessage]). These messages are ordered and will arrive in the same +/// order as they were sent (data messages may be split up into multiple smaller +/// chunks or might be combined). +/// +/// In the most common case, each direction will send one [HeadersStreamMessage] +/// followed by zero or more [DataStreamMessage]s. +/// +/// Establishing a bidirectional stream of bytes to a server is up to the user +/// of this library. There are 3 common ways to achive this +/// +/// * connect to a server via SSL and use the ALPN (SSL) protocol extension +/// to negotiate with the server to speak http/2 (the ALPN protocol +/// identifier for http/2 is `h2`) +/// +/// * have prior knowledge about the server - i.e. know ahead of time that +/// the server will speak http/2 via an unencrypted tcp connection +/// +/// * use a http/1.1 connection and upgrade it to http/2 +/// +/// The first way is the most common way and can be done in Dart by using +/// `dart:io`s secure socket implementation (by using a `SecurityContext` and +/// including 'h2' in the list of protocols used for ALPN). +/// +/// A simple example on how to connect to a http/2 capable server and +/// requesting a resource is available at https://github.com/dart-lang/http2/blob/master/example/display_headers.dart. +library http2.http2; + +import 'transport.dart'; +export 'transport.dart'; diff --git a/pkgs/http2/lib/multiprotocol_server.dart b/pkgs/http2/lib/multiprotocol_server.dart new file mode 100644 index 0000000000..54fe6c0a60 --- /dev/null +++ b/pkgs/http2/lib/multiprotocol_server.dart @@ -0,0 +1,120 @@ +// Copyright (c) 2016 the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'src/artificial_server_socket.dart'; +import 'transport.dart' as http2; + +/// Handles protocol negotiation with HTTP/1.1 and HTTP/2 clients. +/// +/// Given a (host, port) pair and a [SecurityContext], [MultiProtocolHttpServer] +/// will negotiate with the client whether HTTP/1.1 or HTTP/2 should be spoken. +/// +/// The user must supply 2 callback functions to [startServing], which: +/// * one handles HTTP/1.1 clients (called with a [HttpRequest]) +/// * one handles HTTP/2 clients (called with a [http2.ServerTransportStream]) +class MultiProtocolHttpServer { + final SecureServerSocket _serverSocket; + final http2.ServerSettings? _settings; + + late _ServerSocketController _http11Controller; + late HttpServer _http11Server; + + final StreamController _http2Controller = + StreamController(); + Stream get _http2Server => + _http2Controller.stream; + + final _http2Connections = {}; + + MultiProtocolHttpServer._(this._serverSocket, this._settings) { + _http11Controller = + _ServerSocketController(_serverSocket.address, _serverSocket.port); + _http11Server = HttpServer.listenOn(_http11Controller.stream); + } + + /// Binds a new [SecureServerSocket] with a security [context] at [port] and + /// [address] (see [SecureServerSocket.bind] for a description of supported + /// types for [address]). + /// + /// Optionally [settings] can be supplied which will be used for HTTP/2 + /// clients. + /// + /// See also [startServing]. + static Future bind( + Object? address, int port, SecurityContext context, + {http2.ServerSettings? settings}) async { + context.setAlpnProtocols(['h2', 'h2-14', 'http/1.1'], true); + var secureServer = await SecureServerSocket.bind(address, port, context); + return MultiProtocolHttpServer._(secureServer, settings); + } + + /// The port this multi-protocol HTTP server runs on. + int get port => _serverSocket.port; + + /// The address this multi-protocol HTTP server runs on. + InternetAddress get address => _serverSocket.address; + + /// Starts listening for HTTP/1.1 and HTTP/2 clients and calls the given + /// callbacks for new clients. + /// + /// It is expected that [callbackHttp11] and [callbackHttp2] will never throw + /// an exception (i.e. these must take care of error handling themselves). + void startServing(void Function(HttpRequest) callbackHttp11, + void Function(http2.ServerTransportStream) callbackHttp2, + {void Function(dynamic error, StackTrace)? onError}) { + // 1. Start listening on the real [SecureServerSocket]. + _serverSocket.listen((SecureSocket socket) { + var protocol = socket.selectedProtocol; + if (protocol == null || protocol == 'http/1.1') { + _http11Controller.addHttp11Socket(socket); + } else if (protocol == 'h2' || protocol == 'h2-14') { + var connection = http2.ServerTransportConnection.viaSocket(socket, + settings: _settings); + _http2Connections.add(connection); + connection.incomingStreams.listen(_http2Controller.add, + onError: onError, + onDone: () => _http2Connections.remove(connection)); + } else { + socket.destroy(); + throw Exception('Unexpected negotiated ALPN protocol: $protocol.'); + } + }, onError: onError); + + // 2. Drain all incoming http/1.1 and http/2 connections and call the + // respective handlers. + _http11Server.listen(callbackHttp11); + _http2Server.listen(callbackHttp2); + } + + /// Closes this [MultiProtocolHttpServer]. + /// + /// Completes once everything has been successfully shut down. + Future close({bool force = false}) => + _serverSocket.close().whenComplete(() => Future.wait([ + _http11Server.close(force: force), + for (var c in _http2Connections) force ? c.terminate() : c.finish() + ])); +} + +/// An internal helper class. +class _ServerSocketController { + final InternetAddress address; + final int port; + final StreamController _controller = StreamController(); + + _ServerSocketController(this.address, this.port); + + ArtificialServerSocket get stream { + return ArtificialServerSocket(address, port, _controller.stream); + } + + void addHttp11Socket(Socket socket) { + _controller.add(socket); + } + + Future close() => _controller.close(); +} diff --git a/pkgs/http2/lib/src/artificial_server_socket.dart b/pkgs/http2/lib/src/artificial_server_socket.dart new file mode 100644 index 0000000000..1a486fe062 --- /dev/null +++ b/pkgs/http2/lib/src/artificial_server_socket.dart @@ -0,0 +1,35 @@ +// Copyright (c) 2016 the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +/// Custom implementation of the [ServerSocket] interface. +/// +/// This class can be used to create a [ServerSocket] using [Stream] and +/// a [InternetAddress] and `port` (an example use case is to filter [Socket]s +/// and keep the [ServerSocket] interface for APIs that expect it, +/// e.g. `new HttpServer.listenOn()`). +class ArtificialServerSocket extends StreamView + implements ServerSocket { + ArtificialServerSocket(this.address, this.port, Stream stream) + : super(stream); + + // ######################################################################## + // These are the methods of [ServerSocket] in addition to [Stream]. + // ######################################################################## + + @override + final InternetAddress address; + + @override + final int port; + + /// Closing of an [ArtificialServerSocket] is not possible and an exception + /// will be thrown when calling this method. + @override + Future close() async { + throw Exception('Did not expect close() to be called.'); + } +} diff --git a/pkgs/http2/lib/src/async_utils/async_utils.dart b/pkgs/http2/lib/src/async_utils/async_utils.dart new file mode 100644 index 0000000000..22a73e99ef --- /dev/null +++ b/pkgs/http2/lib/src/async_utils/async_utils.dart @@ -0,0 +1,128 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:typed_data'; + +/// An interface for `StreamSink`-like classes to indicate whether adding data +/// would be buffered and when the buffer is empty again. +class BufferIndicator { + final StreamController _controller = StreamController.broadcast(sync: true); + + /// A state variable indicating whether buffereing would occur at the moment. + bool _wouldBuffer = true; + + /// Indicates whether calling [BufferedBytesWriter.add] would buffer the data + /// if called. + /// + /// This can be used at a higher level as a way to do custom buffering and + /// possibly prioritization. + bool get wouldBuffer { + return _wouldBuffer; + } + + /// Signals that no buffering is happening at the moment. + void markUnBuffered() { + if (_wouldBuffer) { + _wouldBuffer = false; + _controller.add(null); + } + } + + /// Signals that buffering starts to happen. + void markBuffered() { + _wouldBuffer = true; + } + + /// A broadcast stream notifying users that the [BufferedBytesWriter.add] + /// method would not buffer the data if called. + Stream get bufferEmptyEvents => _controller.stream; +} + +/// Contains a [StreamSink] and a [BufferIndicator] to indicate whether writes +/// to the sink would cause buffering. +/// +/// It uses the `pause signal` from the `sink.addStream()` as an indicator +/// whether the underlying stream cannot handle more data and would buffer. +class BufferedSink { + /// The indicator whether the underlying sink is buffering at the moment. + final bufferIndicator = BufferIndicator(); + + /// A intermediate [StreamController] used to catch pause signals and to + /// propagate the change via [bufferIndicator]. + final _controller = StreamController>(sync: true); + + /// A future which completes once the sink has been closed. + late final Future _doneFuture; + + BufferedSink(StreamSink> dataSink) { + bufferIndicator.markBuffered(); + + _controller + ..onListen = bufferIndicator.markUnBuffered + ..onPause = bufferIndicator.markBuffered + ..onResume = bufferIndicator.markUnBuffered + ..onCancel = () { + // TODO: We may want to propagate cancel events as errors. + // Currently `_doneFuture` will just complete normally if the sink + // cancelled. + }; + _doneFuture = + Future.wait([_controller.stream.pipe(dataSink), dataSink.done]); + } + + /// The underlying sink. + StreamSink> get sink => _controller; + + /// The future which will complete once this sink has been closed. + Future get doneFuture => _doneFuture; +} + +/// A small wrapper around [BufferedSink] which writes data in batches. +class BufferedBytesWriter { + /// A buffer which will be used for batching writes. + final BytesBuilder _builder = BytesBuilder(copy: false); + + /// The underlying [BufferedSink]. + final BufferedSink _bufferedSink; + + BufferedBytesWriter(StreamSink> outgoing) + : _bufferedSink = BufferedSink(outgoing); + + /// An indicator whether the underlying sink is buffering at the moment. + BufferIndicator get bufferIndicator => _bufferedSink.bufferIndicator; + + /// Adds [data] immediately to the underlying buffer. + /// + /// If there is buffered data which was added with [addBufferedData] and it + /// has not been flushed with [flushBufferedData] an error will be thrown. + void add(List data) { + if (_builder.length > 0) { + throw StateError( + 'Cannot trigger an asynchronous write while there is buffered data.'); + } + _bufferedSink.sink.add(data); + } + + /// Queues up [bytes] to be written. + void addBufferedData(List bytes) { + _builder.add(bytes); + } + + /// Flushes all data which was enqueued by [addBufferedData]. + void flushBufferedData() { + if (_builder.length > 0) { + _bufferedSink.sink.add(_builder.takeBytes()); + } + } + + /// Closes this sink. + Future close() { + flushBufferedData(); + return _bufferedSink.sink.close().whenComplete(() => doneFuture); + } + + /// The future which will complete once this sink has been closed. + Future get doneFuture => _bufferedSink.doneFuture; +} diff --git a/pkgs/http2/lib/src/byte_utils.dart b/pkgs/http2/lib/src/byte_utils.dart new file mode 100644 index 0000000000..671e339ea5 --- /dev/null +++ b/pkgs/http2/lib/src/byte_utils.dart @@ -0,0 +1,57 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:typed_data'; + +List viewOrSublist(List data, int offset, int length) { + if (data is Uint8List) { + return Uint8List.view(data.buffer, data.offsetInBytes + offset, length); + } else { + return data.sublist(offset, offset + length); + } +} + +int readInt64(List bytes, int offset) { + var high = readInt32(bytes, offset); + var low = readInt32(bytes, offset + 4); + return high << 32 | low; +} + +int readInt32(List bytes, int offset) { + return (bytes[offset] << 24) | + (bytes[offset + 1] << 16) | + (bytes[offset + 2] << 8) | + bytes[offset + 3]; +} + +int readInt24(List bytes, int offset) { + return (bytes[offset] << 16) | (bytes[offset + 1] << 8) | bytes[offset + 2]; +} + +int readInt16(List bytes, int offset) { + return (bytes[offset] << 8) | bytes[offset + 1]; +} + +void setInt64(List bytes, int offset, int value) { + setInt32(bytes, offset, value >> 32); + setInt32(bytes, offset + 4, value & 0xffffffff); +} + +void setInt32(List bytes, int offset, int value) { + bytes[offset] = (value >> 24) & 0xff; + bytes[offset + 1] = (value >> 16) & 0xff; + bytes[offset + 2] = (value >> 8) & 0xff; + bytes[offset + 3] = value & 0xff; +} + +void setInt24(List bytes, int offset, int value) { + bytes[offset] = (value >> 16) & 0xff; + bytes[offset + 1] = (value >> 8) & 0xff; + bytes[offset + 2] = value & 0xff; +} + +void setInt16(List bytes, int offset, int value) { + bytes[offset] = (value >> 8) & 0xff; + bytes[offset + 1] = value & 0xff; +} diff --git a/pkgs/http2/lib/src/connection.dart b/pkgs/http2/lib/src/connection.dart new file mode 100644 index 0000000000..4e52e57f66 --- /dev/null +++ b/pkgs/http2/lib/src/connection.dart @@ -0,0 +1,509 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert' show utf8; + +import '../transport.dart'; +import 'connection_preface.dart'; +import 'flowcontrol/connection_queues.dart'; +import 'flowcontrol/queue_messages.dart'; +import 'flowcontrol/window.dart'; +import 'flowcontrol/window_handler.dart'; +import 'frames/frame_defragmenter.dart'; +import 'frames/frames.dart'; +import 'hpack/hpack.dart'; +import 'ping/ping_handler.dart'; +import 'settings/settings.dart'; +import 'streams/stream_handler.dart'; +import 'sync_errors.dart'; + +class ConnectionState { + /// The connection has been established, we're waiting for the settings frame + /// of the remote end. + static const int Initialized = 1; + + /// The connection has been established and is fully operational. + static const int Operational = 2; + + /// The connection is no longer accepting new streams or creating new streams. + static const int Finishing = 3; + + /// The connection has been terminated and cannot be used anymore. + static const int Terminated = 4; + + /// Whether we actively were finishing the connection. + static const int FinishingActive = 1; + + /// Whether we passively were finishing the connection. + static const int FinishingPassive = 2; + + int state = Initialized; + int finishingState = 0; + + ConnectionState(); + + bool get isInitialized => state == ConnectionState.Initialized; + + bool get isOperational => state == ConnectionState.Operational; + + bool get isFinishing => state == ConnectionState.Finishing; + + bool get isTerminated => state == ConnectionState.Terminated; + + bool get activeFinishing => + state == Finishing && (finishingState & FinishingActive) != 0; + + bool get passiveFinishing => + state == Finishing && (finishingState & FinishingPassive) != 0; + + @override + String toString() { + var message = ''; + + void add(bool condition, String flag) { + if (condition) { + if (message.isEmpty) { + message = flag; + } else { + message = '$message/$flag'; + } + } + } + + add(isInitialized, 'Initialized'); + add(isOperational, 'IsOperational'); + add(isFinishing, 'IsFinishing'); + add(isTerminated, 'IsTerminated'); + add(activeFinishing, 'ActiveFinishing'); + add(passiveFinishing, 'PassiveFinishing'); + + return message; + } +} + +abstract class Connection { + /// The settings the other end has acknowledged to use when communicating with + /// us. + final ActiveSettings acknowledgedSettings = ActiveSettings(); + + /// The settings we have to obey communicating with the other side. + final ActiveSettings peerSettings = ActiveSettings(); + + /// Whether this connection is a client connection. + final bool isClientConnection; + + /// Active state handler for this connection. + ActiveStateHandler? onActiveStateChanged; + + final Completer _onInitialPeerSettingsReceived = Completer(); + + final StreamController _pingReceived = StreamController(); + + final StreamController _frameReceived = StreamController(); + + /// Future which completes when the first SETTINGS frame is received from + /// the peer. + Future get onInitialPeerSettingsReceived => + _onInitialPeerSettingsReceived.future; + + /// The HPack context for this connection. + final HPackContext _hpackContext = HPackContext(); + + /// The flow window for this connection of the peer. + final Window _peerWindow = Window(); + + /// The flow window for this connection of this end. + final Window _localWindow = Window(); + + /// Used for defragmenting PushPromise/Header frames. + final FrameDefragmenter _defragmenter = FrameDefragmenter(); + + /// The outgoing frames of this connection; + late FrameWriter _frameWriter; + + /// A subscription of incoming [Frame]s. + late StreamSubscription _frameReaderSubscription; + + /// The incoming connection-level message queue. + late ConnectionMessageQueueIn _incomingQueue; + + /// The outgoing connection-level message queue. + late ConnectionMessageQueueOut _outgoingQueue; + + /// The ping handler used for making pings & handling remote pings. + late PingHandler _pingHandler; + + /// The settings handler used for changing settings & for handling remote + /// setting changes. + late SettingsHandler _settingsHandler; + + /// The set of active streams this connection has. + late StreamHandler _streams; + + /// The connection-level flow control window handler for outgoing messages. + late OutgoingConnectionWindowHandler _connectionWindowHandler; + + /// The state of this connection. + late ConnectionState _state; + + Connection(Stream> incoming, StreamSink> outgoing, + Settings settings, + {this.isClientConnection = true}) { + _setupConnection(incoming, outgoing, settings); + } + + /// Runs all setup necessary before new streams can be created with the remote + /// peer. + void _setupConnection(Stream> incoming, + StreamSink> outgoing, Settings settingsObject) { + // Setup frame reading. + var incomingFrames = + FrameReader(incoming, acknowledgedSettings).startDecoding(); + _frameReaderSubscription = incomingFrames.listen((Frame frame) { + _catchProtocolErrors(() => _handleFrameImpl(frame)); + }, onError: (error, stack) { + _terminate(ErrorCode.CONNECT_ERROR, causedByTransportError: true); + }, onDone: () { + // Ensure existing messages from lower levels are sent to the upper + // levels before we terminate everything. + _incomingQueue.forceDispatchIncomingMessages(); + _streams.forceDispatchIncomingMessages(); + + _terminate(ErrorCode.CONNECT_ERROR, causedByTransportError: true); + }); + + // Setup frame writing. + _frameWriter = FrameWriter(_hpackContext.encoder, outgoing, peerSettings); + _frameWriter.doneFuture.whenComplete(() { + _terminate(ErrorCode.CONNECT_ERROR, causedByTransportError: true); + }); + + // Setup handlers. + _settingsHandler = SettingsHandler(_hpackContext.encoder, _frameWriter, + acknowledgedSettings, peerSettings); + _pingHandler = PingHandler(_frameWriter, _pingReceived); + + var settings = _decodeSettings(settingsObject); + + // Do the initial settings handshake (possibly with pushes disabled). + _settingsHandler.changeSettings(settings).catchError((Object error) { + // TODO: The [error] can contain sensitive information we now expose via + // a [Goaway] frame. We should somehow ensure we're only sending useful + // but non-sensitive information. + _terminate(ErrorCode.PROTOCOL_ERROR, + message: 'Failed to set initial settings (error: $error).'); + }); + + _settingsHandler.onInitialWindowSizeChange.listen((int difference) { + _catchProtocolErrors(() { + _streams.processInitialWindowSizeSettingChange(difference); + }); + }); + + // Setup the connection window handler, which keeps track of the + // size of the outgoing connection window. + _connectionWindowHandler = OutgoingConnectionWindowHandler(_peerWindow); + + var connectionWindowUpdater = + IncomingWindowHandler.connection(_frameWriter, _localWindow); + + // Setup queues for outgoing/incoming messages on the connection level. + _outgoingQueue = + ConnectionMessageQueueOut(_connectionWindowHandler, _frameWriter); + _incomingQueue = + ConnectionMessageQueueIn(connectionWindowUpdater, _catchProtocolErrors); + + if (isClientConnection) { + _streams = StreamHandler.client( + _frameWriter, + _incomingQueue, + _outgoingQueue, + _settingsHandler.peerSettings, + _settingsHandler.acknowledgedSettings, + _activeStateHandler); + } else { + _streams = StreamHandler.server( + _frameWriter, + _incomingQueue, + _outgoingQueue, + _settingsHandler.peerSettings, + _settingsHandler.acknowledgedSettings, + _activeStateHandler); + } + + // NOTE: We're not waiting until initial settings have been exchanged + // before we start using the connection (i.e. we don't wait for half a + // round-trip-time). + _state = ConnectionState(); + } + + List _decodeSettings(Settings settings) { + var settingsList = []; + + // By default a endpoint can make an unlimited number of concurrent streams. + var concurrentStreamLimit = settings.concurrentStreamLimit; + if (concurrentStreamLimit != null) { + settingsList.add(Setting( + Setting.SETTINGS_MAX_CONCURRENT_STREAMS, concurrentStreamLimit)); + } + + // By default the stream level flow control window is 64 KiB. + var streamWindowSize = settings.streamWindowSize; + if (streamWindowSize != null) { + settingsList + .add(Setting(Setting.SETTINGS_INITIAL_WINDOW_SIZE, streamWindowSize)); + } + + if (settings is ClientSettings) { + // By default the server is allowed to do server pushes. + if (!settings.allowServerPushes) { + settingsList.add(Setting(Setting.SETTINGS_ENABLE_PUSH, 0)); + } + } else if (settings is ServerSettings) { + // No special server settings at the moment. + } else { + assert(false); + } + + return settingsList; + } + + /// Pings the remote peer (can e.g. be used for measuring latency). + Future ping() { + return _pingHandler.ping().catchError((e, s) { + return Future.error( + TransportException('The connection has been terminated.')); + }, test: (e) => e is TerminatedException); + } + + /// Finishes this connection. + Future finish() { + _finishing(active: true); + + // TODO: There is probably more we need to wait for. + return _streams.done.whenComplete(() => + Future.wait([_frameWriter.close(), _frameReaderSubscription.cancel()])); + } + + /// Terminates this connection forcefully. + Future terminate([int? errorCode]) { + return _terminate(errorCode ?? ErrorCode.NO_ERROR); + } + + void _activeStateHandler(bool isActive) => + onActiveStateChanged?.call(isActive); + + /// Invokes the passed in closure and catches any exceptions. + void _catchProtocolErrors(void Function() fn) { + try { + fn(); + } on ProtocolException catch (error) { + _terminate(ErrorCode.PROTOCOL_ERROR, message: '$error'); + } on FlowControlException catch (error) { + _terminate(ErrorCode.FLOW_CONTROL_ERROR, message: '$error'); + } on FrameSizeException catch (error) { + _terminate(ErrorCode.FRAME_SIZE_ERROR, message: '$error'); + } on HPackDecodingException catch (error) { + _terminate(ErrorCode.PROTOCOL_ERROR, message: '$error'); + } on TerminatedException { + // We tried to perform an action even though the connection was already + // terminated. + // TODO: Can this even happen and if so, how should we propagate this + // error? + } catch (error) { + _terminate(ErrorCode.INTERNAL_ERROR, message: '$error'); + } + } + + void _handleFrameImpl(Frame? frame) { + // The first frame from the other side must be a [SettingsFrame], otherwise + // we terminate the connection. + if (_state.isInitialized) { + if (frame is! SettingsFrame) { + _terminate(ErrorCode.PROTOCOL_ERROR, + message: 'Expected to first receive a settings frame.'); + return; + } + _state.state = ConnectionState.Operational; + _onInitialPeerSettingsReceived.complete(); + } + + // Try to defragment [frame] if it is a Headers/PushPromise frame. + frame = _defragmenter.tryDefragmentFrame(frame); + if (frame == null) return; + + // Try to decode headers if it's a Headers/PushPromise frame. + // [This needs to be done even if the frames get ignored, since the entire + // connection shares one HPack compression context.] + if (frame is HeadersFrame) { + frame.decodedHeaders = + _hpackContext.decoder.decode(frame.headerBlockFragment); + } else if (frame is PushPromiseFrame) { + frame.decodedHeaders = + _hpackContext.decoder.decode(frame.headerBlockFragment); + } + if (_frameReceived.hasListener) { + _frameReceived.add(null); + } + + // Handle the frame as either a connection or a stream frame. + if (frame.header.streamId == 0) { + if (frame is SettingsFrame) { + _settingsHandler.handleSettingsFrame(frame); + } else if (frame is PingFrame) { + _pingHandler.processPingFrame(frame); + } else if (frame is WindowUpdateFrame) { + _connectionWindowHandler.processWindowUpdate(frame); + } else if (frame is GoawayFrame) { + _streams.processGoawayFrame(frame); + _finishing(active: false); + } else if (frame is UnknownFrame) { + // We can safely ignore these. + } else { + throw ProtocolException( + 'Cannot handle frame type ${frame.runtimeType} with stream-id 0.'); + } + } else { + _streams.processStreamFrame(_state, frame); + } + } + + void _finishing({bool active = true, String? message}) { + // If this connection is already dead, we return. + if (_state.isTerminated) return; + + // If this connection is already finishing, we make sure to store the + // passive bit, since this information is used by [StreamHandler]. + // + // Vice versa should not matter: If we started passively finishing, an + // active finish should be a NOP. + if (_state.isFinishing) { + if (!active) _state.finishingState |= ConnectionState.FinishingPassive; + return; + } + + assert(_state.isInitialized || _state.isOperational); + + // If we are actively finishing this connection, we'll send a + // GoawayFrame otherwise we'll just propagate the message. + if (active) { + _state.state = ConnectionState.Finishing; + _state.finishingState |= ConnectionState.FinishingActive; + + _outgoingQueue.enqueueMessage(GoawayMessage( + _streams.highestPeerInitiatedStream, + ErrorCode.NO_ERROR, + message != null ? utf8.encode(message) : [])); + } else { + _state.state = ConnectionState.Finishing; + _state.finishingState |= ConnectionState.FinishingPassive; + } + + _streams.startClosing(); + } + + /// Terminates this connection (if it is not already terminated). + /// + /// The returned future will never complete with an error. + Future _terminate(int errorCode, + {bool causedByTransportError = false, String? message}) { + // TODO: When do we complete here? + if (_state.state != ConnectionState.Terminated) { + _state.state = ConnectionState.Terminated; + + var cancelFuture = Future.sync(_frameReaderSubscription.cancel); + if (!causedByTransportError) { + _outgoingQueue.enqueueMessage(GoawayMessage( + _streams.highestPeerInitiatedStream, + errorCode, + message != null ? utf8.encode(message) : [])); + } + var closeFuture = _frameWriter.close().catchError((e, s) { + // We ignore any errors after writing to [GoawayFrame] + }); + + // Close all lower level handlers with an error message. + // (e.g. if there is a pending connection.ping(), it's returned + // Future will complete with this error). + var exception = TransportConnectionException( + errorCode, 'Connection is being forcefully terminated.'); + + // Close all streams & stream queues + _streams.terminate(exception); + + // Close the connection queues + _incomingQueue.terminate(exception); + _outgoingQueue.terminate(exception); + + _pingHandler.terminate(exception); + _settingsHandler.terminate(exception); + + return Future.wait([cancelFuture, closeFuture]) + .catchError((_) => const []); + } + return Future.value(); + } +} + +class ClientConnection extends Connection implements ClientTransportConnection { + ClientConnection._(super.incoming, super.outgoing, super.settings) + : super(isClientConnection: true); + + factory ClientConnection(Stream> incoming, + StreamSink> outgoing, ClientSettings clientSettings) { + outgoing.add(CONNECTION_PREFACE); + return ClientConnection._(incoming, outgoing, clientSettings); + } + + @override + bool get isOpen => + !_state.isFinishing && !_state.isTerminated && _streams.canOpenStream; + + @override + ClientTransportStream makeRequest(List
headers, + {bool endStream = false}) { + if (_state.isFinishing) { + throw StateError( + 'The http/2 connection is finishing and can therefore not be used to ' + 'make new streams.'); + } else if (_state.isTerminated) { + throw StateError( + 'The http/2 connection is no longer active and can therefore not be ' + 'used to make new streams.'); + } + var hStream = _streams.newStream(headers, endStream: endStream); + if (_streams.ranOutOfStreamIds) { + _finishing(active: true, message: 'Ran out of stream ids'); + } + return hStream; + } + + @override + Stream get onPingReceived => _pingReceived.stream; + + @override + Stream get onFrameReceived => _frameReceived.stream; +} + +class ServerConnection extends Connection implements ServerTransportConnection { + ServerConnection._(super.incoming, super.outgoing, super.settings) + : super(isClientConnection: false); + + factory ServerConnection(Stream> incoming, + StreamSink> outgoing, ServerSettings serverSettings) { + var frameBytes = readConnectionPreface(incoming); + return ServerConnection._(frameBytes, outgoing, serverSettings); + } + + @override + Stream get incomingStreams => + _streams.incomingStreams.cast(); + + @override + Stream get onPingReceived => _pingReceived.stream; + + @override + Stream get onFrameReceived => _frameReceived.stream; +} diff --git a/pkgs/http2/lib/src/connection_preface.dart b/pkgs/http2/lib/src/connection_preface.dart new file mode 100644 index 0000000000..2f0b98c402 --- /dev/null +++ b/pkgs/http2/lib/src/connection_preface.dart @@ -0,0 +1,114 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:math'; + +import 'byte_utils.dart'; + +/// This is a set of bytes with which a client connection begins in the normal +/// case. It can be used on a server to distinguish HTTP/1.1 and HTTP/2 clients. +const List CONNECTION_PREFACE = [ + 0x50, + 0x52, + 0x49, + 0x20, + 0x2a, + 0x20, + 0x48, + 0x54, + 0x54, + 0x50, + 0x2f, + 0x32, + 0x2e, + 0x30, + 0x0d, + 0x0a, + 0x0d, + 0x0a, + 0x53, + 0x4d, + 0x0d, + 0x0a, + 0x0d, + 0x0a +]; + +/// Reads the connection preface from [incoming]. +/// +/// The returned `Stream` will be a duplicate of `incoming` without the +/// connection preface. If an error occurs while reading the connection +/// preface, the returned stream will have only an error. +Stream> readConnectionPreface(Stream> incoming) { + final result = StreamController>(); + late StreamSubscription subscription; + var connectionPrefaceRead = false; + var prefaceBuffer = []; + var terminated = false; + + void terminate(Object error) { + if (!terminated) { + result.addError(error); + result.close(); + subscription.cancel(); + } + terminated = true; + } + + bool compareConnectionPreface(List data) { + for (var i = 0; i < CONNECTION_PREFACE.length; i++) { + if (data[i] != CONNECTION_PREFACE[i]) { + terminate('Connection preface does not match.'); + return false; + } + } + connectionPrefaceRead = true; + return true; + } + + void onData(List data) { + if (connectionPrefaceRead) { + // Forward data after reading preface. + result.add(data); + } else { + if (prefaceBuffer.isEmpty && data.length > CONNECTION_PREFACE.length) { + if (!compareConnectionPreface(data)) return; + data = data.sublist(CONNECTION_PREFACE.length); + } else if (prefaceBuffer.length < CONNECTION_PREFACE.length) { + var remaining = CONNECTION_PREFACE.length - prefaceBuffer.length; + + var end = min(data.length, remaining); + var part1 = viewOrSublist(data, 0, end); + var part2 = viewOrSublist(data, end, data.length - end); + prefaceBuffer.addAll(part1); + + if (prefaceBuffer.length == CONNECTION_PREFACE.length) { + if (!compareConnectionPreface(prefaceBuffer)) return; + } + data = part2; + } + if (data.isNotEmpty) { + result.add(data); + } + } + } + + result.onListen = () { + subscription = + incoming.listen(onData, onError: result.addError, onDone: () { + if (!connectionPrefaceRead) { + terminate('EOS before connection preface could be read.'); + } else { + result.close(); + } + }); + result + ..onPause = subscription.pause + ..onResume = subscription.resume + ..onCancel = subscription.cancel; + }; + + return result.stream; +} diff --git a/pkgs/http2/lib/src/error_handler.dart b/pkgs/http2/lib/src/error_handler.dart new file mode 100644 index 0000000000..a8e19204ef --- /dev/null +++ b/pkgs/http2/lib/src/error_handler.dart @@ -0,0 +1,105 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'sync_errors.dart'; + +/// Used by classes which may be terminated from the outside. +mixin TerminatableMixin { + bool _terminated = false; + + /// Terminates this stream message queue. Further operations on it will fail. + void terminate([Object? error]) { + if (!wasTerminated) { + _terminated = true; + onTerminated(error); + } + } + + bool get wasTerminated => _terminated; + + void onTerminated(Object? error) { + // Subclasses can override this method if they want. + } + + T ensureNotTerminatedSync(T Function() f) { + if (wasTerminated) { + throw TerminatedException(); + } + return f(); + } + + Future ensureNotTerminatedAsync(Future Function() f) { + if (wasTerminated) { + return Future.error(TerminatedException()); + } + return f(); + } +} + +/// Used by classes which may be cancelled. +mixin CancellableMixin { + bool _cancelled = false; + final _cancelCompleter = Completer.sync(); + + Future get onCancel => _cancelCompleter.future; + + /// Cancel this stream message queue. Further operations on it will fail. + void cancel() { + if (!wasCancelled) { + _cancelled = true; + _cancelCompleter.complete(); + } + } + + bool get wasCancelled => _cancelled; +} + +/// Used by classes which may be closed. +mixin ClosableMixin { + bool _closing = false; + final Completer _completer = Completer(); + + Future get done => _completer.future; + + bool get isClosing => _closing; + bool get wasClosed => _completer.isCompleted; + + void startClosing() { + if (!_closing) { + _closing = true; + + onClosing(); + } + onCheckForClose(); + } + + void onCheckForClose() { + // Subclasses can override this method if they want. + } + + void onClosing() { + // Subclasses can override this method if they want. + } + + dynamic ensureNotClosingSync(dynamic Function() f) { + if (isClosing) { + throw StateError('Was in the process of closing.'); + } + return f(); + } + + void closeWithValue([Object? value]) { + if (!wasClosed) { + _completer.complete(value); + } + } + + void closeWithError(Object? error) { + if (!wasClosed) { + _completer.complete(error); + } + } +} diff --git a/pkgs/http2/lib/src/flowcontrol/connection_queues.dart b/pkgs/http2/lib/src/flowcontrol/connection_queues.dart new file mode 100644 index 0000000000..f1a499a903 --- /dev/null +++ b/pkgs/http2/lib/src/flowcontrol/connection_queues.dart @@ -0,0 +1,354 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// TODO: Take priorities into account. +// TODO: Properly fragment large data frames, so they are not taking up too much +// bandwidth. + +import 'dart:async'; +import 'dart:collection'; + +import '../../transport.dart'; +import '../byte_utils.dart'; +import '../error_handler.dart'; +import '../frames/frames.dart'; +import 'queue_messages.dart'; +import 'stream_queues.dart'; +import 'window_handler.dart'; + +/// The last place before messages coming from the application get encoded and +/// send as [Frame]s. +/// +/// It will convert [Message]s from higher layers and send them via [Frame]s. +/// +/// - It will queue messages until the connection-level flow control window +/// allows sending the message and the underlying [StreamSink] is not +/// buffering. +/// - It will use a [FrameWriter] to write a new frame to the connection. +// TODO: Make [StreamsHandler] call [connectionOut.startClosing()] once +// * all streams have been closed +// * the connection state is finishing +class ConnectionMessageQueueOut extends Object + with TerminatableMixin, ClosableMixin { + /// The handler which will be used for increasing the connection-level flow + /// control window. + final OutgoingConnectionWindowHandler _connectionWindow; + + /// The buffered [Message]s which are to be delivered to the remote peer. + final Queue _messages = Queue(); + + /// The [FrameWriter] used for writing Headers/Data/PushPromise frames. + final FrameWriter _frameWriter; + + ConnectionMessageQueueOut(this._connectionWindow, this._frameWriter) { + _frameWriter.bufferIndicator.bufferEmptyEvents.listen((_) { + _trySendMessages(); + }); + _connectionWindow.positiveWindow.bufferEmptyEvents.listen((_) { + _trySendMessages(); + }); + } + + /// The number of pending messages which haven't been written to the wire. + int get pendingMessages => _messages.length; + + /// Enqueues a new [Message] which should be delivered to the remote peer. + void enqueueMessage(Message message) { + ensureNotClosingSync(() { + if (!wasTerminated) { + _messages.addLast(message); + _trySendMessages(); + } + }); + } + + @override + void onTerminated(Object? error) { + _messages.clear(); + closeWithError(error); + } + + @override + void onCheckForClose() { + if (isClosing && _messages.isEmpty) { + closeWithValue(); + } + } + + void _trySendMessages() { + if (!wasTerminated) { + // We can make progress if + // * there is at least one message to send + // * the underlying frame writer / sink / socket doesn't block + // * either one + // * the next message is a non-flow control message (e.g. headers) + // * the connection window is positive + + if (_messages.isNotEmpty && + !_frameWriter.bufferIndicator.wouldBuffer && + (!_connectionWindow.positiveWindow.wouldBuffer || + _messages.first is! DataMessage)) { + _trySendMessage(); + + // If we have more messages and we can send them, we'll run them + // using `Timer.run()` to let other things get in-between. + if (_messages.isNotEmpty && + !_frameWriter.bufferIndicator.wouldBuffer && + (!_connectionWindow.positiveWindow.wouldBuffer || + _messages.first is! DataMessage)) { + // TODO: If all the frame writer methods would return the + // number of bytes written, we could just say, we loop here until 10kb + // and after words, we'll make `Timer.run()`. + Timer.run(_trySendMessages); + } else { + onCheckForClose(); + } + } + } + } + + void _trySendMessage() { + var message = _messages.first; + if (message is HeadersMessage) { + _messages.removeFirst(); + _frameWriter.writeHeadersFrame(message.streamId, message.headers, + endStream: message.endStream); + } else if (message is PushPromiseMessage) { + _messages.removeFirst(); + _frameWriter.writePushPromiseFrame( + message.streamId, message.promisedStreamId, message.headers); + } else if (message is DataMessage) { + _messages.removeFirst(); + + if (_connectionWindow.peerWindowSize >= message.bytes.length) { + _connectionWindow.decreaseWindow(message.bytes.length); + _frameWriter.writeDataFrame(message.streamId, message.bytes, + endStream: message.endStream); + } else { + // NOTE: We need to fragment the DataMessage. + // TODO: Do not fragment if the number of bytes we can send is too low + var len = _connectionWindow.peerWindowSize; + var head = viewOrSublist(message.bytes, 0, len); + var tail = + viewOrSublist(message.bytes, len, message.bytes.length - len); + + _connectionWindow.decreaseWindow(head.length); + _frameWriter.writeDataFrame(message.streamId, head, endStream: false); + + var tailMessage = + DataMessage(message.streamId, tail, message.endStream); + _messages.addFirst(tailMessage); + } + } else if (message is ResetStreamMessage) { + _messages.removeFirst(); + _frameWriter.writeRstStreamFrame(message.streamId, message.errorCode); + } else if (message is GoawayMessage) { + _messages.removeFirst(); + _frameWriter.writeGoawayFrame( + message.lastStreamId, message.errorCode, message.debugData); + } else { + throw StateError('Unexpected message in queue: ${message.runtimeType}'); + } + } +} + +/// The first place an incoming stream message gets delivered to. +/// +/// The [ConnectionMessageQueueIn] will be given [Frame]s which were sent to +/// any stream on this connection. +/// +/// - It will extract the necessary data from the [Frame] and store it in a new +/// [Message] object. +/// - It will multiplex the created [Message]es to a stream-specific +/// [StreamMessageQueueIn]. +/// - If the [StreamMessageQueueIn] cannot accept more data, the data will be +/// buffered until it can. +/// - [DataMessage]s which have been successfully delivered to a stream-specific +/// [StreamMessageQueueIn] will increase the flow control window for the +/// connection. +/// +/// Incoming [DataFrame]s will decrease the flow control window the peer has +/// available. +// TODO: Make [StreamsHandler] call [connectionOut.startClosing()] once +// * all streams have been closed +// * the connection state is finishing +class ConnectionMessageQueueIn extends Object + with TerminatableMixin, ClosableMixin { + /// The handler which will be used for increasing the connection-level flow + /// control window. + final IncomingWindowHandler _windowUpdateHandler; + + /// Catches any protocol errors and acts upon them. + final void Function(void Function()) _catchProtocolErrors; + + /// A mapping from stream-id to the corresponding stream-specific + /// [StreamMessageQueueIn]. + final Map _stream2messageQueue = {}; + + /// A buffer for [Message]s which cannot be received by their + /// [StreamMessageQueueIn]. + final Map> _stream2pendingMessages = {}; + + /// The number of pending messages which haven't been delivered + /// to the stream-specific queue. (for debugging purposes) + int _count = 0; + + ConnectionMessageQueueIn( + this._windowUpdateHandler, this._catchProtocolErrors); + + @override + void onTerminated(Object? error) { + // NOTE: The higher level will be shutdown first, so all streams + // should have been removed at this point. + assert(_stream2messageQueue.isEmpty); + assert(_stream2pendingMessages.isEmpty); + closeWithError(error); + } + + @override + void onCheckForClose() { + if (isClosing) { + assert(_stream2messageQueue.isEmpty == _stream2pendingMessages.isEmpty); + if (_stream2messageQueue.isEmpty) { + closeWithValue(); + } + } + } + + /// The number of pending messages which haven't been delivered + /// to the stream-specific queue. (for debugging purposes) + int get pendingMessages => _count; + + /// Registers a stream specific [StreamMessageQueueIn] for a new stream id. + void insertNewStreamMessageQueue(int streamId, StreamMessageQueueIn mq) { + if (_stream2messageQueue.containsKey(streamId)) { + throw ArgumentError( + 'Cannot register a SteramMessageQueueIn for the same streamId ' + 'multiple times'); + } + + var pendingMessages = Queue(); + _stream2pendingMessages[streamId] = pendingMessages; + _stream2messageQueue[streamId] = mq; + + mq.bufferIndicator.bufferEmptyEvents.listen((_) { + _catchProtocolErrors(() { + _tryDispatch(streamId, mq, pendingMessages); + }); + }); + } + + /// Removes a stream id and its message queue from this connection-level + /// message queue. + void removeStreamMessageQueue(int streamId) { + _stream2pendingMessages.remove(streamId); + _stream2messageQueue.remove(streamId); + } + + /// Processes an incoming [DataFrame] which is addressed to a specific stream. + void processDataFrame(DataFrame frame) { + var streamId = frame.header.streamId; + var message = DataMessage(streamId, frame.bytes, frame.hasEndStreamFlag); + + _windowUpdateHandler.gotData(message.bytes.length); + _addMessage(streamId, message); + } + + /// If a [DataFrame] will be ignored, this method will take the minimal + /// action necessary. + void processIgnoredDataFrame(DataFrame frame) { + _windowUpdateHandler.dataProcessed(frame.bytes.length); + } + + /// Processes an incoming [HeadersFrame] which is addressed to a specific + /// stream. + void processHeadersFrame(HeadersFrame frame) { + var streamId = frame.header.streamId; + var message = + HeadersMessage(streamId, frame.decodedHeaders, frame.hasEndStreamFlag); + // NOTE: Header frames do not affect flow control - only data frames do. + _addMessage(streamId, message); + } + + /// Processes an incoming [PushPromiseFrame] which is addressed to a specific + /// stream. + void processPushPromiseFrame( + PushPromiseFrame frame, ClientTransportStream pushedStream) { + var streamId = frame.header.streamId; + var message = PushPromiseMessage(streamId, frame.decodedHeaders, + frame.promisedStreamId, pushedStream, false); + + // NOTE: + // * Header frames do not affect flow control - only data frames do. + // * At this point we might reorder a push message earlier than + // data/headers messages. + _addPushMessage(streamId, message); + } + + void _addMessage(int streamId, Message message) { + _count++; + + // TODO: Do we need to do a runtime check here and + // raise a protocol error if we cannot find the registered stream? + var streamMQ = _stream2messageQueue[streamId]!; + var pendingMessages = _stream2pendingMessages[streamId]!; + pendingMessages.addLast(message); + _tryDispatch(streamId, streamMQ, pendingMessages); + } + + void _addPushMessage(int streamId, PushPromiseMessage message) { + _count++; + + // TODO: Do we need to do a runtime check here and + // raise a protocol error if we cannot find the registered stream? + var streamMQ = _stream2messageQueue[streamId]!; + streamMQ.enqueueMessage(message); + } + + void _tryDispatch( + int streamId, StreamMessageQueueIn mq, Queue pendingMessages) { + var bytesDeliveredToStream = 0; + while (!mq.bufferIndicator.wouldBuffer && pendingMessages.isNotEmpty) { + _count--; + + var message = pendingMessages.removeFirst(); + if (message is DataMessage) { + bytesDeliveredToStream += message.bytes.length; + } + mq.enqueueMessage(message); + if (message.endStream) { + assert(pendingMessages.isEmpty); + + _stream2messageQueue.remove(streamId); + _stream2pendingMessages.remove(streamId); + } + } + if (bytesDeliveredToStream > 0) { + _windowUpdateHandler.dataProcessed(bytesDeliveredToStream); + } + + onCheckForClose(); + } + + void forceDispatchIncomingMessages() { + final toBeRemoved = {}; + _stream2pendingMessages.forEach((int streamId, Queue messages) { + final mq = _stream2messageQueue[streamId]!; + while (messages.isNotEmpty) { + _count--; + final message = messages.removeFirst(); + mq.enqueueMessage(message); + if (message.endStream) { + toBeRemoved.add(streamId); + break; + } + } + }); + + for (final streamId in toBeRemoved) { + _stream2messageQueue.remove(streamId); + _stream2pendingMessages.remove(streamId); + } + } +} diff --git a/pkgs/http2/lib/src/flowcontrol/queue_messages.dart b/pkgs/http2/lib/src/flowcontrol/queue_messages.dart new file mode 100644 index 0000000000..5c71228d45 --- /dev/null +++ b/pkgs/http2/lib/src/flowcontrol/queue_messages.dart @@ -0,0 +1,75 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../../transport.dart'; + +/// The subclasses of [Message] are objects that are coming from the +/// connection layer on top of frames. +/// +/// Messages on a HTTP/2 stream will be represented by a different class +/// hierarchy. +abstract class Message { + final int streamId; + final bool endStream; + + Message(this.streamId, this.endStream); +} + +class HeadersMessage extends Message { + final List
headers; + + HeadersMessage(int streamId, this.headers, bool endStream) + : super(streamId, endStream); + + @override + String toString() => + 'HeadersMessage(headers: ${headers.length}, endStream: $endStream)'; +} + +class DataMessage extends Message { + final List bytes; + + DataMessage(int streamId, this.bytes, bool endStream) + : super(streamId, endStream); + + @override + String toString() => + 'DataMessage(bytes: ${bytes.length}, endStream: $endStream)'; +} + +class PushPromiseMessage extends Message { + final List
headers; + final int promisedStreamId; + final ClientTransportStream pushedStream; + + PushPromiseMessage(int streamId, this.headers, this.promisedStreamId, + this.pushedStream, bool endStream) + : super(streamId, endStream); + + @override + String toString() => 'PushPromiseMessage(bytes: ${headers.length}, ' + 'promisedStreamId: $promisedStreamId, endStream: $endStream)'; +} + +class ResetStreamMessage extends Message { + final int errorCode; + + ResetStreamMessage(int streamId, this.errorCode) : super(streamId, false); + + @override + String toString() => 'ResetStreamMessage(errorCode: $errorCode)'; +} + +class GoawayMessage extends Message { + final int lastStreamId; + final int errorCode; + final List debugData; + + GoawayMessage(this.lastStreamId, this.errorCode, this.debugData) + : super(0, false); + + @override + String toString() => 'GoawayMessage(lastStreamId: $lastStreamId, ' + 'errorCode: $errorCode, debugData: ${debugData.length})'; +} diff --git a/pkgs/http2/lib/src/flowcontrol/stream_queues.dart b/pkgs/http2/lib/src/flowcontrol/stream_queues.dart new file mode 100644 index 0000000000..de7950a66e --- /dev/null +++ b/pkgs/http2/lib/src/flowcontrol/stream_queues.dart @@ -0,0 +1,328 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:collection'; + +import '../../transport.dart'; +import '../async_utils/async_utils.dart'; +import '../byte_utils.dart'; +import '../error_handler.dart'; + +import 'connection_queues.dart'; +import 'queue_messages.dart'; +import 'window_handler.dart'; + +/// This class will buffer any headers/data messages in the order they were +/// added. +/// +/// It will ensure that we never send more data than the remote flow control +/// window allows. +class StreamMessageQueueOut extends Object + with TerminatableMixin, ClosableMixin { + /// The id of the stream this message queue belongs to. + final int streamId; + + /// The stream-level flow control handler. + final OutgoingStreamWindowHandler streamWindow; + + /// The underlying connection-level message queue. + final ConnectionMessageQueueOut connectionMessageQueue; + + /// A indicator for whether this queue is currently buffering. + final BufferIndicator bufferIndicator = BufferIndicator(); + + /// Buffered [Message]s which will be written to the underlying connection + /// if the flow control window allows so. + final Queue _messages = Queue(); + + /// Debugging data on how much data should be written to the underlying + /// connection message queue. + int toBeWrittenBytes = 0; + + /// Debugging data on how much data was written to the underlying connection + /// message queue. + int writtenBytes = 0; + + StreamMessageQueueOut( + this.streamId, this.streamWindow, this.connectionMessageQueue) { + streamWindow.positiveWindow.bufferEmptyEvents.listen((_) { + if (!wasTerminated) { + _trySendData(); + } + }); + if (streamWindow.positiveWindow.wouldBuffer) { + bufferIndicator.markBuffered(); + } else { + bufferIndicator.markUnBuffered(); + } + } + + /// Debugging data about how many messages are pending to be written to the + /// connection message queue. + int get pendingMessages => _messages.length; + + /// Enqueues a new [Message] which is to be delivered to the connection + /// message queue. + void enqueueMessage(Message message) { + if (message is! ResetStreamMessage) ensureNotClosingSync(() {}); + if (!wasTerminated) { + if (message.endStream) startClosing(); + + if (message is DataMessage) { + toBeWrittenBytes += message.bytes.length; + } + + _messages.addLast(message); + _trySendData(); + + if (_messages.isNotEmpty) { + bufferIndicator.markBuffered(); + } + } + } + + @override + void onTerminated(Object? error) { + _messages.clear(); + closeWithError(error); + } + + @override + void onCheckForClose() { + if (isClosing && _messages.isEmpty) closeWithValue(); + } + + void _trySendData() { + var queueLenBefore = _messages.length; + + while (_messages.isNotEmpty) { + var message = _messages.first; + + if (message is HeadersMessage) { + _messages.removeFirst(); + connectionMessageQueue.enqueueMessage(message); + } else if (message is DataMessage) { + var bytesAvailable = streamWindow.peerWindowSize; + if (bytesAvailable > 0 || message.bytes.isEmpty) { + _messages.removeFirst(); + + // Do we need to fragment? + var messageToSend = message; + var messageBytes = message.bytes; + // TODO: Do not fragment if the number of bytes we can send is too low + if (messageBytes.length > bytesAvailable) { + var partA = viewOrSublist(messageBytes, 0, bytesAvailable); + var partB = viewOrSublist(messageBytes, bytesAvailable, + messageBytes.length - bytesAvailable); + var messageA = DataMessage(message.streamId, partA, false); + var messageB = + DataMessage(message.streamId, partB, message.endStream); + + // Put the second fragment back into the front of the queue. + _messages.addFirst(messageB); + + // Send the first fragment. + messageToSend = messageA; + } + + writtenBytes += messageToSend.bytes.length; + streamWindow.decreaseWindow(messageToSend.bytes.length); + connectionMessageQueue.enqueueMessage(messageToSend); + } else { + break; + } + } else if (message is ResetStreamMessage) { + _messages.removeFirst(); + connectionMessageQueue.enqueueMessage(message); + } else { + throw StateError('Unknown messages type: ${message.runtimeType}'); + } + } + if (queueLenBefore > 0 && _messages.isEmpty) { + bufferIndicator.markUnBuffered(); + } + + onCheckForClose(); + } +} + +/// Keeps a list of [Message] which should be delivered to the +/// [TransportStream]. +/// +/// It will keep messages up to the stream flow control window size if the +/// [messages] listener is paused. +class StreamMessageQueueIn extends Object + with TerminatableMixin, ClosableMixin, CancellableMixin { + /// The stream-level window our peer is using when sending us messages. + final IncomingWindowHandler windowHandler; + + /// A indicator whether this [StreamMessageQueueIn] is currently buffering. + final BufferIndicator bufferIndicator = BufferIndicator(); + + /// The pending [Message]s which are to be delivered via the [messages] + /// stream. + final Queue _pendingMessages = Queue(); + + /// The [StreamController] used for producing the [messages] stream. + final _incomingMessagesC = StreamController(); + + /// The [StreamController] used for producing the [serverPushes] stream. + final _serverPushStreamsC = StreamController(); + + StreamMessageQueueIn(this.windowHandler) { + // We start by marking it as buffered, since no one is listening yet and + // incoming messages will get buffered. + bufferIndicator.markBuffered(); + + _incomingMessagesC + ..onListen = () { + if (!wasClosed && !wasTerminated) { + _tryDispatch(); + _tryUpdateBufferIndicator(); + } + } + ..onPause = _tryUpdateBufferIndicator + ..onResume = () { + if (!wasClosed && !wasTerminated) { + _tryDispatch(); + _tryUpdateBufferIndicator(); + } + } + ..onCancel = cancel; + + _serverPushStreamsC.onListen = () { + if (!wasClosed && !wasTerminated) { + _tryDispatch(); + _tryUpdateBufferIndicator(); + } + }; + } + + /// Debugging data: the number of pending messages in this queue. + int get pendingMessages => _pendingMessages.length; + + /// The stream of [StreamMessage]s which come from the remote peer. + Stream get messages => _incomingMessagesC.stream; + + /// The stream of [TransportStreamPush]es which come from the remote peer. + Stream get serverPushes => _serverPushStreamsC.stream; + + /// A lower layer enqueues a new [Message] which should be delivered to the + /// app. + void enqueueMessage(Message message) { + ensureNotClosingSync(() { + if (!wasTerminated) { + if (message is PushPromiseMessage) { + // NOTE: If server pushes were enabled, the client is responsible for + // either rejecting or handling them. + assert(!_serverPushStreamsC.isClosed); + var transportStreamPush = + TransportStreamPush(message.headers, message.pushedStream); + _serverPushStreamsC.add(transportStreamPush); + return; + } + + if (message is DataMessage) { + windowHandler.gotData(message.bytes.length); + } + _pendingMessages.add(message); + if (message.endStream) startClosing(); + + _tryDispatch(); + _tryUpdateBufferIndicator(); + } + }); + } + + @override + void onTerminated(Object? error) { + _pendingMessages.clear(); + if (!wasClosed) { + if (error != null) { + _incomingMessagesC.addError(error); + } + _incomingMessagesC.close(); + _serverPushStreamsC.close(); + closeWithError(error); + } + } + + void onCloseCheck() { + if (isClosing && !wasClosed && _pendingMessages.isEmpty) { + _incomingMessagesC.close(); + _serverPushStreamsC.close(); + closeWithValue(); + } + } + + void forceDispatchIncomingMessages() { + while (_pendingMessages.isNotEmpty) { + final message = _pendingMessages.removeFirst(); + assert(!_incomingMessagesC.isClosed); + if (message is HeadersMessage) { + _incomingMessagesC.add(HeadersStreamMessage(message.headers, + endStream: message.endStream)); + } else if (message is DataMessage) { + if (message.bytes.isNotEmpty) { + _incomingMessagesC.add( + DataStreamMessage(message.bytes, endStream: message.endStream)); + } + } else { + // This can never happen. + assert(false); + } + if (message.endStream) { + onCloseCheck(); + } + } + } + + void _tryDispatch() { + while (!wasTerminated && _pendingMessages.isNotEmpty) { + var handled = wasCancelled; + + var message = _pendingMessages.first; + if (wasCancelled) { + _pendingMessages.removeFirst(); + } else if (message is HeadersMessage || message is DataMessage) { + assert(!_incomingMessagesC.isClosed); + if (_incomingMessagesC.hasListener && !_incomingMessagesC.isPaused) { + _pendingMessages.removeFirst(); + if (message is HeadersMessage) { + // NOTE: Header messages do not affect flow control - only + // data messages do. + _incomingMessagesC.add(HeadersStreamMessage(message.headers, + endStream: message.endStream)); + } else if (message is DataMessage) { + if (message.bytes.isNotEmpty) { + _incomingMessagesC.add(DataStreamMessage(message.bytes, + endStream: message.endStream)); + windowHandler.dataProcessed(message.bytes.length); + } + } else { + // This can never happen. + assert(false); + } + handled = true; + } + } + if (handled) { + if (message.endStream) { + onCloseCheck(); + } + } else { + break; + } + } + } + + void _tryUpdateBufferIndicator() { + if (_incomingMessagesC.isPaused || _pendingMessages.isNotEmpty) { + bufferIndicator.markBuffered(); + } else if (bufferIndicator.wouldBuffer && !_incomingMessagesC.isPaused) { + bufferIndicator.markUnBuffered(); + } + } +} diff --git a/pkgs/http2/lib/src/flowcontrol/window.dart b/pkgs/http2/lib/src/flowcontrol/window.dart new file mode 100644 index 0000000000..51b90161c0 --- /dev/null +++ b/pkgs/http2/lib/src/flowcontrol/window.dart @@ -0,0 +1,24 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Window { + static const int MAX_WINDOW_SIZE = (1 << 31) - 1; + + /// The size available in this window. + /// + /// The default flow control window for the entire connection and for new + /// streams is 65535). + /// + /// NOTE: This value can potentially become negative. + int _size; + + Window({int initialSize = (1 << 16) - 1}) : _size = initialSize; + + /// The current size of the flow control window. + int get size => _size; + + void modify(int difference) { + _size += difference; + } +} diff --git a/pkgs/http2/lib/src/flowcontrol/window_handler.dart b/pkgs/http2/lib/src/flowcontrol/window_handler.dart new file mode 100644 index 0000000000..27d0321694 --- /dev/null +++ b/pkgs/http2/lib/src/flowcontrol/window_handler.dart @@ -0,0 +1,162 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../async_utils/async_utils.dart'; +import '../frames/frames.dart'; +import '../sync_errors.dart'; + +import 'window.dart'; + +abstract class AbstractOutgoingWindowHandler { + /// The connection flow control window. + final Window _peerWindow; + + /// Indicates when the outgoing connection window turned positive and we can + /// send data frames again. + final BufferIndicator positiveWindow = BufferIndicator(); + + AbstractOutgoingWindowHandler(this._peerWindow) { + if (_peerWindow.size > 0) { + positiveWindow.markUnBuffered(); + } + } + + /// The flow control window size we use for sending data. We are not allowed + /// to let this window be negative. + int get peerWindowSize => _peerWindow.size; + + /// Process a window update frame received from the remote end. + void processWindowUpdate(WindowUpdateFrame frame) { + var increment = frame.windowSizeIncrement; + if ((_peerWindow.size + increment) > Window.MAX_WINDOW_SIZE) { + throw FlowControlException( + 'Window update received from remote peer would make flow control ' + 'window too large.'); + } else { + _peerWindow.modify(increment); + } + + // If we transitioned from an negative/empty window to a positive window + // we'll fire an event that more data frames can be sent now. + if (positiveWindow.wouldBuffer && _peerWindow.size > 0) { + positiveWindow.markUnBuffered(); + } + } + + /// Update the peer window by subtracting [numberOfBytes]. + /// + /// The remote peer will send us [WindowUpdateFrame]s which will increase + /// the window again at a later point in time. + void decreaseWindow(int numberOfBytes) { + _peerWindow.modify(-numberOfBytes); + if (_peerWindow.size <= 0) { + positiveWindow.markBuffered(); + } + } +} + +/// Handles the connection window for outgoing data frames. +class OutgoingConnectionWindowHandler extends AbstractOutgoingWindowHandler { + OutgoingConnectionWindowHandler(super.window); +} + +/// Handles the window for outgoing messages to the peer. +class OutgoingStreamWindowHandler extends AbstractOutgoingWindowHandler { + OutgoingStreamWindowHandler(super.window); + + /// Update the peer window by adding [difference] to it. + /// + /// + /// The remote peer has send a new [SettingsFrame] which updated the default + /// stream level [Setting.SETTINGS_INITIAL_WINDOW_SIZE]. This causes all + /// existing streams to update the flow stream-level flow control window. + void processInitialWindowSizeSettingChange(int difference) { + if ((_peerWindow.size + difference) > Window.MAX_WINDOW_SIZE) { + throw FlowControlException( + 'Window update received from remote peer would make flow control ' + 'window too large.'); + } else { + _peerWindow.modify(difference); + if (_peerWindow.size <= 0) { + positiveWindow.markBuffered(); + } else if (positiveWindow.wouldBuffer) { + positiveWindow.markUnBuffered(); + } + } + } +} + +/// Mirrors the flow control window the remote end is using. +class IncomingWindowHandler { + /// The [FrameWriter] used for writing [WindowUpdateFrame]s to the wire. + final FrameWriter _frameWriter; + + /// The mirror of the [Window] the remote end sees. + /// + /// If [_localWindow ] turns negative, it means the remote peer sent us more + /// data than we allowed it to send. + final Window _localWindow; + + /// The stream id this window handler is for (is `0` for connection level). + final int _streamId; + + IncomingWindowHandler.stream( + this._frameWriter, this._localWindow, this._streamId); + + IncomingWindowHandler.connection(this._frameWriter, this._localWindow) + : _streamId = 0; + + /// The current size for the incoming data window. + /// + /// (This should never get negative, otherwise the peer send us more data + /// than we told it to send.) + int get localWindowSize => _localWindow.size; + + /// Signals that we received [numberOfBytes] from the remote peer. + void gotData(int numberOfBytes) { + _localWindow.modify(-numberOfBytes); + + // If this turns negative, it means the remote end send us more data + // then we announced we can handle (i.e. the remote window size must be + // negative). + // + // NOTE: [_localWindow.size] tracks the amount of data we advertised that we + // can handle. The value can change in three situations: + // + // a) We received data from the remote end (we can handle now less data) + // => This is handled by [gotData]. + // + // b) We processed data from the remote end (we can handle now more data) + // => This is handled by [dataProcessed]. + // + // c) We increase/decrease the initial stream window size after the + // stream was created (newer streams will start with the changed + // initial stream window size). + // => This is not an issue, because we don't support changing the + // initial window size later on -- only during the initial + // settings exchange. Since streams (and therefore instances + // of [IncomingWindowHandler]) are only created after sending out + // our initial settings. + // + if (_localWindow.size < 0) { + throw FlowControlException( + 'Connection level flow control window became negative.'); + } + } + + /// Tell the peer we received [numberOfBytes] bytes. It will increase it's + /// sending window then. + /// + // TODO/FIXME: If we pause and don't want to get more data, we have to + // - either stop sending window update frames + // - or decreasing the window size + void dataProcessed(int numberOfBytes) { + _localWindow.modify(numberOfBytes); + + // TODO: This can be optimized by delaying the window update to + // send one update with a bigger difference than multiple small update + // frames. + _frameWriter.writeWindowUpdate(numberOfBytes, streamId: _streamId); + } +} diff --git a/pkgs/http2/lib/src/frames/frame_defragmenter.dart b/pkgs/http2/lib/src/frames/frame_defragmenter.dart new file mode 100644 index 0000000000..5ab2c72426 --- /dev/null +++ b/pkgs/http2/lib/src/frames/frame_defragmenter.dart @@ -0,0 +1,91 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../sync_errors.dart'; + +import 'frames.dart'; + +/// Class used for defragmenting [HeadersFrame]s and [PushPromiseFrame]s. +// TODO: Somehow emit an error if too many continuation frames have been sent +// (since we're buffering all of them). +class FrameDefragmenter { + /// The current incomplete [HeadersFrame] fragment. + HeadersFrame? _headersFrame; + + /// The current incomplete [PushPromiseFrame] fragment. + PushPromiseFrame? _pushPromiseFrame; + + /// Tries to defragment [frame]. + /// + /// If the given [frame] is a [HeadersFrame] or a [PushPromiseFrame] which + /// needs de-fragmentation, it will be saved and `null` will be returned. + /// + /// If there is currently an incomplete [HeadersFrame] or [PushPromiseFrame] + /// saved, [frame] needs to be a [ContinuationFrame]. It will be added to the + /// saved frame. In case the defragmentation is complete, the defragmented + /// [HeadersFrame] or [PushPromiseFrame] will be returned. + /// + /// All other [Frame] types will be returned. + // TODO: Consider handling continuation frames without preceding + // headers/push-promise frame here instead of the call site? + Frame? tryDefragmentFrame(Frame? frame) { + if (_headersFrame != null) { + if (frame is ContinuationFrame) { + if (_headersFrame!.header.streamId != frame.header.streamId) { + throw ProtocolException( + 'Defragmentation: frames have different stream ids.'); + } + _headersFrame = _headersFrame!.addBlockContinuation(frame); + + if (frame.hasEndHeadersFlag) { + var frame = _headersFrame; + _headersFrame = null; + return frame; + } else { + return null; + } + } else { + throw ProtocolException( + 'Defragmentation: Incomplete frame must be followed by ' + 'continuation frame.'); + } + } else if (_pushPromiseFrame != null) { + if (frame is ContinuationFrame) { + if (_pushPromiseFrame!.header.streamId != frame.header.streamId) { + throw ProtocolException( + 'Defragmentation: frames have different stream ids.'); + } + _pushPromiseFrame = _pushPromiseFrame!.addBlockContinuation(frame); + + if (frame.hasEndHeadersFlag) { + var frame = _pushPromiseFrame; + _pushPromiseFrame = null; + return frame; + } else { + return null; + } + } else { + throw ProtocolException( + 'Defragmentation: Incomplete frame must be followed by ' + 'continuation frame.'); + } + } else { + if (frame is HeadersFrame) { + if (!frame.hasEndHeadersFlag) { + _headersFrame = frame; + return null; + } + } else if (frame is PushPromiseFrame) { + if (!frame.hasEndHeadersFlag) { + _pushPromiseFrame = frame; + return null; + } + } + } + + // If this frame is not relevant for header defragmentation, we pass it to + // the next stage. + return frame; + } +} diff --git a/pkgs/http2/lib/src/frames/frame_reader.dart b/pkgs/http2/lib/src/frames/frame_reader.dart new file mode 100644 index 0000000000..7b692614aa --- /dev/null +++ b/pkgs/http2/lib/src/frames/frame_reader.dart @@ -0,0 +1,284 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +part of 'frames.dart'; + +/// Used for converting a `Stream>` to a `Stream`. +class FrameReader { + final Stream> _inputStream; + + /// Connection settings which this reader needs to ensure the remote end is + /// complying with. + final ActiveSettings _localSettings; + + final _framesController = StreamController(); + + FrameReader(this._inputStream, this._localSettings); + + /// Starts to listen on the input stream and decodes HTTP/2 transport frames. + Stream startDecoding() { + var bufferedData = >[]; + var bufferedLength = 0; + + FrameHeader? tryReadHeader() { + if (bufferedLength >= FRAME_HEADER_SIZE) { + // Get at least FRAME_HEADER_SIZE bytes in the first byte array. + _mergeLists(bufferedData, FRAME_HEADER_SIZE); + + // Read the frame header from the first byte array. + return _readFrameHeader(bufferedData[0], 0); + } + return null; + } + + Frame? tryReadFrame(FrameHeader header) { + var totalFrameLen = FRAME_HEADER_SIZE + header.length; + if (bufferedLength >= totalFrameLen) { + // Get the whole frame in the first byte array. + _mergeLists(bufferedData, totalFrameLen); + + // Read the frame. + var frame = _readFrame(header, bufferedData[0], FRAME_HEADER_SIZE); + + // Update bufferedData/bufferedLength + var firstChunkLen = bufferedData[0].length; + if (firstChunkLen == totalFrameLen) { + bufferedData.removeAt(0); + } else { + bufferedData[0] = viewOrSublist( + bufferedData[0], totalFrameLen, firstChunkLen - totalFrameLen); + } + bufferedLength -= totalFrameLen; + + return frame; + } + return null; + } + + _framesController.onListen = () { + FrameHeader? header; + + late StreamSubscription> subscription; + + void terminateWithError(Object error, [StackTrace? stack]) { + header = null; + _framesController.addError(error, stack); + subscription.cancel(); + _framesController.close(); + } + + subscription = _inputStream.listen((List data) { + bufferedData.add(data); + bufferedLength += data.length; + + try { + while (true) { + header ??= tryReadHeader(); + if (header != null) { + if (header!.length > _localSettings.maxFrameSize) { + terminateWithError( + FrameSizeException('Incoming frame is too big.')); + return; + } + + var frame = tryReadFrame(header!); + + if (frame != null) { + _framesController.add(frame); + header = null; + } else { + break; + } + } else { + break; + } + } + } catch (error, stack) { + terminateWithError(error, stack); + } + }, onError: (Object error, StackTrace stack) { + terminateWithError(error, stack); + }, onDone: () { + if (bufferedLength == 0) { + _framesController.close(); + } else { + terminateWithError(FrameSizeException( + 'Incoming byte stream ended with incomplete frame')); + } + }); + + _framesController + ..onPause = subscription.pause + ..onResume = subscription.resume; + }; + + return _framesController.stream; + } + + /// Combine combines/merges `List`s of `bufferedData` until + /// `numberOfBytes` have been accumulated. + /// + /// After calling `mergeLists`, `bufferedData[0]` will contain at least + /// `numberOfBytes` bytes. + void _mergeLists(List> bufferedData, int numberOfBytes) { + if (bufferedData[0].length < numberOfBytes) { + var numLists = 0; + var accumulatedLength = 0; + while (accumulatedLength < numberOfBytes && + numLists <= bufferedData.length) { + accumulatedLength += bufferedData[numLists++].length; + } + assert(accumulatedLength >= numberOfBytes); + var newList = Uint8List(accumulatedLength); + var offset = 0; + for (var i = 0; i < numLists; i++) { + var data = bufferedData[i]; + newList.setRange(offset, offset + data.length, data); + offset += data.length; + } + bufferedData[0] = newList; + bufferedData.removeRange(1, numLists); + } + } + + /// Reads a FrameHeader] from [bytes], starting at [offset]. + FrameHeader _readFrameHeader(List bytes, int offset) { + var length = readInt24(bytes, offset); + var type = bytes[offset + 3]; + var flags = bytes[offset + 4]; + var streamId = readInt32(bytes, offset + 5) & 0x7fffffff; + + return FrameHeader(length, type, flags, streamId); + } + + /// Reads a [Frame] from [bytes], starting at [frameOffset]. + Frame _readFrame(FrameHeader header, List bytes, int frameOffset) { + var frameEnd = frameOffset + header.length; + + var offset = frameOffset; + switch (header.type) { + case FrameType.DATA: + var padLength = 0; + if (_isFlagSet(header.flags, DataFrame.FLAG_PADDED)) { + _checkFrameLengthCondition((frameEnd - offset) >= 1); + padLength = bytes[offset++]; + } + var dataLen = frameEnd - offset - padLength; + _checkFrameLengthCondition(dataLen >= 0); + var dataBytes = viewOrSublist(bytes, offset, dataLen); + return DataFrame(header, padLength, dataBytes); + + case FrameType.HEADERS: + var padLength = 0; + if (_isFlagSet(header.flags, HeadersFrame.FLAG_PADDED)) { + _checkFrameLengthCondition((frameEnd - offset) >= 1); + padLength = bytes[offset++]; + } + int? streamDependency; + var exclusiveDependency = false; + int? weight; + if (_isFlagSet(header.flags, HeadersFrame.FLAG_PRIORITY)) { + _checkFrameLengthCondition((frameEnd - offset) >= 5); + exclusiveDependency = (bytes[offset] & 0x80) == 0x80; + streamDependency = readInt32(bytes, offset) & 0x7fffffff; + offset += 4; + weight = bytes[offset++]; + } + var headerBlockLen = frameEnd - offset - padLength; + _checkFrameLengthCondition(headerBlockLen >= 0); + var headerBlockFragment = viewOrSublist(bytes, offset, headerBlockLen); + return HeadersFrame(header, padLength, exclusiveDependency, + streamDependency, weight, headerBlockFragment); + + case FrameType.PRIORITY: + _checkFrameLengthCondition( + (frameEnd - offset) == PriorityFrame.FIXED_FRAME_LENGTH, + message: 'Priority frame length must be exactly 5 bytes.'); + var exclusiveDependency = (bytes[offset] & 0x80) == 0x80; + var streamDependency = readInt32(bytes, offset) & 0x7fffffff; + var weight = bytes[offset + 4]; + return PriorityFrame( + header, exclusiveDependency, streamDependency, weight); + + case FrameType.RST_STREAM: + _checkFrameLengthCondition( + (frameEnd - offset) == RstStreamFrame.FIXED_FRAME_LENGTH, + message: 'Rst frames must have a length of 4.'); + var errorCode = readInt32(bytes, offset); + return RstStreamFrame(header, errorCode); + + case FrameType.SETTINGS: + _checkFrameLengthCondition((header.length % 6) == 0, + message: 'Settings frame length must be a multiple of 6 bytes.'); + + var count = header.length ~/ 6; + var settings = []; + for (var i = 0; i < count; i++) { + var identifier = readInt16(bytes, offset + 6 * i); + var value = readInt32(bytes, offset + 6 * i + 2); + settings.add(Setting(identifier, value)); + } + var frame = SettingsFrame(header, settings); + if (frame.hasAckFlag) { + _checkFrameLengthCondition(header.length == 0, + message: 'Settings frame length must 0 for ACKs.'); + } + return frame; + + case FrameType.PUSH_PROMISE: + var padLength = 0; + if (_isFlagSet(header.flags, PushPromiseFrame.FLAG_PADDED)) { + _checkFrameLengthCondition((frameEnd - offset) >= 1); + padLength = bytes[offset++]; + } + var promisedStreamId = readInt32(bytes, offset) & 0x7fffffff; + offset += 4; + var headerBlockLen = frameEnd - offset - padLength; + _checkFrameLengthCondition(headerBlockLen >= 0); + var headerBlockFragment = viewOrSublist(bytes, offset, headerBlockLen); + return PushPromiseFrame( + header, padLength, promisedStreamId, headerBlockFragment); + + case FrameType.PING: + _checkFrameLengthCondition( + (frameEnd - offset) == PingFrame.FIXED_FRAME_LENGTH, + message: 'Ping frames must have a length of 8.'); + var opaqueData = readInt64(bytes, offset); + return PingFrame(header, opaqueData); + + case FrameType.GOAWAY: + _checkFrameLengthCondition((frameEnd - offset) >= 8); + var lastStreamId = readInt32(bytes, offset); + var errorCode = readInt32(bytes, offset + 4); + var debugData = viewOrSublist(bytes, offset + 8, header.length - 8); + return GoawayFrame(header, lastStreamId, errorCode, debugData); + + case FrameType.WINDOW_UPDATE: + _checkFrameLengthCondition( + (frameEnd - offset) == WindowUpdateFrame.FIXED_FRAME_LENGTH, + message: 'Window update frames must have a length of 4.'); + var windowSizeIncrement = readInt32(bytes, offset) & 0x7fffffff; + return WindowUpdateFrame(header, windowSizeIncrement); + + case FrameType.CONTINUATION: + var headerBlockFragment = + viewOrSublist(bytes, offset, frameEnd - offset); + return ContinuationFrame(header, headerBlockFragment); + + default: + // Unknown frames should be ignored according to spec. + return UnknownFrame( + header, viewOrSublist(bytes, offset, frameEnd - offset)); + } + } + + /// Checks that [condition] is `true` and raises an [FrameSizeException] + /// otherwise. + void _checkFrameLengthCondition(bool condition, + {String message = 'Frame not long enough.'}) { + if (!condition) { + throw FrameSizeException(message); + } + } +} diff --git a/pkgs/http2/lib/src/frames/frame_types.dart b/pkgs/http2/lib/src/frames/frame_types.dart new file mode 100644 index 0000000000..33c9e4aff1 --- /dev/null +++ b/pkgs/http2/lib/src/frames/frame_types.dart @@ -0,0 +1,348 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +part of 'frames.dart'; + +const int FRAME_HEADER_SIZE = 9; + +class FrameType { + static const int DATA = 0; + static const int HEADERS = 1; + static const int PRIORITY = 2; + static const int RST_STREAM = 3; + static const int SETTINGS = 4; + static const int PUSH_PROMISE = 5; + static const int PING = 6; + static const int GOAWAY = 7; + static const int WINDOW_UPDATE = 8; + static const int CONTINUATION = 9; +} + +class ErrorCode { + static const int NO_ERROR = 0; + static const int PROTOCOL_ERROR = 1; + static const int INTERNAL_ERROR = 2; + static const int FLOW_CONTROL_ERROR = 3; + static const int SETTINGS_TIMEOUT = 4; + static const int STREAM_CLOSED = 5; + static const int FRAME_SIZE_ERROR = 6; + static const int REFUSED_STREAM = 7; + static const int CANCEL = 8; + static const int COMPRESSION_ERROR = 9; + static const int CONNECT_ERROR = 10; + static const int ENHANCE_YOUR_CALM = 11; + static const int INADEQUATE_SECURITY = 12; + static const int HTTP_1_1_REQUIRED = 13; +} + +class FrameHeader { + final int length; + final int type; + final int flags; + final int streamId; + + FrameHeader(this.length, this.type, this.flags, this.streamId); + + Map toJson() => + {'length': length, 'type': type, 'flags': flags, 'streamId': streamId}; +} + +class Frame { + static const int MAX_LEN = (1 << 24) - 1; + + final FrameHeader header; + + Frame(this.header); + + Map toJson() => {'header': header.toJson()}; +} + +class DataFrame extends Frame { + static const int FLAG_END_STREAM = 0x1; + static const int FLAG_PADDED = 0x8; + + /// The number of padding bytes. + final int padLength; + + final List bytes; + + DataFrame(super.header, this.padLength, this.bytes); + + bool get hasEndStreamFlag => _isFlagSet(header.flags, FLAG_END_STREAM); + bool get hasPaddedFlag => _isFlagSet(header.flags, FLAG_PADDED); + + @override + Map toJson() => super.toJson() + ..addAll({ + 'padLength': padLength, + 'bytes (length)': bytes.length, + 'bytes (up to 4 bytes)': bytes.length > 4 ? bytes.sublist(0, 4) : bytes, + }); +} + +class HeadersFrame extends Frame { + static const int FLAG_END_STREAM = 0x1; + static const int FLAG_END_HEADERS = 0x4; + static const int FLAG_PADDED = 0x8; + static const int FLAG_PRIORITY = 0x20; + + // NOTE: This is the size a [HeadersFrame] can have in addition to padding + // and header block fragment data. + static const int MAX_CONSTANT_PAYLOAD = 6; + + /// The number of padding bytes (might be null). + final int padLength; + + final bool exclusiveDependency; + final int? streamDependency; + final int? weight; + final List headerBlockFragment; + + HeadersFrame( + super.header, + this.padLength, + this.exclusiveDependency, + this.streamDependency, + this.weight, + this.headerBlockFragment, + ); + + /// This will be set from the outside after decoding. + late List
decodedHeaders; + + bool get hasEndStreamFlag => _isFlagSet(header.flags, FLAG_END_STREAM); + bool get hasEndHeadersFlag => _isFlagSet(header.flags, FLAG_END_HEADERS); + bool get hasPaddedFlag => _isFlagSet(header.flags, FLAG_PADDED); + bool get hasPriorityFlag => _isFlagSet(header.flags, FLAG_PRIORITY); + + HeadersFrame addBlockContinuation(ContinuationFrame frame) { + var fragment = frame.headerBlockFragment; + var flags = header.flags | frame.header.flags; + var fh = FrameHeader( + header.length + fragment.length, header.type, flags, header.streamId); + + var mergedHeaderBlockFragment = + Uint8List(headerBlockFragment.length + fragment.length); + + mergedHeaderBlockFragment.setRange( + 0, headerBlockFragment.length, headerBlockFragment); + + mergedHeaderBlockFragment.setRange( + headerBlockFragment.length, mergedHeaderBlockFragment.length, fragment); + + return HeadersFrame(fh, padLength, exclusiveDependency, streamDependency, + weight, mergedHeaderBlockFragment); + } + + @override + Map toJson() => super.toJson() + ..addAll({ + 'padLength': padLength, + 'exclusiveDependency': exclusiveDependency, + 'streamDependency': streamDependency, + 'weight': weight, + 'headerBlockFragment (length)': headerBlockFragment.length + }); +} + +class PriorityFrame extends Frame { + static const int FIXED_FRAME_LENGTH = 5; + + final bool exclusiveDependency; + final int streamDependency; + final int weight; + + PriorityFrame( + super.header, + this.exclusiveDependency, + this.streamDependency, + this.weight, + ); + + @override + Map toJson() => super.toJson() + ..addAll({ + 'exclusiveDependency': exclusiveDependency, + 'streamDependency': streamDependency, + 'weight': weight, + }); +} + +class RstStreamFrame extends Frame { + static const int FIXED_FRAME_LENGTH = 4; + + final int errorCode; + + RstStreamFrame(super.header, this.errorCode); + + @override + Map toJson() => super.toJson() + ..addAll({ + 'errorCode': errorCode, + }); +} + +class Setting { + static const int SETTINGS_HEADER_TABLE_SIZE = 1; + static const int SETTINGS_ENABLE_PUSH = 2; + static const int SETTINGS_MAX_CONCURRENT_STREAMS = 3; + static const int SETTINGS_INITIAL_WINDOW_SIZE = 4; + static const int SETTINGS_MAX_FRAME_SIZE = 5; + static const int SETTINGS_MAX_HEADER_LIST_SIZE = 6; + + final int identifier; + final int value; + + Setting(this.identifier, this.value); + + Map toJson() => {'identifier': identifier, 'value': value}; +} + +class SettingsFrame extends Frame { + static const int FLAG_ACK = 0x1; + + // A setting consist of a 2 byte identifier and a 4 byte value. + static const int SETTING_SIZE = 6; + + final List settings; + + SettingsFrame(super.header, this.settings); + + bool get hasAckFlag => _isFlagSet(header.flags, FLAG_ACK); + + @override + Map toJson() => super.toJson() + ..addAll({ + 'settings': settings.map((s) => s.toJson()).toList(), + }); +} + +class PushPromiseFrame extends Frame { + static const int FLAG_END_HEADERS = 0x4; + static const int FLAG_PADDED = 0x8; + + // NOTE: This is the size a [PushPromiseFrame] can have in addition to padding + // and header block fragment data. + static const int MAX_CONSTANT_PAYLOAD = 5; + + final int padLength; + final int promisedStreamId; + final List headerBlockFragment; + + /// This will be set from the outside after decoding. + late List
decodedHeaders; + + PushPromiseFrame( + super.header, + this.padLength, + this.promisedStreamId, + this.headerBlockFragment, + ); + + bool get hasEndHeadersFlag => _isFlagSet(header.flags, FLAG_END_HEADERS); + bool get hasPaddedFlag => _isFlagSet(header.flags, FLAG_PADDED); + + PushPromiseFrame addBlockContinuation(ContinuationFrame frame) { + var fragment = frame.headerBlockFragment; + var flags = header.flags | frame.header.flags; + var fh = FrameHeader( + header.length + fragment.length, header.type, flags, header.streamId); + + var mergedHeaderBlockFragment = + Uint8List(headerBlockFragment.length + fragment.length); + + mergedHeaderBlockFragment.setRange( + 0, headerBlockFragment.length, headerBlockFragment); + + mergedHeaderBlockFragment.setRange( + headerBlockFragment.length, mergedHeaderBlockFragment.length, fragment); + + return PushPromiseFrame( + fh, padLength, promisedStreamId, mergedHeaderBlockFragment); + } + + @override + Map toJson() => super.toJson() + ..addAll({ + 'padLength': padLength, + 'promisedStreamId': promisedStreamId, + 'headerBlockFragment (len)': headerBlockFragment.length, + }); +} + +class PingFrame extends Frame { + static const int FIXED_FRAME_LENGTH = 8; + + static const int FLAG_ACK = 0x1; + + final int opaqueData; + + PingFrame(super.header, this.opaqueData); + + bool get hasAckFlag => _isFlagSet(header.flags, FLAG_ACK); + + @override + Map toJson() => super.toJson() + ..addAll({ + 'opaqueData': opaqueData, + }); +} + +class GoawayFrame extends Frame { + final int lastStreamId; + final int errorCode; + final List debugData; + + GoawayFrame(super.header, this.lastStreamId, this.errorCode, this.debugData); + + @override + Map toJson() => super.toJson() + ..addAll({ + 'lastStreamId': lastStreamId, + 'errorCode': errorCode, + 'debugData (length)': debugData.length, + }); +} + +class WindowUpdateFrame extends Frame { + static const int FIXED_FRAME_LENGTH = 4; + + final int windowSizeIncrement; + + WindowUpdateFrame(super.header, this.windowSizeIncrement); + + @override + Map toJson() => super.toJson() + ..addAll({ + 'windowSizeIncrement': windowSizeIncrement, + }); +} + +class ContinuationFrame extends Frame { + static const int FLAG_END_HEADERS = 0x4; + + final List headerBlockFragment; + + ContinuationFrame(super.header, this.headerBlockFragment); + + bool get hasEndHeadersFlag => _isFlagSet(header.flags, FLAG_END_HEADERS); + + @override + Map toJson() => super.toJson() + ..addAll({ + 'headerBlockFragment (length)': headerBlockFragment.length, + }); +} + +class UnknownFrame extends Frame { + final List data; + + UnknownFrame(super.header, this.data); + + @override + Map toJson() => super.toJson() + ..addAll({ + 'data (length)': data.length, + }); +} diff --git a/pkgs/http2/lib/src/frames/frame_utils.dart b/pkgs/http2/lib/src/frames/frame_utils.dart new file mode 100644 index 0000000000..11c30a5f96 --- /dev/null +++ b/pkgs/http2/lib/src/frames/frame_utils.dart @@ -0,0 +1,7 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +part of 'frames.dart'; + +bool _isFlagSet(int value, int flag) => value & flag == flag; diff --git a/pkgs/http2/lib/src/frames/frame_writer.dart b/pkgs/http2/lib/src/frames/frame_writer.dart new file mode 100644 index 0000000000..50caad75c9 --- /dev/null +++ b/pkgs/http2/lib/src/frames/frame_writer.dart @@ -0,0 +1,292 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +part of 'frames.dart'; + +// TODO: No support for writing padded information. +// TODO: No support for stream priorities. +class FrameWriter { + /// The HPack compression context. + final HPackEncoder _hpackEncoder; + + /// A buffered writer for outgoing bytes. + final BufferedBytesWriter _outWriter; + + /// Connection settings which this writer needs to respect. + final ActiveSettings _peerSettings; + + /// This is the maximum over all stream id's we've written to the underlying + /// sink. + int _highestWrittenStreamId = 0; + + FrameWriter( + this._hpackEncoder, StreamSink> outgoing, this._peerSettings) + : _outWriter = BufferedBytesWriter(outgoing); + + /// A indicator whether writes would be buffered. + BufferIndicator get bufferIndicator => _outWriter.bufferIndicator; + + /// This is the maximum over all stream id's we've written to the underlying + /// sink. + int get highestWrittenStreamId => _highestWrittenStreamId; + + void writeDataFrame(int streamId, List data, {bool endStream = false}) { + while (data.length > _peerSettings.maxFrameSize) { + var chunk = viewOrSublist(data, 0, _peerSettings.maxFrameSize); + data = viewOrSublist(data, _peerSettings.maxFrameSize, + data.length - _peerSettings.maxFrameSize); + _writeDataFrameNoFragment(streamId, chunk, false); + } + _writeDataFrameNoFragment(streamId, data, endStream); + } + + void _writeDataFrameNoFragment(int streamId, List data, bool endStream) { + var type = FrameType.DATA; + var flags = endStream ? DataFrame.FLAG_END_STREAM : 0; + + var buffer = Uint8List(FRAME_HEADER_SIZE + data.length); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, streamId, data.length); + offset += FRAME_HEADER_SIZE; + + buffer.setRange(offset, offset + data.length, data); + + _writeData(buffer); + } + + void writeHeadersFrame(int streamId, List
headers, + {bool endStream = true}) { + var fragment = _hpackEncoder.encode(headers); + var maxSize = + _peerSettings.maxFrameSize - HeadersFrame.MAX_CONSTANT_PAYLOAD; + + if (fragment.length < maxSize) { + _writeHeadersFrameNoFragment(streamId, fragment, true, endStream); + } else { + var chunk = fragment.sublist(0, maxSize); + fragment = fragment.sublist(maxSize); + _writeHeadersFrameNoFragment(streamId, chunk, false, endStream); + while (fragment.length > _peerSettings.maxFrameSize) { + var chunk = fragment.sublist(0, _peerSettings.maxFrameSize); + fragment = fragment.sublist(_peerSettings.maxFrameSize); + _writeContinuationFrame(streamId, chunk, false); + } + _writeContinuationFrame(streamId, fragment, true); + } + } + + void _writeHeadersFrameNoFragment( + int streamId, List fragment, bool endHeaders, bool endStream) { + var type = FrameType.HEADERS; + var flags = 0; + if (endHeaders) flags |= HeadersFrame.FLAG_END_HEADERS; + if (endStream) flags |= HeadersFrame.FLAG_END_STREAM; + + var buffer = Uint8List(FRAME_HEADER_SIZE + fragment.length); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, streamId, fragment.length); + offset += FRAME_HEADER_SIZE; + + buffer.setRange(offset, buffer.length, fragment); + + _writeData(buffer); + } + + void _writeContinuationFrame( + int streamId, List fragment, bool endHeaders) { + var type = FrameType.CONTINUATION; + var flags = endHeaders ? ContinuationFrame.FLAG_END_HEADERS : 0; + + var buffer = Uint8List(FRAME_HEADER_SIZE + fragment.length); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, streamId, fragment.length); + offset += FRAME_HEADER_SIZE; + + buffer.setRange(offset, buffer.length, fragment); + + _writeData(buffer); + } + + void writePriorityFrame(int streamId, int streamDependency, int weight, + {bool exclusive = false}) { + var type = FrameType.PRIORITY; + var flags = 0; + + var buffer = + Uint8List(FRAME_HEADER_SIZE + PriorityFrame.FIXED_FRAME_LENGTH); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, streamId, 5); + offset += FRAME_HEADER_SIZE; + + if (exclusive) { + setInt32(buffer, offset, (1 << 31) | streamDependency); + } else { + setInt32(buffer, offset, streamDependency); + } + buffer[offset + 4] = weight; + + _writeData(buffer); + } + + void writeRstStreamFrame(int streamId, int errorCode) { + var type = FrameType.RST_STREAM; + var flags = 0; + + var buffer = + Uint8List(FRAME_HEADER_SIZE + RstStreamFrame.FIXED_FRAME_LENGTH); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, streamId, 4); + offset += FRAME_HEADER_SIZE; + + setInt32(buffer, offset, errorCode); + + _writeData(buffer); + } + + void writeSettingsFrame(List settings) { + var type = FrameType.SETTINGS; + var flags = 0; + + var buffer = Uint8List(FRAME_HEADER_SIZE + 6 * settings.length); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, 0, 6 * settings.length); + offset += FRAME_HEADER_SIZE; + + for (var i = 0; i < settings.length; i++) { + var setting = settings[i]; + setInt16(buffer, offset + 6 * i, setting.identifier); + setInt32(buffer, offset + 6 * i + 2, setting.value); + } + + _writeData(buffer); + } + + void writeSettingsAckFrame() { + var type = FrameType.SETTINGS; + var flags = SettingsFrame.FLAG_ACK; + + var buffer = Uint8List(FRAME_HEADER_SIZE); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, 0, 0); + offset += FRAME_HEADER_SIZE; + + _writeData(buffer); + } + + void writePushPromiseFrame( + int streamId, int promisedStreamId, List
headers) { + var fragment = _hpackEncoder.encode(headers); + var maxSize = + _peerSettings.maxFrameSize - PushPromiseFrame.MAX_CONSTANT_PAYLOAD; + + if (fragment.length < maxSize) { + _writePushPromiseFrameNoFragmentation( + streamId, promisedStreamId, fragment, true); + } else { + var chunk = fragment.sublist(0, maxSize); + fragment = fragment.sublist(maxSize); + _writePushPromiseFrameNoFragmentation( + streamId, promisedStreamId, chunk, false); + while (fragment.length > _peerSettings.maxFrameSize) { + var chunk = fragment.sublist(0, _peerSettings.maxFrameSize); + fragment = fragment.sublist(_peerSettings.maxFrameSize); + _writeContinuationFrame(streamId, chunk, false); + } + _writeContinuationFrame(streamId, chunk, true); + } + } + + void _writePushPromiseFrameNoFragmentation( + int streamId, int promisedStreamId, List fragment, bool endHeaders) { + var type = FrameType.PUSH_PROMISE; + var flags = endHeaders ? HeadersFrame.FLAG_END_HEADERS : 0; + + var buffer = Uint8List(FRAME_HEADER_SIZE + 4 + fragment.length); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, streamId, 4 + fragment.length); + offset += FRAME_HEADER_SIZE; + + setInt32(buffer, offset, promisedStreamId); + buffer.setRange(offset + 4, offset + 4 + fragment.length, fragment); + + _writeData(buffer); + } + + void writePingFrame(int opaqueData, {bool ack = false}) { + var type = FrameType.PING; + var flags = ack ? PingFrame.FLAG_ACK : 0; + + var buffer = Uint8List(FRAME_HEADER_SIZE + PingFrame.FIXED_FRAME_LENGTH); + var offset = 0; + + _setFrameHeader(buffer, 0, type, flags, 0, 8); + offset += FRAME_HEADER_SIZE; + + setInt64(buffer, offset, opaqueData); + _writeData(buffer); + } + + void writeGoawayFrame(int lastStreamId, int errorCode, List debugData) { + var type = FrameType.GOAWAY; + var flags = 0; + + var buffer = Uint8List(FRAME_HEADER_SIZE + 8 + debugData.length); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, 0, 8 + debugData.length); + offset += FRAME_HEADER_SIZE; + + setInt32(buffer, offset, lastStreamId); + setInt32(buffer, offset + 4, errorCode); + buffer.setRange(offset + 8, buffer.length, debugData); + + _writeData(buffer); + } + + void writeWindowUpdate(int sizeIncrement, {int streamId = 0}) { + var type = FrameType.WINDOW_UPDATE; + var flags = 0; + + var buffer = + Uint8List(FRAME_HEADER_SIZE + WindowUpdateFrame.FIXED_FRAME_LENGTH); + var offset = 0; + + _setFrameHeader(buffer, offset, type, flags, streamId, 4); + offset += FRAME_HEADER_SIZE; + + setInt32(buffer, offset, sizeIncrement); + + _writeData(buffer); + } + + void _writeData(List bytes) { + _outWriter.add(bytes); + } + + /// Closes the underlying sink and returns [doneFuture]. + Future close() { + return _outWriter.close().whenComplete(() => doneFuture); + } + + /// The future which will complete once this writer is done. + Future get doneFuture => _outWriter.doneFuture; + + void _setFrameHeader(List bytes, int offset, int type, int flags, + int streamId, int length) { + setInt24(bytes, offset, length); + bytes[3] = type; + bytes[4] = flags; + setInt32(bytes, 5, streamId); + + _highestWrittenStreamId = max(_highestWrittenStreamId, streamId); + } +} diff --git a/pkgs/http2/lib/src/frames/frames.dart b/pkgs/http2/lib/src/frames/frames.dart new file mode 100644 index 0000000000..f6e74d250f --- /dev/null +++ b/pkgs/http2/lib/src/frames/frames.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library http2.src.frames; + +import 'dart:async'; +import 'dart:math' show max; +import 'dart:typed_data'; + +import '../async_utils/async_utils.dart'; +import '../byte_utils.dart'; +import '../hpack/hpack.dart'; +import '../settings/settings.dart'; +import '../sync_errors.dart'; + +part 'frame_types.dart'; +part 'frame_utils.dart'; +part 'frame_reader.dart'; +part 'frame_writer.dart'; diff --git a/pkgs/http2/lib/src/hpack/hpack.dart b/pkgs/http2/lib/src/hpack/hpack.dart new file mode 100644 index 0000000000..ab5d9c8fa8 --- /dev/null +++ b/pkgs/http2/lib/src/hpack/hpack.dart @@ -0,0 +1,347 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Implements a [HPackContext] for encoding/decoding headers according to the +/// HPACK specificaiton. See here for more information: +/// https://tools.ietf.org/html/draft-ietf-httpbis-header-compression-10 +library http2.hpack; + +import 'dart:convert' show ascii; +import 'dart:typed_data'; + +import '../byte_utils.dart'; +import 'huffman.dart'; +import 'huffman_table.dart'; + +/// Exception raised due to encoding/decoding errors. +class HPackDecodingException implements Exception { + final String _message; + + HPackDecodingException(this._message); + + @override + String toString() => 'HPackDecodingException: $_message'; +} + +/// A HPACK encoding/decoding context. +/// +/// This is a statefull class, so encoding/decoding changes internal state. +class HPackContext { + final HPackEncoder encoder = HPackEncoder(); + final HPackDecoder decoder = HPackDecoder(); + + HPackContext( + {int maxSendingHeaderTableSize = 4096, + int maxReceivingHeaderTableSize = 4096}) { + encoder.updateMaxSendingHeaderTableSize(maxSendingHeaderTableSize); + decoder.updateMaxReceivingHeaderTableSize(maxReceivingHeaderTableSize); + } +} + +/// A HTTP/2 header. +class Header { + final List name; + final List value; + final bool neverIndexed; + + Header(this.name, this.value, {this.neverIndexed = false}); + + factory Header.ascii(String name, String value) { + // Specs: `However, header field names MUST be converted to lowercase prior + // to their encoding in HTTP/2. A request or response containing uppercase + // header field names MUST be treated as malformed (Section 8.1.2.6).` + return Header(ascii.encode(name.toLowerCase()), ascii.encode(value)); + } +} + +/// A stateful HPACK decoder. +class HPackDecoder { + late int _maxHeaderTableSize; + + final IndexTable _table = IndexTable(); + + void updateMaxReceivingHeaderTableSize(int newMaximumSize) { + _maxHeaderTableSize = newMaximumSize; + } + + List
decode(List data) { + var offset = 0; + + int readInteger(int prefixBits) { + assert(prefixBits <= 8 && prefixBits > 0); + + var byte = data[offset++] & ((1 << prefixBits) - 1); + + int integer; + if (byte == ((1 << prefixBits) - 1)) { + // Length encodeded. + integer = 0; + var shift = 0; + while (true) { + var done = (data[offset] & 0x80) != 0x80; + integer += (data[offset++] & 0x7f) << shift; + shift += 7; + if (done) break; + } + integer += (1 << prefixBits) - 1; + } else { + // In place length. + integer = byte; + } + + return integer; + } + + List readStringLiteral() { + var isHuffmanEncoding = (data[offset] & 0x80) != 0; + var length = readInteger(7); + + var sublist = viewOrSublist(data, offset, length); + offset += length; + if (isHuffmanEncoding) { + return http2HuffmanCodec.decode(sublist); + } else { + return sublist; + } + } + + Header readHeaderFieldInternal(int index, {bool neverIndexed = false}) { + List name, value; + if (index > 0) { + name = _table.lookup(index).name; + value = readStringLiteral(); + } else { + name = readStringLiteral(); + value = readStringLiteral(); + } + return Header(name, value, neverIndexed: neverIndexed); + } + + try { + var headers =
[]; + while (offset < data.length) { + var byte = data[offset]; + var isIndexedField = (byte & 0x80) != 0; + var isIncrementalIndexing = (byte & 0xc0) == 0x40; + + var isWithoutIndexing = (byte & 0xf0) == 0; + var isNeverIndexing = (byte & 0xf0) == 0x10; + var isDynamicTableSizeUpdate = (byte & 0xe0) == 0x20; + + if (isIndexedField) { + var index = readInteger(7); + var field = _table.lookup(index); + headers.add(field); + } else if (isIncrementalIndexing) { + var field = readHeaderFieldInternal(readInteger(6)); + _table.addHeaderField(field); + headers.add(field); + } else if (isWithoutIndexing) { + headers.add(readHeaderFieldInternal(readInteger(4))); + } else if (isNeverIndexing) { + headers + .add(readHeaderFieldInternal(readInteger(4), neverIndexed: true)); + } else if (isDynamicTableSizeUpdate) { + var newMaxSize = readInteger(5); + if (newMaxSize <= _maxHeaderTableSize) { + _table.updateMaxSize(newMaxSize); + } else { + throw HPackDecodingException('Dynamic table size update failed: ' + 'A new value of $newMaxSize exceeds the limit of ' + '$_maxHeaderTableSize'); + } + } else { + throw HPackDecodingException('Invalid encoding of headers.'); + } + } + return headers; + // ignore: avoid_catching_errors + } on RangeError catch (e) { + throw HPackDecodingException('$e'); + } on HuffmanDecodingException catch (e) { + throw HPackDecodingException('$e'); + } + } +} + +/// A stateful HPACK encoder. +// TODO: Currently we encode all headers: +// - without huffman encoding +// - without using the dynamic table +class HPackEncoder { + void updateMaxSendingHeaderTableSize(int newMaximumSize) { + // TODO: Once we start encoding via dynamic table we need to let the other + // side know the maximum table size we're using. + } + + List encode(List
headers) { + var bytesBuilder = BytesBuilder(); + var currentByte = 0; + + void writeInteger(int prefixBits, int value) { + assert(prefixBits <= 8); + + if (value < (1 << prefixBits) - 1) { + currentByte |= value; + bytesBuilder.addByte(currentByte); + } else { + // Length encodeded. + currentByte |= (1 << prefixBits) - 1; + value -= (1 << prefixBits) - 1; + bytesBuilder.addByte(currentByte); + var done = false; + while (!done) { + currentByte = value & 0x7f; + value = value >> 7; + done = value == 0; + if (!done) currentByte |= 0x80; + bytesBuilder.addByte(currentByte); + } + } + currentByte = 0; + } + + void writeStringLiteral(List bytes) { + // TODO: Support huffman encoding. + currentByte = 0; // 1 would be huffman encoding + writeInteger(7, bytes.length); + bytesBuilder.add(bytes); + } + + void writeLiteralHeaderWithoutIndexing(Header header) { + bytesBuilder.addByte(0); + writeStringLiteral(header.name); + writeStringLiteral(header.value); + } + + for (var header in headers) { + writeLiteralHeaderWithoutIndexing(header); + } + + return bytesBuilder.takeBytes(); + } +} + +class IndexTable { + static final List _staticTable = [ + null, + Header(ascii.encode(':authority'), const []), + Header(ascii.encode(':method'), ascii.encode('GET')), + Header(ascii.encode(':method'), ascii.encode('POST')), + Header(ascii.encode(':path'), ascii.encode('/')), + Header(ascii.encode(':path'), ascii.encode('/index.html')), + Header(ascii.encode(':scheme'), ascii.encode('http')), + Header(ascii.encode(':scheme'), ascii.encode('https')), + Header(ascii.encode(':status'), ascii.encode('200')), + Header(ascii.encode(':status'), ascii.encode('204')), + Header(ascii.encode(':status'), ascii.encode('206')), + Header(ascii.encode(':status'), ascii.encode('304')), + Header(ascii.encode(':status'), ascii.encode('400')), + Header(ascii.encode(':status'), ascii.encode('404')), + Header(ascii.encode(':status'), ascii.encode('500')), + Header(ascii.encode('accept-charset'), const []), + Header(ascii.encode('accept-encoding'), ascii.encode('gzip, deflate')), + Header(ascii.encode('accept-language'), const []), + Header(ascii.encode('accept-ranges'), const []), + Header(ascii.encode('accept'), const []), + Header(ascii.encode('access-control-allow-origin'), const []), + Header(ascii.encode('age'), const []), + Header(ascii.encode('allow'), const []), + Header(ascii.encode('authorization'), const []), + Header(ascii.encode('cache-control'), const []), + Header(ascii.encode('content-disposition'), const []), + Header(ascii.encode('content-encoding'), const []), + Header(ascii.encode('content-language'), const []), + Header(ascii.encode('content-length'), const []), + Header(ascii.encode('content-location'), const []), + Header(ascii.encode('content-range'), const []), + Header(ascii.encode('content-type'), const []), + Header(ascii.encode('cookie'), const []), + Header(ascii.encode('date'), const []), + Header(ascii.encode('etag'), const []), + Header(ascii.encode('expect'), const []), + Header(ascii.encode('expires'), const []), + Header(ascii.encode('from'), const []), + Header(ascii.encode('host'), const []), + Header(ascii.encode('if-match'), const []), + Header(ascii.encode('if-modified-since'), const []), + Header(ascii.encode('if-none-match'), const []), + Header(ascii.encode('if-range'), const []), + Header(ascii.encode('if-unmodified-since'), const []), + Header(ascii.encode('last-modified'), const []), + Header(ascii.encode('link'), const []), + Header(ascii.encode('location'), const []), + Header(ascii.encode('max-forwards'), const []), + Header(ascii.encode('proxy-authenticate'), const []), + Header(ascii.encode('proxy-authorization'), const []), + Header(ascii.encode('range'), const []), + Header(ascii.encode('referer'), const []), + Header(ascii.encode('refresh'), const []), + Header(ascii.encode('retry-after'), const []), + Header(ascii.encode('server'), const []), + Header(ascii.encode('set-cookie'), const []), + Header(ascii.encode('strict-transport-security'), const []), + Header(ascii.encode('transfer-encoding'), const []), + Header(ascii.encode('user-agent'), const []), + Header(ascii.encode('vary'), const []), + Header(ascii.encode('via'), const []), + Header(ascii.encode('www-authenticate'), const []), + ]; + + final List
_dynamicTable = []; + + /// The maximum size the dynamic table can grow to before entries need to be + /// evicted. + int _maximumSize = 4096; + + /// The current size of the dynamic table. + int _currentSize = 0; + + IndexTable(); + + /// Updates the maximum size which the dynamic table can grow to. + void updateMaxSize(int newMaxDynTableSize) { + _maximumSize = newMaxDynTableSize; + _reduce(); + } + + /// Lookup an item by index. + Header lookup(int index) { + if (index <= 0) { + throw HPackDecodingException( + 'Invalid index (was: $index) for table lookup.'); + } + if (index < _staticTable.length) { + return _staticTable[index]!; + } + index -= _staticTable.length; + if (index < _dynamicTable.length) { + return _dynamicTable[index]; + } + throw HPackDecodingException( + 'Invalid index (was: $index) for table lookup.'); + } + + /// Adds a new header field to the dynamic table - and evicts entries as + /// necessary. + void addHeaderField(Header header) { + _dynamicTable.insert(0, header); + _currentSize += _sizeOf(header); + _reduce(); + } + + /// Removes as many entries as required to be within the limit of + /// [_maximumSize]. + void _reduce() { + while (_currentSize > _maximumSize) { + var h = _dynamicTable.removeLast(); + _currentSize -= _sizeOf(h); + } + } + + /// Returns the "size" a [header] has. + /// + /// This is specified to be the number of octets of name/value plus 32. + int _sizeOf(Header header) => header.name.length + header.value.length + 32; +} diff --git a/pkgs/http2/lib/src/hpack/huffman.dart b/pkgs/http2/lib/src/hpack/huffman.dart new file mode 100644 index 0000000000..aca4cde481 --- /dev/null +++ b/pkgs/http2/lib/src/hpack/huffman.dart @@ -0,0 +1,180 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:typed_data'; + +import 'huffman_table.dart'; + +class HuffmanDecodingException implements Exception { + final String _message; + + HuffmanDecodingException(this._message); + + @override + String toString() => 'HuffmanDecodingException: $_message'; +} + +/// A codec used for encoding/decoding using a huffman codec. +class HuffmanCodec { + final HuffmanEncoder _encoder; + final HuffmanDecoder _decoder; + + HuffmanCodec(this._encoder, this._decoder); + + List decode(List bytes) => _decoder.decode(bytes); + + List encode(List bytes) => _encoder.encode(bytes); +} + +/// A huffman decoder based on a [HuffmanTreeNode]. +class HuffmanDecoder { + final HuffmanTreeNode _root; + + HuffmanDecoder(this._root); + + /// Decodes [bytes] using a huffman tree. + List decode(List bytes) { + var buffer = BytesBuilder(); + + var currentByteOffset = 0; + var node = _root; + var currentDepth = 0; + while (currentByteOffset < bytes.length) { + var byte = bytes[currentByteOffset]; + for (var currentBit = 7; currentBit >= 0; currentBit--) { + var right = (byte >> currentBit) & 1 == 1; + if (right) { + node = node.right!; + } else { + node = node.left!; + } + currentDepth++; + if (node.value != null) { + if (node.value == EOS_BYTE) { + throw HuffmanDecodingException( + 'More than 7 bit padding is not allowed. Found entire EOS ' + 'encoding'); + } + buffer.addByte(node.value!); + node = _root; + currentDepth = 0; + } + } + currentByteOffset++; + } + + if (node != _root) { + if (currentDepth > 7) { + throw HuffmanDecodingException( + 'Incomplete encoding of a byte or more than 7 bit padding.'); + } + + while (node.right != null) { + node = node.right!; + } + + if (node.value != 256) { + throw HuffmanDecodingException('Incomplete encoding of a byte.'); + } + } + + return buffer.takeBytes(); + } +} + +/// A huffman encoder based on a list of codewords. +class HuffmanEncoder { + final List _codewords; + + HuffmanEncoder(this._codewords); + + /// Encodes [bytes] using a list of codewords. + List encode(List bytes) { + var buffer = BytesBuilder(); + + var currentByte = 0; + var currentBitOffset = 7; + + void writeValue(int value, int numBits) { + var i = numBits - 1; + while (i >= 0) { + if (currentBitOffset == 7 && i >= 7) { + assert(currentByte == 0); + + buffer.addByte((value >> (i - 7)) & 0xff); + currentBitOffset = 7; + currentByte = 0; + i -= 8; + } else { + currentByte |= ((value >> i) & 1) << currentBitOffset; + + currentBitOffset--; + if (currentBitOffset == -1) { + buffer.addByte(currentByte); + currentBitOffset = 7; + currentByte = 0; + } + i--; + } + } + } + + for (var i = 0; i < bytes.length; i++) { + var byte = bytes[i]; + var value = _codewords[byte]; + writeValue(value.encodedBytes, value.numBits); + } + + if (currentBitOffset < 7) { + writeValue(0xff, 1 + currentBitOffset); + } + + return buffer.takeBytes(); + } +} + +/// Specifies the encoding of a specific value using huffman encoding. +class EncodedHuffmanValue { + /// An integer representation of the encoded bit-string. + final int encodedBytes; + + /// The number of bits in [encodedBytes]. + final int numBits; + + const EncodedHuffmanValue(this.encodedBytes, this.numBits); +} + +/// A node in the huffman tree. +class HuffmanTreeNode { + HuffmanTreeNode? left; + HuffmanTreeNode? right; + int? value; +} + +/// Generates a huffman decoding tree. +HuffmanTreeNode generateHuffmanTree(List valueEncodings) { + var root = HuffmanTreeNode(); + + for (var byteOffset = 0; byteOffset < valueEncodings.length; byteOffset++) { + var entry = valueEncodings[byteOffset]; + + var current = root; + for (var bitNr = 0; bitNr < entry.numBits; bitNr++) { + var right = + ((entry.encodedBytes >> (entry.numBits - bitNr - 1)) & 1) == 1; + + if (right) { + current.right ??= HuffmanTreeNode(); + current = current.right!; + } else { + current.left ??= HuffmanTreeNode(); + current = current.left!; + } + } + + current.value = byteOffset; + } + + return root; +} diff --git a/pkgs/http2/lib/src/hpack/huffman_table.dart b/pkgs/http2/lib/src/hpack/huffman_table.dart new file mode 100644 index 0000000000..488e1246d9 --- /dev/null +++ b/pkgs/http2/lib/src/hpack/huffman_table.dart @@ -0,0 +1,275 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'huffman.dart'; + +/// The huffman codec for encoding/decoding HTTP/2 header blocks. +final HuffmanCodec http2HuffmanCodec = HuffmanCodec(HuffmanEncoder(_codeWords), + HuffmanDecoder(generateHuffmanTree(_codeWords))); + +/// This is the integer representing the End-of-String symbol +/// (it is not representable by a byte). +const int EOS_BYTE = 256; + +/// This list of byte encodings via huffman encoding was generated from the +/// HPACK specification. +const List _codeWords = [ + EncodedHuffmanValue(0x1ff8, 13), + EncodedHuffmanValue(0x7fffd8, 23), + EncodedHuffmanValue(0xfffffe2, 28), + EncodedHuffmanValue(0xfffffe3, 28), + EncodedHuffmanValue(0xfffffe4, 28), + EncodedHuffmanValue(0xfffffe5, 28), + EncodedHuffmanValue(0xfffffe6, 28), + EncodedHuffmanValue(0xfffffe7, 28), + EncodedHuffmanValue(0xfffffe8, 28), + EncodedHuffmanValue(0xffffea, 24), + EncodedHuffmanValue(0x3ffffffc, 30), + EncodedHuffmanValue(0xfffffe9, 28), + EncodedHuffmanValue(0xfffffea, 28), + EncodedHuffmanValue(0x3ffffffd, 30), + EncodedHuffmanValue(0xfffffeb, 28), + EncodedHuffmanValue(0xfffffec, 28), + EncodedHuffmanValue(0xfffffed, 28), + EncodedHuffmanValue(0xfffffee, 28), + EncodedHuffmanValue(0xfffffef, 28), + EncodedHuffmanValue(0xffffff0, 28), + EncodedHuffmanValue(0xffffff1, 28), + EncodedHuffmanValue(0xffffff2, 28), + EncodedHuffmanValue(0x3ffffffe, 30), + EncodedHuffmanValue(0xffffff3, 28), + EncodedHuffmanValue(0xffffff4, 28), + EncodedHuffmanValue(0xffffff5, 28), + EncodedHuffmanValue(0xffffff6, 28), + EncodedHuffmanValue(0xffffff7, 28), + EncodedHuffmanValue(0xffffff8, 28), + EncodedHuffmanValue(0xffffff9, 28), + EncodedHuffmanValue(0xffffffa, 28), + EncodedHuffmanValue(0xffffffb, 28), + EncodedHuffmanValue(0x14, 6), + EncodedHuffmanValue(0x3f8, 10), + EncodedHuffmanValue(0x3f9, 10), + EncodedHuffmanValue(0xffa, 12), + EncodedHuffmanValue(0x1ff9, 13), + EncodedHuffmanValue(0x15, 6), + EncodedHuffmanValue(0xf8, 8), + EncodedHuffmanValue(0x7fa, 11), + EncodedHuffmanValue(0x3fa, 10), + EncodedHuffmanValue(0x3fb, 10), + EncodedHuffmanValue(0xf9, 8), + EncodedHuffmanValue(0x7fb, 11), + EncodedHuffmanValue(0xfa, 8), + EncodedHuffmanValue(0x16, 6), + EncodedHuffmanValue(0x17, 6), + EncodedHuffmanValue(0x18, 6), + EncodedHuffmanValue(0x0, 5), + EncodedHuffmanValue(0x1, 5), + EncodedHuffmanValue(0x2, 5), + EncodedHuffmanValue(0x19, 6), + EncodedHuffmanValue(0x1a, 6), + EncodedHuffmanValue(0x1b, 6), + EncodedHuffmanValue(0x1c, 6), + EncodedHuffmanValue(0x1d, 6), + EncodedHuffmanValue(0x1e, 6), + EncodedHuffmanValue(0x1f, 6), + EncodedHuffmanValue(0x5c, 7), + EncodedHuffmanValue(0xfb, 8), + EncodedHuffmanValue(0x7ffc, 15), + EncodedHuffmanValue(0x20, 6), + EncodedHuffmanValue(0xffb, 12), + EncodedHuffmanValue(0x3fc, 10), + EncodedHuffmanValue(0x1ffa, 13), + EncodedHuffmanValue(0x21, 6), + EncodedHuffmanValue(0x5d, 7), + EncodedHuffmanValue(0x5e, 7), + EncodedHuffmanValue(0x5f, 7), + EncodedHuffmanValue(0x60, 7), + EncodedHuffmanValue(0x61, 7), + EncodedHuffmanValue(0x62, 7), + EncodedHuffmanValue(0x63, 7), + EncodedHuffmanValue(0x64, 7), + EncodedHuffmanValue(0x65, 7), + EncodedHuffmanValue(0x66, 7), + EncodedHuffmanValue(0x67, 7), + EncodedHuffmanValue(0x68, 7), + EncodedHuffmanValue(0x69, 7), + EncodedHuffmanValue(0x6a, 7), + EncodedHuffmanValue(0x6b, 7), + EncodedHuffmanValue(0x6c, 7), + EncodedHuffmanValue(0x6d, 7), + EncodedHuffmanValue(0x6e, 7), + EncodedHuffmanValue(0x6f, 7), + EncodedHuffmanValue(0x70, 7), + EncodedHuffmanValue(0x71, 7), + EncodedHuffmanValue(0x72, 7), + EncodedHuffmanValue(0xfc, 8), + EncodedHuffmanValue(0x73, 7), + EncodedHuffmanValue(0xfd, 8), + EncodedHuffmanValue(0x1ffb, 13), + EncodedHuffmanValue(0x7fff0, 19), + EncodedHuffmanValue(0x1ffc, 13), + EncodedHuffmanValue(0x3ffc, 14), + EncodedHuffmanValue(0x22, 6), + EncodedHuffmanValue(0x7ffd, 15), + EncodedHuffmanValue(0x3, 5), + EncodedHuffmanValue(0x23, 6), + EncodedHuffmanValue(0x4, 5), + EncodedHuffmanValue(0x24, 6), + EncodedHuffmanValue(0x5, 5), + EncodedHuffmanValue(0x25, 6), + EncodedHuffmanValue(0x26, 6), + EncodedHuffmanValue(0x27, 6), + EncodedHuffmanValue(0x6, 5), + EncodedHuffmanValue(0x74, 7), + EncodedHuffmanValue(0x75, 7), + EncodedHuffmanValue(0x28, 6), + EncodedHuffmanValue(0x29, 6), + EncodedHuffmanValue(0x2a, 6), + EncodedHuffmanValue(0x7, 5), + EncodedHuffmanValue(0x2b, 6), + EncodedHuffmanValue(0x76, 7), + EncodedHuffmanValue(0x2c, 6), + EncodedHuffmanValue(0x8, 5), + EncodedHuffmanValue(0x9, 5), + EncodedHuffmanValue(0x2d, 6), + EncodedHuffmanValue(0x77, 7), + EncodedHuffmanValue(0x78, 7), + EncodedHuffmanValue(0x79, 7), + EncodedHuffmanValue(0x7a, 7), + EncodedHuffmanValue(0x7b, 7), + EncodedHuffmanValue(0x7ffe, 15), + EncodedHuffmanValue(0x7fc, 11), + EncodedHuffmanValue(0x3ffd, 14), + EncodedHuffmanValue(0x1ffd, 13), + EncodedHuffmanValue(0xffffffc, 28), + EncodedHuffmanValue(0xfffe6, 20), + EncodedHuffmanValue(0x3fffd2, 22), + EncodedHuffmanValue(0xfffe7, 20), + EncodedHuffmanValue(0xfffe8, 20), + EncodedHuffmanValue(0x3fffd3, 22), + EncodedHuffmanValue(0x3fffd4, 22), + EncodedHuffmanValue(0x3fffd5, 22), + EncodedHuffmanValue(0x7fffd9, 23), + EncodedHuffmanValue(0x3fffd6, 22), + EncodedHuffmanValue(0x7fffda, 23), + EncodedHuffmanValue(0x7fffdb, 23), + EncodedHuffmanValue(0x7fffdc, 23), + EncodedHuffmanValue(0x7fffdd, 23), + EncodedHuffmanValue(0x7fffde, 23), + EncodedHuffmanValue(0xffffeb, 24), + EncodedHuffmanValue(0x7fffdf, 23), + EncodedHuffmanValue(0xffffec, 24), + EncodedHuffmanValue(0xffffed, 24), + EncodedHuffmanValue(0x3fffd7, 22), + EncodedHuffmanValue(0x7fffe0, 23), + EncodedHuffmanValue(0xffffee, 24), + EncodedHuffmanValue(0x7fffe1, 23), + EncodedHuffmanValue(0x7fffe2, 23), + EncodedHuffmanValue(0x7fffe3, 23), + EncodedHuffmanValue(0x7fffe4, 23), + EncodedHuffmanValue(0x1fffdc, 21), + EncodedHuffmanValue(0x3fffd8, 22), + EncodedHuffmanValue(0x7fffe5, 23), + EncodedHuffmanValue(0x3fffd9, 22), + EncodedHuffmanValue(0x7fffe6, 23), + EncodedHuffmanValue(0x7fffe7, 23), + EncodedHuffmanValue(0xffffef, 24), + EncodedHuffmanValue(0x3fffda, 22), + EncodedHuffmanValue(0x1fffdd, 21), + EncodedHuffmanValue(0xfffe9, 20), + EncodedHuffmanValue(0x3fffdb, 22), + EncodedHuffmanValue(0x3fffdc, 22), + EncodedHuffmanValue(0x7fffe8, 23), + EncodedHuffmanValue(0x7fffe9, 23), + EncodedHuffmanValue(0x1fffde, 21), + EncodedHuffmanValue(0x7fffea, 23), + EncodedHuffmanValue(0x3fffdd, 22), + EncodedHuffmanValue(0x3fffde, 22), + EncodedHuffmanValue(0xfffff0, 24), + EncodedHuffmanValue(0x1fffdf, 21), + EncodedHuffmanValue(0x3fffdf, 22), + EncodedHuffmanValue(0x7fffeb, 23), + EncodedHuffmanValue(0x7fffec, 23), + EncodedHuffmanValue(0x1fffe0, 21), + EncodedHuffmanValue(0x1fffe1, 21), + EncodedHuffmanValue(0x3fffe0, 22), + EncodedHuffmanValue(0x1fffe2, 21), + EncodedHuffmanValue(0x7fffed, 23), + EncodedHuffmanValue(0x3fffe1, 22), + EncodedHuffmanValue(0x7fffee, 23), + EncodedHuffmanValue(0x7fffef, 23), + EncodedHuffmanValue(0xfffea, 20), + EncodedHuffmanValue(0x3fffe2, 22), + EncodedHuffmanValue(0x3fffe3, 22), + EncodedHuffmanValue(0x3fffe4, 22), + EncodedHuffmanValue(0x7ffff0, 23), + EncodedHuffmanValue(0x3fffe5, 22), + EncodedHuffmanValue(0x3fffe6, 22), + EncodedHuffmanValue(0x7ffff1, 23), + EncodedHuffmanValue(0x3ffffe0, 26), + EncodedHuffmanValue(0x3ffffe1, 26), + EncodedHuffmanValue(0xfffeb, 20), + EncodedHuffmanValue(0x7fff1, 19), + EncodedHuffmanValue(0x3fffe7, 22), + EncodedHuffmanValue(0x7ffff2, 23), + EncodedHuffmanValue(0x3fffe8, 22), + EncodedHuffmanValue(0x1ffffec, 25), + EncodedHuffmanValue(0x3ffffe2, 26), + EncodedHuffmanValue(0x3ffffe3, 26), + EncodedHuffmanValue(0x3ffffe4, 26), + EncodedHuffmanValue(0x7ffffde, 27), + EncodedHuffmanValue(0x7ffffdf, 27), + EncodedHuffmanValue(0x3ffffe5, 26), + EncodedHuffmanValue(0xfffff1, 24), + EncodedHuffmanValue(0x1ffffed, 25), + EncodedHuffmanValue(0x7fff2, 19), + EncodedHuffmanValue(0x1fffe3, 21), + EncodedHuffmanValue(0x3ffffe6, 26), + EncodedHuffmanValue(0x7ffffe0, 27), + EncodedHuffmanValue(0x7ffffe1, 27), + EncodedHuffmanValue(0x3ffffe7, 26), + EncodedHuffmanValue(0x7ffffe2, 27), + EncodedHuffmanValue(0xfffff2, 24), + EncodedHuffmanValue(0x1fffe4, 21), + EncodedHuffmanValue(0x1fffe5, 21), + EncodedHuffmanValue(0x3ffffe8, 26), + EncodedHuffmanValue(0x3ffffe9, 26), + EncodedHuffmanValue(0xffffffd, 28), + EncodedHuffmanValue(0x7ffffe3, 27), + EncodedHuffmanValue(0x7ffffe4, 27), + EncodedHuffmanValue(0x7ffffe5, 27), + EncodedHuffmanValue(0xfffec, 20), + EncodedHuffmanValue(0xfffff3, 24), + EncodedHuffmanValue(0xfffed, 20), + EncodedHuffmanValue(0x1fffe6, 21), + EncodedHuffmanValue(0x3fffe9, 22), + EncodedHuffmanValue(0x1fffe7, 21), + EncodedHuffmanValue(0x1fffe8, 21), + EncodedHuffmanValue(0x7ffff3, 23), + EncodedHuffmanValue(0x3fffea, 22), + EncodedHuffmanValue(0x3fffeb, 22), + EncodedHuffmanValue(0x1ffffee, 25), + EncodedHuffmanValue(0x1ffffef, 25), + EncodedHuffmanValue(0xfffff4, 24), + EncodedHuffmanValue(0xfffff5, 24), + EncodedHuffmanValue(0x3ffffea, 26), + EncodedHuffmanValue(0x7ffff4, 23), + EncodedHuffmanValue(0x3ffffeb, 26), + EncodedHuffmanValue(0x7ffffe6, 27), + EncodedHuffmanValue(0x3ffffec, 26), + EncodedHuffmanValue(0x3ffffed, 26), + EncodedHuffmanValue(0x7ffffe7, 27), + EncodedHuffmanValue(0x7ffffe8, 27), + EncodedHuffmanValue(0x7ffffe9, 27), + EncodedHuffmanValue(0x7ffffea, 27), + EncodedHuffmanValue(0x7ffffeb, 27), + EncodedHuffmanValue(0xffffffe, 28), + EncodedHuffmanValue(0x7ffffec, 27), + EncodedHuffmanValue(0x7ffffed, 27), + EncodedHuffmanValue(0x7ffffee, 27), + EncodedHuffmanValue(0x7ffffef, 27), + EncodedHuffmanValue(0x7fffff0, 27), + EncodedHuffmanValue(0x3ffffee, 26), + EncodedHuffmanValue(0x3fffffff, 30), +]; diff --git a/pkgs/http2/lib/src/ping/ping_handler.dart b/pkgs/http2/lib/src/ping/ping_handler.dart new file mode 100644 index 0000000000..f9be1f9b44 --- /dev/null +++ b/pkgs/http2/lib/src/ping/ping_handler.dart @@ -0,0 +1,71 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import '../error_handler.dart'; +import '../frames/frames.dart'; +import '../sync_errors.dart'; + +/// Responsible for pinging the other end and for handling pings from the +/// other end. +// TODO: We currently write unconditionally to the [FrameWriter]: we might want +// to consider be more aware what [Framewriter.bufferIndicator.wouldBuffer] +// says. +class PingHandler extends Object with TerminatableMixin { + final FrameWriter _frameWriter; + final Map _remainingPings = {}; + final Sink? pingReceived; + final bool Function() isListeningToPings; + int _nextId = 1; + + PingHandler(this._frameWriter, StreamController pingStream) + : pingReceived = pingStream.sink, + isListeningToPings = (() => pingStream.hasListener); + + @override + void onTerminated(Object? error) { + final remainingPings = _remainingPings.values.toList(); + _remainingPings.clear(); + for (final ping in remainingPings) { + ping.completeError( + error ?? 'Remaining ping completed with unspecified error'); + } + } + + void processPingFrame(PingFrame frame) { + ensureNotTerminatedSync(() { + if (frame.header.streamId != 0) { + throw ProtocolException('Ping frames must have a stream id of 0.'); + } + + if (!frame.hasAckFlag) { + if (isListeningToPings()) { + pingReceived?.add(frame.opaqueData); + } + _frameWriter.writePingFrame(frame.opaqueData, ack: true); + } else { + var c = _remainingPings.remove(frame.opaqueData); + if (c != null) { + c.complete(); + } else { + // NOTE: It is not specified what happens when one gets an ACK for a + // ping we never sent. We be very strict and fail in this case. + throw ProtocolException( + 'Received ping ack with unknown opaque data.'); + } + } + }); + } + + Future ping() { + return ensureNotTerminatedAsync(() { + var c = Completer(); + var id = _nextId++; + _remainingPings[id] = c; + _frameWriter.writePingFrame(id); + return c.future; + }); + } +} diff --git a/pkgs/http2/lib/src/settings/settings.dart b/pkgs/http2/lib/src/settings/settings.dart new file mode 100644 index 0000000000..291c66856c --- /dev/null +++ b/pkgs/http2/lib/src/settings/settings.dart @@ -0,0 +1,225 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import '../error_handler.dart'; +import '../frames/frames.dart'; +import '../hpack/hpack.dart'; +import '../sync_errors.dart'; + +/// The settings a remote peer can choose to set. +class ActiveSettings { + /// Allows the sender to inform the remote endpoint of the maximum size of the + /// header compression table used to decode header blocks, in octets. The + /// encoder can select any size equal to or less than this value by using + /// signaling specific to the header compression format inside a header block. + /// The initial value is 4,096 octets. + int headerTableSize; + + /// This setting can be use to disable server push (Section 8.2). An endpoint + /// MUST NOT send a PUSH_PROMISE frame if it receives this parameter set to a + /// value of 0. An endpoint that has both set this parameter to 0 and had it + /// acknowledged MUST treat the receipt of a PUSH_PROMISE frame as a + /// connection error (Section 5.4.1) of type PROTOCOL_ERROR. + /// + /// The initial value is 1, which indicates that server push is permitted. + /// Any value other than 0 or 1 MUST be treated as a connection error + /// (Section 5.4.1) of type PROTOCOL_ERROR. + bool enablePush; + + /// Indicates the maximum number of concurrent streams that the sender will + /// allow. This limit is directional: it applies to the number of streams that + /// the sender permits the receiver to create. Initially there is no limit to + /// this value. It is recommended that this value be no smaller than 100, so + /// as to not unnecessarily limit parallelism. + /// + /// A value of 0 for SETTINGS_MAX_CONCURRENT_STREAMS SHOULD NOT be treated as + /// special by endpoints. A zero value does prevent the creation of new + /// streams, however this can also happen for any limit that is exhausted with + /// active streams. Servers SHOULD only set a zero value for short durations; + /// if a server does not wish to accept requests, closing the connection is + /// more appropriate. + int? maxConcurrentStreams; + + /// Indicates the sender's initial window size (in octets) for stream level + /// flow control. The initial value is 2^16-1 (65,535) octets. + /// + /// This setting affects the window size of all streams, including existing + /// streams, see Section 6.9.2. + /// Values above the maximum flow control window size of 231-1 MUST be treated + /// as a connection error (Section 5.4.1) of type FLOW_CONTROL_ERROR. + int initialWindowSize; + + /// Indicates the size of the largest frame payload that the sender is willing + /// to receive, in octets. + /// + /// The initial value is 2^14 (16,384) octets. The value advertised by an + /// endpoint MUST be between this initial value and the maximum allowed frame + /// size (2^24-1 or 16,777,215 octets), inclusive. Values outside this range + /// MUST be treated as a connection error (Section 5.4.1) of type + /// PROTOCOL_ERROR. + int maxFrameSize; + + /// This advisory setting informs a peer of the maximum size of header list + /// that the sender is prepared to accept, in octets. The value is based on + /// the uncompressed size of header fields, including the length of the name + /// and value in octets plus an overhead of 32 octets for each header field. + /// + /// For any given request, a lower limit than what is advertised MAY be + /// enforced. The initial value of this setting is unlimited. + int? maxHeaderListSize; + + ActiveSettings( + {this.headerTableSize = 4096, + this.enablePush = true, + this.maxConcurrentStreams, + this.initialWindowSize = (1 << 16) - 1, + this.maxFrameSize = 1 << 14, + this.maxHeaderListSize}); +} + +/// Handles remote and local connection [Setting]s. +/// +/// Incoming [SettingsFrame]s will be handled here to update the peer settings. +/// Changes to [_toBeAcknowledgedSettings] can be made, the peer will then be +/// notified of the setting changes it should use. +class SettingsHandler extends Object with TerminatableMixin { + /// Certain settings changes can change the maximum allowed dynamic table + /// size used by the HPack encoder. + final HPackEncoder _hpackEncoder; + + final FrameWriter _frameWriter; + + /// A list of outstanding setting changes. + final List> _toBeAcknowledgedSettings = []; + + /// A list of completers for outstanding setting changes. + final List _toBeAcknowledgedCompleters = []; + + /// The local settings, which the remote side ACKed to obey. + final ActiveSettings _acknowledgedSettings; + + /// The peer settings, which we ACKed and are obeying. + final ActiveSettings _peerSettings; + + final _onInitialWindowSizeChangeController = + StreamController.broadcast(sync: true); + + /// Events are fired when a SettingsFrame changes the initial size + /// of stream windows. + Stream get onInitialWindowSizeChange => + _onInitialWindowSizeChangeController.stream; + + SettingsHandler(this._hpackEncoder, this._frameWriter, + this._acknowledgedSettings, this._peerSettings); + + /// The settings for this endpoint of the connection which the remote peer + /// has ACKed and uses. + ActiveSettings get acknowledgedSettings => _acknowledgedSettings; + + /// The settings for the remote endpoint of the connection which this + /// endpoint should use. + ActiveSettings get peerSettings => _peerSettings; + + /// Handles an incoming [SettingsFrame] which can be an ACK or a settings + /// change. + void handleSettingsFrame(SettingsFrame frame) { + ensureNotTerminatedSync(() { + assert(frame.header.streamId == 0); + + if (frame.hasAckFlag) { + assert(frame.header.length == 0); + + if (_toBeAcknowledgedSettings.isEmpty) { + // NOTE: The specification does not say anything about ACKed settings + // which were never sent to the other side. We consider this definitly + // an error. + throw ProtocolException( + 'Received an acknowledged settings frame which did not have a ' + 'outstanding settings request.'); + } + var settingChanges = _toBeAcknowledgedSettings.removeAt(0); + var completer = _toBeAcknowledgedCompleters.removeAt(0); + _modifySettings(_acknowledgedSettings, settingChanges, false); + completer.complete(); + } else { + _modifySettings(_peerSettings, frame.settings, true); + _frameWriter.writeSettingsAckFrame(); + } + }); + } + + @override + void onTerminated(Object? error) { + _toBeAcknowledgedSettings.clear(); + for (var completer in _toBeAcknowledgedCompleters) { + completer.completeError(error!); + } + } + + Future changeSettings(List changes) { + return ensureNotTerminatedAsync(() { + // TODO: Have a timeout: When ACK doesn't get back in a reasonable time + // frame we should quit with ErrorCode.SETTINGS_TIMEOUT. + var completer = Completer(); + _toBeAcknowledgedSettings.add(changes); + _toBeAcknowledgedCompleters.add(completer); + _frameWriter.writeSettingsFrame(changes); + return completer.future; + }); + } + + void _modifySettings( + ActiveSettings base, List changes, bool peerSettings) { + for (var setting in changes) { + switch (setting.identifier) { + case Setting.SETTINGS_ENABLE_PUSH: + if (setting.value == 0) { + base.enablePush = false; + } else if (setting.value == 1) { + base.enablePush = true; + } else { + throw ProtocolException( + 'The push setting can be only set to 0 or 1.'); + } + break; + + case Setting.SETTINGS_HEADER_TABLE_SIZE: + base.headerTableSize = setting.value; + if (peerSettings) { + _hpackEncoder.updateMaxSendingHeaderTableSize(base.headerTableSize); + } + break; + + case Setting.SETTINGS_MAX_HEADER_LIST_SIZE: + // TODO: Propagate this signal to the HPackContext. + base.maxHeaderListSize = setting.value; + break; + + case Setting.SETTINGS_MAX_CONCURRENT_STREAMS: + // NOTE: We will not force closing of existing streams if the limit is + // lower than the current number of open streams. But we will prevent + // new streams from being created if the number of existing streams + // is above this limit. + base.maxConcurrentStreams = setting.value; + break; + + case Setting.SETTINGS_INITIAL_WINDOW_SIZE: + if (setting.value < (1 << 31)) { + var difference = setting.value - base.initialWindowSize; + _onInitialWindowSizeChangeController.add(difference); + base.initialWindowSize = setting.value; + } else { + throw FlowControlException('Invalid initial window size.'); + } + break; + + default: + // Spec says to ignore unknown settings. + break; + } + } + } +} diff --git a/pkgs/http2/lib/src/streams/stream_handler.dart b/pkgs/http2/lib/src/streams/stream_handler.dart new file mode 100644 index 0000000000..92a228df5e --- /dev/null +++ b/pkgs/http2/lib/src/streams/stream_handler.dart @@ -0,0 +1,893 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:math'; + +import '../../transport.dart'; +import '../connection.dart'; +import '../error_handler.dart'; +import '../flowcontrol/connection_queues.dart'; +import '../flowcontrol/queue_messages.dart'; +import '../flowcontrol/stream_queues.dart'; +import '../flowcontrol/window.dart'; +import '../flowcontrol/window_handler.dart'; +import '../frames/frames.dart'; +import '../settings/settings.dart'; +import '../sync_errors.dart'; + +/// Represents the current state of a stream. +enum StreamState { + ReservedLocal, + ReservedRemote, + Idle, + Open, + HalfClosedLocal, + HalfClosedRemote, + Closed, + + /// The [Terminated] state is an artificial state and signals that this stream + /// has been forcefully terminated. + Terminated, +} + +/// Represents a HTTP/2 stream. +class Http2StreamImpl extends TransportStream + implements ClientTransportStream, ServerTransportStream { + /// The id of this stream. + /// + /// * odd numbered streams are client streams + /// * even numbered streams are opened from the server + @override + final int id; + + // The queue for incoming [StreamMessage]s. + final StreamMessageQueueIn incomingQueue; + + // The queue for outgoing [StreamMessage]s. + final StreamMessageQueueOut outgoingQueue; + + // The stream controller to which the application can + // add outgoing messages. + final StreamController _outgoingC; + + final OutgoingStreamWindowHandler windowHandler; + + // The state of this stream. + StreamState state = StreamState.Idle; + + // Error code from RST_STREAM frame, if the stream has been terminated + // remotely. + int? _terminatedErrorCode; + + // Termination handler. Invoked if the stream receives an RST_STREAM frame. + void Function(int)? _onTerminated; + + final ZoneUnaryCallback _canPushFun; + final ZoneBinaryCallback> + _pushStreamFun; + final ZoneUnaryCallback _terminateStreamFun; + + late StreamSubscription _outgoingCSubscription; + + Http2StreamImpl( + this.incomingQueue, + this.outgoingQueue, + this._outgoingC, + this.id, + this.windowHandler, + this._canPushFun, + this._pushStreamFun, + this._terminateStreamFun); + + /// A stream of data and/or headers from the remote end. + @override + Stream get incomingMessages => incomingQueue.messages; + + /// A sink for writing data and/or headers to the remote end. + @override + StreamSink get outgoingMessages => _outgoingC.sink; + + /// Streams which the server pushed to this endpoint. + @override + Stream get peerPushes => incomingQueue.serverPushes; + + @override + bool get canPush => _canPushFun(this); + + /// Pushes a new stream to a client. + /// + /// The [requestHeaders] are the headers to which the pushed stream + /// responds to. + @override + ServerTransportStream push(List
requestHeaders) => + _pushStreamFun(this, requestHeaders); + + @override + void terminate() => _terminateStreamFun(this); + + @override + set onTerminated(void Function(int) handler) { + _onTerminated = handler; + if (_terminatedErrorCode != null && _onTerminated != null) { + _onTerminated!(_terminatedErrorCode!); + } + } + + void _handleTerminated(int errorCode) { + _terminatedErrorCode = errorCode; + if (_onTerminated != null) { + _onTerminated!(_terminatedErrorCode!); + } + } +} + +/// Handles [Frame]s with a non-zero stream-id. +/// +/// It keeps track of open streams, their state, their queues, forwards +/// messages from the connection level to stream level and vise versa. +// TODO: Handle stream/connection queue errors & forward to connection object. +class StreamHandler extends Object with TerminatableMixin, ClosableMixin { + static const int MAX_STREAM_ID = (1 << 31) - 1; + + final FrameWriter _frameWriter; + final ConnectionMessageQueueIn incomingQueue; + final ConnectionMessageQueueOut outgoingQueue; + + final StreamController _newStreamsC = StreamController(); + + final ActiveSettings _peerSettings; + final ActiveSettings _localSettings; + + final Map _openStreams = {}; + int nextStreamId; + int lastRemoteStreamId; + + int _highestStreamIdReceived = 0; + + /// Represents the highest stream id this connection has received from the + /// remote side. + int get highestPeerInitiatedStream => _highestStreamIdReceived; + + bool get isServer => nextStreamId.isEven; + + bool get ranOutOfStreamIds => _ranOutOfStreamIds(); + + /// Whether it is possible to open a new stream to the remote end (e.g. based + /// on whether we have reached the limit of maximum concurrent open streams). + bool get canOpenStream => _canCreateNewStream(); + + final ActiveStateHandler _onActiveStateChanged; + + StreamHandler._( + this._frameWriter, + this.incomingQueue, + this.outgoingQueue, + this._peerSettings, + this._localSettings, + this._onActiveStateChanged, + this.nextStreamId, + this.lastRemoteStreamId); + + factory StreamHandler.client( + FrameWriter writer, + ConnectionMessageQueueIn incomingQueue, + ConnectionMessageQueueOut outgoingQueue, + ActiveSettings peerSettings, + ActiveSettings localSettings, + ActiveStateHandler onActiveStateChanged) { + return StreamHandler._(writer, incomingQueue, outgoingQueue, peerSettings, + localSettings, onActiveStateChanged, 1, 0); + } + + factory StreamHandler.server( + FrameWriter writer, + ConnectionMessageQueueIn incomingQueue, + ConnectionMessageQueueOut outgoingQueue, + ActiveSettings peerSettings, + ActiveSettings localSettings, + ActiveStateHandler onActiveStateChanged) { + return StreamHandler._(writer, incomingQueue, outgoingQueue, peerSettings, + localSettings, onActiveStateChanged, 2, -1); + } + + @override + void onTerminated(Object? error) { + _openStreams.values.toList().forEach((stream) => + _closeStreamAbnormally(stream, error, propagateException: true)); + startClosing(); + } + + void forceDispatchIncomingMessages() { + _openStreams.forEach((int streamId, Http2StreamImpl stream) { + stream.incomingQueue.forceDispatchIncomingMessages(); + }); + } + + Stream get incomingStreams => _newStreamsC.stream; + + List get openStreams => _openStreams.values.toList(); + + void processInitialWindowSizeSettingChange(int difference) { + // If the initialFlowWindow size was changed via a SettingsFrame, all + // existing streams must be updated to reflect this change. + for (var stream in _openStreams.values) { + stream.windowHandler.processInitialWindowSizeSettingChange(difference); + } + } + + void processGoawayFrame(GoawayFrame frame) { + var lastStreamId = frame.lastStreamId; + var streamIds = _openStreams.keys + .where((id) => id > lastStreamId && !_isPeerInitiatedStream(id)) + .toList(); + for (var id in streamIds) { + var exception = StreamException( + id, + 'Remote end was telling us to stop. This stream was not processed ' + 'and can therefore be retried (on a new connection).'); + _closeStreamIdAbnormally(id, exception, propagateException: true); + } + } + + //////////////////////////////////////////////////////////////////////////// + //// New local/remote Stream handling + //////////////////////////////////////////////////////////////////////////// + + bool _isPeerInitiatedStream(int streamId) { + var isServerStreamId = streamId.isEven; + var isLocalStream = isServerStreamId == isServer; + return !isLocalStream; + } + + Http2StreamImpl newStream(List
headers, {bool endStream = false}) { + return ensureNotTerminatedSync(() { + var stream = newLocalStream(); + _sendHeaders(stream, headers, endStream: endStream); + return stream; + }); + } + + Http2StreamImpl newLocalStream() { + return ensureNotTerminatedSync(() { + assert(_canCreateNewStream()); + + if (MAX_STREAM_ID < nextStreamId) { + throw StateError( + 'Cannot create new streams, since a wrap around would happen.'); + } + var streamId = nextStreamId; + nextStreamId += 2; + return _newStreamInternal(streamId); + }); + } + + Http2StreamImpl newRemoteStream(int remoteStreamId) { + return ensureNotTerminatedSync(() { + assert(remoteStreamId <= MAX_STREAM_ID); + // NOTE: We cannot enforce that a new stream id is 2 higher than the last + // used stream id. Meaning there can be "holes" in the sense that stream + // ids are not used: + // + // http/2 spec: + // The first use of a new stream identifier implicitly closes all + // streams in the "idle" state that might have been initiated by that + // peer with a lower-valued stream identifier. For example, if a client + // sends a HEADERS frame on stream 7 without ever sending a frame on + // stream 5, then stream 5 transitions to the "closed" state when the + // first frame for stream 7 is sent or received. + + if (remoteStreamId <= lastRemoteStreamId) { + throw ProtocolException('Remote tried to open new stream which is ' + 'not in "idle" state.'); + } + + var sameDirection = (nextStreamId + remoteStreamId).isEven; + assert(!sameDirection); + + lastRemoteStreamId = remoteStreamId; + return _newStreamInternal(remoteStreamId); + }); + } + + Http2StreamImpl _newStreamInternal(int streamId) { + // For each new stream we must: + // - setup sending/receiving [Window]s with correct initial size + // - setup sending/receiving WindowHandlers which take care of + // updating the windows. + // - setup incoming/outgoing stream queues, which buffer data + // that is not handled by + // * the application [incoming] + // * the underlying transport [outgoing] + // - register incoming stream queue in connection-level queue + + var outgoingStreamWindow = + Window(initialSize: _peerSettings.initialWindowSize); + + var incomingStreamWindow = + Window(initialSize: _localSettings.initialWindowSize); + + var windowOutHandler = OutgoingStreamWindowHandler(outgoingStreamWindow); + + var windowInHandler = IncomingWindowHandler.stream( + _frameWriter, incomingStreamWindow, streamId); + + var streamQueueIn = StreamMessageQueueIn(windowInHandler); + var streamQueueOut = + StreamMessageQueueOut(streamId, windowOutHandler, outgoingQueue); + + incomingQueue.insertNewStreamMessageQueue(streamId, streamQueueIn); + + var outgoingC = StreamController(); + var stream = Http2StreamImpl(streamQueueIn, streamQueueOut, outgoingC, + streamId, windowOutHandler, _canPush, _push, _terminateStream); + final wasIdle = _openStreams.isEmpty; + _openStreams[stream.id] = stream; + + _setupOutgoingMessageHandling(stream); + + // Handle incoming stream cancellation. RST is only sent when streamQueueOut + // has been closed because RST make the stream 'closed'. + streamQueueIn.onCancel.then((_) { + // If our side is done sending data, i.e. we have enqueued the + // end-of-stream in the outgoing message queue, but the remote end is + // still sending us data, despite us not being interested in it, we will + // reset the stream. + if (stream.state == StreamState.HalfClosedLocal) { + stream.outgoingQueue + .enqueueMessage(ResetStreamMessage(stream.id, ErrorCode.CANCEL)); + } + }); + + // NOTE: We are not interested whether the streams were normally finished + // or abnormally terminated. Therefore we use 'catchError((_) {})'! + var streamDone = [streamQueueIn.done, streamQueueOut.done]; + Future.wait(streamDone).catchError((_) => const []).whenComplete(() { + _cleanupClosedStream(stream); + }); + + if (wasIdle) { + _onActiveStateChanged(true); + } + + return stream; + } + + bool _canPush(Http2StreamImpl stream) { + var openState = stream.state == StreamState.Open || + stream.state == StreamState.HalfClosedRemote; + var pushEnabled = _peerSettings.enablePush; + return openState && + pushEnabled && + _canCreateNewStream() && + !_ranOutOfStreamIds(); + } + + ServerTransportStream _push( + Http2StreamImpl stream, List
requestHeaders) { + if (stream.state != StreamState.Open && + stream.state != StreamState.HalfClosedRemote) { + throw StateError('Cannot push based on a stream that is neither open ' + 'nor half-closed-remote.'); + } + + if (!_peerSettings.enablePush) { + throw StateError('Client did disable server pushes.'); + } + + if (!_canCreateNewStream()) { + throw StateError('Maximum number of streams reached.'); + } + + if (_ranOutOfStreamIds()) { + throw StateError('There are no more stream ids left. Please use a ' + 'new connection.'); + } + + var pushStream = newLocalStream(); + + // NOTE: Since there was no real request from the client, we simulate it + // by adding a synthetic `endStream = true` Data message into the incoming + // queue. + _changeState(pushStream, StreamState.ReservedLocal); + // TODO: We should wait for us to send the headers frame before doing this + // transition. + _changeState(pushStream, StreamState.HalfClosedRemote); + pushStream.incomingQueue + .enqueueMessage(DataMessage(stream.id, const [], true)); + + _frameWriter.writePushPromiseFrame( + stream.id, pushStream.id, requestHeaders); + + return pushStream; + } + + void _terminateStream(Http2StreamImpl stream) { + if (stream.state == StreamState.Open || + stream.state == StreamState.HalfClosedLocal || + stream.state == StreamState.HalfClosedRemote || + stream.state == StreamState.ReservedLocal || + stream.state == StreamState.ReservedRemote) { + _frameWriter.writeRstStreamFrame(stream.id, ErrorCode.CANCEL); + _closeStreamAbnormally(stream, null, propagateException: false); + } + } + + void _setupOutgoingMessageHandling(Http2StreamImpl stream) { + stream._outgoingCSubscription = + stream._outgoingC.stream.listen((StreamMessage msg) { + if (!wasTerminated) { + _handleNewOutgoingMessage(stream, msg); + } + }, onError: (error, stack) { + if (!wasTerminated) { + stream.terminate(); + } + }, onDone: () { + if (!wasTerminated) { + // Stream should already have been closed by the last frame, but we + // allow multiple close calls, just to make sure. + _handleOutgoingClose(stream); + } + }); + stream.outgoingQueue.bufferIndicator.bufferEmptyEvents.listen((_) { + if (stream._outgoingCSubscription.isPaused) { + stream._outgoingCSubscription.resume(); + } + }); + } + + void _handleNewOutgoingMessage(Http2StreamImpl stream, StreamMessage msg) { + if (stream.state == StreamState.Idle) { + if (msg is! HeadersStreamMessage) { + var exception = TransportException( + 'The first message on a stream needs to be a headers frame.'); + _closeStreamAbnormally(stream, exception); + return; + } + _changeState(stream, StreamState.Open); + } + + if (msg is DataStreamMessage) { + _sendData(stream, msg.bytes, endStream: msg.endStream); + } else if (msg is HeadersStreamMessage) { + _sendHeaders(stream, msg.headers, endStream: msg.endStream); + } + + if (stream.outgoingQueue.bufferIndicator.wouldBuffer && + !stream._outgoingCSubscription.isPaused) { + stream._outgoingCSubscription.pause(); + } + } + + void _handleOutgoingClose(Http2StreamImpl stream) { + // We allow multiple close calls. + if (stream.state != StreamState.HalfClosedLocal && + stream.state != StreamState.Closed && + stream.state != StreamState.Terminated) { + _sendData(stream, const [], endStream: true); + } + } + + //////////////////////////////////////////////////////////////////////////// + //// Process incoming stream frames + //////////////////////////////////////////////////////////////////////////// + + void processStreamFrame(ConnectionState connectionState, Frame frame) { + try { + _processStreamFrameInternal(connectionState, frame); + } on StreamClosedException catch (exception) { + _frameWriter.writeRstStreamFrame( + exception.streamId, ErrorCode.STREAM_CLOSED); + _closeStreamIdAbnormally(exception.streamId, exception); + } on StreamException catch (exception) { + _frameWriter.writeRstStreamFrame( + exception.streamId, ErrorCode.INTERNAL_ERROR); + _closeStreamIdAbnormally(exception.streamId, exception); + } + } + + void _processStreamFrameInternal( + ConnectionState connectionState, Frame frame) { + // If we initiated a close of the connection and the received frame belongs + // to a stream id which is higher than the last peer-initiated stream we + // processed, we'll ignore it. + // http/2 spec: + // After sending a GOAWAY frame, the sender can discard frames for + // streams initiated by the receiver with identifiers higher than the + // identified last stream. However, any frames that alter connection + // state cannot be completely ignored. For instance, HEADERS, + // PUSH_PROMISE, and CONTINUATION frames MUST be minimally processed to + // ensure the state maintained for header compression is consistent + // (see Section 4.3); similarly, DATA frames MUST be counted toward + // the connection flow-control window. Failure to process these + // frames can cause flow control or header compression state to become + // unsynchronized. + if (connectionState.activeFinishing && + _isPeerInitiatedStream(frame.header.streamId) && + frame.header.streamId > highestPeerInitiatedStream) { + // Even if the frame will be ignored, we still need to process it in a + // minimal way to ensure the connection window will be updated. + if (frame is DataFrame) { + incomingQueue.processIgnoredDataFrame(frame); + } + return; + } + + // TODO: Consider splitting this method into client/server handling. + return ensureNotTerminatedSync(() { + var stream = _openStreams[frame.header.streamId]; + if (stream == null) { + bool frameBelongsToIdleStream() { + var streamId = frame.header.streamId; + var isServerStreamId = frame.header.streamId.isEven; + var isLocalStream = isServerStreamId == isServer; + var isIdleStream = isLocalStream + ? streamId >= nextStreamId + : streamId > lastRemoteStreamId; + return isIdleStream; + } + + if (_isPeerInitiatedStream(frame.header.streamId)) { + // Update highest stream id we received and processed (we update it + // before processing, so if it was an error, the client will not + // retry it). + _highestStreamIdReceived = + max(_highestStreamIdReceived, frame.header.streamId); + } + + if (frame is HeadersFrame) { + if (isServer) { + var newStream = newRemoteStream(frame.header.streamId); + _changeState(newStream, StreamState.Open); + + _handleHeadersFrame(newStream, frame); + _newStreamsC.add(newStream); + } else { + // A server cannot open new streams to the client. The only way + // for a server to start a new stream is via a PUSH_PROMISE_FRAME. + throw ProtocolException( + 'HTTP/2 clients cannot receive HEADER_FRAMEs as a connection' + 'attempt.'); + } + } else if (frame is WindowUpdateFrame) { + if (frameBelongsToIdleStream()) { + // We treat this as a protocol error even though not enforced + // or specified by the HTTP/2 spec. + throw ProtocolException( + 'Got a WINDOW_UPDATE_FRAME for an "idle" stream id.'); + } else { + // We must be able to receive window update frames for streams that + // have been already closed. The specification does not mention + // what happens if the streamId is belonging to an "idle" / unused + // stream. + } + } else if (frame is RstStreamFrame) { + if (frameBelongsToIdleStream()) { + // [RstFrame]s for streams which haven't been established (known as + // idle streams) must be treated as a connection error. + throw ProtocolException( + 'Got a RST_STREAM_FRAME for an "idle" stream id.'); + } else { + // [RstFrame]s for already dead (known as "closed") streams should + // be ignored. (If the stream was in "HalfClosedRemote" and we did + // send an endStream=true, it will be removed from the stream set). + } + } else if (frame is PriorityFrame) { + // http/2 spec: + // The PRIORITY frame can be sent for a stream in the "idle" or + // "closed" states. This allows for the reprioritization of a + // group of dependent streams by altering the priority of an + // unused or closed parent stream. + // + // As long as we do not handle stream priorities, we can safely ignore + // such frames on idle streams. + // + // NOTE: Firefox for example sends [PriorityFrame]s even without + // opening any streams (e.g. streams 3,5,7,9,11 [PriorityFrame]s and + // stream 13 is the first real stream opened by a [HeadersFrame]. + // + // TODO: When implementing priorities for HTTP/2 streams, these frames + // need to be taken into account. + } else if (frame is PushPromiseFrame) { + throw ProtocolException('Cannot push on a non-existent stream ' + '(stream ${frame.header.streamId} does not exist)'); + } else if (frame is DataFrame) { + // http/2 spec: + // However, after sending the RST_STREAM, the sending endpoint + // MUST be prepared to receive and process additional frames sent + // on the stream that might have been sent by the peer prior to + // the arrival of the RST_STREAM. + // and: + // A receiver that receives a flow-controlled frame MUST always + // account for its contribution against the connection + // flow-control window, unless the receiver treats this as a + // connection error (Section 5.4.1). This is necessary even if the + // frame is in error. The sender counts the frame toward the + // flow-control window, but if the receiver does not, the + // flow-control window at the sender and receiver can become + // different. + incomingQueue.processIgnoredDataFrame(frame); + // Still respond with an error, as the stream is closed. + throw _throwStreamClosedException(frame.header.streamId); + } else { + throw _throwStreamClosedException(frame.header.streamId); + } + } else { + if (frame is HeadersFrame) { + _handleHeadersFrame(stream, frame); + } else if (frame is DataFrame) { + _handleDataFrame(stream, frame); + } else if (frame is PushPromiseFrame) { + _handlePushPromiseFrame(stream, frame); + } else if (frame is WindowUpdateFrame) { + _handleWindowUpdate(stream, frame); + } else if (frame is RstStreamFrame) { + _handleRstFrame(stream, frame); + } else { + throw ProtocolException( + 'Unsupported frame type ${frame.runtimeType}.'); + } + } + }); + } + + void _handleHeadersFrame(Http2StreamImpl stream, HeadersFrame frame) { + if (stream.state == StreamState.ReservedRemote) { + _changeState(stream, StreamState.HalfClosedLocal); + } + + if (stream.state != StreamState.Open && + stream.state != StreamState.HalfClosedLocal) { + throw StreamClosedException( + stream.id, 'Expected open state (was: ${stream.state}).'); + } + + incomingQueue.processHeadersFrame(frame); + + if (frame.hasEndStreamFlag) _handleEndOfStreamRemote(stream); + } + + void _handleDataFrame(Http2StreamImpl stream, DataFrame frame) { + if (stream.state != StreamState.Open && + stream.state != StreamState.HalfClosedLocal) { + throw StreamClosedException( + stream.id, 'Expected open state (was: ${stream.state}).'); + } + + incomingQueue.processDataFrame(frame); + + if (frame.hasEndStreamFlag) _handleEndOfStreamRemote(stream); + } + + void _handlePushPromiseFrame(Http2StreamImpl stream, PushPromiseFrame frame) { + if (stream.state != StreamState.Open && + stream.state != StreamState.HalfClosedLocal) { + throw ProtocolException('Expected open state (was: ${stream.state}).'); + } + + var pushedStream = newRemoteStream(frame.promisedStreamId); + _changeState(pushedStream, StreamState.ReservedRemote); + + incomingQueue.processPushPromiseFrame(frame, pushedStream); + } + + void _handleWindowUpdate(Http2StreamImpl stream, WindowUpdateFrame frame) { + stream.windowHandler.processWindowUpdate(frame); + } + + void _handleRstFrame(Http2StreamImpl stream, RstStreamFrame frame) { + stream._handleTerminated(frame.errorCode); + var exception = StreamTransportException( + 'Stream was terminated by peer (errorCode: ${frame.errorCode}).'); + _closeStreamAbnormally(stream, exception, propagateException: true); + } + + void _handleEndOfStreamRemote(Http2StreamImpl stream) { + if (stream.state == StreamState.Open) { + _changeState(stream, StreamState.HalfClosedRemote); + } else if (stream.state == StreamState.HalfClosedLocal) { + _changeState(stream, StreamState.Closed); + // TODO: We have to make sure that we + // - remove the stream for data structures which only care about the + // state + // - keep the stream in data structures which need to be emptied + // (e.g. MessageQueues which are not empty yet). + _openStreams.remove(stream.id); + } else { + throw StateError( + 'Got an end-of-stream from the remote end, but this stream is ' + 'neither in the Open nor in the HalfClosedLocal state. ' + 'This should never happen.'); + } + } + + //////////////////////////////////////////////////////////////////////////// + //// Process outgoing stream messages + //////////////////////////////////////////////////////////////////////////// + + void _sendHeaders(Http2StreamImpl stream, List
headers, + {bool endStream = false}) { + if (stream.state != StreamState.Idle && + stream.state != StreamState.Open && + stream.state != StreamState.HalfClosedRemote) { + throw StateError('Idle state expected.'); + } + + stream.outgoingQueue + .enqueueMessage(HeadersMessage(stream.id, headers, endStream)); + + if (stream.state == StreamState.Idle) { + _changeState(stream, StreamState.Open); + } + + if (endStream) { + _endStream(stream); + } + } + + void _sendData(Http2StreamImpl stream, List data, + {bool endStream = false}) { + if (stream.state != StreamState.Open && + stream.state != StreamState.HalfClosedRemote) { + throw StateError('Open state expected (was: ${stream.state}).'); + } + + stream.outgoingQueue + .enqueueMessage(DataMessage(stream.id, data, endStream)); + + if (endStream) { + _endStream(stream); + } + } + + void _endStream(Http2StreamImpl stream) { + if (stream.state == StreamState.Open) { + _changeState(stream, StreamState.HalfClosedLocal); + } else if (stream.state == StreamState.HalfClosedRemote) { + _changeState(stream, StreamState.Closed); + } else { + throw StateError('Invalid state transition. This should never happen.'); + } + } + + //////////////////////////////////////////////////////////////////////////// + //// Stream closing + //////////////////////////////////////////////////////////////////////////// + + void _cleanupClosedStream(Http2StreamImpl stream) { + // NOTE: This function should only be called once + // * all incoming data has been delivered to the application + // * all outgoing data has been added to the connection queue. + incomingQueue.removeStreamMessageQueue(stream.id); + _openStreams.remove(stream.id); + if (stream.state != StreamState.Terminated) { + _changeState(stream, StreamState.Terminated); + } + if (_openStreams.isEmpty) { + _onActiveStateChanged(false); + } + onCheckForClose(); + } + + void _closeStreamIdAbnormally(int streamId, Exception exception, + {bool propagateException = false}) { + var stream = _openStreams[streamId]; + if (stream != null) { + _closeStreamAbnormally(stream, exception, + propagateException: propagateException); + } + } + + void _closeStreamAbnormally(Http2StreamImpl stream, Object? exception, + {bool propagateException = false}) { + incomingQueue.removeStreamMessageQueue(stream.id); + + if (stream.state != StreamState.Terminated) { + _changeState(stream, StreamState.Terminated); + } + stream.incomingQueue.terminate(propagateException ? exception : null); + stream._outgoingCSubscription.cancel(); + stream._outgoingC.close(); + + // NOTE: we're not adding an error here. + stream.outgoingQueue.terminate(); + + onCheckForClose(); + } + + @override + void onClosing() { + _newStreamsC.close(); + } + + @override + void onCheckForClose() { + if (isClosing && _openStreams.isEmpty) { + closeWithValue(); + } + } + + //////////////////////////////////////////////////////////////////////////// + //// State transitioning & Counting of active streams + //////////////////////////////////////////////////////////////////////////// + + /// The number of streams which we initiated and which are in one of the open + /// states (i.e. [StreamState.Open], [StreamState.HalfClosedLocal] or + /// [StreamState.HalfClosedRemote]) + int _numberOfActiveStreams = 0; + + bool _canCreateNewStream() { + var limit = _peerSettings.maxConcurrentStreams; + return limit == null || _numberOfActiveStreams < limit; + } + + bool _ranOutOfStreamIds() { + return nextStreamId > MAX_STREAM_ID; + } + + void _changeState(Http2StreamImpl stream, StreamState to) { + var from = stream.state; + + // In checked mode we'll test that the state transition is allowed. + assert((from == StreamState.Idle && to == StreamState.ReservedLocal) || + (from == StreamState.Idle && to == StreamState.ReservedRemote) || + (from == StreamState.Idle && to == StreamState.Open) || + (from == StreamState.Open && to == StreamState.HalfClosedLocal) || + (from == StreamState.Open && to == StreamState.HalfClosedRemote) || + (from == StreamState.Open && to == StreamState.Closed) || + (from == StreamState.HalfClosedLocal && to == StreamState.Closed) || + (from == StreamState.HalfClosedRemote && to == StreamState.Closed) || + (from == StreamState.ReservedLocal && + to == StreamState.HalfClosedRemote) || + (from == StreamState.ReservedLocal && to == StreamState.Closed) || + (from == StreamState.ReservedRemote && to == StreamState.Closed) || + (from == StreamState.ReservedRemote && + to == StreamState.HalfClosedLocal) || + (from != StreamState.Terminated && to == StreamState.Terminated)); + + // If we initiated the stream and it became "open" or "closed" we need to + // update the [_numberOfActiveStreams] counter. + if (_didInitiateStream(stream)) { + // NOTE: We wait until the stream is completely done. + // (If we waited only until `StreamState.Closed` then we might still have + // the endStream header/data message buffered, but not yet sent out). + switch (stream.state) { + case StreamState.ReservedLocal: + case StreamState.ReservedRemote: + case StreamState.Idle: + if (to == StreamState.Open || + to == StreamState.HalfClosedLocal || + to == StreamState.HalfClosedRemote) { + _numberOfActiveStreams++; + } + break; + case StreamState.Open: + case StreamState.HalfClosedLocal: + case StreamState.HalfClosedRemote: + case StreamState.Closed: + if (to == StreamState.Terminated) { + _numberOfActiveStreams--; + } + break; + case StreamState.Terminated: + // There is nothing to do here. + break; + } + } + stream.state = to; + } + + bool _didInitiateStream(Http2StreamImpl stream) { + var id = stream.id; + return (isServer && id.isEven) || (!isServer && id.isOdd); + } + + static Exception _throwStreamClosedException(int streamId) => + StreamClosedException( + streamId, + 'No open stream found and was not a headers frame opening a ' + 'new stream.', + ); +} diff --git a/pkgs/http2/lib/src/sync_errors.dart b/pkgs/http2/lib/src/sync_errors.dart new file mode 100644 index 0000000000..3d11616ad1 --- /dev/null +++ b/pkgs/http2/lib/src/sync_errors.dart @@ -0,0 +1,52 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class ProtocolException implements Exception { + final String _message; + + ProtocolException(this._message); + + @override + String toString() => 'ProtocolError: $_message'; +} + +class FlowControlException implements Exception { + final String _message; + + FlowControlException(this._message); + + @override + String toString() => 'FlowControlException: $_message'; +} + +class FrameSizeException implements Exception { + final String _message; + + FrameSizeException(this._message); + + @override + String toString() => 'FrameSizeException: $_message'; +} + +class TerminatedException implements Exception { + @override + String toString() => 'TerminatedException: The object has been terminated.'; +} + +class StreamException implements Exception { + final String _message; + final int streamId; + + StreamException(this.streamId, this._message); + + @override + String toString() => 'StreamException(stream id: $streamId): $_message'; +} + +class StreamClosedException extends StreamException { + StreamClosedException(super.streamId, [super.message = '']); + + @override + String toString() => 'StreamClosedException(stream id: $streamId): $_message'; +} diff --git a/pkgs/http2/lib/transport.dart b/pkgs/http2/lib/transport.dart new file mode 100644 index 0000000000..87a10f6799 --- /dev/null +++ b/pkgs/http2/lib/transport.dart @@ -0,0 +1,243 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'src/connection.dart'; +import 'src/hpack/hpack.dart' show Header; + +export 'src/frames/frames.dart' show ErrorCode; +export 'src/hpack/hpack.dart' show Header; + +typedef ActiveStateHandler = void Function(bool isActive); + +/// Settings for a [TransportConnection]. +abstract class Settings { + /// The maximum number of concurrent streams the remote end can open + /// (defaults to being unlimited). + final int? concurrentStreamLimit; + + /// The default stream window size the remote peer can use when creating new + /// streams (defaults to 65535 bytes). + final int? streamWindowSize; + + const Settings({this.concurrentStreamLimit, this.streamWindowSize}); +} + +/// Settings for a [TransportConnection] a server can make. +class ServerSettings extends Settings { + const ServerSettings({super.concurrentStreamLimit, super.streamWindowSize}); +} + +/// Settings for a [TransportConnection] a client can make. +class ClientSettings extends Settings { + /// Whether the client allows pushes from the server (defaults to false). + final bool allowServerPushes; + + const ClientSettings( + {super.concurrentStreamLimit, + super.streamWindowSize, + this.allowServerPushes = false}); +} + +/// Represents a HTTP/2 connection. +abstract class TransportConnection { + /// Pings the other end. + Future ping(); + + /// Sets the active state callback. + /// + /// This callback is invoked with `true` when the number of active streams + /// goes from 0 to 1 (the connection goes from idle to active), and with + /// `false` when the number of active streams becomes 0 (the connection goes + /// from active to idle). + set onActiveStateChanged(ActiveStateHandler callback); + + /// Future which completes when the first SETTINGS frame is received from + /// the peer. + Future get onInitialPeerSettingsReceived; + + /// Stream which emits an event with the ping id every time a ping is received + /// on this connection. + Stream get onPingReceived; + + /// Stream which emits an event every time a ping is received on this + /// connection. + Stream get onFrameReceived; + + /// Finish this connection. + /// + /// No new streams will be accepted or can be created. + Future finish(); + + /// Terminates this connection forcefully. + Future terminate([int? errorCode]); +} + +abstract class ClientTransportConnection extends TransportConnection { + factory ClientTransportConnection.viaSocket(Socket socket, + {ClientSettings? settings}) => + ClientTransportConnection.viaStreams(socket, socket, settings: settings); + + factory ClientTransportConnection.viaStreams( + Stream> incoming, StreamSink> outgoing, + {ClientSettings? settings}) { + settings ??= const ClientSettings(); + return ClientConnection(incoming, outgoing, settings); + } + + /// Whether this connection is open and can be used to make new requests + /// via [makeRequest]. + bool get isOpen; + + /// Creates a new outgoing stream. + ClientTransportStream makeRequest(List
headers, + {bool endStream = false}); +} + +abstract class ServerTransportConnection extends TransportConnection { + factory ServerTransportConnection.viaSocket(Socket socket, + {ServerSettings? settings}) { + return ServerTransportConnection.viaStreams(socket, socket, + settings: settings); + } + + factory ServerTransportConnection.viaStreams( + Stream> incoming, StreamSink> outgoing, + {ServerSettings? settings = + const ServerSettings(concurrentStreamLimit: 1000)}) { + settings ??= const ServerSettings(); + return ServerConnection(incoming, outgoing, settings); + } + + /// Incoming HTTP/2 streams. + Stream get incomingStreams; +} + +/// Represents a HTTP/2 stream. +abstract class TransportStream { + /// The id of this stream. + /// + /// * odd numbered streams are client streams + /// * even numbered streams are opened from the server + int get id; + + /// A stream of data and/or headers from the remote end. + Stream get incomingMessages; + + /// A sink for writing data and/or headers to the remote end. + StreamSink get outgoingMessages; + + /// Sets the termination handler on this stream. + /// + /// The handler will be called if the stream receives an RST_STREAM frame. + set onTerminated(void Function(int?) value); + + /// Terminates this HTTP/2 stream in an un-normal way. + /// + /// For normal termination, one can cancel the [StreamSubscription] from + /// `incoming.listen()` and close the `outgoing` [StreamSink]. + /// + /// Terminating this HTTP/2 stream will free up all resources associated with + /// it locally and will notify the remote end that this stream is no longer + /// used. + void terminate(); + + // For convenience only. + void sendHeaders(List
headers, {bool endStream = false}) { + outgoingMessages.add(HeadersStreamMessage(headers, endStream: endStream)); + if (endStream) outgoingMessages.close(); + } + + void sendData(List bytes, {bool endStream = false}) { + outgoingMessages.add(DataStreamMessage(bytes, endStream: endStream)); + if (endStream) outgoingMessages.close(); + } +} + +abstract class ClientTransportStream extends TransportStream { + /// Streams which the remote end pushed to this endpoint. + /// + /// If peer pushes were enabled, the client is responsible to either + /// handle or reject any peer push. + Stream get peerPushes; +} + +abstract class ServerTransportStream extends TransportStream { + /// Whether a method to [push] will succeed. Requirements for this getter to + /// return `true` are: + /// * this stream must be in the Open or HalfClosedRemote state + /// * the client needs to have the "enable push" settings enabled + /// * the number of active streams has not reached the maximum + bool get canPush; + + /// Pushes a new stream to the remote peer. + ServerTransportStream push(List
requestHeaders); +} + +/// Represents a message which can be sent over a HTTP/2 stream. +abstract class StreamMessage { + final bool endStream; + + StreamMessage({bool? endStream}) : endStream = endStream ?? false; +} + +/// Represents a data message which can be sent over a HTTP/2 stream. +class DataStreamMessage extends StreamMessage { + final List bytes; + + DataStreamMessage(this.bytes, {super.endStream}); + + @override + String toString() => 'DataStreamMessage(${bytes.length} bytes)'; +} + +/// Represents a headers message which can be sent over a HTTP/2 stream. +class HeadersStreamMessage extends StreamMessage { + final List
headers; + + HeadersStreamMessage(this.headers, {super.endStream}); + + @override + String toString() => 'HeadersStreamMessage(${headers.length} headers)'; +} + +/// Represents a remote stream push. +class TransportStreamPush { + /// The request headers which [stream] is the response to. + final List
requestHeaders; + + /// The remote stream push. + final ClientTransportStream stream; + + TransportStreamPush(this.requestHeaders, this.stream); + + @override + String toString() => + 'TransportStreamPush(${requestHeaders.length} request headers headers)'; +} + +/// An exception thrown by the HTTP/2 implementation. +class TransportException implements Exception { + final String message; + + TransportException(this.message); + + @override + String toString() => 'HTTP/2 error: $message'; +} + +/// An exception thrown when a HTTP/2 connection error occurred. +class TransportConnectionException extends TransportException { + final int errorCode; + + TransportConnectionException(this.errorCode, String details) + : super('Connection error: $details (errorCode: $errorCode)'); +} + +/// An exception thrown when a HTTP/2 stream error occured. +class StreamTransportException extends TransportException { + StreamTransportException(String details) : super('Stream error: $details'); +} diff --git a/pkgs/http2/manual_test/out_of_stream_ids_test.dart b/pkgs/http2/manual_test/out_of_stream_ids_test.dart new file mode 100644 index 0000000000..acfbbd9cee --- /dev/null +++ b/pkgs/http2/manual_test/out_of_stream_ids_test.dart @@ -0,0 +1,62 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE FILE. + +/// --------------------------------------------------------------------------- +/// In order to run this test one needs to change the following line in +/// ../lib/src/streams/stream_handler.dart +/// +/// - static const int MAX_STREAM_ID = (1 << 31) - 1; +/// + static const int MAX_STREAM_ID = (1 << 5) - 1; +/// +/// without this patch this test will run for a _long_ time. +/// --------------------------------------------------------------------------- +library; + +import 'dart:async'; + +import 'package:http2/src/streams/stream_handler.dart'; +import 'package:http2/transport.dart'; +import 'package:test/test.dart'; + +import '../test/transport_test.dart'; + +void main() { + group('transport-test', () { + transportTest('client-runs-out-of-stream-ids', + (ClientTransportConnection client, + ServerTransportConnection server) async { + Future serverFun() async { + await for (ServerTransportStream stream in server.incomingStreams) { + stream.sendHeaders([Header.ascii('x', 'y')], endStream: true); + expect(await stream.incomingMessages.toList(), hasLength(1)); + } + await server.finish(); + } + + Future clientFun() async { + var headers = [Header.ascii('a', 'b')]; + + const kMaxStreamId = StreamHandler.MAX_STREAM_ID; + for (var i = 1; i <= kMaxStreamId; i += 2) { + var stream = client.makeRequest(headers, endStream: true); + var messages = await stream.incomingMessages.toList(); + expect(messages, hasLength(1)); + } + + expect(client.isOpen, false); + expect(() => client.makeRequest(headers), + throwsA(const TypeMatcher())); + + await Future.delayed(const Duration(seconds: 1)); + await client.finish(); + } + + var serverFuture = serverFun(); + var clientFuture = clientFun(); + + await serverFuture; + await clientFuture; + }); + }); +} diff --git a/pkgs/http2/pubspec.yaml b/pkgs/http2/pubspec.yaml new file mode 100644 index 0000000000..7d9e6b851b --- /dev/null +++ b/pkgs/http2/pubspec.yaml @@ -0,0 +1,18 @@ +name: http2 +version: 2.3.1 +description: A HTTP/2 implementation in Dart. +repository: https://github.com/dart-lang/http/tree/master/pkgs/http2 + +topics: + - http + - network + - protocols + +environment: + sdk: ^3.2.0 + +dev_dependencies: + build_runner: ^2.3.0 + dart_flutter_team_lints: ^2.0.0 + mockito: ^5.3.2 + test: ^1.21.4 diff --git a/pkgs/http2/test/certificates/server_chain.pem b/pkgs/http2/test/certificates/server_chain.pem new file mode 100644 index 0000000000..4163fe7ddd --- /dev/null +++ b/pkgs/http2/test/certificates/server_chain.pem @@ -0,0 +1,57 @@ +-----BEGIN CERTIFICATE----- +MIIDKTCCAhGgAwIBAgIJAOWmjTS+OnTEMA0GCSqGSIb3DQEBCwUAMBcxFTATBgNV +BAMMDGludGVybWVkaWF0ZTAeFw0xNTA1MTgwOTAwNDBaFw0yMzA4MDQwOTAwNDBa +MBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBALlcwQJuzd+xH8QFgfJSn5tRlvhkldSX98cE7NiA602NBbnAVyUrkRXq +Ni75lgt0kwjYfA9z674m8WSVbgpLPintPCla9CYky1TH0keIs8Rz6cGWHryWEHiu +EDuljQynu2b3sAFuHu9nfWurbJwZnFakBKpdQ9m4EyOZCHC/jHYY7HacKSXg1Cki +we2ca0BWDrcqy8kLy0dZ5oC6IZG8O8drAK8f3f44CRYw59D3sOKBrKXaabpvyEcb +N7Wk2HDBVwHpUJo1reVwtbM8dhqQayYSD8oXnGpP3RQNu/e2rzlXRyq/BfcDY1JI +7TbC4t/7/N4EcPSpGsTcSOC9A7FpzvECAwEAAaN7MHkwCQYDVR0TBAIwADAsBglg +hkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0O +BBYEFCnwiEMMFZh7NhCr+qA8K0w4Q+AOMB8GA1UdIwQYMBaAFB0h1Evsaw2vfrmS +YuoCTmC4EE6ZMA0GCSqGSIb3DQEBCwUAA4IBAQAcFmHMaXRxyoNaeOowQ6iQWoZd +AUbvG7SHr7I6Pi2aqdqofsKWts7Ytm5WsS0M2nN+sW504houu0iCPeJJX8RQw2q4 +CCcNOs9IXk+2uMzlpocHpv+yYoUiD5DxgWh7eghQMLyMpf8FX3Gy4VazeuXznHOM +4gE4L417xkDzYOzqVTp0FTyAPUv6G2euhNCD6TMru9REcRhYul+K9kocjA5tt2KG +MH6y28LXbLyq4YJUxSUU9gY/xlnbbZS48KDqEcdYC9zjW9nQ0qS+XQuQuFIcwjJ5 +V4kAUYxDu6FoTpyQjgsrmBbZlKNxH7Nj4NDlcdJhp/zeSKHqWa5hSWjjKIxp +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDAjCCAeqgAwIBAgIJAOWmjTS+OnTDMA0GCSqGSIb3DQEBCwUAMBgxFjAUBgNV +BAMMDXJvb3RhdXRob3JpdHkwHhcNMTUwNTE4MDkwMDQwWhcNMjMwODA0MDkwMDQw +WjAXMRUwEwYDVQQDDAxpbnRlcm1lZGlhdGUwggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQDSrAO1CoPvUllgLOzDm5nG0skDF7vh1DUgAIDVGz0ecD0JFbQx +EF79pju/6MbtpTW2FYvRp11t/G7rGtX923ybOHY/1MNFQrdIvPlO1VV7IGKjoMwP +DNeb0fIGjHoE9QxaDxR8NX8xQbItpsw+TUtRfc9SLkR+jaYJfVRoM21BOncZbSHE +YKiZlEbpecB/+EtwVpgvl+8mPD5U07Fi4fp/lza3WXInXQPyiTVllIEJCt4PKmlu +MocNaJOW38bysL7i0PzDpVZtOxLHOTaW68yF3FckIHNCaA7k1ABEEEegjFMmIao7 +B9w7A0jvr4jZVvNmui5Djjn+oJxwEVVgyf8LAgMBAAGjUDBOMB0GA1UdDgQWBBQd +IdRL7GsNr365kmLqAk5guBBOmTAfBgNVHSMEGDAWgBRk81s9d0ZbiZhh44KckwPb +oTc0XzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQBZQTK0plfdB5PC +cC5icut4EmrByJa1RbU7ayuEE70e7hla6KVmVjVdCBGltI4jBYwfhKbRItHiAJ/8 +x+XZKBG8DLPFuDb7lAa1ObhAYF7YThUFPQYaBhfzKcWrdmWDBFpvNv6E0Mm364dZ +e7Yxmbe5S4agkYPoxEzgEYmcUk9jbjdR6eTbs8laG169ljrECXfEU9RiAcqz5iSX +NLSewqB47hn3B9qgKcQn+PsgO2j7M+rfklhNgeGJeWmy7j6clSOuCsIjWHU0RLQ4 +0W3SB/rpEAJ7fgQbYUPTIUNALSOWi/o1tDX2mXPRjBoxqAv7I+vYk1lZPmSzkyRh +FKvRDxsW +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDAzCCAeugAwIBAgIJAJ0MomS4Ck+8MA0GCSqGSIb3DQEBCwUAMBgxFjAUBgNV +BAMMDXJvb3RhdXRob3JpdHkwHhcNMTUwNTE4MDkwMDQwWhcNMjMwODA0MDkwMDQw +WjAYMRYwFAYDVQQDDA1yb290YXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEAts1ijtBV92S2cOvpUMOSTp9c6A34nIGr0T5Nhz6XiqRVT+gv +dQgmkdKJQjbvR60y6jzltYFsI2MpGVXY8h/oAL81D/k7PDB2aREgyBfTPAhBHyGw +siR+2xYt5b/Zs99q5RdRqQNzNpLPJriIKvUsRyQWy1UiG2s7pRXQeA8qB0XtJdCj +kFIi+G2bDsaffspGeDOCqt7t+yqvRXfSES0c/l7DIHaiMbbp4//ZNML3RNgAjPz2 +hCezZ+wOYajOIyoSPK8IgICrhYFYxvgWxwbLDBEfC5B3jOQsySe10GoRAKZz1gBV +DmgReu81tYJmdgkc9zknnQtIFdA0ex+GvZlfWQIDAQABo1AwTjAdBgNVHQ4EFgQU +ZPNbPXdGW4mYYeOCnJMD26E3NF8wHwYDVR0jBBgwFoAUZPNbPXdGW4mYYeOCnJMD +26E3NF8wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEATzkZ97K777uZ +lQcduNX3ey4IbCiEzFA2zO5Blj+ilfIwNbZXNOgm/lqNvVGDYs6J1apJJe30vL3X +J+t2zsZWzzQzb9uIU37zYemt6m0fHrSrx/iy5lGNqt3HMfqEcOqSCOIK3PCTMz2/ +uyGe1iw33PVeWsm1JUybQ9IrU/huJjbgOHU4wab+8SJCM49ipArp68Fr6j4lcEaE +4rfRg1ZsvxiOyUB3qPn6wyL/JB8kOJ+QCBe498376eaem8AEFk0kQRh6hDaWtq/k +t6IIXQLjx+EBDVP/veK0UnVhKRP8YTOoV8ZiG1NcdlJmX/Uk7iAfevP7CkBfSN8W +r6AL284qtw== +-----END CERTIFICATE----- diff --git a/pkgs/http2/test/certificates/server_key.pem b/pkgs/http2/test/certificates/server_key.pem new file mode 100644 index 0000000000..1fd2324045 --- /dev/null +++ b/pkgs/http2/test/certificates/server_key.pem @@ -0,0 +1,29 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIE5DAcBgoqhkiG9w0BDAEBMA4ECL7L6rj6uEHGAgIIAASCBMLbucyfqAkgCbhP +xNSHYllPMAv/dsIjtnsBwepCXPGkCBCuOAw/2FaCHjN9hBqL5V7fkrKeaemhm2YE +ycPtlHJYPDf3kEkyMjdZ9rIY6kePGfQizs2uJPcXj4YPyQ4HsfVXpOicKfQrouf5 +Mze9bGzeMN065q3iP4dYUMwHAyZYteXCsanQNHlqvsWli0W+H8St8fdsXefZhnv1 +qVatKWdNdWQ9t5MuljgNU2Vv56sHKEYXI0yLxk2QUMk8KlJfnmt8foYUsnPUXHmc +gIjLKwwVkpdololnEHSNu0cEOUPowjgJru+uMpn7vdNl7TPEQ9jbEgdNg4JwoYzU +0nao8WzjaSp7kzvZz0VFwKnk5AjstGvvuAWckADdq23QElbn/mF7AG1m/TBpYxzF +gTt37UdndS/AcvVznWVVrRP5iTSIawdIwvqI4s7rqsoE0GCcak+RhchgAz2gWKkS +oODUo0JL6pPVbJ3l4ebbaO6c99nDVc8dViPtc1EkStJEJ2O4kI4xgLSCr4Y9ahKn +oAaoSkX7Xxq3aQm+BzqSpLjdGL8atsqR/YVOIHYIl3gThvP0NfZGx1xHyvO5mCdZ +kHxSA7tKWxauZ3eQ2clbnzeRsl4El0WMHy/5K1ovene4v7sunmoXVtghBC8hK6eh +zMO9orex2PNQ/VQC7HCvtytunOVx1lkSBoNo7hR70igg6rW9H7UyoAoBOwMpT1xa +J6V62nqruTKOqFNfur7aHJGpHGtDb5/ickHeYCyPTvmGp67u4wChzKReeg02oECe +d1E5FKAcIa8s9TVOB6Z+HvTRNQZu2PsI6TJnjQRowvY9DAHiWTlJZBBY/pko3hxX +TsIeybpvRdEHpDWv86/iqtw1hv9CUxS/8ZTWUgBo+osShHW79FeDASr9FC4/Zn76 +ZDERTgV4YWlW/klVWcG2lFo7jix+OPXAB+ZQavLhlN1xdWBcIz1AUWjAM4hdPylW +HCX4PB9CQIPl2E7F+Y2p6nMcMWSJVBi5UIH7E9LfaBguXSzMmTk2Fw5p1aOQ6wfN +goVAMVwi8ppAVs741PfHdZ295xMmK/1LCxz5DeAdD/tsA/SYfT753GotioDuC7im +EyJ5JyvTr5I6RFFBuqt3NlUb3Hp16wP3B2x9DZiB6jxr0l341/NHgsyeBXkuIy9j +ON2mvpBPCJhS8kgWo3G0UyyKnx64tcgpGuSvZhGwPz843B6AbYyE6pMRfSWRMkMS +YZYa+VNKhR4ixdj07ocFZEWLVjCH7kxkE8JZXKt8jKYmkWd0lS1QVjgaKlO6lRa3 +q6SPJkhW6pvqobvcqVNXwi1XuzpZeEbuh0B7OTekFTTxx5g9XeDl56M8SVQ1KEhT +Q1t7H2Nba18WCB7cf+6PN0F0K0Jz1Kq7ZWaqEI/grX1m4RQuvNF5807sB/QKMO/Z +Gz3NXvHg5xTJRd/567lxPGkor0cE7qD1EZfmJ2HrBYXQ91bhgA7LToBuMZo6ZRXH +QfsanjbP4FPLMiGdQigLjj3A35L/f4sQOOVac/sRaFnm7pzcxsMvyVU/YtvGcjYE +xaOOVnamg661Wo0wksXoDjeSz/JIyyKO3Gwp1FSm2wGLjjy/Ehmqcqy8rvHuf07w +AUukhVtTNn4= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/pkgs/http2/test/client_test.dart b/pkgs/http2/test/client_test.dart new file mode 100644 index 0000000000..726707f357 --- /dev/null +++ b/pkgs/http2/test/client_test.dart @@ -0,0 +1,881 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert' show ascii; +import 'dart:typed_data'; + +import 'package:http2/src/connection_preface.dart'; +import 'package:http2/src/flowcontrol/window.dart'; +import 'package:http2/src/frames/frames.dart'; +import 'package:http2/src/hpack/hpack.dart'; +import 'package:http2/src/settings/settings.dart'; +import 'package:http2/transport.dart'; +import 'package:test/test.dart'; + +import 'src/hpack/hpack_test.dart' show isHeader; + +void main() { + group('client-tests', () { + group('normal', () { + clientTest('gracefull-shutdown-for-unused-connection', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var settingsDone = Completer(); + + Future serverFun() async { + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + settingsDone.complete(); + + // Make sure we get the graceful shutdown message. + expect( + await nextFrame(), + isA() + .having((f) => f.errorCode, 'errorCode', ErrorCode.NO_ERROR)); + + // Make sure the client ended the connection. + expect(await serverReader.moveNext(), false); + } + + Future clientFun() async { + await settingsDone.future; + + expect(client.isOpen, true); + + // Try to gracefully finish the connection. + var future = client.finish(); + + expect(client.isOpen, false); + + await future; + } + + await Future.wait([serverFun(), clientFun()]); + }); + }); + + group('connection-operational', () { + clientTest('on-connection-operational-fires', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + final settingsDone = Completer(); + + Future serverFun() async { + serverWriter.writeSettingsFrame([]); + settingsDone.complete(); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + // Make sure we get the graceful shutdown message. + expect( + await nextFrame(), + isA() + .having((f) => f.errorCode, 'errorCode', ErrorCode.NO_ERROR)); + + // Make sure the client ended the connection. + expect(await serverReader.moveNext(), false); + } + + Future clientFun() async { + await settingsDone.future; + await client.onInitialPeerSettingsReceived + .timeout(const Duration(milliseconds: 20)); // Should complete + + expect(client.isOpen, true); + + // Try to gracefully finish the connection. + var future = client.finish(); + + expect(client.isOpen, false); + + await future; + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('on-connection-operational-does-not-fire', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + final goawayReceived = Completer(); + Future serverFun() async { + serverWriter.writePingFrame(42); + expect(await nextFrame(), isA()); + expect(await nextFrame(), isA()); + goawayReceived.complete(); + expect(await serverReader.moveNext(), false); + } + + Future clientFun() async { + expect(client.isOpen, true); + + expect( + client.onInitialPeerSettingsReceived + .timeout(const Duration(seconds: 1)), + throwsA(isA())); + + // We wait until the server received the error (it's actually later + // than necessary, but we can't make a deterministic test otherwise). + await goawayReceived.future; + + expect(client.isOpen, false); + + String? error; + try { + client.makeRequest([Header.ascii('a', 'b')]); + } catch (e) { + error = '$e'; + } + expect(error, contains('no longer active')); + + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + }); + + group('server-errors', () { + clientTest('no-settings-frame-at-beginning-immediate-error', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var goawayReceived = Completer(); + Future serverFun() async { + serverWriter.writePingFrame(42); + expect(await nextFrame(), isA()); + expect(await nextFrame(), isA()); + goawayReceived.complete(); + expect(await serverReader.moveNext(), false); + } + + Future clientFun() async { + expect(client.isOpen, true); + + // We wait until the server received the error (it's actually later + // than necessary, but we can't make a deterministic test otherwise). + await goawayReceived.future; + + expect(client.isOpen, false); + + String? error; + try { + client.makeRequest([Header.ascii('a', 'b')]); + } catch (e) { + error = '$e'; + } + expect(error, contains('no longer active')); + + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('no-settings-frame-at-beginning-delayed-error', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + Future serverFun() async { + expect(await nextFrame(), isA()); + expect(await nextFrame(), isA()); + serverWriter.writePingFrame(42); + expect(await nextFrame(), isA()); + expect(await serverReader.moveNext(), false); + } + + Future clientFun() async { + expect(client.isOpen, true); + var stream = client.makeRequest([Header.ascii('a', 'b')]); + + String? error; + try { + await stream.incomingMessages.toList(); + } catch (e) { + error = '$e'; + } + expect(error, contains('forcefully terminated')); + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('data-frame-for-invalid-stream', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var handshakeCompleter = Completer(); + + Future serverFun() async { + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + handshakeCompleter.complete(); + + var headers = await nextFrame() as HeadersFrame; + expect( + await nextFrame(), + isA().having( + (p0) => p0.hasEndStreamFlag, 'Last data frame', true)); + + // Write a data frame for a non-existent stream. + var invalidStreamId = headers.header.streamId + 2; + serverWriter.writeDataFrame(invalidStreamId, [42]); + + // Make sure the client sends a [RstStreamFrame] frame. + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Connection update', 0)); + expect( + await nextFrame(), + isA() + .having( + (f) => f.errorCode, 'errorCode', ErrorCode.STREAM_CLOSED) + .having((f) => f.header.streamId, 'header.streamId', + invalidStreamId)); + + // Close the original stream. + serverWriter.writeDataFrame(headers.header.streamId, [], + endStream: true); + + // Wait for the client finish. + expect(await nextFrame(), isA()); + expect(await serverReader.moveNext(), false); + await serverWriter.close(); + } + + Future clientFun() async { + await handshakeCompleter.future; + + var stream = client.makeRequest([Header.ascii('a', 'b')]); + await stream.outgoingMessages.close(); + expect(await stream.incomingMessages.toList(), isEmpty); + + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('data-frame-after-stream-closed', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var handshakeCompleter = Completer(); + + Future serverFun() async { + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + handshakeCompleter.complete(); + + var headers = await nextFrame() as HeadersFrame; + expect( + await nextFrame(), + isA().having( + (p0) => p0.hasEndStreamFlag, 'Last data frame', true)); + + var streamId = headers.header.streamId; + + // Write a data frame for a non-existent stream. + var data1 = [42, 42]; + serverWriter.writeDataFrame(streamId, data1, endStream: true); + + // Write more data on the closed stream. + var data2 = [42]; + serverWriter.writeDataFrame(streamId, data2); + + // NOTE: The order of the window update frame / rst frame just + // happens to be like that ATM. + + // The two WindowUpdateFrames for the data1 DataFrame. + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Stream update', 1) + .having((p0) => p0.windowSizeIncrement, 'Windowsize', + data1.length)); + + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Connection update', 0) + .having((p0) => p0.windowSizeIncrement, 'Windowsize', + data1.length)); + + // The [WindowUpdateFrame] for the frame on the closed stream, which + // should still update the connection. + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Connection update', 0) + .having((p0) => p0.windowSizeIncrement, 'Windowsize', + data2.length)); + + // Make sure we get a [RstStreamFrame] frame. + expect( + await nextFrame(), + isA() + .having( + (f) => f.errorCode, 'errorCode', ErrorCode.STREAM_CLOSED) + .having( + (f) => f.header.streamId, 'header.streamId', streamId)); + + // Wait for the client finish. + expect(await nextFrame(), isA()); + expect(await serverReader.moveNext(), false); + await serverWriter.close(); + } + + Future clientFun() async { + await handshakeCompleter.future; + + var stream = client.makeRequest([Header.ascii('a', 'b')]); + await stream.outgoingMessages.close(); + var messages = await stream.incomingMessages.toList(); + expect(messages, hasLength(1)); + expect( + messages[0], + isA() + .having((p0) => p0.bytes, 'Same as `data1` above', [42, 42]), + ); + + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('data-frame-received-after-stream-cancel', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var handshakeCompleter = Completer(); + var cancelDone = Completer(); + var endDone = Completer(); + + Future serverFun() async { + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + handshakeCompleter.complete(); + + var headers = await nextFrame() as HeadersFrame; + expect( + await nextFrame(), + isA().having( + (p0) => p0.hasEndStreamFlag, 'Last data frame', true)); + var streamId = headers.header.streamId; + + // Write a data frame. + serverWriter.writeDataFrame(streamId, [42]); + await cancelDone.future; + serverWriter.writeDataFrame(streamId, [43]); + + // NOTE: The order of the window update frame / rst frame just + // happens to be like that ATM. + + // Await stream/connection window update frame. + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Stream update', 1) + .having((p0) => p0.windowSizeIncrement, 'Windowsize', 1)); + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Connection update', 0) + .having((p0) => p0.windowSizeIncrement, 'Windowsize', 1)); + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Connection update', 0) + .having((p0) => p0.windowSizeIncrement, 'Windowsize', 1)); + + // Make sure we get a [RstStreamFrame] frame. + expect( + await nextFrame(), + isA() + .having((f) => f.errorCode, 'errorCode', ErrorCode.CANCEL) + .having( + (f) => f.header.streamId, 'header.streamId', streamId)); + + serverWriter.writeRstStreamFrame(streamId, ErrorCode.STREAM_CLOSED); + + endDone.complete(); + + // Wait for the client finish. + expect(await nextFrame(), isA()); + expect(await serverReader.moveNext(), false); + await serverWriter.close(); + } + + Future clientFun() async { + await handshakeCompleter.future; + + var stream = client.makeRequest([Header.ascii('a', 'b')]); + await stream.outgoingMessages.close(); + + // first will cancel the stream + var message = await stream.incomingMessages.first; + expect( + message, + isA() + .having((p0) => p0.bytes, 'Same sent data above', [42]), + ); + + cancelDone.complete(); + + await endDone.future; + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('data-frame-received-after-stream-cancel-and-out-not-closed', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var handshakeCompleter = Completer(); + var cancelDone = Completer(); + var endDone = Completer(); + var clientDone = Completer(); + + Future serverFun() async { + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + handshakeCompleter.complete(); + + var headers = await nextFrame() as HeadersFrame; + + var streamId = headers.header.streamId; + + // Write a data frame. + serverWriter.writeDataFrame(streamId, [42]); + await cancelDone.future; + serverWriter.writeDataFrame(streamId, [43]); + serverWriter.writeRstStreamFrame(streamId, ErrorCode.STREAM_CLOSED); + endDone.complete(); + + // NOTE: The order of the window update frame / rst frame just + // happens to be like that ATM. + + // Await stream/connection window update frame. + + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Stream update', 1) + .having((p0) => p0.windowSizeIncrement, 'Windowsize', 1)); + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Connection update', 0) + .having((p0) => p0.windowSizeIncrement, 'Windowsize', 1)); + expect( + await nextFrame(), + isA() + .having((p0) => p0.header.streamId, 'Connection update', 0) + .having((p0) => p0.windowSizeIncrement, 'Windowsize', 1)); + + await clientDone.future; + expect( + await nextFrame(), + isA().having( + (p0) => p0.hasEndStreamFlag, 'Last data frame', true)); + + // Wait for the client finish. + expect(await serverReader.moveNext(), false); + await serverWriter.close(); + } + + Future clientFun() async { + await handshakeCompleter.future; + + var stream = client.makeRequest([Header.ascii('a', 'b')]); + + // first will cancel the stream + var message = await stream.incomingMessages.first; + expect( + message, + isA() + .having((p0) => p0.bytes, 'Same sent data above', [42]), + ); + + cancelDone.complete(); + + await endDone.future; + + await stream.outgoingMessages.close(); + clientDone.complete(); + + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('client-reports-connection-error-on-push-to-nonexistent', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var handshakeCompleter = Completer(); + + Future serverFun() async { + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + handshakeCompleter.complete(); + + var headers = await nextFrame() as HeadersFrame; + expect( + await nextFrame(), + isA().having( + (p0) => p0.hasEndStreamFlag, 'Last data frame', true)); + + var streamId = headers.header.streamId; + + // Write response. + serverWriter.writeHeadersFrame(streamId, [Header.ascii('a', 'b')], + endStream: true); + + // Push stream to the (non existing) one. + var pushStreamId = 2; + serverWriter.writePushPromiseFrame( + streamId, pushStreamId, [Header.ascii('a', 'b')]); + + // Make sure we get a connection error. + var frame = await nextFrame() as GoawayFrame; + expect(ascii.decode(frame.debugData), + contains('Cannot push on a non-existent stream')); + expect(await serverReader.moveNext(), false); + await serverWriter.close(); + } + + Future clientFun() async { + await handshakeCompleter.future; + + var stream = client.makeRequest([Header.ascii('a', 'b')]); + await stream.outgoingMessages.close(); + var messages = await stream.incomingMessages.toList(); + expect(messages, hasLength(1)); + + expect( + messages[0], + isA().having((p0) => p0.headers.first, + 'Same sent headers above', isHeader('a', 'b')), + ); + + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('client-reports-connection-error-on-push-to-non-open', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var handshakeCompleter = Completer(); + + Future serverFun() async { + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + handshakeCompleter.complete(); + + var headers = await nextFrame() as HeadersFrame; + var streamId = headers.header.streamId; + + // Write response. + serverWriter.writeDataFrame(streamId, [], endStream: true); + + // Push stream onto the existing (but half-closed) one. + var pushStreamId = 2; + serverWriter.writePushPromiseFrame( + streamId, pushStreamId, [Header.ascii('a', 'b')]); + + // Make sure we get a connection error. + var frame = await nextFrame() as GoawayFrame; + expect( + ascii.decode(frame.debugData), + contains( + 'Expected open state (was: StreamState.HalfClosedRemote)')); + expect(await serverReader.moveNext(), false); + await serverWriter.close(); + } + + Future clientFun() async { + await handshakeCompleter.future; + + var stream = client.makeRequest([Header.ascii('a', 'b')]); + + // NOTE: We are not closing the outgoing part on purpose. + expect(await stream.incomingMessages.toList(), isEmpty); + expect(await stream.peerPushes.toList(), isEmpty); + + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('client-reports-flowcontrol-error-on-negative-window', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var handshakeCompleter = Completer(); + + Future serverFun() async { + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + handshakeCompleter.complete(); + + var headers = await nextFrame() as HeadersFrame; + var streamId = headers.header.streamId; + + // Write more than [kFlowControlWindowSize] bytes. + final kFlowControlWindowSize = Window().size; + var sentBytes = 0; + final bytes = Uint8List(1024); + while (sentBytes <= kFlowControlWindowSize) { + serverWriter.writeDataFrame(streamId, bytes); + sentBytes += bytes.length; + } + + // Read the resulting [GoawayFrame] and assert the error message + // describes that the flow control window became negative. + var frame = await nextFrame() as GoawayFrame; + expect( + ascii.decode(frame.debugData), + contains('Connection level flow control window became ' + 'negative.')); + expect(await serverReader.moveNext(), false); + await serverWriter.close(); + } + + Future clientFun() async { + await handshakeCompleter.future; + + var stream = client.makeRequest([Header.ascii('a', 'b')]); + var sub = stream.incomingMessages.listen( + expectAsync1((StreamMessage msg) {}, count: 0), + onError: expectAsync1((Object error) {})); + sub.pause(); + await Future.delayed(const Duration(milliseconds: 40)); + sub.resume(); + + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + }); + + group('client-errors', () { + clientTest('client-resets-stream', (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var settingsDone = Completer(); + var headersDone = Completer(); + + Future serverFun() async { + var decoder = HPackDecoder(); + + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + settingsDone.complete(); + + // Make sure we got the new stream. + var frame = await nextFrame() as HeadersFrame; + expect(frame.hasEndStreamFlag, false); + var decodedHeaders = decoder.decode(frame.headerBlockFragment); + expect(decodedHeaders, hasLength(1)); + expect(decodedHeaders[0], isHeader('a', 'b')); + + headersDone.complete(); + + // Make sure we got the stream reset. + expect( + await nextFrame(), + isA().having( + (p0) => p0.errorCode, 'Stream reset', ErrorCode.CANCEL)); + + // Make sure we get the graceful shutdown message. + expect( + await nextFrame(), + isA().having( + (p0) => p0.errorCode, 'Stream reset', ErrorCode.NO_ERROR)); + + // Make sure the client ended the connection. + expect(await serverReader.moveNext(), false); + } + + Future clientFun() async { + await settingsDone.future; + + // Make a new stream and terminate it. + var stream = + client.makeRequest([Header.ascii('a', 'b')], endStream: false); + + await headersDone.future; + stream.terminate(); + + // Make sure we don't get messages/pushes on the terminated stream. + expect(await stream.incomingMessages.toList(), isEmpty); + expect(await stream.peerPushes.toList(), isEmpty); + + // Try to gracefully finish the connection. + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + clientTest('goaway-terminates-nonprocessed-streams', + (ClientTransportConnection client, + FrameWriter serverWriter, + StreamIterator serverReader, + Future Function() nextFrame) async { + var settingsDone = Completer(); + + Future serverFun() async { + var decoder = HPackDecoder(); + + serverWriter.writeSettingsFrame([]); + expect(await nextFrame(), isA()); + serverWriter.writeSettingsAckFrame(); + expect(await nextFrame(), isA()); + + settingsDone.complete(); + + // Make sure we got the new stream. + var frame = await nextFrame() as HeadersFrame; + expect(frame.hasEndStreamFlag, false); + var decodedHeaders = decoder.decode(frame.headerBlockFragment); + expect(decodedHeaders, hasLength(1)); + expect(decodedHeaders[0], isHeader('a', 'b')); + + // Send the GoawayFrame. + serverWriter.writeGoawayFrame(0, ErrorCode.NO_ERROR, []); + + // Since there are no open streams left, the other end should just + // close the connection. + expect(await serverReader.moveNext(), false); + } + + Future clientFun() async { + await settingsDone.future; + + // Make a new stream and terminate it. + var stream = + client.makeRequest([Header.ascii('a', 'b')], endStream: false); + + // Make sure we don't get messages/pushes on the terminated stream. + unawaited( + stream.incomingMessages.toList().catchError(expectAsync1((e) { + expect( + '$e', + contains('This stream was not processed and can ' + 'therefore be retried')); + return []; + }))); + expect(await stream.peerPushes.toList(), isEmpty); + + // Try to gracefully finish the connection. + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + }); + }); +} + +void clientTest( + String name, + Future Function(ClientTransportConnection, FrameWriter, + StreamIterator frameReader, Future Function() readNext) + func, +) { + return test(name, () { + var streams = ClientStreams(); + var serverReader = streams.serverConnectionFrameReader; + + Future readNext() async { + expect(await serverReader.moveNext(), true); + return serverReader.current; + } + + return func(streams.clientConnection, streams.serverConnectionFrameWriter, + serverReader, readNext); + }); +} + +class ClientStreams { + final StreamController> writeA = StreamController(); + final StreamController> writeB = StreamController(); + Stream> get readA => writeA.stream; + Stream> get readB => writeB.stream; + + StreamIterator get serverConnectionFrameReader { + var localSettings = ActiveSettings(); + var streamAfterConnectionPreface = readConnectionPreface(readA); + return StreamIterator( + FrameReader(streamAfterConnectionPreface, localSettings) + .startDecoding()); + } + + FrameWriter get serverConnectionFrameWriter { + var encoder = HPackEncoder(); + var peerSettings = ActiveSettings(); + return FrameWriter(encoder, writeB, peerSettings); + } + + ClientTransportConnection get clientConnection => + ClientTransportConnection.viaStreams(readB, writeA); +} diff --git a/pkgs/http2/test/multiprotocol_server_test.dart b/pkgs/http2/test/multiprotocol_server_test.dart new file mode 100644 index 0000000000..736e7da6b3 --- /dev/null +++ b/pkgs/http2/test/multiprotocol_server_test.dart @@ -0,0 +1,130 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert' show ascii, utf8; +import 'dart:io'; + +import 'package:http2/multiprotocol_server.dart'; +import 'package:http2/transport.dart'; +import 'package:test/test.dart'; + +void main() { + var context = SecurityContext() + ..useCertificateChain('test/certificates/server_chain.pem') + ..usePrivateKey('test/certificates/server_key.pem', password: 'dartdart'); + + group('multiprotocol-server', () { + test('http/1.1', () async { + const Count = 2; + + var server = await MultiProtocolHttpServer.bind('localhost', 0, context); + var requestNr = 0; + server.startServing( + expectAsync1((HttpRequest request) async { + await handleHttp11Request(request, requestNr++); + if (requestNr == Count) { + await server.close(); + } + }, count: Count), + expectAsync1((ServerTransportStream stream) {}, count: 0)); + + var client = HttpClient(); + client.badCertificateCallback = (_, __, ___) => true; + for (var i = 0; i < Count; i++) { + await makeHttp11Request(server, client, i); + } + }); + + test('http/2', () async { + const Count = 2; + + var server = await MultiProtocolHttpServer.bind('localhost', 0, context); + var requestNr = 0; + server.startServing( + expectAsync1((HttpRequest request) {}, count: 0), + expectAsync1((ServerTransportStream stream) async { + await handleHttp2Request(stream, requestNr++); + if (requestNr == Count) { + await server.close(); + } + }, count: Count)); + + var socket = await SecureSocket.connect('localhost', server.port, + onBadCertificate: (_) => true, + supportedProtocols: ['http/1.1', 'h2']); + var connection = ClientTransportConnection.viaSocket(socket); + for (var i = 0; i < Count; i++) { + await makeHttp2Request(server, connection, i); + } + await connection.finish(); + }); + }); +} + +Future makeHttp11Request( + MultiProtocolHttpServer server, HttpClient client, int i) async { + var request = + await client.getUrl(Uri.parse('https://localhost:${server.port}/abc$i')); + var response = await request.close(); + var body = await response.cast>().transform(utf8.decoder).join(''); + expect(body, 'answer$i'); +} + +Future handleHttp11Request(HttpRequest request, int i) async { + expect(request.uri.path, '/abc$i'); + await request.drain(); + request.response.write('answer$i'); + await request.response.close(); +} + +Future makeHttp2Request(MultiProtocolHttpServer server, + ClientTransportConnection connection, int i) async { + expect(connection.isOpen, true); + var headers = [ + Header.ascii(':method', 'GET'), + Header.ascii(':scheme', 'https'), + Header.ascii(':authority', 'localhost:${server.port}'), + Header.ascii(':path', '/abc$i'), + ]; + + var stream = connection.makeRequest(headers, endStream: true); + var si = StreamIterator(stream.incomingMessages); + + expect(await si.moveNext(), true); + expect(si.current, isA()); + var responseHeaders = getHeaders(si.current as HeadersStreamMessage); + expect(responseHeaders[':status'], '200'); + + expect(await si.moveNext(), true); + expect(ascii.decode((si.current as DataStreamMessage).bytes), 'answer$i'); + + expect(await si.moveNext(), false); +} + +Future handleHttp2Request(ServerTransportStream stream, int i) async { + var si = StreamIterator(stream.incomingMessages); + + expect(await si.moveNext(), true); + expect(si.current, isA()); + var headers = getHeaders(si.current as HeadersStreamMessage); + + expect(headers[':path'], '/abc$i'); + expect(await si.moveNext(), false); + + stream.outgoingMessages.add(HeadersStreamMessage([ + Header.ascii(':status', '200'), + ])); + + stream.outgoingMessages.add(DataStreamMessage(ascii.encode('answer$i'))); + await stream.outgoingMessages.close(); +} + +Map getHeaders(HeadersStreamMessage headers) { + var map = {}; + for (var h in headers.headers) { + map.putIfAbsent(ascii.decode(h.name), () => ascii.decode(h.value)); + } + return map; +} diff --git a/pkgs/http2/test/server_test.dart b/pkgs/http2/test/server_test.dart new file mode 100644 index 0000000000..1af51c929a --- /dev/null +++ b/pkgs/http2/test/server_test.dart @@ -0,0 +1,244 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http2/src/connection_preface.dart'; +import 'package:http2/src/frames/frames.dart'; +import 'package:http2/src/hpack/hpack.dart'; +import 'package:http2/src/settings/settings.dart'; +import 'package:http2/transport.dart'; +import 'package:test/test.dart'; + +void main() { + group('server-tests', () { + group('normal', () { + serverTest('gracefull-shutdown-for-unused-connection', + (ServerTransportConnection server, + FrameWriter clientWriter, + StreamIterator clientReader, + Future Function() nextFrame) async { + Future serverFun() async { + expect(await server.incomingStreams.toList(), isEmpty); + await server.finish(); + } + + Future clientFun() async { + expect(await nextFrame() is SettingsFrame, true); + clientWriter.writeSettingsAckFrame(); + clientWriter.writeSettingsFrame([]); + expect(await nextFrame() is SettingsFrame, true); + + // Tell the server to finish. + clientWriter.writeGoawayFrame(3, ErrorCode.NO_ERROR, []); + + // Make sure the server ended the connection. + expect(await clientReader.moveNext(), false); + } + + await Future.wait([serverFun(), clientFun()]); + }); + }); + + group('client-errors', () { + serverTest('no-settings-frame-at-beginning', + (ServerTransportConnection server, + FrameWriter clientWriter, + StreamIterator clientReader, + Future Function() nextFrame) async { + Future serverFun() async { + // TODO: Do we want to get an error in this case? + expect(await server.incomingStreams.toList(), isEmpty); + await server.finish(); + } + + Future clientFun() async { + expect(await nextFrame() is SettingsFrame, true); + + // Write headers frame to open a new stream + clientWriter.writeHeadersFrame(1, [], endStream: true); + + // Make sure the client gets a [GoawayFrame] frame. + expect( + await nextFrame(), + isA().having( + (f) => f.errorCode, 'errorCode', ErrorCode.PROTOCOL_ERROR)); + + // Make sure the server ended the connection. + expect(await clientReader.moveNext(), false); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + serverTest('data-frame-for-invalid-stream', + (ServerTransportConnection server, + FrameWriter clientWriter, + StreamIterator clientReader, + Future Function() nextFrame) async { + Future serverFun() async { + await server.incomingStreams.toList(); + await server.finish(); + } + + Future clientFun() async { + expect(await nextFrame() is SettingsFrame, true); + clientWriter.writeSettingsAckFrame(); + clientWriter.writeSettingsFrame([]); + expect(await nextFrame() is SettingsFrame, true); + + // Write data frame to non-existent stream. + clientWriter.writeDataFrame(3, [1, 2, 3]); + + // Make sure the client gets a [RstStreamFrame] frame. + var frame = await nextFrame(); + expect(frame is WindowUpdateFrame, true); + expect( + await nextFrame(), + isA() + .having( + (f) => f.errorCode, 'errorCode', ErrorCode.STREAM_CLOSED) + .having((f) => f.header.streamId, 'header.streamId', 3)); + + // Tell the server to finish. + clientWriter.writeGoawayFrame(3, ErrorCode.NO_ERROR, []); + + // Make sure the server ended the connection. + expect(await clientReader.moveNext(), false); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + serverTest('data-frame-after-stream-closed', + (ServerTransportConnection server, + FrameWriter clientWriter, + StreamIterator clientReader, + Future Function() nextFrame) async { + Future serverFun() async { + await server.incomingStreams.toList(); + await server.finish(); + } + + Future clientFun() async { + expect(await nextFrame() is SettingsFrame, true); + clientWriter.writeSettingsAckFrame(); + clientWriter.writeSettingsFrame([]); + expect(await nextFrame() is SettingsFrame, true); + + clientWriter.writeHeadersFrame(3, [Header.ascii('a', 'b')], + endStream: true); + + // Write data frame to non-existent stream (stream 3 was closed + // above). + clientWriter.writeDataFrame(3, [1, 2, 3]); + + // Make sure the client gets a [RstStreamFrame] frame. + expect( + await nextFrame(), + isA() + .having( + (f) => f.errorCode, 'errorCode', ErrorCode.STREAM_CLOSED) + .having((f) => f.header.streamId, 'header.streamId', 3)); + + // Tell the server to finish. + clientWriter.writeGoawayFrame(3, ErrorCode.NO_ERROR, []); + + // Make sure the server ended the connection. + expect(await clientReader.moveNext(), false); + } + + await Future.wait([serverFun(), clientFun()]); + }); + }); + + group('server-errors', () { + serverTest('server-resets-stream', (ServerTransportConnection server, + FrameWriter clientWriter, + StreamIterator clientReader, + Future Function() nextFrame) async { + Future serverFun() async { + var it = StreamIterator(server.incomingStreams); + expect(await it.moveNext(), true); + + TransportStream stream = it.current; + stream.terminate(); + + expect(await it.moveNext(), false); + + await server.finish(); + } + + Future clientFun() async { + expect(await nextFrame() is SettingsFrame, true); + clientWriter.writeSettingsAckFrame(); + clientWriter.writeSettingsFrame([]); + expect(await nextFrame() is SettingsFrame, true); + + clientWriter.writeHeadersFrame(1, [Header.ascii('a', 'b')], + endStream: false); + + // Make sure the client gets a [RstStreamFrame] frame. + expect( + await nextFrame(), + isA() + .having((f) => f.errorCode, 'errorCode', ErrorCode.CANCEL) + .having((f) => f.header.streamId, 'header.streamId', 1)); + + // Tell the server to finish. + clientWriter.writeGoawayFrame(3, ErrorCode.NO_ERROR, []); + + // Make sure the server ended the connection. + expect(await clientReader.moveNext(), false); + } + + await Future.wait([serverFun(), clientFun()]); + }); + }); + }); +} + +void serverTest( + String name, + void Function( + ServerTransportConnection, + FrameWriter, + StreamIterator frameReader, + Future Function() readNext) + func) { + return test(name, () { + var streams = ClientErrorStreams(); + var clientReader = streams.clientConnectionFrameReader; + + Future readNext() async { + expect(await clientReader.moveNext(), true); + return clientReader.current; + } + + return func(streams.serverConnection, streams.clientConnectionFrameWriter, + clientReader, readNext); + }); +} + +class ClientErrorStreams { + final StreamController> writeA = StreamController(); + final StreamController> writeB = StreamController(); + Stream> get readA => writeA.stream; + Stream> get readB => writeB.stream; + + StreamIterator get clientConnectionFrameReader { + var localSettings = ActiveSettings(); + return StreamIterator(FrameReader(readA, localSettings).startDecoding()); + } + + FrameWriter get clientConnectionFrameWriter { + var encoder = HPackEncoder(); + var peerSettings = ActiveSettings(); + writeB.add(CONNECTION_PREFACE); + return FrameWriter(encoder, writeB, peerSettings); + } + + ServerTransportConnection get serverConnection => + ServerTransportConnection.viaStreams(readB, writeA); +} diff --git a/pkgs/http2/test/src/async_utils/async_utils_test.dart b/pkgs/http2/test/src/async_utils/async_utils_test.dart new file mode 100644 index 0000000000..6d1ebaadd5 --- /dev/null +++ b/pkgs/http2/test/src/async_utils/async_utils_test.dart @@ -0,0 +1,85 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http2/src/async_utils/async_utils.dart'; +import 'package:test/test.dart'; + +void main() { + group('async_utils', () { + test('buffer-indicator', () { + var bi = BufferIndicator(); + bi.bufferEmptyEvents.listen(expectAsync1((_) {}, count: 2)); + + expect(bi.wouldBuffer, true); + + bi.markUnBuffered(); + expect(bi.wouldBuffer, false); + + bi.markBuffered(); + expect(bi.wouldBuffer, true); + bi.markBuffered(); + expect(bi.wouldBuffer, true); + + bi.markUnBuffered(); + expect(bi.wouldBuffer, false); + bi.markUnBuffered(); + expect(bi.wouldBuffer, false); + + bi.markBuffered(); + expect(bi.wouldBuffer, true); + bi.markBuffered(); + expect(bi.wouldBuffer, true); + }); + + test('buffered-sink', () { + var c = StreamController>(); + var bs = BufferedSink(c); + + expect(bs.bufferIndicator.wouldBuffer, true); + var sub = c.stream.listen(expectAsync1((_) {}, count: 2)); + + expect(bs.bufferIndicator.wouldBuffer, false); + + sub.pause(); + Timer.run(expectAsync0(() { + expect(bs.bufferIndicator.wouldBuffer, true); + bs.sink.add([1]); + + sub.resume(); + Timer.run(expectAsync0(() { + expect(bs.bufferIndicator.wouldBuffer, false); + bs.sink.add([2]); + + Timer.run(expectAsync0(() { + sub.cancel(); + expect(bs.bufferIndicator.wouldBuffer, false); + })); + })); + })); + }); + + test('buffered-bytes-writer', () async { + var c = StreamController>(); + var writer = BufferedBytesWriter(c); + + expect(writer.bufferIndicator.wouldBuffer, true); + + var bytesFuture = c.stream.fold>([], (b, d) => b..addAll(d)); + + expect(writer.bufferIndicator.wouldBuffer, false); + + writer.add([1, 2]); + writer.add([3, 4]); + + writer.addBufferedData([5, 6]); + expect(() => writer.add([7, 8]), throwsStateError); + + writer.addBufferedData([7, 8]); + await writer.close(); + expect(await bytesFuture, [1, 2, 3, 4, 5, 6, 7, 8]); + }); + }); +} diff --git a/pkgs/http2/test/src/connection_preface_test.dart b/pkgs/http2/test/src/connection_preface_test.dart new file mode 100644 index 0000000000..d2e6eb3f61 --- /dev/null +++ b/pkgs/http2/test/src/connection_preface_test.dart @@ -0,0 +1,80 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:math' show min; + +import 'package:http2/src/connection_preface.dart'; +import 'package:test/test.dart'; + +void main() { + group('connection-preface', () { + test('successful', () async { + final frameBytes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + final data = List.from(CONNECTION_PREFACE)..addAll(frameBytes); + + for (var size = 1; size <= data.length; size++) { + var c = StreamController>(); + var resultF = readConnectionPreface(c.stream) + .fold>([], (b, d) => b..addAll(d)); + + for (var i = 0; i < (size - 1 + data.length) ~/ size; i++) { + var from = size * i; + var to = min(size * (i + 1), data.length); + + c.add(data.sublist(from, to)); + } + unawaited(c.close()); + + expect(await resultF, frameBytes); + } + }); + + test('only-part-of-connection-sequence', () async { + var c = StreamController>(); + var resultF = readConnectionPreface(c.stream) + .fold>([], (b, d) => b..addAll(d)); + + for (var i = 0; i < CONNECTION_PREFACE.length - 1; i++) { + c.add([CONNECTION_PREFACE[i]]); + } + unawaited(c.close()); + + unawaited(resultF.catchError(expectAsync2((Object error, Object _) { + expect(error, contains('EOS before connection preface could be read')); + return []; + }))); + }); + + test('wrong-connection-sequence', () async { + var c = StreamController>(); + var resultF = readConnectionPreface(c.stream) + .fold>([], (b, d) => b..addAll(d)); + + for (var i = 0; i < CONNECTION_PREFACE.length; i++) { + c.add([0xff]); + } + unawaited(c.close()); + + unawaited(resultF.catchError(expectAsync2((Object error, Object _) { + expect(error, contains('Connection preface does not match.')); + return []; + }))); + }); + + test('incoming-socket-error', () async { + var c = StreamController>(); + var resultF = readConnectionPreface(c.stream) + .fold>([], (b, d) => b..addAll(d)); + + c.addError('hello world'); + unawaited(c.close()); + + unawaited(resultF.catchError(expectAsync2((Object error, Object _) { + expect(error, contains('hello world')); + return []; + }))); + }); + }); +} diff --git a/pkgs/http2/test/src/error_matchers.dart b/pkgs/http2/test/src/error_matchers.dart new file mode 100644 index 0000000000..7886462525 --- /dev/null +++ b/pkgs/http2/test/src/error_matchers.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http2/src/sync_errors.dart'; +import 'package:test/test.dart'; + +const Matcher isProtocolException = TypeMatcher(); +const Matcher isFrameSizeException = TypeMatcher(); +const Matcher isTerminatedException = TypeMatcher(); +const Matcher isFlowControlException = TypeMatcher(); diff --git a/pkgs/http2/test/src/flowcontrol/connection_queues_test.dart b/pkgs/http2/test/src/flowcontrol/connection_queues_test.dart new file mode 100644 index 0000000000..1cde81be6a --- /dev/null +++ b/pkgs/http2/test/src/flowcontrol/connection_queues_test.dart @@ -0,0 +1,170 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http2/src/async_utils/async_utils.dart'; +import 'package:http2/src/flowcontrol/connection_queues.dart'; +import 'package:http2/src/flowcontrol/queue_messages.dart'; +import 'package:http2/src/flowcontrol/window.dart'; +import 'package:http2/src/flowcontrol/window_handler.dart'; +import 'package:http2/src/frames/frames.dart'; +import 'package:http2/transport.dart'; +import 'package:mockito/mockito.dart'; +import 'package:test/test.dart'; + +import 'mocks.mocks.dart'; + +void main() { + group('flowcontrol', () { + test('connection-message-queue-out', () { + var fw = MockFrameWriter(); + when(fw.bufferIndicator).thenReturn(BufferIndicator()); + when(fw.writeHeadersFrame(any, any, endStream: anyNamed('endStream'))) + .thenReturn(null); + when(fw.writeDataFrame(any, any, endStream: anyNamed('endStream'))) + .thenReturn(null); + var windowMock = MockOutgoingWindowHandler(); + var queue = ConnectionMessageQueueOut(windowMock, fw); + + fw.bufferIndicator.markUnBuffered(); + + expect(queue.pendingMessages, 0); + + var headers = [Header.ascii('a', 'b')]; + var bytes = [1, 2, 3]; + + // Send [HeadersMessage]. + queue.enqueueMessage(HeadersMessage(99, headers, false)); + expect(queue.pendingMessages, 0); + verify(fw.writeHeadersFrame(99, headers, endStream: false)).called(1); + verify(fw.bufferIndicator).called(greaterThan(0)); + verifyNoMoreInteractions(fw); + verifyZeroInteractions(windowMock); + + clearInteractions(fw); + + // Send [DataMessage]. + windowMock.peerWindowSize = bytes.length; + windowMock.positiveWindow.markUnBuffered(); + queue.enqueueMessage(DataMessage(99, bytes, false)); + expect(queue.pendingMessages, 0); + verify(windowMock.decreaseWindow(bytes.length)).called(1); + verify(fw.writeDataFrame(99, bytes, endStream: false)).called(1); + verifyNoMoreInteractions(windowMock); + verify(fw.bufferIndicator).called(greaterThan(0)); + verifyNoMoreInteractions(fw); + + clearInteractions(fw); + clearInteractions(windowMock); + + // Send [DataMessage] if the connection window is too small. + // Should trigger fragmentation and should write 1 byte. + windowMock.peerWindowSize = 1; + // decreaseWindow() marks the window as buffered in this case, so we need + // our mock to do the same (otherwise, the call to markUnBuffered() below + // has no effect). + when(windowMock.decreaseWindow(1)).thenAnswer((_) { + windowMock.positiveWindow.markBuffered(); + }); + queue.enqueueMessage(DataMessage(99, bytes, true)); + expect(queue.pendingMessages, 1); + verify(windowMock.decreaseWindow(1)).called(1); + verify(fw.bufferIndicator).called(greaterThan(0)); + verify(fw.writeDataFrame(99, bytes.sublist(0, 1), endStream: false)) + .called(1); + verifyNoMoreInteractions(windowMock); + verifyNoMoreInteractions(fw); + + clearInteractions(fw); + reset(windowMock); + + // Now mark it as unbuffered. This should write the rest of the + // [bytes.length - 1] bytes. + windowMock.peerWindowSize = bytes.length - 1; + windowMock.positiveWindow.markUnBuffered(); + verify(windowMock.decreaseWindow(bytes.length - 1)).called(1); + verify(fw.writeDataFrame(99, bytes.sublist(1), endStream: true)) + .called(1); + verifyNoMoreInteractions(windowMock); + verify(fw.bufferIndicator).called(greaterThan(0)); + verifyNoMoreInteractions(fw); + + queue.startClosing(); + queue.done.then(expectAsync1((_) { + expect(queue.pendingMessages, 0); + expect(() => queue.enqueueMessage(DataMessage(99, bytes, true)), + throwsA(const TypeMatcher())); + })); + }); + + test('connection-message-queue-in', () { + const STREAM_ID = 99; + final bytes = [1, 2, 3]; + + var windowMock = MockIncomingWindowHandler(); + when(windowMock.gotData(any)).thenReturn(null); + when(windowMock.dataProcessed(any)).thenReturn(null); + + var queue = ConnectionMessageQueueIn(windowMock, (f) => f()); + expect(queue.pendingMessages, 0); + + var streamQueueMock = MockStreamMessageQueueIn(); + when(streamQueueMock.bufferIndicator).thenReturn(BufferIndicator()); + when(streamQueueMock.enqueueMessage(any)).thenReturn(null); + + queue.insertNewStreamMessageQueue(STREAM_ID, streamQueueMock); + + // Insert a [DataFrame] and let it be buffered. + var header = FrameHeader(0, 0, 0, STREAM_ID); + queue.processDataFrame(DataFrame(header, 0, bytes)); + expect(queue.pendingMessages, 1); + verify(windowMock.gotData(bytes.length)).called(1); + verifyNoMoreInteractions(windowMock); + verify(streamQueueMock.bufferIndicator).called(greaterThan(0)); + verifyNoMoreInteractions(streamQueueMock); + + clearInteractions(windowMock); + + // Indicate that the stream queue has space, and make sure + // the data is propagated from the connection to the stream + // specific queue. + streamQueueMock.bufferIndicator.markUnBuffered(); + verify(windowMock.dataProcessed(bytes.length)).called(1); + var capturedMessage = verify(streamQueueMock.enqueueMessage(captureAny)) + .captured + .single as DataMessage; + expect(capturedMessage.streamId, STREAM_ID); + expect(capturedMessage.bytes, bytes); + + verifyNoMoreInteractions(windowMock); + verify(streamQueueMock.bufferIndicator).called(greaterThan(0)); + verifyNoMoreInteractions(streamQueueMock); + + // TODO: Write tests for adding HeadersFrame/PushPromiseFrame. + }); + + test('connection-ignored-message-queue-in', () { + const STREAM_ID = 99; + final bytes = [1, 2, 3]; + + var windowMock = MockIncomingWindowHandler(); + when(windowMock.gotData(any)).thenReturn(null); + var queue = ConnectionMessageQueueIn(windowMock, (f) => f()); + + // Insert a [DataFrame] and let it be buffered. + var header = FrameHeader(0, 0, 0, STREAM_ID); + queue.processIgnoredDataFrame(DataFrame(header, 0, bytes)); + expect(queue.pendingMessages, 0); + verify(windowMock.dataProcessed(bytes.length)).called(1); + verifyNoMoreInteractions(windowMock); + }); + }); +} + +class MockOutgoingWindowHandler extends Mock + implements OutgoingConnectionWindowHandler, OutgoingStreamWindowHandler { + @override + BufferIndicator positiveWindow = BufferIndicator(); + @override + int peerWindowSize = Window().size; +} diff --git a/pkgs/http2/test/src/flowcontrol/mocks.dart b/pkgs/http2/test/src/flowcontrol/mocks.dart new file mode 100644 index 0000000000..c30048936c --- /dev/null +++ b/pkgs/http2/test/src/flowcontrol/mocks.dart @@ -0,0 +1,25 @@ +// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http2/src/flowcontrol/connection_queues.dart'; +import 'package:http2/src/flowcontrol/stream_queues.dart'; +import 'package:http2/src/flowcontrol/window_handler.dart'; +import 'package:http2/src/frames/frames.dart'; +import 'package:mockito/annotations.dart'; + +@GenerateMocks([ + FrameWriter, + IncomingWindowHandler, + OutgoingStreamWindowHandler, +], customMocks: [ + MockSpec(fallbackGenerators: { + #ensureNotTerminatedSync: ensureNotTerminatedSyncFallback, + }), + MockSpec(fallbackGenerators: { + #ensureNotTerminatedSync: ensureNotTerminatedSyncFallback, + }) +]) +T ensureNotTerminatedSyncFallback(T Function()? f) => + throw UnimplementedError( + 'Method cannot be stubbed; requires fallback values for return'); diff --git a/pkgs/http2/test/src/flowcontrol/mocks.mocks.dart b/pkgs/http2/test/src/flowcontrol/mocks.mocks.dart new file mode 100644 index 0000000000..0f09888cb6 --- /dev/null +++ b/pkgs/http2/test/src/flowcontrol/mocks.mocks.dart @@ -0,0 +1,622 @@ +// Mocks generated by Mockito 5.4.1 from annotations +// in http2/test/src/flowcontrol/mocks.dart. +// Do not manually edit this file. + +// @dart=2.19 + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i5; + +import 'package:http2/src/async_utils/async_utils.dart' as _i2; +import 'package:http2/src/flowcontrol/connection_queues.dart' as _i7; +import 'package:http2/src/flowcontrol/queue_messages.dart' as _i8; +import 'package:http2/src/flowcontrol/stream_queues.dart' as _i10; +import 'package:http2/src/flowcontrol/window_handler.dart' as _i3; +import 'package:http2/src/frames/frames.dart' as _i4; +import 'package:http2/src/hpack/hpack.dart' as _i6; +import 'package:http2/transport.dart' as _i11; +import 'package:mockito/mockito.dart' as _i1; + +import 'mocks.dart' as _i9; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeBufferIndicator_0 extends _i1.SmartFake + implements _i2.BufferIndicator { + _FakeBufferIndicator_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeIncomingWindowHandler_1 extends _i1.SmartFake + implements _i3.IncomingWindowHandler { + _FakeIncomingWindowHandler_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [FrameWriter]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockFrameWriter extends _i1.Mock implements _i4.FrameWriter { + MockFrameWriter() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.BufferIndicator get bufferIndicator => (super.noSuchMethod( + Invocation.getter(#bufferIndicator), + returnValue: _FakeBufferIndicator_0( + this, + Invocation.getter(#bufferIndicator), + ), + ) as _i2.BufferIndicator); + @override + int get highestWrittenStreamId => (super.noSuchMethod( + Invocation.getter(#highestWrittenStreamId), + returnValue: 0, + ) as int); + @override + _i5.Future get doneFuture => (super.noSuchMethod( + Invocation.getter(#doneFuture), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override + void writeDataFrame( + int? streamId, + List? data, { + bool? endStream = false, + }) => + super.noSuchMethod( + Invocation.method( + #writeDataFrame, + [ + streamId, + data, + ], + {#endStream: endStream}, + ), + returnValueForMissingStub: null, + ); + @override + void writeHeadersFrame( + int? streamId, + List<_i6.Header>? headers, { + bool? endStream = true, + }) => + super.noSuchMethod( + Invocation.method( + #writeHeadersFrame, + [ + streamId, + headers, + ], + {#endStream: endStream}, + ), + returnValueForMissingStub: null, + ); + @override + void writePriorityFrame( + int? streamId, + int? streamDependency, + int? weight, { + bool? exclusive = false, + }) => + super.noSuchMethod( + Invocation.method( + #writePriorityFrame, + [ + streamId, + streamDependency, + weight, + ], + {#exclusive: exclusive}, + ), + returnValueForMissingStub: null, + ); + @override + void writeRstStreamFrame( + int? streamId, + int? errorCode, + ) => + super.noSuchMethod( + Invocation.method( + #writeRstStreamFrame, + [ + streamId, + errorCode, + ], + ), + returnValueForMissingStub: null, + ); + @override + void writeSettingsFrame(List<_i4.Setting>? settings) => super.noSuchMethod( + Invocation.method( + #writeSettingsFrame, + [settings], + ), + returnValueForMissingStub: null, + ); + @override + void writeSettingsAckFrame() => super.noSuchMethod( + Invocation.method( + #writeSettingsAckFrame, + [], + ), + returnValueForMissingStub: null, + ); + @override + void writePushPromiseFrame( + int? streamId, + int? promisedStreamId, + List<_i6.Header>? headers, + ) => + super.noSuchMethod( + Invocation.method( + #writePushPromiseFrame, + [ + streamId, + promisedStreamId, + headers, + ], + ), + returnValueForMissingStub: null, + ); + @override + void writePingFrame( + int? opaqueData, { + bool? ack = false, + }) => + super.noSuchMethod( + Invocation.method( + #writePingFrame, + [opaqueData], + {#ack: ack}, + ), + returnValueForMissingStub: null, + ); + @override + void writeGoawayFrame( + int? lastStreamId, + int? errorCode, + List? debugData, + ) => + super.noSuchMethod( + Invocation.method( + #writeGoawayFrame, + [ + lastStreamId, + errorCode, + debugData, + ], + ), + returnValueForMissingStub: null, + ); + @override + void writeWindowUpdate( + int? sizeIncrement, { + int? streamId = 0, + }) => + super.noSuchMethod( + Invocation.method( + #writeWindowUpdate, + [sizeIncrement], + {#streamId: streamId}, + ), + returnValueForMissingStub: null, + ); + @override + _i5.Future close() => (super.noSuchMethod( + Invocation.method( + #close, + [], + ), + returnValue: _i5.Future.value(), + ) as _i5.Future); +} + +/// A class which mocks [IncomingWindowHandler]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockIncomingWindowHandler extends _i1.Mock + implements _i3.IncomingWindowHandler { + MockIncomingWindowHandler() { + _i1.throwOnMissingStub(this); + } + + @override + int get localWindowSize => (super.noSuchMethod( + Invocation.getter(#localWindowSize), + returnValue: 0, + ) as int); + @override + void gotData(int? numberOfBytes) => super.noSuchMethod( + Invocation.method( + #gotData, + [numberOfBytes], + ), + returnValueForMissingStub: null, + ); + @override + void dataProcessed(int? numberOfBytes) => super.noSuchMethod( + Invocation.method( + #dataProcessed, + [numberOfBytes], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [OutgoingStreamWindowHandler]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockOutgoingStreamWindowHandler extends _i1.Mock + implements _i3.OutgoingStreamWindowHandler { + MockOutgoingStreamWindowHandler() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.BufferIndicator get positiveWindow => (super.noSuchMethod( + Invocation.getter(#positiveWindow), + returnValue: _FakeBufferIndicator_0( + this, + Invocation.getter(#positiveWindow), + ), + ) as _i2.BufferIndicator); + @override + int get peerWindowSize => (super.noSuchMethod( + Invocation.getter(#peerWindowSize), + returnValue: 0, + ) as int); + @override + void processInitialWindowSizeSettingChange(int? difference) => + super.noSuchMethod( + Invocation.method( + #processInitialWindowSizeSettingChange, + [difference], + ), + returnValueForMissingStub: null, + ); + @override + void processWindowUpdate(_i4.WindowUpdateFrame? frame) => super.noSuchMethod( + Invocation.method( + #processWindowUpdate, + [frame], + ), + returnValueForMissingStub: null, + ); + @override + void decreaseWindow(int? numberOfBytes) => super.noSuchMethod( + Invocation.method( + #decreaseWindow, + [numberOfBytes], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [ConnectionMessageQueueOut]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockConnectionMessageQueueOut extends _i1.Mock + implements _i7.ConnectionMessageQueueOut { + MockConnectionMessageQueueOut() { + _i1.throwOnMissingStub(this); + } + + @override + int get pendingMessages => (super.noSuchMethod( + Invocation.getter(#pendingMessages), + returnValue: 0, + ) as int); + @override + bool get wasTerminated => (super.noSuchMethod( + Invocation.getter(#wasTerminated), + returnValue: false, + ) as bool); + @override + _i5.Future get done => (super.noSuchMethod( + Invocation.getter(#done), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override + bool get isClosing => (super.noSuchMethod( + Invocation.getter(#isClosing), + returnValue: false, + ) as bool); + @override + bool get wasClosed => (super.noSuchMethod( + Invocation.getter(#wasClosed), + returnValue: false, + ) as bool); + @override + void enqueueMessage(_i8.Message? message) => super.noSuchMethod( + Invocation.method( + #enqueueMessage, + [message], + ), + returnValueForMissingStub: null, + ); + @override + void onTerminated(Object? error) => super.noSuchMethod( + Invocation.method( + #onTerminated, + [error], + ), + returnValueForMissingStub: null, + ); + @override + void onCheckForClose() => super.noSuchMethod( + Invocation.method( + #onCheckForClose, + [], + ), + returnValueForMissingStub: null, + ); + @override + void terminate([dynamic error]) => super.noSuchMethod( + Invocation.method( + #terminate, + [error], + ), + returnValueForMissingStub: null, + ); + @override + T ensureNotTerminatedSync(T Function()? f) => (super.noSuchMethod( + Invocation.method( + #ensureNotTerminatedSync, + [f], + ), + returnValue: _i9.ensureNotTerminatedSyncFallback(f), + ) as T); + @override + _i5.Future ensureNotTerminatedAsync( + _i5.Future Function()? f) => + (super.noSuchMethod( + Invocation.method( + #ensureNotTerminatedAsync, + [f], + ), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override + void startClosing() => super.noSuchMethod( + Invocation.method( + #startClosing, + [], + ), + returnValueForMissingStub: null, + ); + @override + void onClosing() => super.noSuchMethod( + Invocation.method( + #onClosing, + [], + ), + returnValueForMissingStub: null, + ); + @override + dynamic ensureNotClosingSync(dynamic Function()? f) => + super.noSuchMethod(Invocation.method( + #ensureNotClosingSync, + [f], + )); + @override + void closeWithValue([dynamic value]) => super.noSuchMethod( + Invocation.method( + #closeWithValue, + [value], + ), + returnValueForMissingStub: null, + ); + @override + void closeWithError(dynamic error) => super.noSuchMethod( + Invocation.method( + #closeWithError, + [error], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [StreamMessageQueueIn]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockStreamMessageQueueIn extends _i1.Mock + implements _i10.StreamMessageQueueIn { + MockStreamMessageQueueIn() { + _i1.throwOnMissingStub(this); + } + + @override + _i3.IncomingWindowHandler get windowHandler => (super.noSuchMethod( + Invocation.getter(#windowHandler), + returnValue: _FakeIncomingWindowHandler_1( + this, + Invocation.getter(#windowHandler), + ), + ) as _i3.IncomingWindowHandler); + @override + _i2.BufferIndicator get bufferIndicator => (super.noSuchMethod( + Invocation.getter(#bufferIndicator), + returnValue: _FakeBufferIndicator_0( + this, + Invocation.getter(#bufferIndicator), + ), + ) as _i2.BufferIndicator); + @override + int get pendingMessages => (super.noSuchMethod( + Invocation.getter(#pendingMessages), + returnValue: 0, + ) as int); + @override + _i5.Stream<_i11.StreamMessage> get messages => (super.noSuchMethod( + Invocation.getter(#messages), + returnValue: _i5.Stream<_i11.StreamMessage>.empty(), + ) as _i5.Stream<_i11.StreamMessage>); + @override + _i5.Stream<_i11.TransportStreamPush> get serverPushes => (super.noSuchMethod( + Invocation.getter(#serverPushes), + returnValue: _i5.Stream<_i11.TransportStreamPush>.empty(), + ) as _i5.Stream<_i11.TransportStreamPush>); + @override + bool get wasTerminated => (super.noSuchMethod( + Invocation.getter(#wasTerminated), + returnValue: false, + ) as bool); + @override + _i5.Future get done => (super.noSuchMethod( + Invocation.getter(#done), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override + bool get isClosing => (super.noSuchMethod( + Invocation.getter(#isClosing), + returnValue: false, + ) as bool); + @override + bool get wasClosed => (super.noSuchMethod( + Invocation.getter(#wasClosed), + returnValue: false, + ) as bool); + @override + _i5.Future get onCancel => (super.noSuchMethod( + Invocation.getter(#onCancel), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override + bool get wasCancelled => (super.noSuchMethod( + Invocation.getter(#wasCancelled), + returnValue: false, + ) as bool); + @override + void enqueueMessage(_i8.Message? message) => super.noSuchMethod( + Invocation.method( + #enqueueMessage, + [message], + ), + returnValueForMissingStub: null, + ); + @override + void onTerminated(Object? error) => super.noSuchMethod( + Invocation.method( + #onTerminated, + [error], + ), + returnValueForMissingStub: null, + ); + @override + void onCloseCheck() => super.noSuchMethod( + Invocation.method( + #onCloseCheck, + [], + ), + returnValueForMissingStub: null, + ); + @override + void forceDispatchIncomingMessages() => super.noSuchMethod( + Invocation.method( + #forceDispatchIncomingMessages, + [], + ), + returnValueForMissingStub: null, + ); + @override + void terminate([dynamic error]) => super.noSuchMethod( + Invocation.method( + #terminate, + [error], + ), + returnValueForMissingStub: null, + ); + @override + T ensureNotTerminatedSync(T Function()? f) => (super.noSuchMethod( + Invocation.method( + #ensureNotTerminatedSync, + [f], + ), + returnValue: _i9.ensureNotTerminatedSyncFallback(f), + ) as T); + @override + _i5.Future ensureNotTerminatedAsync( + _i5.Future Function()? f) => + (super.noSuchMethod( + Invocation.method( + #ensureNotTerminatedAsync, + [f], + ), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override + void startClosing() => super.noSuchMethod( + Invocation.method( + #startClosing, + [], + ), + returnValueForMissingStub: null, + ); + @override + void onCheckForClose() => super.noSuchMethod( + Invocation.method( + #onCheckForClose, + [], + ), + returnValueForMissingStub: null, + ); + @override + void onClosing() => super.noSuchMethod( + Invocation.method( + #onClosing, + [], + ), + returnValueForMissingStub: null, + ); + @override + dynamic ensureNotClosingSync(dynamic Function()? f) => + super.noSuchMethod(Invocation.method( + #ensureNotClosingSync, + [f], + )); + @override + void closeWithValue([dynamic value]) => super.noSuchMethod( + Invocation.method( + #closeWithValue, + [value], + ), + returnValueForMissingStub: null, + ); + @override + void closeWithError(dynamic error) => super.noSuchMethod( + Invocation.method( + #closeWithError, + [error], + ), + returnValueForMissingStub: null, + ); + @override + void cancel() => super.noSuchMethod( + Invocation.method( + #cancel, + [], + ), + returnValueForMissingStub: null, + ); +} diff --git a/pkgs/http2/test/src/flowcontrol/stream_queues_test.dart b/pkgs/http2/test/src/flowcontrol/stream_queues_test.dart new file mode 100644 index 0000000000..0b5ae7a7a1 --- /dev/null +++ b/pkgs/http2/test/src/flowcontrol/stream_queues_test.dart @@ -0,0 +1,150 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http2/src/async_utils/async_utils.dart'; +import 'package:http2/src/flowcontrol/queue_messages.dart'; +import 'package:http2/src/flowcontrol/stream_queues.dart'; +import 'package:http2/transport.dart'; +import 'package:mockito/mockito.dart'; +import 'package:test/test.dart'; + +import 'mocks.mocks.dart'; + +void main() { + group('flowcontrol', () { + const STREAM_ID = 99; + const BYTES = [1, 2, 3]; + + group('stream-message-queue-out', () { + test('window-big-enough', () { + var connectionQueueMock = MockConnectionMessageQueueOut(); + when(connectionQueueMock.enqueueMessage(any)).thenReturn(null); + var windowMock = MockOutgoingStreamWindowHandler(); + when(windowMock.positiveWindow).thenReturn(BufferIndicator()); + when(windowMock.decreaseWindow(any)).thenReturn(null); + + windowMock.positiveWindow.markUnBuffered(); + var queue = + StreamMessageQueueOut(STREAM_ID, windowMock, connectionQueueMock); + + expect(queue.bufferIndicator.wouldBuffer, isFalse); + expect(queue.pendingMessages, 0); + when(windowMock.peerWindowSize).thenReturn(BYTES.length); + + queue.enqueueMessage(DataMessage(STREAM_ID, BYTES, true)); + verify(windowMock.decreaseWindow(BYTES.length)).called(1); + final capturedMessage = + verify(connectionQueueMock.enqueueMessage(captureAny)) + .captured + .single; + expect(capturedMessage, const TypeMatcher()); + var capturedDataMessage = capturedMessage as DataMessage; + expect(capturedDataMessage.bytes, BYTES); + expect(capturedDataMessage.endStream, isTrue); + }); + + test('window-smaller-than-necessary', () { + var connectionQueueMock = MockConnectionMessageQueueOut(); + when(connectionQueueMock.enqueueMessage(any)).thenReturn(null); + var windowMock = MockOutgoingStreamWindowHandler(); + when(windowMock.positiveWindow).thenReturn(BufferIndicator()); + when(windowMock.decreaseWindow(any)).thenReturn(null); + windowMock.positiveWindow.markUnBuffered(); + var queue = + StreamMessageQueueOut(STREAM_ID, windowMock, connectionQueueMock); + + expect(queue.bufferIndicator.wouldBuffer, isFalse); + expect(queue.pendingMessages, 0); + + // We set the window size fixed to 1, which means all the data messages + // will get fragmented to 1 byte. + when(windowMock.peerWindowSize).thenReturn(1); + queue.enqueueMessage(DataMessage(STREAM_ID, BYTES, true)); + + expect(queue.pendingMessages, 0); + verify(windowMock.decreaseWindow(1)).called(BYTES.length); + final messages = + verify(connectionQueueMock.enqueueMessage(captureAny)).captured; + expect(messages, hasLength(BYTES.length)); + for (var counter = 0; counter < messages.length; counter++) { + expect(messages[counter], const TypeMatcher()); + var dataMessage = messages[counter] as DataMessage; + expect(dataMessage.bytes, BYTES.sublist(counter, counter + 1)); + expect(dataMessage.endStream, counter == BYTES.length - 1); + } + verify(windowMock.positiveWindow).called(greaterThan(0)); + verify(windowMock.peerWindowSize).called(greaterThan(0)); + verifyNoMoreInteractions(windowMock); + }); + + test('window-empty', () { + var connectionQueueMock = MockConnectionMessageQueueOut(); + var windowMock = MockOutgoingStreamWindowHandler(); + when(windowMock.positiveWindow).thenReturn(BufferIndicator()); + windowMock.positiveWindow.markUnBuffered(); + var queue = + StreamMessageQueueOut(STREAM_ID, windowMock, connectionQueueMock); + + expect(queue.bufferIndicator.wouldBuffer, isFalse); + expect(queue.pendingMessages, 0); + + when(windowMock.peerWindowSize).thenReturn(0); + queue.enqueueMessage(DataMessage(STREAM_ID, BYTES, true)); + expect(queue.bufferIndicator.wouldBuffer, isTrue); + expect(queue.pendingMessages, 1); + verify(windowMock.positiveWindow).called(greaterThan(0)); + verify(windowMock.peerWindowSize).called(greaterThan(0)); + verifyNoMoreInteractions(windowMock); + verifyZeroInteractions(connectionQueueMock); + }); + }); + + group('stream-message-queue-in', () { + test('data-end-of-stream', () { + var windowMock = MockIncomingWindowHandler(); + when(windowMock.gotData(any)).thenReturn(null); + when(windowMock.dataProcessed(any)).thenReturn(null); + var queue = StreamMessageQueueIn(windowMock); + + expect(queue.pendingMessages, 0); + queue.messages.listen(expectAsync1((StreamMessage message) { + expect(message, isA()); + + var dataMessage = message as DataStreamMessage; + expect(dataMessage.bytes, BYTES); + }), onDone: expectAsync0(() {})); + queue.enqueueMessage(DataMessage(STREAM_ID, BYTES, true)); + expect(queue.bufferIndicator.wouldBuffer, isFalse); + verifyInOrder([ + windowMock.gotData(BYTES.length), + windowMock.dataProcessed(BYTES.length) + ]); + verifyNoMoreInteractions(windowMock); + }); + }); + + test('data-end-of-stream--paused', () { + const STREAM_ID = 99; + final bytes = [1, 2, 3]; + + var windowMock = MockIncomingWindowHandler(); + when(windowMock.gotData(any)).thenReturn(null); + var queue = StreamMessageQueueIn(windowMock); + + var sub = queue.messages.listen(expectAsync1((_) {}, count: 0), + onDone: expectAsync0(() {}, count: 0)); + sub.pause(); + + expect(queue.pendingMessages, 0); + queue.enqueueMessage(DataMessage(STREAM_ID, bytes, true)); + expect(queue.pendingMessages, 1); + expect(queue.bufferIndicator.wouldBuffer, isTrue); + // We assert that we got the data, but it wasn't processed. + verify(windowMock.gotData(bytes.length)).called(1); + // verifyNever(windowMock.dataProcessed(any)); + }); + + // TODO: Add tests for Headers/HeadersPush messages. + }); +} diff --git a/pkgs/http2/test/src/flowcontrol/window_handler_test.dart b/pkgs/http2/test/src/flowcontrol/window_handler_test.dart new file mode 100644 index 0000000000..017dadd4ef --- /dev/null +++ b/pkgs/http2/test/src/flowcontrol/window_handler_test.dart @@ -0,0 +1,131 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http2/src/flowcontrol/window.dart'; +import 'package:http2/src/flowcontrol/window_handler.dart'; +import 'package:http2/src/frames/frames.dart'; +import 'package:mockito/mockito.dart'; +import 'package:test/test.dart'; + +import '../error_matchers.dart'; + +void main() { + group('flowcontrol', () { + void testAbstractOutgoingWindowHandler( + AbstractOutgoingWindowHandler handler, Window window, int initialSize) { + var sub = handler.positiveWindow.bufferEmptyEvents + .listen(expectAsync1((_) {}, count: 0)); + + expect(handler.peerWindowSize, initialSize); + expect(window.size, initialSize); + + // If we're sending data to the remote end, we need to subtract + // the number of bytes from the outgoing connection (and stream) windows. + handler.decreaseWindow(100); + expect(handler.peerWindowSize, initialSize - 100); + expect(window.size, initialSize - 100); + + // If we received a window update frame, the window should be increased + // again. + var frameHeader = FrameHeader(4, FrameType.WINDOW_UPDATE, 0, 0); + handler.processWindowUpdate(WindowUpdateFrame(frameHeader, 100)); + expect(handler.peerWindowSize, initialSize); + expect(window.size, initialSize); + + sub.cancel(); + + // If we decrease the outgoing window size to 0 or below, and + // increase it again, we expect to get an update event. + expect(handler.positiveWindow.wouldBuffer, isFalse); + handler.decreaseWindow(window.size); + expect(handler.positiveWindow.wouldBuffer, isTrue); + sub = handler.positiveWindow.bufferEmptyEvents.listen(expectAsync1((_) { + expect(handler.peerWindowSize, 1); + expect(window.size, 1); + })); + + // Now we trigger the 1 byte window increase + handler.processWindowUpdate(WindowUpdateFrame(frameHeader, 1)); + sub.cancel(); + + // If the remote end sends us [WindowUpdateFrame]s which increase it above + // the maximum size, we throw a [FlowControlException]. + var frame = WindowUpdateFrame(frameHeader, Window.MAX_WINDOW_SIZE); + expect(() => handler.processWindowUpdate(frame), + throwsA(isFlowControlException)); + } + + test('outgoing-connection-window-handler', () { + var window = Window(); + var initialSize = window.size; + var handler = OutgoingConnectionWindowHandler(window); + + testAbstractOutgoingWindowHandler(handler, window, initialSize); + }); + + test('outgoing-stream-window-handler', () { + var window = Window(); + var initialSize = window.size; + var handler = OutgoingStreamWindowHandler(window); + + testAbstractOutgoingWindowHandler(handler, window, initialSize); + + // Test stream specific functionality: If the connection window + // gets increased/decreased via a [SettingsFrame], all stream + // windows need to get updated as well. + + window = Window(); + initialSize = window.size; + handler = OutgoingStreamWindowHandler(window); + + expect(handler.positiveWindow.wouldBuffer, isFalse); + final bufferEmpty = handler.positiveWindow.bufferEmptyEvents + .listen(expectAsync1((_) {}, count: 0)); + handler.processInitialWindowSizeSettingChange(-window.size); + expect(handler.positiveWindow.wouldBuffer, isTrue); + expect(handler.peerWindowSize, 0); + expect(window.size, 0); + bufferEmpty.onData(expectAsync1((_) {}, count: 1)); + handler.processInitialWindowSizeSettingChange(1); + expect(handler.positiveWindow.wouldBuffer, isFalse); + expect(handler.peerWindowSize, 1); + expect(window.size, 1); + + expect( + () => handler.processInitialWindowSizeSettingChange( + Window.MAX_WINDOW_SIZE + 1), + throwsA(isFlowControlException)); + }); + + test('incoming-window-handler', () { + const STREAM_ID = 99; + + var fw = FrameWriterMock(); + var window = Window(); + var initialSize = window.size; + var handler = IncomingWindowHandler.stream(fw, window, STREAM_ID); + + expect(handler.localWindowSize, initialSize); + expect(window.size, initialSize); + + // If the remote end sends us now 100 bytes, it reduces the local + // incoming window by 100 bytes. Once we handled these bytes, it, + // will send a [WindowUpdateFrame] to the remote peer to ACK it. + handler.gotData(100); + expect(handler.localWindowSize, initialSize - 100); + expect(window.size, initialSize - 100); + + // The data might sit in a queue. Once the user drains enough data of + // the queue, we will start ACKing the data and the window becomes + // positive again. + handler.dataProcessed(100); + expect(handler.localWindowSize, initialSize); + expect(window.size, initialSize); + verify(fw.writeWindowUpdate(100, streamId: STREAM_ID)).called(1); + verifyNoMoreInteractions(fw); + }); + }); +} + +class FrameWriterMock extends Mock implements FrameWriter {} diff --git a/pkgs/http2/test/src/frames/frame_defragmenter_test.dart b/pkgs/http2/test/src/frames/frame_defragmenter_test.dart new file mode 100644 index 0000000000..04abec1195 --- /dev/null +++ b/pkgs/http2/test/src/frames/frame_defragmenter_test.dart @@ -0,0 +1,132 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http2/src/frames/frame_defragmenter.dart'; +import 'package:http2/src/frames/frames.dart'; +import 'package:test/test.dart'; + +import '../error_matchers.dart'; + +void main() { + group('frames', () { + group('frame-defragmenter', () { + UnknownFrame unknownFrame() { + return UnknownFrame(FrameHeader(0, 0, 0, 1), []); + } + + HeadersFrame headersFrame(List data, + {bool fragmented = false, int streamId = 1}) { + var flags = fragmented ? 0 : HeadersFrame.FLAG_END_HEADERS; + var header = + FrameHeader(data.length, FrameType.HEADERS, flags, streamId); + return HeadersFrame(header, 0, false, null, null, data); + } + + PushPromiseFrame pushPromiseFrame(List data, + {bool fragmented = false, int streamId = 1}) { + var flags = fragmented ? 0 : HeadersFrame.FLAG_END_HEADERS; + var header = + FrameHeader(data.length, FrameType.PUSH_PROMISE, flags, streamId); + return PushPromiseFrame(header, 0, 44, data); + } + + ContinuationFrame continuationFrame(List data, + {bool fragmented = false, int streamId = 1}) { + var flags = fragmented ? 0 : ContinuationFrame.FLAG_END_HEADERS; + var header = + FrameHeader(data.length, FrameType.CONTINUATION, flags, streamId); + return ContinuationFrame(header, data); + } + + test('unknown-frame', () { + var defrag = FrameDefragmenter(); + expect(defrag.tryDefragmentFrame(unknownFrame()) is UnknownFrame, true); + }); + + test('fragmented-headers-frame', () { + var defrag = FrameDefragmenter(); + + var f1 = headersFrame([1, 2, 3], fragmented: true); + var f2 = continuationFrame([4, 5, 6], fragmented: true); + var f3 = continuationFrame([7, 8, 9], fragmented: false); + + expect(defrag.tryDefragmentFrame(f1), isNull); + expect(defrag.tryDefragmentFrame(f2), isNull); + var h = defrag.tryDefragmentFrame(f3) as HeadersFrame; + expect(h.hasEndHeadersFlag, isTrue); + expect(h.hasEndStreamFlag, isFalse); + expect(h.hasPaddedFlag, isFalse); + expect(h.padLength, 0); + expect(h.headerBlockFragment, [1, 2, 3, 4, 5, 6, 7, 8, 9]); + }); + + test('fragmented-push-promise-frame', () { + var defrag = FrameDefragmenter(); + + var f1 = pushPromiseFrame([1, 2, 3], fragmented: true); + var f2 = continuationFrame([4, 5, 6], fragmented: true); + var f3 = continuationFrame([7, 8, 9], fragmented: false); + + expect(defrag.tryDefragmentFrame(f1), isNull); + expect(defrag.tryDefragmentFrame(f2), isNull); + var h = defrag.tryDefragmentFrame(f3) as PushPromiseFrame; + expect(h.hasEndHeadersFlag, isTrue); + expect(h.hasPaddedFlag, isFalse); + expect(h.padLength, 0); + expect(h.headerBlockFragment, [1, 2, 3, 4, 5, 6, 7, 8, 9]); + }); + + test('fragmented-headers-frame--wrong-id', () { + var defrag = FrameDefragmenter(); + + var f1 = headersFrame([1, 2, 3], fragmented: true, streamId: 1); + var f2 = continuationFrame([4, 5, 6], fragmented: true, streamId: 2); + + expect(defrag.tryDefragmentFrame(f1), isNull); + expect( + () => defrag.tryDefragmentFrame(f2), throwsA(isProtocolException)); + }); + + test('fragmented-push-promise-frame', () { + var defrag = FrameDefragmenter(); + + var f1 = pushPromiseFrame([1, 2, 3], fragmented: true, streamId: 1); + var f2 = continuationFrame([4, 5, 6], fragmented: true, streamId: 2); + + expect(defrag.tryDefragmentFrame(f1), isNull); + expect( + () => defrag.tryDefragmentFrame(f2), throwsA(isProtocolException)); + }); + + test('fragmented-headers-frame--no-continuation-frame', () { + var defrag = FrameDefragmenter(); + + var f1 = headersFrame([1, 2, 3], fragmented: true); + var f2 = unknownFrame(); + + expect(defrag.tryDefragmentFrame(f1), isNull); + expect( + () => defrag.tryDefragmentFrame(f2), throwsA(isProtocolException)); + }); + + test('fragmented-push-promise-no-continuation-frame', () { + var defrag = FrameDefragmenter(); + + var f1 = pushPromiseFrame([1, 2, 3], fragmented: true); + var f2 = unknownFrame(); + + expect(defrag.tryDefragmentFrame(f1), isNull); + expect( + () => defrag.tryDefragmentFrame(f2), throwsA(isProtocolException)); + }); + + test('push-without-headres-or-push-promise-frame', () { + var defrag = FrameDefragmenter(); + + var f1 = continuationFrame([4, 5, 6], fragmented: true, streamId: 1); + expect(defrag.tryDefragmentFrame(f1), equals(f1)); + }); + }); + }); +} diff --git a/pkgs/http2/test/src/frames/frame_reader_test.dart b/pkgs/http2/test/src/frames/frame_reader_test.dart new file mode 100644 index 0000000000..9cdf068c40 --- /dev/null +++ b/pkgs/http2/test/src/frames/frame_reader_test.dart @@ -0,0 +1,113 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http2/src/frames/frames.dart'; +import 'package:http2/src/settings/settings.dart'; +import 'package:test/test.dart'; + +void main() { + group('frames', () { + group('frame-reader', () { + final maxFrameSize = ActiveSettings().maxFrameSize; + + Stream dataFrame(List body) { + var settings = ActiveSettings(); + var controller = StreamController>(); + var reader = FrameReader(controller.stream, settings); + + // This is a DataFrame: + // - length: n + // - type: [0] + // - flags: [0] + // - stream id: [0, 0, 0, 1] + controller + ..add([0, (body.length >> 8) & 0xff, body.length & 0xff]) + ..add([0]) + ..add([0]) + ..add([0, 0, 0, 1]) + ..add(body) + ..close(); + return reader.startDecoding(); + } + + test('data-frame--max-frame-size', () { + var body = List.filled(maxFrameSize, 0x42); + dataFrame(body).listen(expectAsync1((Frame frame) { + expect(frame, isA()); + expect(frame.header, hasLength(body.length)); + expect(frame.header.flags, 0); + var dataFrame = frame as DataFrame; + expect(dataFrame.hasEndStreamFlag, isFalse); + expect(dataFrame.hasPaddedFlag, isFalse); + expect(dataFrame.bytes, body); + }), + onError: + expectAsync2((Object error, StackTrace stack) {}, count: 0)); + }); + + test('data-frame--max-frame-size-plus-1', () { + var body = List.filled(maxFrameSize + 1, 0x42); + dataFrame(body).listen(expectAsync1((_) {}, count: 0), + onError: expectAsync2((Object error, StackTrace stack) { + expect('$error', contains('Incoming frame is too big')); + })); + }); + + test('incomplete-header', () { + var settings = ActiveSettings(); + + var controller = StreamController>(); + var reader = FrameReader(controller.stream, settings); + + controller + ..add([1]) + ..close(); + + reader.startDecoding().listen(expectAsync1((_) {}, count: 0), + onError: expectAsync2((Object error, StackTrace stack) { + expect('$error', contains('incomplete frame')); + })); + }); + + test('incomplete-frame', () { + var settings = ActiveSettings(); + + var controller = StreamController>(); + var reader = FrameReader(controller.stream, settings); + + // This is a DataFrame: + // - length: [0, 0, 255] + // - type: [0] + // - flags: [0] + // - stream id: [0, 0, 0, 1] + controller + ..add([0, 0, 255, 0, 0, 0, 0, 0, 1]) + ..close(); + + reader.startDecoding().listen(expectAsync1((_) {}, count: 0), + onError: expectAsync2((Object error, StackTrace stack) { + expect('$error', contains('incomplete frame')); + })); + }); + + test('connection-error', () { + var settings = ActiveSettings(); + + var controller = StreamController>(); + var reader = FrameReader(controller.stream, settings); + + controller + ..addError('hello world') + ..close(); + + reader.startDecoding().listen(expectAsync1((_) {}, count: 0), + onError: expectAsync2((Object error, StackTrace stack) { + expect('$error', contains('hello world')); + })); + }); + }); + }); +} diff --git a/pkgs/http2/test/src/frames/frame_writer_reader_test.dart b/pkgs/http2/test/src/frames/frame_writer_reader_test.dart new file mode 100644 index 0000000000..28bc59cddd --- /dev/null +++ b/pkgs/http2/test/src/frames/frame_writer_reader_test.dart @@ -0,0 +1,232 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http2/src/frames/frames.dart'; +import 'package:http2/src/hpack/hpack.dart'; +import 'package:http2/src/settings/settings.dart'; +import 'package:test/test.dart'; + +import '../hpack/hpack_test.dart' show isHeader; + +void main() { + group('frames', () { + group('writer-reader', () { + writerReaderTest('data-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writeDataFrame(99, [1, 2, 3], endStream: true); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is DataFrame, isTrue); + + var dataFrame = frames[0] as DataFrame; + expect(dataFrame.header.streamId, 99); + expect(dataFrame.hasPaddedFlag, isFalse); + expect(dataFrame.padLength, 0); + expect(dataFrame.hasEndStreamFlag, isTrue); + expect(dataFrame.bytes, [1, 2, 3]); + }); + + writerReaderTest('headers-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writeHeadersFrame(99, [Header.ascii('a', 'b')], endStream: true); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is HeadersFrame, isTrue); + + var headersFrame = frames[0] as HeadersFrame; + expect(headersFrame.header.streamId, 99); + expect(headersFrame.hasPaddedFlag, isFalse); + expect(headersFrame.padLength, 0); + expect(headersFrame.hasEndStreamFlag, isTrue); + expect(headersFrame.hasEndHeadersFlag, isTrue); + expect(headersFrame.exclusiveDependency, false); + expect(headersFrame.hasPriorityFlag, false); + expect(headersFrame.streamDependency, isNull); + expect(headersFrame.weight, isNull); + + var headers = decoder.decode(headersFrame.headerBlockFragment); + expect(headers, hasLength(1)); + expect(headers[0], isHeader('a', 'b')); + }); + + writerReaderTest('priority-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writePriorityFrame(99, 44, 33, exclusive: true); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is PriorityFrame, isTrue); + + var priorityFrame = frames[0] as PriorityFrame; + expect(priorityFrame.header.streamId, 99); + expect(priorityFrame.exclusiveDependency, isTrue); + expect(priorityFrame.streamDependency, 44); + expect(priorityFrame.weight, 33); + }); + + writerReaderTest('rst-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writeRstStreamFrame(99, 42); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is RstStreamFrame, isTrue); + + var rstFrame = frames[0] as RstStreamFrame; + expect(rstFrame.header.streamId, 99); + expect(rstFrame.errorCode, 42); + }); + + writerReaderTest('settings-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writeSettingsFrame([Setting(Setting.SETTINGS_ENABLE_PUSH, 1)]); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is SettingsFrame, isTrue); + + var settingsFrame = frames[0] as SettingsFrame; + expect(settingsFrame.hasAckFlag, false); + expect(settingsFrame.header.streamId, 0); + expect(settingsFrame.settings, hasLength(1)); + expect( + settingsFrame.settings[0].identifier, Setting.SETTINGS_ENABLE_PUSH); + expect(settingsFrame.settings[0].value, 1); + }); + + writerReaderTest('settings-frame-ack', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writeSettingsAckFrame(); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is SettingsFrame, isTrue); + + var settingsFrame = frames[0] as SettingsFrame; + expect(settingsFrame.hasAckFlag, true); + expect(settingsFrame.header.streamId, 0); + expect(settingsFrame.settings, hasLength(0)); + }); + + writerReaderTest('push-promise-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writePushPromiseFrame(99, 44, [Header.ascii('a', 'b')]); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is PushPromiseFrame, isTrue); + + var pushPromiseFrame = frames[0] as PushPromiseFrame; + expect(pushPromiseFrame.header.streamId, 99); + expect(pushPromiseFrame.hasEndHeadersFlag, isTrue); + expect(pushPromiseFrame.hasPaddedFlag, isFalse); + expect(pushPromiseFrame.padLength, 0); + expect(pushPromiseFrame.promisedStreamId, 44); + + var headers = decoder.decode(pushPromiseFrame.headerBlockFragment); + expect(headers, hasLength(1)); + expect(headers[0], isHeader('a', 'b')); + }); + + writerReaderTest('ping-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writePingFrame(44, ack: true); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is PingFrame, isTrue); + + var pingFrame = frames[0] as PingFrame; + expect(pingFrame.header.streamId, 0); + expect(pingFrame.opaqueData, 44); + expect(pingFrame.hasAckFlag, isTrue); + }); + + writerReaderTest('goaway-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writeGoawayFrame(44, 33, [1, 2, 3]); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is GoawayFrame, isTrue); + + var goawayFrame = frames[0] as GoawayFrame; + expect(goawayFrame.header.streamId, 0); + expect(goawayFrame.lastStreamId, 44); + expect(goawayFrame.errorCode, 33); + expect(goawayFrame.debugData, [1, 2, 3]); + }); + + writerReaderTest('window-update-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + writer.writeWindowUpdate(55, streamId: 99); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(1)); + expect(frames[0] is WindowUpdateFrame, isTrue); + + var windowUpdateFrame = frames[0] as WindowUpdateFrame; + expect(windowUpdateFrame.header.streamId, 99); + expect(windowUpdateFrame.windowSizeIncrement, 55); + }); + + writerReaderTest('frag-headers-frame', + (FrameWriter writer, FrameReader reader, HPackDecoder decoder) async { + var headerName = [1]; + var headerValue = List.filled(1 << 14, 0x42); + var header = Header(headerName, headerValue); + + writer.writeHeadersFrame(99, [header], endStream: true); + + var frames = await finishWriting(writer, reader); + expect(frames, hasLength(2)); + expect(frames[0] is HeadersFrame, isTrue); + expect(frames[1] is ContinuationFrame, isTrue); + + var headersFrame = frames[0] as HeadersFrame; + expect(headersFrame.header.streamId, 99); + expect(headersFrame.hasPaddedFlag, isFalse); + expect(headersFrame.padLength, 0); + expect(headersFrame.hasEndHeadersFlag, isFalse); + expect(headersFrame.hasEndStreamFlag, isTrue); + expect(headersFrame.hasPriorityFlag, isFalse); + + var contFrame = frames[1] as ContinuationFrame; + expect(contFrame.header.streamId, 99); + expect(contFrame.hasEndHeadersFlag, isTrue); + + var headerBlock = [ + ...headersFrame.headerBlockFragment, + ...contFrame.headerBlockFragment + ]; + + var headers = decoder.decode(headerBlock); + expect(headers, hasLength(1)); + expect(headers[0].name, headerName); + expect(headers[0].value, headerValue); + }); + }); + }); +} + +void writerReaderTest(String name, + Future Function(FrameWriter, FrameReader, HPackDecoder) func) { + test(name, () { + var settings = ActiveSettings(); + var context = HPackContext(); + var controller = StreamController>(); + var writer = FrameWriter(context.encoder, controller, settings); + var reader = FrameReader(controller.stream, settings); + return func(writer, reader, context.decoder); + }); +} + +Future> finishWriting(FrameWriter writer, FrameReader reader) { + return Future.wait([writer.close(), reader.startDecoding().toList()]) + .then((results) => results.last as List); +} diff --git a/pkgs/http2/test/src/frames/frame_writer_test.dart b/pkgs/http2/test/src/frames/frame_writer_test.dart new file mode 100644 index 0000000000..24b822fef0 --- /dev/null +++ b/pkgs/http2/test/src/frames/frame_writer_test.dart @@ -0,0 +1,30 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http2/src/frames/frames.dart'; +import 'package:http2/src/hpack/hpack.dart'; +import 'package:http2/src/settings/settings.dart'; +import 'package:test/test.dart'; + +void main() { + group('frames', () { + group('frame-writer', () { + test('connection-error', () { + var settings = ActiveSettings(); + var context = HPackContext(); + var controller = StreamController>(); + var writer = FrameWriter(context.encoder, controller, settings); + + writer.doneFuture.then(expectAsync1((_) { + // We expect that the writer is done at this point. + })); + + // We cancel here the reading part (simulates a dying socket). + controller.stream.listen((_) {}).cancel(); + }); + }); + }); +} diff --git a/pkgs/http2/test/src/hpack/hpack_test.dart b/pkgs/http2/test/src/hpack/hpack_test.dart new file mode 100644 index 0000000000..aadf6cb17e --- /dev/null +++ b/pkgs/http2/test/src/hpack/hpack_test.dart @@ -0,0 +1,830 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http2/src/hpack/hpack.dart'; +import 'package:test/test.dart'; + +void main() { + group('hpack', () { + group('hpack-spec-decoder', () { + test('C.3 request without huffman encoding', () { + var context = HPackContext(); + List
headers; + + // First request + headers = context.decoder.decode([ + 0x82, + 0x86, + 0x84, + 0x41, + 0x0f, + 0x77, + 0x77, + 0x77, + 0x2e, + 0x65, + 0x78, + 0x61, + 0x6d, + 0x70, + 0x6c, + 0x65, + 0x2e, + 0x63, + 0x6f, + 0x6d + ]); + expect(headers, hasLength(4)); + expect(headers[0], isHeader(':method', 'GET')); + expect(headers[1], isHeader(':scheme', 'http')); + expect(headers[2], isHeader(':path', '/')); + expect(headers[3], isHeader(':authority', 'www.example.com')); + + // Second request + headers = context.decoder.decode([ + 0x82, + 0x86, + 0x84, + 0xbe, + 0x58, + 0x08, + 0x6e, + 0x6f, + 0x2d, + 0x63, + 0x61, + 0x63, + 0x68, + 0x65 + ]); + expect(headers, hasLength(5)); + expect(headers[0], isHeader(':method', 'GET')); + expect(headers[1], isHeader(':scheme', 'http')); + expect(headers[2], isHeader(':path', '/')); + expect(headers[3], isHeader(':authority', 'www.example.com')); + expect(headers[4], isHeader('cache-control', 'no-cache')); + + // Third request + headers = context.decoder.decode([ + 0x82, + 0x87, + 0x85, + 0xbf, + 0x40, + 0x0a, + 0x63, + 0x75, + 0x73, + 0x74, + 0x6f, + 0x6d, + 0x2d, + 0x6b, + 0x65, + 0x79, + 0x0c, + 0x63, + 0x75, + 0x73, + 0x74, + 0x6f, + 0x6d, + 0x2d, + 0x76, + 0x61, + 0x6c, + 0x75, + 0x65 + ]); + expect(headers, hasLength(5)); + expect(headers[0], isHeader(':method', 'GET')); + expect(headers[1], isHeader(':scheme', 'https')); + expect(headers[2], isHeader(':path', '/index.html')); + expect(headers[3], isHeader(':authority', 'www.example.com')); + expect(headers[4], isHeader('custom-key', 'custom-value')); + }); + + test('C.4 request with huffman encoding', () { + var context = HPackContext(); + List
headers; + + // First request + headers = context.decoder.decode([ + 0x82, + 0x86, + 0x84, + 0x41, + 0x8c, + 0xf1, + 0xe3, + 0xc2, + 0xe5, + 0xf2, + 0x3a, + 0x6b, + 0xa0, + 0xab, + 0x90, + 0xf4, + 0xff + ]); + expect(headers, hasLength(4)); + expect(headers[0], isHeader(':method', 'GET')); + expect(headers[1], isHeader(':scheme', 'http')); + expect(headers[2], isHeader(':path', '/')); + expect(headers[3], isHeader(':authority', 'www.example.com')); + + // Second request + headers = context.decoder.decode([ + 0x82, + 0x86, + 0x84, + 0xbe, + 0x58, + 0x86, + 0xa8, + 0xeb, + 0x10, + 0x64, + 0x9c, + 0xbf + ]); + expect(headers, hasLength(5)); + expect(headers[0], isHeader(':method', 'GET')); + expect(headers[1], isHeader(':scheme', 'http')); + expect(headers[2], isHeader(':path', '/')); + expect(headers[3], isHeader(':authority', 'www.example.com')); + expect(headers[4], isHeader('cache-control', 'no-cache')); + + // Third request + headers = context.decoder.decode([ + 0x82, + 0x87, + 0x85, + 0xbf, + 0x40, + 0x88, + 0x25, + 0xa8, + 0x49, + 0xe9, + 0x5b, + 0xa9, + 0x7d, + 0x7f, + 0x89, + 0x25, + 0xa8, + 0x49, + 0xe9, + 0x5b, + 0xb8, + 0xe8, + 0xb4, + 0xbf + ]); + expect(headers, hasLength(5)); + expect(headers[0], isHeader(':method', 'GET')); + expect(headers[1], isHeader(':scheme', 'https')); + expect(headers[2], isHeader(':path', '/index.html')); + expect(headers[3], isHeader(':authority', 'www.example.com')); + expect(headers[4], isHeader('custom-key', 'custom-value')); + }); + + test('C.5 response without huffman encoding', () { + var context = HPackContext(); + List
headers; + + // First response + headers = context.decoder.decode([ + 0x48, + 0x03, + 0x33, + 0x30, + 0x32, + 0x58, + 0x07, + 0x70, + 0x72, + 0x69, + 0x76, + 0x61, + 0x74, + 0x65, + 0x61, + 0x1d, + 0x4d, + 0x6f, + 0x6e, + 0x2c, + 0x20, + 0x32, + 0x31, + 0x20, + 0x4f, + 0x63, + 0x74, + 0x20, + 0x32, + 0x30, + 0x31, + 0x33, + 0x20, + 0x32, + 0x30, + 0x3a, + 0x31, + 0x33, + 0x3a, + 0x32, + 0x31, + 0x20, + 0x47, + 0x4d, + 0x54, + 0x6e, + 0x17, + 0x68, + 0x74, + 0x74, + 0x70, + 0x73, + 0x3a, + 0x2f, + 0x2f, + 0x77, + 0x77, + 0x77, + 0x2e, + 0x65, + 0x78, + 0x61, + 0x6d, + 0x70, + 0x6c, + 0x65, + 0x2e, + 0x63, + 0x6f, + 0x6d + ]); + expect(headers, hasLength(4)); + expect(headers[0], isHeader(':status', '302')); + expect(headers[1], isHeader('cache-control', 'private')); + expect(headers[2], isHeader('date', 'Mon, 21 Oct 2013 20:13:21 GMT')); + expect(headers[3], isHeader('location', 'https://www.example.com')); + + // Second response + headers = context.decoder + .decode([0x48, 0x03, 0x33, 0x30, 0x37, 0xc1, 0xc0, 0xbf]); + expect(headers, hasLength(4)); + expect(headers[0], isHeader(':status', '307')); + expect(headers[1], isHeader('cache-control', 'private')); + expect(headers[2], isHeader('date', 'Mon, 21 Oct 2013 20:13:21 GMT')); + expect(headers[3], isHeader('location', 'https://www.example.com')); + + // Third response + headers = context.decoder.decode([ + 0x88, + 0xc1, + 0x61, + 0x1d, + 0x4d, + 0x6f, + 0x6e, + 0x2c, + 0x20, + 0x32, + 0x31, + 0x20, + 0x4f, + 0x63, + 0x74, + 0x20, + 0x32, + 0x30, + 0x31, + 0x33, + 0x20, + 0x32, + 0x30, + 0x3a, + 0x31, + 0x33, + 0x3a, + 0x32, + 0x32, + 0x20, + 0x47, + 0x4d, + 0x54, + 0xc0, + 0x5a, + 0x04, + 0x67, + 0x7a, + 0x69, + 0x70, + 0x77, + 0x38, + 0x66, + 0x6f, + 0x6f, + 0x3d, + 0x41, + 0x53, + 0x44, + 0x4a, + 0x4b, + 0x48, + 0x51, + 0x4b, + 0x42, + 0x5a, + 0x58, + 0x4f, + 0x51, + 0x57, + 0x45, + 0x4f, + 0x50, + 0x49, + 0x55, + 0x41, + 0x58, + 0x51, + 0x57, + 0x45, + 0x4f, + 0x49, + 0x55, + 0x3b, + 0x20, + 0x6d, + 0x61, + 0x78, + 0x2d, + 0x61, + 0x67, + 0x65, + 0x3d, + 0x33, + 0x36, + 0x30, + 0x30, + 0x3b, + 0x20, + 0x76, + 0x65, + 0x72, + 0x73, + 0x69, + 0x6f, + 0x6e, + 0x3d, + 0x31 + ]); + expect(headers, hasLength(6)); + expect(headers[0], isHeader(':status', '200')); + expect(headers[1], isHeader('cache-control', 'private')); + expect(headers[2], isHeader('date', 'Mon, 21 Oct 2013 20:13:22 GMT')); + expect(headers[3], isHeader('location', 'https://www.example.com')); + expect(headers[4], isHeader('content-encoding', 'gzip')); + expect( + headers[5], + isHeader('set-cookie', + 'foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1')); + }); + + test('C.6 response with huffman encoding', () { + var context = HPackContext(); + List
headers; + + // First response + headers = context.decoder.decode([ + 0x48, + 0x82, + 0x64, + 0x02, + 0x58, + 0x85, + 0xae, + 0xc3, + 0x77, + 0x1a, + 0x4b, + 0x61, + 0x96, + 0xd0, + 0x7a, + 0xbe, + 0x94, + 0x10, + 0x54, + 0xd4, + 0x44, + 0xa8, + 0x20, + 0x05, + 0x95, + 0x04, + 0x0b, + 0x81, + 0x66, + 0xe0, + 0x82, + 0xa6, + 0x2d, + 0x1b, + 0xff, + 0x6e, + 0x91, + 0x9d, + 0x29, + 0xad, + 0x17, + 0x18, + 0x63, + 0xc7, + 0x8f, + 0x0b, + 0x97, + 0xc8, + 0xe9, + 0xae, + 0x82, + 0xae, + 0x43, + 0xd3 + ]); + expect(headers, hasLength(4)); + expect(headers[0], isHeader(':status', '302')); + expect(headers[1], isHeader('cache-control', 'private')); + expect(headers[2], isHeader('date', 'Mon, 21 Oct 2013 20:13:21 GMT')); + expect(headers[3], isHeader('location', 'https://www.example.com')); + + // Second response + headers = context.decoder + .decode([0x48, 0x83, 0x64, 0x0e, 0xff, 0xc1, 0xc0, 0xbf]); + expect(headers, hasLength(4)); + expect(headers[0], isHeader(':status', '307')); + expect(headers[1], isHeader('cache-control', 'private')); + expect(headers[2], isHeader('date', 'Mon, 21 Oct 2013 20:13:21 GMT')); + expect(headers[3], isHeader('location', 'https://www.example.com')); + + // Third response + headers = context.decoder.decode([ + 0x88, + 0xc1, + 0x61, + 0x96, + 0xd0, + 0x7a, + 0xbe, + 0x94, + 0x10, + 0x54, + 0xd4, + 0x44, + 0xa8, + 0x20, + 0x05, + 0x95, + 0x04, + 0x0b, + 0x81, + 0x66, + 0xe0, + 0x84, + 0xa6, + 0x2d, + 0x1b, + 0xff, + 0xc0, + 0x5a, + 0x83, + 0x9b, + 0xd9, + 0xab, + 0x77, + 0xad, + 0x94, + 0xe7, + 0x82, + 0x1d, + 0xd7, + 0xf2, + 0xe6, + 0xc7, + 0xb3, + 0x35, + 0xdf, + 0xdf, + 0xcd, + 0x5b, + 0x39, + 0x60, + 0xd5, + 0xaf, + 0x27, + 0x08, + 0x7f, + 0x36, + 0x72, + 0xc1, + 0xab, + 0x27, + 0x0f, + 0xb5, + 0x29, + 0x1f, + 0x95, + 0x87, + 0x31, + 0x60, + 0x65, + 0xc0, + 0x03, + 0xed, + 0x4e, + 0xe5, + 0xb1, + 0x06, + 0x3d, + 0x50, + 0x07 + ]); + expect(headers, hasLength(6)); + expect(headers[0], isHeader(':status', '200')); + expect(headers[1], isHeader('cache-control', 'private')); + expect(headers[2], isHeader('date', 'Mon, 21 Oct 2013 20:13:22 GMT')); + expect(headers[3], isHeader('location', 'https://www.example.com')); + expect(headers[4], isHeader('content-encoding', 'gzip')); + expect( + headers[5], + isHeader('set-cookie', + 'foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1')); + }); + }); + + group('negative-decoder-tests', () { + test('invalid-integer-encoding', () { + var context = HPackContext(); + expect(() => context.decoder.decode([1 << 6, 0xff]), + throwsA(isHPackDecodingException)); + }); + + test('index-out-of-table-size', () { + var context = HPackContext(); + expect(() => context.decoder.decode([0x7f]), + throwsA(isHPackDecodingException)); + }); + + test('invalid-update-dynamic-table-size', () { + var context = HPackContext(); + expect(() => context.decoder.decode([0x3f]), + throwsA(isHPackDecodingException)); + }); + + test('update-dynamic-table-size-too-high', () { + var context = HPackContext(); + // Tries to set dynamic table to 4097 (max is 4096 by default) + var bytes = TestHelper.newInteger(0x20, 5, 4097); + expect(() => context.decoder.decode(bytes), + throwsA(isHPackDecodingException)); + }); + }); + + group('custom decoder tests', () { + const char0 = 0x30; + const char1 = 0x31; + const char2 = 0x31; + const char3 = 0x31; + const charA = 0x61; + const charB = 0x62; + const charC = 0x63; + const charD = 0x64; + + test('update-dynamic-table-size-too-high', () { + var context = HPackContext(); + // Sets dynamic table to 4096 + expect(context.decoder.decode(TestHelper.newInteger(0x20, 5, 4096)), + []); + }); + + test('dynamic table entry', () { + List
headers; + var context = HPackContext(); + + var buffer = []; + buffer.addAll(TestHelper.insertIntoDynamicTable(2048, char0, charA)); + buffer.addAll(TestHelper.insertIntoDynamicTable(2048, char1, charB)); + buffer.addAll(TestHelper.dynamicTableLookup(0)); + buffer.addAll(TestHelper.dynamicTableLookup(1)); + buffer.addAll(TestHelper.dynamicTableLookup(0)); + buffer.addAll(TestHelper.dynamicTableLookup(1)); + buffer.addAll(TestHelper.insertIntoDynamicTable(1024, char2, charC)); + buffer.addAll(TestHelper.insertIntoDynamicTable(1024, char3, charD)); + buffer.addAll(TestHelper.dynamicTableLookup(0)); + buffer.addAll(TestHelper.dynamicTableLookup(1)); + buffer.addAll(TestHelper.dynamicTableLookup(2)); + + headers = context.decoder.decode(buffer); + expect(headers, hasLength(11)); + TestHelper.expectHeader(headers[0], 2048, char0, charA); + TestHelper.expectHeader(headers[1], 2048, char1, charB); + + TestHelper.expectHeader(headers[2], 2048, char1, charB); + TestHelper.expectHeader(headers[3], 2048, char0, charA); + TestHelper.expectHeader(headers[4], 2048, char1, charB); + TestHelper.expectHeader(headers[5], 2048, char0, charA); + + TestHelper.expectHeader(headers[6], 1024, char2, charC); + TestHelper.expectHeader(headers[7], 1024, char3, charD); + + TestHelper.expectHeader(headers[8], 1024, char1, charD); + TestHelper.expectHeader(headers[9], 1024, char0, charC); + TestHelper.expectHeader(headers[10], 2048, char1, charB); + + // We're reducing now the size by 1 byte, which should evict the last + // entry. + headers = + context.decoder.decode(TestHelper.setDynamicTableSize(4096 - 1)); + expect(headers, hasLength(0)); + + headers = context.decoder.decode(TestHelper.dynamicTableLookup(0)); + expect(headers, hasLength(1)); + TestHelper.expectHeader(headers[0], 1024, char1, charD); + + headers = context.decoder.decode(TestHelper.dynamicTableLookup(1)); + expect(headers, hasLength(1)); + TestHelper.expectHeader(headers[0], 1024, char0, charC); + + // Since we reduce the size by 1 byte, the last entry must be gone now. + expect(() => context.decoder.decode(TestHelper.dynamicTableLookup(2)), + throwsA(isHPackDecodingException)); + }); + }); + + group('encoder-tests', () { + test('simple-encoding', () { + var context = HPackContext(); + var headers = [Header.ascii('key', 'value')]; + expect(context.encoder.encode(headers), + [0x00, 0x03, 0x6b, 0x65, 0x79, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65]); + }); + + test('simple-encoding-long-value', () { + var context = HPackContext(); + var headers = [ + Header([0x42], List.filled(300, 0x84)) + ]; + + expect(context.decoder.decode(context.encoder.encode(headers)).first, + equalsHeader(headers.first)); + + expect(context.encoder.encode(headers), [ + // Literal Header Field with Incremental Indexing - Indexed Name + 0x00, + + // Key: Length + 0x01, + + // Key: Bytes + 0x42, + + // Value: (first 7 bits + rest) + 0x7f, 0xad, 0x01, + + // Value: Bytes + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + ]); + }); + }); + }); +} + +class TestHelper { + static List setDynamicTableSize(int newSize) { + return TestHelper.newInteger(0x20, 5, newSize); + } + + static List newInteger(int currentByte, int prefixBits, int value) { + assert((currentByte & ((1 << prefixBits) - 1)) == 0); + var buffer = []; + if (value < ((1 << prefixBits) - 1)) { + currentByte |= value; + buffer.add(currentByte); + } else { + // Length encodeded. + currentByte |= (1 << prefixBits) - 1; + value -= (1 << prefixBits) - 1; + buffer.add(currentByte); + var done = false; + while (!done) { + currentByte = value & 0x7f; + value = value >> 7; + done = value == 0; + if (!done) currentByte |= 0x80; + buffer.add(currentByte); + } + } + return buffer; + } + + static List insertIntoDynamicTable(int n, int nameChar, int valueChar) { + // NOTE: size(header) = 32 + header.name.length + header.value.length. + + var buffer = []; + + // Literal indexed (will be put into dynamic table) + buffer.addAll([0x40]); + + var name = [nameChar]; + buffer.addAll(newInteger(0, 7, name.length)); + buffer.addAll(name); + + var value = List.filled(n - 32 - name.length, valueChar); + buffer.addAll(newInteger(0, 7, value.length)); + buffer.addAll(value); + + return buffer; + } + + static List dynamicTableLookup(int index) { + // There are 62 entries in the static table. + return newInteger(0x80, 7, 62 + index); + } + + static void expectHeader(Header h, int len, int nameChar, int valueChar) { + var data = h.value; + expect(data, hasLength(len - 32 - 1)); + for (var i = 0; i < data.length; i++) { + expect(data[i], valueChar); + } + } +} + +/// A matcher for HuffmannDecodingExceptions. +const Matcher isHPackDecodingException = TypeMatcher(); + +class _HeaderMatcher extends Matcher { + final Header header; + + _HeaderMatcher(this.header); + + @override + Description describe(Description description) => description.add('Header'); + + @override + bool matches(Object? item, Map matchState) { + return item is Header && + _compareLists(item.name, header.name) && + _compareLists(item.value, header.value); + } + + bool _compareLists(List a, List b) { + if (a.length != b.length) return false; + for (var i = 0; i < a.length; i++) { + if (a[i] != b[i]) return false; + } + return true; + } +} + +Matcher isHeader(String name, String value) => + _HeaderMatcher(Header.ascii(name, value)); + +Matcher equalsHeader(Header header) => _HeaderMatcher(header); diff --git a/pkgs/http2/test/src/hpack/huffman_table_test.dart b/pkgs/http2/test/src/hpack/huffman_table_test.dart new file mode 100644 index 0000000000..fa1c75be71 --- /dev/null +++ b/pkgs/http2/test/src/hpack/huffman_table_test.dart @@ -0,0 +1,158 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert' show ascii; + +import 'package:http2/src/hpack/huffman.dart'; +import 'package:http2/src/hpack/huffman_table.dart'; +import 'package:test/test.dart'; + +void main() { + group('hpack', () { + group('huffman', () { + final decode = http2HuffmanCodec.decode; + final encode = http2HuffmanCodec.encode; + + var hpackSpecTestCases = { + 'www.example.com': [ + 0xf1, + 0xe3, + 0xc2, + 0xe5, + 0xf2, + 0x3a, + 0x6b, + 0xa0, + 0xab, + 0x90, + 0xf4, + 0xff + ], + 'no-cache': [0xa8, 0xeb, 0x10, 0x64, 0x9c, 0xbf], + 'custom-key': [0x25, 0xa8, 0x49, 0xe9, 0x5b, 0xa9, 0x7d, 0x7f], + 'custom-value': [0x25, 0xa8, 0x49, 0xe9, 0x5b, 0xb8, 0xe8, 0xb4, 0xbf], + }; + + test('hpack-spec-testcases', () { + hpackSpecTestCases.forEach((String value, List encoding) { + expect(decode(encoding), ascii.encode(value)); + expect(encode(ascii.encode(value)), encoding); + }); + }); + + test('more-than-7-bit-padding', () { + var data = [ + // Just more-than-7-bitpadding + [0xff], + [0xff, 0xff], + [0xff, 0xff, 0xff], + [0xff, 0xff, 0xff, 0xff], + + // 0xf8 = '&' + more-than-7-bitpadding + [0xf8, 0xff], + [0xf8, 0xff, 0xff], + [0xf8, 0xff, 0xff, 0xff], + [0xf8, 0xff, 0xff, 0xff, 0xff], + + // ')' + entire EOS + [0xfe, 0xff, 0xff, 0xff, 0xff], + ]; + + for (var test in data) { + expect(() => decode(test), throwsA(isHuffmanDecodingException)); + } + }); + + test('incomplete-encoding', () { + var data = [ + // Incomplete encoding + [0xfe], + + // 0xf8 = '&' + Incomplete encoding + [0xf8, 0xfe], + ]; + + for (var test in data) { + expect(() => decode(test), throwsA(isHuffmanDecodingException)); + } + }); + + test('fuzzy-test', () { + var data = [ + [0xb8, 0xa4, 0x4e, 0xe3, 0xb1, 0x4d, 0x3d, 0x63, 0x16, 0x5b, 0x6a], + [0x71, 0x5f, 0xb3, 0xb1, 0x4b, 0x94, 0xe8, 0x2f, 0x4c, 0x3d, 0x04], + [0x95, 0x6d, 0x89, 0xfb, 0x91, 0x6a, 0x6c, 0x52, 0x64, 0x9a, 0xd1], + [0x64, 0x59, 0x79, 0x38, 0xd2, 0x09, 0xea, 0x94, 0x92, 0xda, 0x24], + [0xb0, 0x35, 0xfe, 0xa9, 0x96, 0xb5, 0xe1, 0xde, 0x0a, 0x82, 0x18], + [0x39, 0xe5, 0xdd, 0xba, 0x50, 0xd4, 0x33, 0xa7, 0xb9, 0x63, 0x21], + [0x26, 0x52, 0x7a, 0xaa, 0x52, 0x4d, 0x27, 0x81, 0xe4, 0xef, 0xcd], + [0x17, 0x9e, 0x09, 0xcc, 0xd0, 0x0f, 0x5e, 0x03, 0x45, 0xc9, 0xba], + [0x84, 0xfc, 0x75, 0xeb, 0xcc, 0x9e, 0xb6, 0x50, 0x3f, 0xf8, 0x00], + [0xb9, 0x24, 0x95, 0x13, 0x6d, 0x89, 0xb2, 0x89, 0x86, 0x02, 0xca], + [0xb7, 0xd5, 0x78, 0xfa, 0xa3, 0xa9, 0x90, 0x1b, 0x35, 0xb4, 0x72], + [0x62, 0x9a, 0x31, 0x0c, 0x32, 0x1c, 0x25, 0x2e, 0x1b, 0x56, 0x55], + [0xa9, 0x5d, 0xa8, 0xa4, 0xed, 0x91, 0xeb, 0xba, 0xa0, 0xf9, 0x82], + [0x59, 0x9c, 0xc3, 0x6f, 0x66, 0xec, 0x65, 0xe0, 0x95, 0x6e, 0x34], + [0x3d, 0xc7, 0x0d, 0x6c, 0x01, 0x7d, 0xf2, 0x03, 0x9b, 0xe3, 0xc1], + [0x1d, 0xc6, 0xa4, 0xd1, 0x59, 0x52, 0xce, 0x42, 0x3d, 0xf6, 0xe5], + [0x2d, 0xbd, 0xb6, 0x5c, 0xfb, 0x52, 0x65, 0x2e, 0x7f, 0x03, 0x61], + [0x22, 0x24, 0x50, 0x48, 0x65, 0x5a, 0xe0, 0x0d, 0xf9, 0x78, 0x8d], + [0x72, 0xeb, 0x1d, 0x31, 0xb7, 0xe3, 0xa8, 0x15, 0x1f, 0xf1, 0x43], + [0x45, 0xa4, 0x40, 0x5a, 0x9c, 0x98, 0xa8, 0x6e, 0xac, 0xba, 0x83], + [0x27, 0x55, 0x33, 0xa7, 0x79, 0x08, 0x29, 0x42, 0x6d, 0x89, 0xfc], + [0x3b, 0x65, 0x21, 0x7a, 0x24, 0x58, 0x58, 0x6a, 0x97, 0x6e, 0x7c], + [0x56, 0x41, 0xff, 0x08, 0xaf, 0x9d, 0x33, 0x12, 0xcd, 0xb5, 0x99], + [0x35, 0x48, 0x38, 0x46, 0x3f, 0xee, 0x15, 0x16, 0x8d, 0xf5, 0x16], + [0xcc, 0xc0, 0x1b, 0x1e, 0xf1, 0xae, 0xf7, 0x40, 0xca, 0xc7, 0x9d], + [0x93, 0xae, 0x93, 0xcf, 0x97, 0xdf, 0xba, 0xd6, 0xb2, 0xac, 0x2f], + [0x45, 0xe4, 0x5b, 0x73, 0x54, 0x4c, 0x6c, 0x95, 0xa9, 0xab, 0x7f], + [0x71, 0xac, 0xbf, 0xdf, 0xa4, 0x29, 0xe3, 0x17, 0x3f, 0x24, 0x2f], + [0x5e, 0xc0, 0xf2, 0xbf, 0x5d, 0xc0, 0x31, 0x2d, 0x97, 0x24, 0x1d], + [0x6d, 0x0b, 0x7c, 0x15, 0x68, 0x7c, 0xe1, 0x15, 0xbf, 0x4f, 0x85], + [0x0a, 0x59, 0xf2, 0x3e, 0x48, 0x1d, 0xac, 0xc8, 0x22, 0xb0, 0x37], + [0x3a, 0xe2, 0x9e, 0xec, 0xf9, 0x1e, 0x88, 0xfa, 0xbe, 0x00, 0xee], + [0xc7, 0x5a, 0x1f, 0xc8, 0x48, 0x23, 0x3b, 0x1a, 0x0f, 0xf3, 0x7c], + [0x43, 0x0d, 0x10, 0x03, 0xb2, 0xc6, 0xbd, 0xed, 0x03, 0x19, 0x49], + [0xc9, 0xc4, 0x0e, 0xf3, 0xc6, 0xf4, 0xc1, 0x71, 0xee, 0x96, 0xeb], + [0x18, 0x51, 0x07, 0x36, 0x1a, 0x13, 0x83, 0x69, 0x2b, 0x1b, 0x09], + [0xac, 0x23, 0xb7, 0x47, 0x2d, 0xeb, 0x39, 0xdc, 0x3e, 0xdb, 0x74], + [0x44, 0x60, 0x06, 0x28, 0x5e, 0x8f, 0xef, 0xfc, 0x70, 0x7b, 0x73], + [0xda, 0x38, 0x25, 0x76, 0xa9, 0x1a, 0x99, 0x9a, 0x52, 0xdf, 0x8c], + [0xd4, 0xc4, 0x99, 0x2b, 0x54, 0x88, 0xc9, 0x34, 0x80, 0x43, 0x15], + [0x11, 0xa1, 0xed, 0xe3, 0xb4, 0x88, 0xd5, 0x1d, 0x4a, 0x1b, 0x9f], + [0xfd, 0x2c, 0xb4, 0x6e, 0x65, 0xfb, 0x27, 0x9b, 0x65, 0x55, 0x19], + [0xb6, 0xa4, 0x67, 0x16, 0x8a, 0x59, 0xf5, 0xfc, 0x0f, 0x7e, 0x24], + [0x40, 0x8e, 0x5d, 0x84, 0x90, 0x76, 0x50, 0xdb, 0x72, 0x2a, 0x3b], + [0x7d, 0x1e, 0x9d, 0x2f, 0xad, 0xce, 0x60, 0x00, 0xf8, 0xbc, 0xfa], + [0xc1, 0x2d, 0x32, 0xbd, 0xa2, 0xe7, 0xed, 0x17, 0x48, 0xca, 0xb0], + [0xe6, 0x91, 0x6c, 0xa7, 0xdc, 0x83, 0x58, 0x19, 0x05, 0xb1, 0xa6], + [0xec, 0xb2, 0x16, 0xa3, 0x89, 0x7a, 0xcd, 0x44, 0xe9, 0x3a, 0x98], + [0xcf, 0xef, 0x78, 0x5b, 0x7a, 0xec, 0xa8, 0xfa, 0x6c, 0x78, 0x23], + [0x8b, 0x53, 0x89, 0x82, 0x21, 0x3e, 0xfc, 0xed, 0xe4, 0x6b, 0xa0], + [0xff, 0x28, 0x10, 0xb2, 0x24, 0xf9, 0xb5, 0x3e, 0x08, 0xb2, 0x50], + [0x5e, 0x57, 0x11, 0xff, 0x06, 0x1b, 0xc7, 0x0b, 0x28, 0x5b, 0x34], + [0x00, 0x4a, 0xcc, 0x4e, 0x8e, 0x07, 0xea, 0x93, 0x10, 0x1c, 0x87], + [0xab, 0xc7, 0x7e, 0x10, 0x64, 0x7f, 0xa4, 0x6c, 0xca, 0x93, 0x73], + [0xcf, 0x57, 0xc5, 0x15, 0xbc, 0x47, 0xed, 0x5b, 0x1e, 0xb5, 0x9b], + [0x8e, 0xa5, 0xf3, 0x07, 0xa0, 0x68, 0x1e, 0x9e, 0xea, 0x57, 0x3f], + [0xfe, 0xa7, 0x7f, 0x91, 0xc7, 0xa4, 0x15, 0x7c, 0xa2, 0x00, 0x4c], + [0xb9, 0x62, 0x28, 0xa5, 0x9b, 0x04, 0x98, 0xf9, 0xdd, 0x37, 0x42], + [0xfa, 0x40, 0x1c, 0xce, 0xa0, 0x75, 0x9d, 0xaf, 0xd2, 0x09, 0xae], + [0xa7, 0x8e, 0xdb, 0x1e, 0x8b, 0x94, 0x24, 0x47, 0xd8, 0x04, 0xd7], + [0x69, 0x95, 0x8a, 0x29, 0xbe, 0x9f, 0xfb, 0x71, 0x91, 0x9a, 0x40], + [0x82, 0xed, 0x1e, 0xf5, 0xac, 0x34, 0x17, 0xfe, 0x5f, 0xfd, 0xd3], + [0x81, 0xe6, 0xaa, 0x7b, 0x12, 0xf0, 0xb2, 0xb9, 0x47, 0x02, 0x3c], + [0x05, 0xc3, 0x6d, 0xd5, 0xf1, 0xa4, 0x93, 0xe2, 0x8b, 0x7c, 0xed], + ]; + for (var test in data) { + expect(decode(encode(test)), equals(test)); + } + }); + }); + }); +} + +/// A matcher for HuffmanDecodingExceptions. +const Matcher isHuffmanDecodingException = + TypeMatcher(); diff --git a/pkgs/http2/test/src/ping/ping_handler_test.dart b/pkgs/http2/test/src/ping/ping_handler_test.dart new file mode 100644 index 0000000000..df02420870 --- /dev/null +++ b/pkgs/http2/test/src/ping/ping_handler_test.dart @@ -0,0 +1,125 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http2/src/frames/frames.dart'; +import 'package:http2/src/ping/ping_handler.dart'; +import 'package:mockito/mockito.dart'; +import 'package:test/test.dart'; + +import '../error_matchers.dart'; + +void main() { + group('ping-handler', () { + test('successful-ping', () async { + var writer = FrameWriterMock(); + var pingHandler = instantiateHandler(writer); + + var p1 = pingHandler.ping(); + var p2 = pingHandler.ping(); + + verifyInOrder([ + writer.writePingFrame(1), + writer.writePingFrame(2), + ]); + + var header = FrameHeader(8, FrameType.PING, PingFrame.FLAG_ACK, 0); + pingHandler.processPingFrame(PingFrame(header, 1)); + var header2 = FrameHeader(8, FrameType.PING, PingFrame.FLAG_ACK, 0); + pingHandler.processPingFrame(PingFrame(header2, 2)); + + await p1; + await p2; + verifyNoMoreInteractions(writer); + }); + + test('successful-ack-to-remote-ping', () async { + var writer = FrameWriterMock(); + var pingHandler = instantiateHandler(writer); + + var header = FrameHeader(8, FrameType.PING, 0, 0); + pingHandler.processPingFrame(PingFrame(header, 1)); + var header2 = FrameHeader(8, FrameType.PING, 0, 0); + pingHandler.processPingFrame(PingFrame(header2, 2)); + + verifyInOrder([ + writer.writePingFrame(1, ack: true), + writer.writePingFrame(2, ack: true) + ]); + verifyNoMoreInteractions(writer); + }); + + test('ping-unknown-opaque-data', () async { + var writer = FrameWriterMock(); + var pingHandler = instantiateHandler(writer); + + var future = pingHandler.ping(); + verify(writer.writePingFrame(1)).called(1); + + var header = FrameHeader(8, FrameType.PING, PingFrame.FLAG_ACK, 0); + expect(() => pingHandler.processPingFrame(PingFrame(header, 2)), + throwsA(isProtocolException)); + + // Ensure outstanding pings will be completed with an error once we call + // `pingHandler.terminate()`. + unawaited(future.catchError(expectAsync2((Object error, Object _) { + expect(error, 'hello world'); + }))); + pingHandler.terminate('hello world'); + verifyNoMoreInteractions(writer); + }); + + test('terminate-ping-handler', () async { + var writer = FrameWriterMock(); + var pingHandler = instantiateHandler(writer); + + pingHandler.terminate('hello world'); + expect( + () => pingHandler.processPingFrame(PingFrame( + FrameHeader(8, FrameType.PING, PingFrame.FLAG_ACK, 1), 1)), + throwsA(isTerminatedException)); + expect(pingHandler.ping(), throwsA(isTerminatedException)); + verifyZeroInteractions(writer); + }); + + test('ping-non-zero-stream-id', () async { + var writer = FrameWriterMock(); + var pingHandler = instantiateHandler(writer); + + var header = FrameHeader(8, FrameType.PING, PingFrame.FLAG_ACK, 1); + expect(() => pingHandler.processPingFrame(PingFrame(header, 1)), + throwsA(isProtocolException)); + verifyZeroInteractions(writer); + }); + + test('receiving-ping-calls-stream', () async { + final pings = []; + + final writer = FrameWriterMock(); + final pingStream = StreamController()..stream.listen(pings.add); + + PingHandler(writer, pingStream) + ..processPingFrame(PingFrame( + FrameHeader(8, FrameType.PING, 0, 0), + 1, + )) + ..processPingFrame(PingFrame( + FrameHeader(8, FrameType.PING, 0, 0), + 2, + )); + + await pingStream.close(); + + expect(pings, [1, 2]); + }); + }); +} + +PingHandler instantiateHandler(FrameWriterMock writer) { + var controller = StreamController(); + return PingHandler(writer, controller); +} + +class FrameWriterMock extends Mock implements FrameWriter {} diff --git a/pkgs/http2/test/src/settings/settings_handler_test.dart b/pkgs/http2/test/src/settings/settings_handler_test.dart new file mode 100644 index 0000000000..3d16a73ae8 --- /dev/null +++ b/pkgs/http2/test/src/settings/settings_handler_test.dart @@ -0,0 +1,112 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http2/src/frames/frames.dart'; +import 'package:http2/src/hpack/hpack.dart'; +import 'package:http2/src/settings/settings.dart'; +import 'package:mockito/mockito.dart'; +import 'package:test/test.dart'; + +import '../error_matchers.dart'; + +void main() { + group('settings-handler', () { + var pushSettings = [Setting(Setting.SETTINGS_ENABLE_PUSH, 0)]; + var invalidPushSettings = [Setting(Setting.SETTINGS_ENABLE_PUSH, 2)]; + var setMaxTable256 = [Setting(Setting.SETTINGS_HEADER_TABLE_SIZE, 256)]; + + test('successful-setting', () async { + var writer = FrameWriterMock(); + var sh = SettingsHandler( + HPackEncoder(), writer, ActiveSettings(), ActiveSettings()); + + // Start changing settings. + var changed = sh.changeSettings(pushSettings); + verify(writer.writeSettingsFrame(pushSettings)).called(1); + verifyNoMoreInteractions(writer); + + // Check that settings haven't been applied. + expect(sh.acknowledgedSettings.enablePush, true); + + // Simulate remote end to respond with an ACK. + var header = + FrameHeader(0, FrameType.SETTINGS, SettingsFrame.FLAG_ACK, 0); + sh.handleSettingsFrame(SettingsFrame(header, [])); + + await changed; + + // Check that settings have been applied. + expect(sh.acknowledgedSettings.enablePush, false); + }); + + test('ack-remote-settings-change', () { + var writer = FrameWriterMock(); + var sh = SettingsHandler( + HPackEncoder(), writer, ActiveSettings(), ActiveSettings()); + + // Check that settings haven't been applied. + expect(sh.peerSettings.enablePush, true); + + // Simulate remote end by setting the push setting. + var header = FrameHeader(6, FrameType.SETTINGS, 0, 0); + sh.handleSettingsFrame(SettingsFrame(header, pushSettings)); + + // Check that settings have been applied. + expect(sh.peerSettings.enablePush, false); + verify(writer.writeSettingsAckFrame()).called(1); + verifyNoMoreInteractions(writer); + }); + + test('invalid-remote-ack', () { + var writer = FrameWriterMock(); + var sh = SettingsHandler( + HPackEncoder(), writer, ActiveSettings(), ActiveSettings()); + + // Simulates ACK even though we haven't sent any settings. + var header = + FrameHeader(0, FrameType.SETTINGS, SettingsFrame.FLAG_ACK, 0); + var settingsFrame = SettingsFrame(header, const []); + + expect(() => sh.handleSettingsFrame(settingsFrame), + throwsA(isProtocolException)); + verifyZeroInteractions(writer); + }); + + test('invalid-remote-settings-change', () { + var writer = FrameWriterMock(); + var sh = SettingsHandler( + HPackEncoder(), writer, ActiveSettings(), ActiveSettings()); + + // Check that settings haven't been applied. + expect(sh.peerSettings.enablePush, true); + + // Simulate remote end by setting the push setting. + var header = FrameHeader(6, FrameType.SETTINGS, 0, 0); + var settingsFrame = SettingsFrame(header, invalidPushSettings); + expect(() => sh.handleSettingsFrame(settingsFrame), + throwsA(isProtocolException)); + verifyZeroInteractions(writer); + }); + + test('change-max-header-table-size', () { + var writer = FrameWriterMock(); + var mock = HPackEncoderMock(); + var sh = + SettingsHandler(mock, writer, ActiveSettings(), ActiveSettings()); + + // Simulate remote end by setting the push setting. + var header = FrameHeader(6, FrameType.SETTINGS, 0, 0); + var settingsFrame = SettingsFrame(header, setMaxTable256); + sh.handleSettingsFrame(settingsFrame); + verify(mock.updateMaxSendingHeaderTableSize(256)).called(1); + verify(writer.writeSettingsAckFrame()).called(1); + verifyNoMoreInteractions(mock); + verifyNoMoreInteractions(writer); + }); + }); +} + +class FrameWriterMock extends Mock implements FrameWriter {} + +class HPackEncoderMock extends Mock implements HPackEncoder {} diff --git a/pkgs/http2/test/src/streams/helper.dart b/pkgs/http2/test/src/streams/helper.dart new file mode 100644 index 0000000000..726a7d6449 --- /dev/null +++ b/pkgs/http2/test/src/streams/helper.dart @@ -0,0 +1,50 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http2/transport.dart'; +import 'package:test/test.dart'; + +void expectHeadersEqual(List
headers, List
expectedHeaders) { + expect(headers, hasLength(expectedHeaders.length)); + for (var i = 0; i < expectedHeaders.length; i++) { + expect(headers[i].name, expectedHeaders[i].name); + expect(headers[i].value, expectedHeaders[i].value); + } +} + +void expectEmptyStream(Stream s) { + s.listen(expectAsync1((_) {}, count: 0), onDone: expectAsync0(() {})); +} + +void streamTest( + String name, + Future Function(ClientTransportConnection, ServerTransportConnection) + func, + {ClientSettings? settings}) { + return test(name, () { + var bidirect = BidirectionalConnection(); + bidirect.settings = settings; + var client = bidirect.clientConnection; + var server = bidirect.serverConnection; + return func(client, server); + }); +} + +class BidirectionalConnection { + ClientSettings? settings; + final StreamController> writeA = StreamController(); + final StreamController> writeB = StreamController(); + + Stream> get readA => writeA.stream; + + Stream> get readB => writeB.stream; + + ClientTransportConnection get clientConnection => + ClientTransportConnection.viaStreams(readA, writeB, settings: settings); + + ServerTransportConnection get serverConnection => + ServerTransportConnection.viaStreams(readB, writeA); +} diff --git a/pkgs/http2/test/src/streams/simple_flow_test.dart b/pkgs/http2/test/src/streams/simple_flow_test.dart new file mode 100644 index 0000000000..25226d1a60 --- /dev/null +++ b/pkgs/http2/test/src/streams/simple_flow_test.dart @@ -0,0 +1,96 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http2/transport.dart'; +import 'package:test/test.dart'; + +import 'helper.dart'; + +void main() { + group('streams', () { + group('flowcontrol', () { + const numOfOneKB = 1000; + + var expectedHeaders = [Header.ascii('key', 'value')]; + var allBytes = List.generate(numOfOneKB * 1024, (i) => i % 256); + allBytes.addAll(List.generate(42, (i) => 42)); + + void Function(StreamMessage) headersTestFun(String type) { + return expectAsync1((StreamMessage msg) { + expect( + msg, + isA() + .having((m) => m.headers.first.name, 'headers.first.name', + expectedHeaders.first.name) + .having((m) => m.headers.first.value, 'headers.first.value', + expectedHeaders.first.value)); + }); + } + + var serverReceivedAllBytes = Completer(); + + void Function(StreamMessage) messageTestFun(String type) { + var expectHeader = true; + var numBytesReceived = 0; + return (StreamMessage msg) { + if (expectHeader) { + expectHeader = false; + expect( + msg, + isA() + .having((m) => m.headers.first.name, 'headers.first.name', + expectedHeaders.first.name) + .having((m) => m.headers.first.value, 'headers.first.value', + expectedHeaders.first.value)); + } else { + expect(msg, isA()); + var bytes = (msg as DataStreamMessage).bytes; + expect( + bytes, + allBytes.sublist( + numBytesReceived, numBytesReceived + bytes.length)); + numBytesReceived += bytes.length; + + if (numBytesReceived > allBytes.length) { + if (serverReceivedAllBytes.isCompleted) { + throw Exception('Got more messages than expected'); + } + serverReceivedAllBytes.complete(); + } + } + }; + } + + void sendData(TransportStream cStream) { + for (var i = 0; i < (allBytes.length + 1023) ~/ 1024; i++) { + var end = 1024 * (i + 1); + var isLast = end > allBytes.length; + if (isLast) { + end = allBytes.length; + } + cStream.sendData(allBytes.sublist(1024 * i, end), endStream: isLast); + } + } + + streamTest('single-header-request--empty-response', + (ClientTransportConnection client, + ServerTransportConnection server) async { + server.incomingStreams + .listen(expectAsync1((TransportStream sStream) async { + sStream.incomingMessages + .listen(messageTestFun('server'), onDone: expectAsync0(() {})); + sStream.sendHeaders(expectedHeaders, endStream: true); + await serverReceivedAllBytes.future; + })); + + TransportStream cStream = client.makeRequest(expectedHeaders); + sendData(cStream); + cStream.incomingMessages + .listen(headersTestFun('client'), onDone: expectAsync0(() {})); + }); + }); + }); +} diff --git a/pkgs/http2/test/src/streams/simple_push_test.dart b/pkgs/http2/test/src/streams/simple_push_test.dart new file mode 100644 index 0000000000..d12dbb5d5d --- /dev/null +++ b/pkgs/http2/test/src/streams/simple_push_test.dart @@ -0,0 +1,90 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert' show utf8; + +import 'package:http2/transport.dart'; +import 'package:test/test.dart'; + +import 'helper.dart'; + +void main() { + group('streams', () { + group('server-push', () { + const numOfOneKB = 1000; + + var expectedHeaders = [Header.ascii('key', 'value')]; + var allBytes = List.generate(numOfOneKB * 1024, (i) => i % 256); + allBytes.addAll(List.generate(42, (i) => 42)); + + void testHeaders(List
headers) { + expect(headers, hasLength(expectedHeaders.length)); + for (var i = 0; i < headers.length; i++) { + expect(headers[i].name, expectedHeaders[i].name); + expect(headers[i].value, expectedHeaders[i].value); + } + } + + void Function(StreamMessage) headersTestFun() { + return expectAsync1((StreamMessage msg) { + expect(msg, isA()); + testHeaders((msg as HeadersStreamMessage).headers); + }); + } + + var serverReceivedAllBytes = Completer(); + + Future readData(StreamIterator iterator) async { + var all = []; + + while (await iterator.moveNext()) { + var msg = iterator.current; + expect(msg, isA()); + all.addAll((msg as DataStreamMessage).bytes); + } + + return utf8.decode(all); + } + + Future sendData(TransportStream stream, String data) { + stream.outgoingMessages + ..add(DataStreamMessage(utf8.encode(data))) + ..close(); + return stream.outgoingMessages.done; + } + + streamTest('server-push', (ClientTransportConnection client, + ServerTransportConnection server) async { + server.incomingStreams + .listen(expectAsync1((ServerTransportStream sStream) async { + var pushStream = sStream.push(expectedHeaders); + pushStream.sendHeaders(expectedHeaders); + await sendData(pushStream, 'pushing "hello world" :)'); + + unawaited(sStream.incomingMessages.drain()); + sStream.sendHeaders(expectedHeaders, endStream: true); + + await serverReceivedAllBytes.future; + })); + + var cStream = client.makeRequest(expectedHeaders, endStream: true); + cStream.incomingMessages + .listen(headersTestFun(), onDone: expectAsync0(() {})); + cStream.peerPushes + .listen(expectAsync1((TransportStreamPush push) async { + testHeaders(push.requestHeaders); + + var iterator = StreamIterator(push.stream.incomingMessages); + var hasNext = await iterator.moveNext(); + expect(hasNext, isTrue); + testHeaders((iterator.current as HeadersStreamMessage).headers); + + var msg = await readData(iterator); + expect(msg, 'pushing "hello world" :)'); + })); + }, settings: const ClientSettings(allowServerPushes: true)); + }); + }); +} diff --git a/pkgs/http2/test/src/streams/streams_test.dart b/pkgs/http2/test/src/streams/streams_test.dart new file mode 100644 index 0000000000..6bfa49c495 --- /dev/null +++ b/pkgs/http2/test/src/streams/streams_test.dart @@ -0,0 +1,238 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:http2/transport.dart'; +import 'package:test/test.dart'; + +import 'helper.dart'; + +void main() { + group('streams', () { + streamTest('single-header-request--empty-response', + (ClientTransportConnection client, + ServerTransportConnection server) async { + var expectedHeaders = [Header.ascii('key', 'value')]; + + server.incomingStreams.listen(expectAsync1((TransportStream sStream) { + sStream.incomingMessages.listen(expectAsync1((StreamMessage msg) { + expect(msg, isA()); + + var headersMsg = msg as HeadersStreamMessage; + expectHeadersEqual(headersMsg.headers, expectedHeaders); + }), onDone: expectAsync0(() {})); + sStream.outgoingMessages.close(); + })); + + TransportStream cStream = + client.makeRequest(expectedHeaders, endStream: true); + expectEmptyStream(cStream.incomingMessages); + }); + + streamTest('multi-header-request--empty-response', + (ClientTransportConnection client, + ServerTransportConnection server) async { + var expectedHeaders = [Header.ascii('key', 'value')]; + + server.incomingStreams.listen(expectAsync1((TransportStream sStream) { + sStream.incomingMessages.listen( + expectAsync1((StreamMessage msg) { + expect(msg, isA()); + + var headersMsg = msg as HeadersStreamMessage; + expectHeadersEqual(headersMsg.headers, expectedHeaders); + }, count: 3), + onDone: expectAsync0(() {})); + sStream.outgoingMessages.close(); + })); + + TransportStream cStream = client.makeRequest(expectedHeaders); + cStream.sendHeaders(expectedHeaders); + cStream.sendHeaders(expectedHeaders, endStream: true); + expectEmptyStream(cStream.incomingMessages); + }); + + streamTest('multi-data-request--empty-response', + (ClientTransportConnection client, + ServerTransportConnection server) async { + var expectedHeaders = [Header.ascii('key', 'value')]; + var chunks = [ + [1], + [2], + [3] + ]; + + server.incomingStreams + .listen(expectAsync1((TransportStream sStream) async { + var isFirst = true; + var receivedChunks = >[]; + sStream.incomingMessages.listen( + expectAsync1((StreamMessage msg) { + if (isFirst) { + isFirst = false; + expect(msg, isA()); + + var headersMsg = msg as HeadersStreamMessage; + expectHeadersEqual(headersMsg.headers, expectedHeaders); + } else { + expect(msg, isA()); + + var dataMsg = msg as DataStreamMessage; + receivedChunks.add(dataMsg.bytes); + } + }, count: 1 + chunks.length), onDone: expectAsync0(() { + expect(receivedChunks, chunks); + })); + unawaited(sStream.outgoingMessages.close()); + })); + + TransportStream cStream = client.makeRequest(expectedHeaders); + chunks.forEach(cStream.sendData); + unawaited(cStream.outgoingMessages.close()); + expectEmptyStream(cStream.incomingMessages); + }); + + streamTest('single-header-request--single-headers-response', + (ClientTransportConnection client, + ServerTransportConnection server) async { + var expectedHeaders = [Header.ascii('key', 'value')]; + + server.incomingStreams.listen(expectAsync1((TransportStream sStream) { + sStream.incomingMessages.listen(expectAsync1((StreamMessage msg) { + expect(msg, isA()); + + var headersMsg = msg as HeadersStreamMessage; + expectHeadersEqual(headersMsg.headers, expectedHeaders); + }), onDone: expectAsync0(() {})); + sStream.sendHeaders(expectedHeaders, endStream: true); + })); + + TransportStream cStream = + client.makeRequest(expectedHeaders, endStream: true); + + cStream.incomingMessages.listen(expectAsync1((StreamMessage msg) { + expect(msg, isA()); + + var headersMsg = msg as HeadersStreamMessage; + expectHeadersEqual(headersMsg.headers, expectedHeaders); + }), onDone: expectAsync0(() {})); + }); + + streamTest('single-header-request--multi-headers-response', + (ClientTransportConnection client, + ServerTransportConnection server) async { + var expectedHeaders = [Header.ascii('key', 'value')]; + + server.incomingStreams.listen(expectAsync1((TransportStream sStream) { + sStream.incomingMessages.listen(expectAsync1((StreamMessage msg) { + expect(msg, isA()); + + var headersMsg = msg as HeadersStreamMessage; + expectHeadersEqual(headersMsg.headers, expectedHeaders); + }), onDone: expectAsync0(() {})); + + sStream.sendHeaders(expectedHeaders); + sStream.sendHeaders(expectedHeaders); + sStream.sendHeaders(expectedHeaders, endStream: true); + })); + + TransportStream cStream = + client.makeRequest(expectedHeaders, endStream: true); + + cStream.incomingMessages.listen(expectAsync1((StreamMessage msg) { + expect(msg, isA()); + + var headersMsg = msg as HeadersStreamMessage; + expectHeadersEqual(headersMsg.headers, expectedHeaders); + }, count: 3)); + }); + + streamTest('single-header-request--multi-data-response', + (ClientTransportConnection client, + ServerTransportConnection server) async { + var expectedHeaders = [Header.ascii('key', 'value')]; + var chunks = [ + [1], + [2], + [3] + ]; + + server.incomingStreams.listen(expectAsync1((TransportStream sStream) { + sStream.incomingMessages.listen(expectAsync1((StreamMessage msg) { + expect(msg, isA()); + + var headersMsg = msg as HeadersStreamMessage; + expectHeadersEqual(headersMsg.headers, expectedHeaders); + }), onDone: expectAsync0(() {})); + + chunks.forEach(sStream.sendData); + sStream.outgoingMessages.close(); + })); + + TransportStream cStream = client.makeRequest(expectedHeaders); + unawaited(cStream.outgoingMessages.close()); + + var i = 0; + cStream.incomingMessages.listen(expectAsync1((StreamMessage msg) { + expect( + msg, + isA() + .having((m) => m.bytes, 'bytes', chunks[i++])); + }, count: chunks.length)); + }); + }); + + streamTest('single-data-request--data-trailer-response', + (ClientTransportConnection client, + ServerTransportConnection server) async { + var expectedHeaders = [Header.ascii('key', 'value')]; + var chunk = [1]; + + server.incomingStreams.listen(expectAsync1((TransportStream sStream) async { + var isFirst = true; + List? receivedChunk; + sStream.incomingMessages.listen( + expectAsync1((StreamMessage msg) { + if (isFirst) { + isFirst = false; + expect(msg, isA()); + expect(msg.endStream, false); + + var headersMsg = msg as HeadersStreamMessage; + expectHeadersEqual(headersMsg.headers, expectedHeaders); + } else { + expect(msg, isA()); + expect(msg.endStream, true); + expect(receivedChunk, null); + + var dataMsg = msg as DataStreamMessage; + receivedChunk = dataMsg.bytes; + } + }, count: 2), onDone: expectAsync0(() { + expect(receivedChunk, chunk); + sStream.sendData([2]); + sStream.sendHeaders(expectedHeaders, endStream: true); + })); + })); + + TransportStream cStream = client.makeRequest(expectedHeaders); + cStream.sendData(chunk, endStream: true); + + var isFirst = true; + cStream.incomingMessages.listen(expectAsync1((StreamMessage msg) { + if (isFirst) { + expect(msg, const TypeMatcher()); + final data = msg as DataStreamMessage; + expect(data.bytes, [2]); + isFirst = false; + } else { + expect(msg, const TypeMatcher()); + final trailer = msg as HeadersStreamMessage; + expect(trailer.endStream, true); + expectHeadersEqual(trailer.headers, expectedHeaders); + } + }, count: 2)); + }); +} diff --git a/pkgs/http2/test/transport_test.dart b/pkgs/http2/test/transport_test.dart new file mode 100644 index 0000000000..96c2c03e0c --- /dev/null +++ b/pkgs/http2/test/transport_test.dart @@ -0,0 +1,544 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE FILE. + +import 'dart:async'; +import 'dart:typed_data'; + +import 'package:http2/src/flowcontrol/window.dart'; +import 'package:http2/transport.dart'; +import 'package:test/test.dart'; + +import 'src/hpack/hpack_test.dart' show isHeader; + +void main() { + group('transport-test', () { + transportTest('ping', + (TransportConnection client, TransportConnection server) async { + await client.ping(); + await server.ping(); + }); + + transportTest('terminated-client-ping', + (TransportConnection client, TransportConnection server) async { + var clientError = + client.ping().catchError(expectAsync2((Object e, StackTrace s) { + expect(e, isA()); + })); + await client.terminate(); + await clientError; + + // NOTE: Now the connection is dead and client/server should complete + // with [TransportException]s when doing work (e.g. ping). + unawaited(client.ping().catchError(expectAsync2((Object e, StackTrace s) { + expect(e, isA()); + }))); + unawaited(server.ping().catchError(expectAsync2((Object e, StackTrace s) { + expect(e, isA()); + }))); + }); + + transportTest('terminated-server-ping', + (TransportConnection client, TransportConnection server) async { + var clientError = + client.ping().catchError(expectAsync2((Object e, StackTrace s) { + expect(e, isA()); + })); + await server.terminate(); + await clientError; + + // NOTE: Now the connection is dead and the client/server should complete + // with [TransportException]s when doing work (e.g. ping). + unawaited(client.ping().catchError(expectAsync2((Object e, StackTrace s) { + expect(e, isA()); + }))); + unawaited(server.ping().catchError(expectAsync2((Object e, StackTrace s) { + expect(e, isA()); + }))); + }); + + const concurrentStreamLimit = 5; + transportTest('exhaust-concurrent-stream-limit', + (ClientTransportConnection client, + ServerTransportConnection server) async { + Future clientFun() async { + // We have to wait until the max-concurrent-streams [Setting] was + // transferred from server to client, which is asynchronous. + // The default is unlimited, which is why we have to wait for the server + // setting to arrive on the client. + // At the moment, delaying by 2 microtask cycles is enough. + await Future.value(); + await Future.value(); + + final streams = []; + for (var i = 0; i < concurrentStreamLimit; ++i) { + expect(client.isOpen, true); + streams.add(client.makeRequest([Header.ascii('a', 'b')])); + } + expect(client.isOpen, false); + for (final stream in streams) { + stream.sendData([], endStream: true); + } + await client.finish(); + } + + Future serverFun() async { + await for (final stream in server.incomingStreams) { + await stream.incomingMessages.toList(); + stream.sendHeaders([Header.ascii('a', 'b')], endStream: true); + } + await server.finish(); + } + + await Future.wait([clientFun(), serverFun()]); + }, + serverSettings: + const ServerSettings(concurrentStreamLimit: concurrentStreamLimit)); + + transportTest('disabled-push', (ClientTransportConnection client, + ServerTransportConnection server) async { + server.incomingStreams + .listen(expectAsync1((ServerTransportStream stream) async { + expect(stream.canPush, false); + expect(() => stream.push([Header.ascii('a', 'b')]), + throwsA(const TypeMatcher())); + stream.sendHeaders([Header.ascii('x', 'y')], endStream: true); + })); + + var stream = + client.makeRequest([Header.ascii('a', 'b')], endStream: true); + + var messages = await stream.incomingMessages.toList(); + expect(messages, hasLength(1)); + expect(messages[0] is HeadersStreamMessage, true); + expect( + (messages[0] as HeadersStreamMessage).headers[0], isHeader('x', 'y')); + + expect(await stream.peerPushes.toList(), isEmpty); + }); + + // By default, the stream concurrency level is set to this limit. + const kDefaultStreamLimit = 100; + transportTest('enabled-push-100', (ClientTransportConnection client, + ServerTransportConnection server) async { + // To ensure the limit is kept up-to-date with closing/opening streams, we + // retry this. + const kRepetitions = 20; + + Future serverFun() async { + await for (ServerTransportStream stream in server.incomingStreams) { + var pushes = []; + for (var i = 0; i < kDefaultStreamLimit; i++) { + expect(stream.canPush, true); + pushes.add(stream.push([Header.ascii('a', 'b')])); + } + + // Now we should have reached the limit and we should not be able to + // create more pushes. + expect(stream.canPush, false); + expect(() => stream.push([Header.ascii('a', 'b')]), + throwsA(const TypeMatcher())); + + // Finish the pushes + for (var pushedStream in pushes) { + pushedStream + .sendHeaders([Header.ascii('e', 'nd')], endStream: true); + await pushedStream.incomingMessages.toList(); + } + + // Finish the stream. + stream.sendHeaders([Header.ascii('x', 'y')], endStream: true); + expect(await stream.incomingMessages.toList(), hasLength(1)); + } + } + + Future clientFun() async { + for (var i = 0; i < kRepetitions; i++) { + var stream = + client.makeRequest([Header.ascii('a', 'b')], endStream: true); + + Future expectPeerPushes() async { + var numberOfPushes = 0; + await for (TransportStreamPush pushedStream in stream.peerPushes) { + numberOfPushes++; + var messages = + await pushedStream.stream.incomingMessages.toList(); + expect(messages, hasLength(1)); + expect((messages[0] as HeadersStreamMessage).headers[0], + isHeader('e', 'nd')); + expect(await pushedStream.stream.peerPushes.toList(), isEmpty); + } + return numberOfPushes; + } + + // Wait for the end of the normal stream. + var messages = await stream.incomingMessages.toList(); + expect(messages, hasLength(1)); + expect(messages[0] is HeadersStreamMessage, true); + expect((messages[0] as HeadersStreamMessage).headers[0], + isHeader('x', 'y')); + + expect(await expectPeerPushes(), kDefaultStreamLimit); + } + } + + var serverFuture = serverFun(); + + await clientFun(); + await client.terminate(); + await serverFuture; + }, + clientSettings: const ClientSettings( + concurrentStreamLimit: kDefaultStreamLimit, + allowServerPushes: true)); + + transportTest('early-shutdown', (ClientTransportConnection client, + ServerTransportConnection server) async { + Future serverFun() async { + await for (ServerTransportStream stream in server.incomingStreams) { + stream.sendHeaders([Header.ascii('x', 'y')], endStream: true); + expect(await stream.incomingMessages.toList(), hasLength(1)); + } + await server.finish(); + } + + Future clientFun() async { + var headers = [Header.ascii('a', 'b')]; + var stream = client.makeRequest(headers, endStream: true); + var finishFuture = client.finish(); + var messages = await stream.incomingMessages.toList(); + expect(messages, hasLength(1)); + await finishFuture; + } + + await Future.wait([serverFun(), clientFun()]); + }); + + transportTest('client-terminates-stream', (ClientTransportConnection client, + ServerTransportConnection server) async { + var readyForError = Completer(); + + Future serverFun() async { + await for (ServerTransportStream stream in server.incomingStreams) { + stream.sendHeaders([Header.ascii('x', 'y')], endStream: true); + stream.incomingMessages.listen(expectAsync1((msg) { + expect(msg, isA()); + readyForError.complete(); + }), onError: expectAsync1((Object error) { + expect('$error', contains('Stream was terminated by peer')); + })); + } + await server.finish(); + } + + Future clientFun() async { + var headers = [Header.ascii('a', 'b')]; + var stream = client.makeRequest(headers, endStream: false); + await readyForError.future; + stream.terminate(); + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + transportTest('server-terminates-stream', (ClientTransportConnection client, + ServerTransportConnection server) async { + Future serverFun() async { + await for (ServerTransportStream stream in server.incomingStreams) { + stream.terminate(); + } + await server.finish(); + } + + Future clientFun() async { + var headers = [Header.ascii('a', 'b')]; + var stream = client.makeRequest(headers, endStream: true); + var messageList = stream.incomingMessages.toList(); + await messageList.catchError(expectAsync1((Object error) { + expect('$error', contains('Stream was terminated by peer')); + return []; + })); + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + transportTest('client-terminates-stream-after-half-close', + (ClientTransportConnection client, + ServerTransportConnection server) async { + var readyForError = Completer(); + + Future serverFun() async { + await for (ServerTransportStream stream in server.incomingStreams) { + stream.onTerminated = expectAsync1((Object? errorCode) { + expect(errorCode, 8); + }, count: 1); + stream.sendHeaders([Header.ascii('x', 'y')], endStream: false); + stream.incomingMessages.listen( + expectAsync1((msg) { + expect(msg, isA()); + }), + onError: expectAsync1((Object _) {}, count: 0), + onDone: expectAsync0(() { + readyForError.complete(); + }, count: 1), + ); + } + await server.finish(); + } + + Future clientFun() async { + var headers = [Header.ascii('a', 'b')]; + var stream = client.makeRequest(headers, endStream: true); + await stream.outgoingMessages.close(); + await readyForError.future; + stream.terminate(); + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + transportTest('server-terminates-stream-after-half-close', + (ClientTransportConnection client, + ServerTransportConnection server) async { + var readyForError = Completer(); + + Future serverFun() async { + await for (ServerTransportStream stream in server.incomingStreams) { + stream.sendHeaders([Header.ascii('x', 'y')], endStream: false); + stream.incomingMessages.listen( + expectAsync1((msg) async { + expect(msg, isA()); + await readyForError.future; + stream.terminate(); + }), + onError: expectAsync1((Object _) {}, count: 0), + onDone: expectAsync0(() {}, count: 1), + ); + } + await server.finish(); + } + + Future clientFun() async { + var headers = [Header.ascii('a', 'b')]; + var stream = client.makeRequest(headers, endStream: false); + stream.onTerminated = expectAsync1((Object? errorCode) { + expect(errorCode, 8); + }, count: 1); + readyForError.complete(); + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + }); + + transportTest('idle-handler', (ClientTransportConnection client, + ServerTransportConnection server) async { + Future serverFun() async { + var activeCount = 0; + var idleCount = 0; + server.onActiveStateChanged = expectAsync1((active) { + if (active) { + activeCount++; + } else { + idleCount++; + } + }, count: 6); + await for (final stream in server.incomingStreams) { + stream.sendHeaders([]); + unawaited(stream.incomingMessages + .toList() + .then((_) => stream.outgoingMessages.close())); + } + await server.finish(); + expect(activeCount, 3); + expect(idleCount, 3); + } + + Future clientFun() async { + var activeCount = 0; + var idleCount = 0; + client.onActiveStateChanged = expectAsync1((active) { + if (active) { + activeCount++; + } else { + idleCount++; + } + }, count: 6); + final streams = List.generate( + 5, (_) => client.makeRequest([])); + await Future.wait(streams.map((s) => s.outgoingMessages.close())); + await Future.wait(streams.map((s) => s.incomingMessages.toList())); + // This extra await is needed to allow the idle handler to run before + // verifying the idleCount, because the stream cleanup runs + // asynchronously after the stream is closed. + await Future.value(); + expect(activeCount, 1); + expect(idleCount, 1); + + var stream = client.makeRequest([]); + await stream.outgoingMessages.close(); + await stream.incomingMessages.toList(); + await Future.value(); + + stream = client.makeRequest([]); + await stream.outgoingMessages.close(); + await stream.incomingMessages.toList(); + await Future.value(); + + await client.finish(); + expect(activeCount, 3); + expect(idleCount, 3); + } + + await Future.wait([clientFun(), serverFun()]); + }); + + group('flow-control', () { + const kChunkSize = 1024; + const kNumberOfMessages = 1000; + final headers = [Header.ascii('a', 'b')]; + + Future testWindowSize( + ClientTransportConnection client, + ServerTransportConnection server, + int expectedStreamFlowcontrolWindow) async { + expect(expectedStreamFlowcontrolWindow, + lessThan(kChunkSize * kNumberOfMessages)); + + var serverSentBytes = 0; + var flowcontrolWindowFull = Completer(); + + Future serverFun() async { + await for (ServerTransportStream stream in server.incomingStreams) { + stream.sendHeaders([Header.ascii('x', 'y')]); + + var messageNr = 0; + var controller = StreamController(); + void addData() { + if (!controller.isPaused) { + if (messageNr < kNumberOfMessages) { + var messageBytes = Uint8List(kChunkSize); + for (var j = 0; j < messageBytes.length; j++) { + messageBytes[j] = (messageNr + j) % 256; + } + controller.add(DataStreamMessage(messageBytes)); + + messageNr++; + serverSentBytes += messageBytes.length; + + Timer.run(addData); + } else { + if (!controller.isClosed) controller.close(); + } + } + } + + controller + ..onListen = addData + ..onPause = expectAsync0(() { + // Assert that we're now at the place (since the granularity + // of adding is [kChunkSize], it could be that we added + // [kChunkSize - 1] bytes more than allowed, before getting + // the pause event). + expect(serverSentBytes - kChunkSize + 1, + lessThan(expectedStreamFlowcontrolWindow)); + flowcontrolWindowFull.complete(); + }) + ..onResume = addData + ..onCancel = () {}; + + await stream.outgoingMessages.addStream(controller.stream); + await stream.outgoingMessages.close(); + await stream.incomingMessages.toList(); + } + await server.finish(); + } + + Future clientFun() async { + var stream = client.makeRequest(headers, endStream: true); + + var gotHeadersFrame = false; + var byteNr = 0; + + var sub = stream.incomingMessages.listen((message) { + if (!gotHeadersFrame) { + expect(message, isA()); + gotHeadersFrame = true; + } else { + expect(message, isA()); + var dataMessage = message as DataStreamMessage; + + // We're just testing the first byte, to make the test faster. + expect(dataMessage.bytes[0], + ((byteNr ~/ kChunkSize) + (byteNr % kChunkSize)) % 256); + + byteNr += dataMessage.bytes.length; + } + }); + + // We pause immediately, making the server fill the stream flowcontrol + // window. + sub.pause(); + + await flowcontrolWindowFull.future; + sub.resume(); + await client.finish(); + } + + await Future.wait([serverFun(), clientFun()]); + } + + transportTest('fast-sender-receiver-paused--default-window-size', + (ClientTransportConnection client, + ServerTransportConnection server) async { + await testWindowSize(client, server, Window().size); + }); + + transportTest('fast-sender-receiver-paused--10kb-window-size', + (ClientTransportConnection client, + ServerTransportConnection server) async { + await testWindowSize(client, server, 8096); + }, clientSettings: const ClientSettings(streamWindowSize: 8096)); + }); + }); +} + +void transportTest( + String name, + Future Function(ClientTransportConnection, ServerTransportConnection) + func, + {ClientSettings? clientSettings, + ServerSettings? serverSettings}) { + return test(name, () { + var bidirectional = BidirectionalConnection(); + bidirectional.clientSettings = clientSettings; + bidirectional.serverSettings = serverSettings; + var client = bidirectional.clientConnection; + var server = bidirectional.serverConnection; + return func(client, server); + }); +} + +class BidirectionalConnection { + ClientSettings? clientSettings; + ServerSettings? serverSettings; + + final StreamController> writeA = StreamController(); + final StreamController> writeB = StreamController(); + + Stream> get readA => writeA.stream; + + Stream> get readB => writeB.stream; + + ClientTransportConnection get clientConnection => + ClientTransportConnection.viaStreams(readA, writeB.sink, + settings: clientSettings); + + ServerTransportConnection get serverConnection => + ServerTransportConnection.viaStreams(readB, writeA.sink, + settings: serverSettings); +} diff --git a/pkgs/http_client_conformance_tests/.gitattributes b/pkgs/http_client_conformance_tests/.gitattributes new file mode 100644 index 0000000000..104d0ecaf9 --- /dev/null +++ b/pkgs/http_client_conformance_tests/.gitattributes @@ -0,0 +1,2 @@ +lib/src/*_server_vm.dart linguist-generated=true +lib/src/*_server_web.dart linguist-generated=true diff --git a/pkgs/http_client_conformance_tests/LICENSE b/pkgs/http_client_conformance_tests/LICENSE new file mode 100644 index 0000000000..000cd7beca --- /dev/null +++ b/pkgs/http_client_conformance_tests/LICENSE @@ -0,0 +1,27 @@ +Copyright 2014, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. diff --git a/pkgs/http_client_conformance_tests/README.md b/pkgs/http_client_conformance_tests/README.md new file mode 100644 index 0000000000..631401f6f7 --- /dev/null +++ b/pkgs/http_client_conformance_tests/README.md @@ -0,0 +1,44 @@ +[![pub package](https://img.shields.io/pub/v/http_client_conformance_tests.svg)](https://pub.dev/packages/http_client_conformance_tests) + +A library that tests whether implementations of `package:http` +[`Client`](https://pub.dev/documentation/http/latest/http/Client-class.html) +behave as expected. + +This package is intended to be used in the tests of packages that implement +`package:http` +[`Client`](https://pub.dev/documentation/http/latest/http/Client-class.html). + +The tests work by starting a series of test servers and running the provided +`package:http` +[`Client`](https://pub.dev/documentation/http/latest/http/Client-class.html) +against them. + +## Usage + +`package:http_client_conformance_tests` is meant to be used in the tests suite +of a `package:http` +[`Client`](https://pub.dev/documentation/http/latest/http/Client-class.html) +like: + +```dart +import 'package:http/http.dart'; +import 'package:test/test.dart'; + +import 'package:http_client_conformance_tests/http_client_conformance_tests.dart'; + +class MyHttpClient extends BaseClient { + @override + Future send(BaseRequest request) async { + // Your implementation here. + } +} + +void main() { + group('client conformance tests', () { + testAll(MyHttpClient()); + }); +} +``` + +**Note**: This package does not have its own tests, instead it is +exercised by the tests in `package:http`. diff --git a/pkgs/http_client_conformance_tests/bin/generate_server_wrappers.dart b/pkgs/http_client_conformance_tests/bin/generate_server_wrappers.dart new file mode 100644 index 0000000000..52e9d766c3 --- /dev/null +++ b/pkgs/http_client_conformance_tests/bin/generate_server_wrappers.dart @@ -0,0 +1,59 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Generates the '*_server_vm.dart' and '*_server_web.dart' support files. +library; + +import 'dart:core'; +import 'dart:io'; + +import 'package:dart_style/dart_style.dart'; + +const _export = '''export 'server_queue_helpers.dart' + show StreamQueueOfNullableObjectExtension;'''; + +const _vm = '''// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import ''; + +$_export + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} +'''; + +const _web = '''// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +$_export + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/')); +'''; + +void main() async { + final files = await Directory('lib/src').list().toList(); + final formatter = + DartFormatter(languageVersion: DartFormatter.latestLanguageVersion); + + files.where((file) => file.path.endsWith('_server.dart')).forEach((file) { + final vmPath = file.path.replaceAll('_server.dart', '_server_vm.dart'); + File(vmPath).writeAsStringSync(formatter.format(_vm.replaceAll( + '', file.uri.pathSegments.last))); + + final webPath = file.path.replaceAll('_server.dart', '_server_web.dart'); + File(webPath).writeAsStringSync(formatter.format(_web.replaceAll( + '', file.uri.pathSegments.last))); + }); +} diff --git a/pkgs/http_client_conformance_tests/example/client_test.dart b/pkgs/http_client_conformance_tests/example/client_test.dart new file mode 100644 index 0000000000..0b4bbb3089 --- /dev/null +++ b/pkgs/http_client_conformance_tests/example/client_test.dart @@ -0,0 +1,17 @@ +import 'package:http/http.dart'; +import 'package:http_client_conformance_tests/http_client_conformance_tests.dart'; +import 'package:test/test.dart'; + +class MyHttpClient extends BaseClient { + @override + Future send(BaseRequest request) async { + // Your implementation here. + throw UnsupportedError('implement this method'); + } +} + +void main() { + group('client conformance tests', () { + testAll(MyHttpClient.new); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/http_client_conformance_tests.dart b/pkgs/http_client_conformance_tests/lib/http_client_conformance_tests.dart new file mode 100644 index 0000000000..1a43a6b144 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/http_client_conformance_tests.dart @@ -0,0 +1,114 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http/http.dart'; + +import 'src/close_tests.dart'; +import 'src/compressed_response_body_tests.dart'; +import 'src/isolate_test.dart'; +import 'src/multipart_tests.dart'; +import 'src/multiple_clients_tests.dart'; +import 'src/redirect_tests.dart'; +import 'src/request_body_streamed_tests.dart'; +import 'src/request_body_tests.dart'; +import 'src/request_cookies_test.dart'; +import 'src/request_headers_tests.dart'; +import 'src/request_methods_tests.dart'; +import 'src/response_body_streamed_test.dart'; +import 'src/response_body_tests.dart'; +import 'src/response_cookies_test.dart'; +import 'src/response_headers_tests.dart'; +import 'src/response_status_line_tests.dart'; +import 'src/server_errors_test.dart'; + +export 'src/close_tests.dart' show testClose; +export 'src/compressed_response_body_tests.dart' + show testCompressedResponseBody; +export 'src/isolate_test.dart' show testIsolate; +export 'src/multipart_tests.dart' show testMultipartRequests; +export 'src/multiple_clients_tests.dart' show testMultipleClients; +export 'src/redirect_tests.dart' show testRedirect; +export 'src/request_body_streamed_tests.dart' show testRequestBodyStreamed; +export 'src/request_body_tests.dart' show testRequestBody; +export 'src/request_cookies_test.dart' show testRequestCookies; +export 'src/request_headers_tests.dart' show testRequestHeaders; +export 'src/request_methods_tests.dart' show testRequestMethods; +export 'src/response_body_streamed_test.dart' show testResponseBodyStreamed; +export 'src/response_body_tests.dart' show testResponseBody; +export 'src/response_cookies_test.dart' show testResponseCookies; +export 'src/response_headers_tests.dart' show testResponseHeaders; +export 'src/response_status_line_tests.dart' show testResponseStatusLine; +export 'src/server_errors_test.dart' show testServerErrors; + +/// Runs the entire test suite against the given [Client]. +/// +/// If [canStreamRequestBody] is `false` then tests that assume that the +/// [Client] supports sending HTTP requests with unbounded body sizes will be +/// skipped. +// +/// If [canStreamResponseBody] is `false` then tests that assume that the +/// [Client] supports receiving HTTP responses with unbounded body sizes will +/// be skipped +/// +/// If [redirectAlwaysAllowed] is `true` then tests that require the [Client] +/// to limit redirects will be skipped. +/// +/// If [canWorkInIsolates] is `false` then tests that require that the [Client] +/// work in Isolates other than the main isolate will be skipped. +/// +/// If [preservesMethodCase] is `false` then tests that assume that the +/// [Client] preserves custom request method casing will be skipped. +/// +/// If [canSendCookieHeaders] is `false` then tests that require that "cookie" +/// headers be sent by the client will not be run. +/// +/// If [canReceiveSetCookieHeaders] is `false` then tests that require that +/// "set-cookie" headers be received by the client will not be run. +/// +/// If [supportsFoldedHeaders] is `false` then the tests that assume that the +/// [Client] can parse folded headers will be skipped. +/// +/// If [supportsMultipartRequest] is `false` then tests that assume that +/// multipart requests can be sent will be skipped. +/// +/// The tests are run against a series of HTTP servers that are started by the +/// tests. If the tests are run in the browser, then the test servers are +/// started in another process. Otherwise, the test servers are run in-process. +void testAll( + Client Function() clientFactory, { + bool canStreamRequestBody = true, + bool canStreamResponseBody = true, + bool redirectAlwaysAllowed = false, + bool canWorkInIsolates = true, + bool preservesMethodCase = false, + bool supportsFoldedHeaders = true, + bool canSendCookieHeaders = false, + bool canReceiveSetCookieHeaders = false, + bool supportsMultipartRequest = true, +}) { + testRequestBody(clientFactory()); + testRequestBodyStreamed(clientFactory(), + canStreamRequestBody: canStreamRequestBody); + testResponseBody(clientFactory(), + canStreamResponseBody: canStreamResponseBody); + testResponseBodyStreamed(clientFactory(), + canStreamResponseBody: canStreamResponseBody); + testRequestHeaders(clientFactory()); + testRequestMethods(clientFactory(), preservesMethodCase: preservesMethodCase); + testResponseHeaders(clientFactory(), + supportsFoldedHeaders: supportsFoldedHeaders); + testResponseStatusLine(clientFactory()); + testRedirect(clientFactory(), redirectAlwaysAllowed: redirectAlwaysAllowed); + testServerErrors(clientFactory()); + testCompressedResponseBody(clientFactory()); + testMultipleClients(clientFactory); + testMultipartRequests(clientFactory(), + supportsMultipartRequest: supportsMultipartRequest); + testClose(clientFactory); + testIsolate(clientFactory, canWorkInIsolates: canWorkInIsolates); + testRequestCookies(clientFactory(), + canSendCookieHeaders: canSendCookieHeaders); + testResponseCookies(clientFactory(), + canReceiveSetCookieHeaders: canReceiveSetCookieHeaders); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/close_tests.dart b/pkgs/http_client_conformance_tests/lib/src/close_tests.dart new file mode 100644 index 0000000000..39324ad7c6 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/close_tests.dart @@ -0,0 +1,53 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'request_body_server_vm.dart' + if (dart.library.js_interop) 'request_body_server_web.dart'; + +/// Tests that the [Client] correctly implements [Client.close]. +void testClose(Client Function() clientFactory) { + group('close', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('close no request', () async { + clientFactory().close(); + }); + + test('close after request', () async { + final client = clientFactory(); + await client.post(Uri.http(host, ''), body: 'Hello'); + client.close(); + }); + + test('multiple close after request', () async { + final client = clientFactory(); + await client.post(Uri.http(host, ''), body: 'Hello'); + client + ..close() + ..close(); + }); + + test('request after close', () async { + final client = clientFactory(); + await client.post(Uri.http(host, ''), body: 'Hello'); + client.close(); + expect(() async => await client.post(Uri.http(host, ''), body: 'Hello'), + throwsA(isA())); + }); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server.dart b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server.dart new file mode 100644 index 0000000000..bb4b95d1e8 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server.dart @@ -0,0 +1,62 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that responds with "Hello World!" +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Request Received: +/// - send headers as `Map>` +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + final server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + const message = 'Hello World!'; + late List contents; + + await request.drain(); + + final headers = >{}; + request.headers.forEach((field, value) { + headers[field] = value; + }); + channel.sink.add(headers); + + request.response.headers.set('Access-Control-Allow-Origin', '*'); + request.response.headers.set('Content-Type', 'text/plain'); + + if (request.requestedUri.pathSegments.isNotEmpty) { + if (request.requestedUri.pathSegments.last == 'gzip') { + request.response.headers.set('Content-Encoding', 'gzip'); + contents = gzip.encode(message.codeUnits); + } + if (request.requestedUri.pathSegments.last == 'deflate') { + request.response.headers.set('Content-Encoding', 'deflate'); + contents = zlib.encode(message.codeUnits); + } + if (request.requestedUri.pathSegments.last == 'upper') { + request.response.headers.set('Content-Encoding', 'upper'); + contents = message.toUpperCase().codeUnits; + } + } + + if (request.requestedUri.queryParameters.containsKey('length')) { + request.response.contentLength = contents.length; + } + request.response.add(contents); + await request.response.close(); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_vm.dart new file mode 100644 index 0000000000..a5ae1e0529 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'compressed_response_body_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_web.dart new file mode 100644 index 0000000000..7b1d1a6368 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_web.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: + 'http_client_conformance_tests/src/compressed_response_body_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart new file mode 100644 index 0000000000..538b3ba4de --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart @@ -0,0 +1,86 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'compressed_response_body_server_vm.dart' + if (dart.library.js_interop) 'compressed_response_body_server_web.dart'; + +/// Tests that the [Client] correctly implements HTTP responses with compressed +/// bodies. +/// +/// If the response is encoded using a recognized 'Content-Encoding' then the +/// [Client] must decode it. Otherwise it must return the content unchanged. +/// +/// The 'Content-Encoding' and 'Content-Length' headers may be absent for +/// responses with a 'Content-Encoding' and, if present, their values are +/// undefined. +/// +/// The value of `StreamedResponse.contentLength` is not defined for responses +/// with a 'Content-Encoding' header. +void testCompressedResponseBody(Client client) async { + group('response body', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + const message = 'Hello World!'; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('gzip: small response with content length', () async { + // Test a supported content encoding. + final response = await client.get(Uri.http(host, '/gzip')); + final requestHeaders = await httpServerQueue.next as Map; + + expect((requestHeaders['accept-encoding'] as List).join(', '), + contains('gzip')); + expect(response.body, message); + expect(response.bodyBytes, message.codeUnits); + expect(response.contentLength, message.length); + expect(response.headers['content-type'], 'text/plain'); + expect(response.isRedirect, isFalse); + expect(response.reasonPhrase, 'OK'); + expect(response.request!.method, 'GET'); + expect(response.statusCode, 200); + }); + + test('gzip: small response streamed with content length', () async { + // Test a supported content encoding. + final request = Request('GET', Uri.http(host, '/gzip', {'length': ''})); + final response = await client.send(request); + final requestHeaders = await httpServerQueue.next as Map; + + expect((requestHeaders['accept-encoding'] as List).join(', '), + contains('gzip')); + expect(await response.stream.bytesToString(), message); + expect(response.headers['content-type'], 'text/plain'); + expect(response.isRedirect, isFalse); + expect(response.reasonPhrase, 'OK'); + expect(response.request!.method, 'GET'); + expect(response.statusCode, 200); + }); + + test('upper: small response streamed with content length', () async { + // Test an unsupported content encoding. + final request = Request('GET', Uri.http(host, '/upper', {'length': ''})); + final response = await client.send(request); + await httpServerQueue.next; + + expect(await response.stream.bytesToString(), message.toUpperCase()); + expect(response.headers['content-type'], 'text/plain'); + expect(response.isRedirect, isFalse); + expect(response.reasonPhrase, 'OK'); + expect(response.request!.method, 'GET'); + expect(response.statusCode, 200); + }); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/dummy_isolate.dart b/pkgs/http_client_conformance_tests/lib/src/dummy_isolate.dart new file mode 100644 index 0000000000..0f592220f1 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/dummy_isolate.dart @@ -0,0 +1,10 @@ +import 'dart:async'; + +// ignore: avoid_classes_with_only_static_members +/// An Isolate implementation for the web that throws when used. +abstract class Isolate { + static Future run(FutureOr Function() computation, + {String? debugName}) => + throw ArgumentError.value('true', 'canWorkInIsolates', + 'isolate tests are not supported on the web'); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart b/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart new file mode 100644 index 0000000000..1f5559b69d --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart @@ -0,0 +1,51 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:isolate' if (dart.library.js_interop) 'dummy_isolate.dart'; + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'request_body_server_vm.dart' + if (dart.library.js_interop) 'request_body_server_web.dart'; + +Future _testPost(Client Function() clientFactory, String host) async { + await Isolate.run( + () => clientFactory().post(Uri.http(host, ''), body: 'Hello World!')); +} + +/// Tests that the [Client] is usable from Isolates other than the main +/// isolate. +/// +/// If [canWorkInIsolates] is `false` then the tests will be skipped. +void testIsolate(Client Function() clientFactory, + {bool canWorkInIsolates = true}) { + group('test isolate', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('client.post() with string body', () async { + await _testPost(clientFactory, host); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next; + + expect(serverReceivedContentType, ['text/plain; charset=utf-8']); + expect(serverReceivedBody, 'Hello World!'); + }); + }, + skip: canWorkInIsolates + ? false + : 'does not work outside of the main isolate'); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/multipart_server.dart b/pkgs/http_client_conformance_tests/lib/src/multipart_server.dart new file mode 100644 index 0000000000..3072090dec --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/multipart_server.dart @@ -0,0 +1,53 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that captures the request headers and body. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Request Received: +/// - send the received headers and request body +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + request.response.headers.set('Access-Control-Allow-Origin', '*'); + request.response + ..contentLength = 0 + ..statusCode = HttpStatus.ok; + + if (request.method == 'OPTIONS') { + // Handle a CORS preflight request: + // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#preflighted_requests + request.response.headers + ..set('Access-Control-Allow-Methods', '*') + ..set('Access-Control-Allow-Headers', '*'); + await request.response.close(); + } else { + final headers = >{}; + request.headers.forEach((field, value) { + headers[field] = value; + }); + final body = + await const Utf8Decoder().bind(request).fold('', (x, y) => '$x$y'); + await request.response.close(); + channel.sink.add([headers, body]); + } + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/multipart_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/multipart_server_vm.dart new file mode 100644 index 0000000000..3168e6c036 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/multipart_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'multipart_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/multipart_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/multipart_server_web.dart new file mode 100644 index 0000000000..8d8e88108a --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/multipart_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/multipart_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/multipart_tests.dart b/pkgs/http_client_conformance_tests/lib/src/multipart_tests.dart new file mode 100644 index 0000000000..0277e30935 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/multipart_tests.dart @@ -0,0 +1,52 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'multipart_server_vm.dart' + if (dart.library.js_interop) 'multipart_server_web.dart'; + +/// Tests that the [Client] correctly sends [MultipartRequest]. +/// +/// If [supportsMultipartRequest] is `false` then tests that assume that +/// multipart requests can be sent will be skipped. +void testMultipartRequests(Client client, + {required bool supportsMultipartRequest}) async { + group('multipart requests', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('attached file', () async { + final request = MultipartRequest('POST', Uri.http(host, '')); + + request.files.add(MultipartFile.fromString('file1', 'Hello World')); + + await client.send(request); + final serverRequest = await httpServerQueue.next as List; + final headers = (serverRequest[0] as Map).cast>(); + final body = serverRequest[1] as String; + expect(headers['content-length']!.single, '${request.contentLength}'); + expect(headers['content-type']!.single, + startsWith('multipart/form-data; boundary=')); + expect(body, contains('''content-type: text/plain; charset=utf-8\r +content-disposition: form-data; name="file1"\r +\r +Hello World''')); + }); + }, + skip: supportsMultipartRequest + ? false + : 'does not support multipart requests'); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server.dart b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server.dart new file mode 100644 index 0000000000..171f6aeb04 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server.dart @@ -0,0 +1,35 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that responds the client request path. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + final server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + request.response.headers.set('Access-Control-Allow-Origin', '*'); + + await request.drain(); + + if (request.requestedUri.pathSegments.isNotEmpty) { + request.response.write(request.requestedUri.pathSegments.last); + } + await Future.delayed(const Duration(seconds: 1)); + await request.response.close(); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_vm.dart new file mode 100644 index 0000000000..f00f4baffc --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'multiple_clients_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_web.dart new file mode 100644 index 0000000000..3f71aa75cb --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/multiple_clients_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart new file mode 100644 index 0000000000..ad40d4a1a9 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart @@ -0,0 +1,41 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'multiple_clients_server_vm.dart' + if (dart.library.js_interop) 'multiple_clients_server_web.dart'; + +/// Tests that the [Client] works correctly if there are many used +/// simultaneously. +void testMultipleClients(Client Function() clientFactory) async { + group('test multiple clients', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('multiple clients with simultaneous requests', () async { + final responseFutures = >[]; + for (var i = 0; i < 5; ++i) { + final client = clientFactory(); + responseFutures.add(client.get(Uri.http(host, '/$i'))); + } + final responses = await Future.wait(responseFutures); + for (var i = 0; i < 5; ++i) { + expect(responses[i].statusCode, 200); + expect(responses[i].body, i.toString()); + } + }); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/redirect_server.dart b/pkgs/http_client_conformance_tests/lib/src/redirect_server.dart new file mode 100644 index 0000000000..2813e32239 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/redirect_server.dart @@ -0,0 +1,45 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server and sends the port back on the given channel. +/// +/// Quits when anything is received on the channel. +/// +/// URI | Redirects TO +/// ===========|============== +/// ".../loop" | ".../loop" +/// ".../10" | ".../9" +/// ".../9" | ".../8" +/// ... | ... +/// ".../1" | "/" +/// "/" | <200 return> +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = await HttpServer.bind('localhost', 0) + ..listen((request) async { + request.response.headers.set('Access-Control-Allow-Origin', '*'); + if (request.requestedUri.pathSegments.isEmpty) { + unawaited(request.response.close()); + } else if (request.requestedUri.pathSegments.last == 'loop') { + unawaited(request.response + .redirect(Uri.http('localhost:${server.port}', '/loop'))); + } else { + final n = int.parse(request.requestedUri.pathSegments.last); + final nextPath = n - 1 == 0 ? '' : '${n - 1}'; + unawaited(request.response + .redirect(Uri.http('localhost:${server.port}', '/$nextPath'))); + } + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/redirect_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/redirect_server_vm.dart new file mode 100644 index 0000000000..4a9450a1f5 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/redirect_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'redirect_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/redirect_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/redirect_server_web.dart new file mode 100644 index 0000000000..a5fb0f2880 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/redirect_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/redirect_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart b/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart new file mode 100644 index 0000000000..a33d077705 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart @@ -0,0 +1,117 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'redirect_server_vm.dart' + if (dart.library.js_interop) 'redirect_server_web.dart'; + +/// Tests that the [Client] correctly implements HTTP redirect logic. +/// +/// If [redirectAlwaysAllowed] is `true` then tests that require the [Client] +/// to limit redirects will be skipped. +void testRedirect(Client client, {bool redirectAlwaysAllowed = false}) async { + group('redirects', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('no redirect', () async { + final request = Request('GET', Uri.http(host, '/')) + ..followRedirects = false; + final response = await client.send(request); + expect(response.statusCode, 200); + expect(response.isRedirect, false); + if (response case BaseResponseWithUrl(url: final url)) { + expect(url, Uri.http(host, '/')); + } + }); + + test('disallow redirect', () async { + final request = Request('GET', Uri.http(host, '/1')) + ..followRedirects = false; + final response = await client.send(request); + expect(response.statusCode, 302); + expect(response.isRedirect, true); + if (response case BaseResponseWithUrl(url: final url)) { + expect(url, Uri.http(host, '/1')); + } + }, skip: redirectAlwaysAllowed ? 'redirects always allowed' : false); + + test('disallow redirect, 0 maxRedirects', () async { + final request = Request('GET', Uri.http(host, '/1')) + ..followRedirects = false + ..maxRedirects = 0; + final response = await client.send(request); + expect(response.statusCode, 302); + expect(response.isRedirect, true); + if (response case BaseResponseWithUrl(url: final url)) { + expect(url, Uri.http(host, '/1')); + } + }, skip: redirectAlwaysAllowed ? 'redirects always allowed' : false); + + test('allow redirect', () async { + final request = Request('GET', Uri.http(host, '/1')) + ..followRedirects = true; + final response = await client.send(request); + expect(response.statusCode, 200); + expect(response.isRedirect, false); + if (response case BaseResponseWithUrl(url: final url)) { + expect(url, Uri.http(host, '/')); + } + }); + + test('allow redirect, 0 maxRedirects', () async { + final request = Request('GET', Uri.http(host, '/1')) + ..followRedirects = true + ..maxRedirects = 0; + expect( + client.send(request), + throwsA(isA() + .having((e) => e.message, 'message', 'Redirect limit exceeded'))); + }, skip: redirectAlwaysAllowed ? 'redirects always allowed' : false); + + test('exactly the right number of allowed redirects', () async { + final request = Request('GET', Uri.http(host, '/5')) + ..followRedirects = true + ..maxRedirects = 5; + final response = await client.send(request); + expect(response.statusCode, 200); + expect(response.isRedirect, false); + if (response case BaseResponseWithUrl(url: final url)) { + expect(url, Uri.http(host, '/')); + } + }, skip: redirectAlwaysAllowed ? 'redirects always allowed' : false); + + test('too many redirects', () async { + final request = Request('GET', Uri.http(host, '/6')) + ..followRedirects = true + ..maxRedirects = 5; + expect( + client.send(request), + throwsA(isA() + .having((e) => e.message, 'message', 'Redirect limit exceeded'))); + }, skip: redirectAlwaysAllowed ? 'redirects always allowed' : false); + + test( + 'loop', + () async { + final request = Request('GET', Uri.http(host, '/loop')) + ..followRedirects = true + ..maxRedirects = 5; + expect(client.send(request), throwsA(isA())); + }, + ); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_server.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_server.dart new file mode 100644 index 0000000000..9b61f4f64a --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_server.dart @@ -0,0 +1,56 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that captures the content type header and request +/// body. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Request Received: +/// - send "Content-Type" header +/// - send request body +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + request.response.headers.set('Access-Control-Allow-Origin', '*'); + if (request.method == 'OPTIONS') { + // Handle a CORS preflight request: + // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#preflighted_requests + request.response.headers + ..set('Access-Control-Allow-Methods', 'POST, DELETE') + ..set('Access-Control-Allow-Headers', 'Content-Type'); + } else { + channel.sink.add(request.headers[HttpHeaders.contentTypeHeader]); + try { + final serverReceivedBody = await const Utf8Decoder() + .bind(request) + .fold('', (p, e) => '$p$e'); + channel.sink.add(serverReceivedBody); + } on HttpException catch (e) { + // The server may through if the client disconnections. + // This can happen if there is an error in the request + // stream. + print('Request Body Server Exception: $e'); + return; + } + } + unawaited(request.response.close()); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_server_vm.dart new file mode 100644 index 0000000000..d2e1e4a185 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'request_body_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_server_web.dart new file mode 100644 index 0000000000..6b6ab0076a --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/request_body_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server.dart new file mode 100644 index 0000000000..428bb781eb --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server.dart @@ -0,0 +1,42 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that absorbs a request stream of integers and +/// signals the client to quit after 1000 have been received. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Integer == 1000 received: +/// - send 1000 +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + request.response.headers.set('Access-Control-Allow-Origin', '*'); + await const LineSplitter() + .bind(const Utf8Decoder().bind(request)) + .forEach((s) { + final lastReceived = int.parse(s.trim()); + if (lastReceived == 1000) { + channel.sink.add(lastReceived); + } + }); + unawaited(request.response.close()); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_vm.dart new file mode 100644 index 0000000000..c343d68309 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'request_body_streamed_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_web.dart new file mode 100644 index 0000000000..41477eef4d --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_web.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: + 'http_client_conformance_tests/src/request_body_streamed_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart new file mode 100644 index 0000000000..0f43505f53 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart @@ -0,0 +1,64 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'request_body_streamed_server_vm.dart' + if (dart.library.js_interop) 'request_body_streamed_server_web.dart'; + +/// Tests that the [Client] correctly implements streamed request body +/// uploading. +/// +/// If [canStreamRequestBody] is `false` then tests that assume that the +/// [Client] supports sending HTTP requests with unbounded body sizes will be +/// skipped. +void testRequestBodyStreamed(Client client, + {bool canStreamRequestBody = true}) { + group('streamed requests', () { + late String host; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + + setUp(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDown(() => httpServerChannel.sink.add(null)); + + test('client.send() with StreamedRequest', () async { + // The client continuously streams data to the server until + // instructed to stop (by setting `clientWriting` to `false`). + // The server sets `serverWriting` to `false` after it has + // already received some data. + // + // This ensures that the client supports streamed data sends. + var lastReceived = 0; + + Stream count() async* { + var i = 0; + unawaited( + httpServerQueue.next.then((value) => lastReceived = value as int)); + do { + yield '${i++}\n'; + // Let the event loop run. + await Future.delayed(const Duration()); + } while (lastReceived < 1000); + } + + final request = StreamedRequest('POST', Uri.http(host, '')); + const Utf8Encoder().bind(count()).listen(request.sink.add, + onError: request.sink.addError, onDone: request.sink.close); + await client.send(request); + + expect(lastReceived, greaterThanOrEqualTo(1000)); + }); + }, skip: canStreamRequestBody ? false : 'does not stream request bodies'); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart new file mode 100644 index 0000000000..98da3785a3 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart @@ -0,0 +1,323 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'request_body_server_vm.dart' + if (dart.library.js_interop) 'request_body_server_web.dart'; + +class _Plus2Decoder extends Converter, String> { + @override + String convert(List input) => + const Utf8Decoder().convert(input.map((e) => e + 2).toList()); +} + +class _Plus2Encoder extends Converter> { + @override + List convert(String input) => + const Utf8Encoder().convert(input).map((e) => e - 2).toList(); +} + +/// An encoding, meant for testing, the just decrements input bytes by 2. +class _Plus2Encoding extends Encoding { + @override + Converter, String> get decoder => _Plus2Decoder(); + + @override + Converter> get encoder => _Plus2Encoder(); + + @override + String get name => 'plus2'; +} + +/// Tests that the [Client] correctly implements HTTP requests with bodies e.g. +/// 'POST'. +void testRequestBody(Client client) { + group('request body', () { + late String host; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + + setUp(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDown(() => httpServerChannel.sink.add(null)); + + test('client.post() with string body', () async { + await client.post(Uri.http(host, ''), body: 'Hello World!'); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next; + + expect(serverReceivedContentType, ['text/plain; charset=utf-8']); + expect(serverReceivedBody, 'Hello World!'); + }); + + test('client.post() with string body and custom encoding', () async { + await client.post(Uri.http(host, ''), + body: 'Hello', encoding: _Plus2Encoding()); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next; + + expect(serverReceivedContentType, ['text/plain; charset=plus2']); + expect(serverReceivedBody, 'Fcjjm'); + }); + + test('client.post() with map body', () async { + await client.post(Uri.http(host, ''), body: {'key': 'value'}); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next; + + expect(serverReceivedContentType, + ['application/x-www-form-urlencoded; charset=utf-8']); + expect(serverReceivedBody, 'key=value'); + }); + + test('client.post() with map body and encoding', () async { + await client.post(Uri.http(host, ''), + body: {'key': 'value'}, encoding: _Plus2Encoding()); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next; + + expect(serverReceivedContentType, + ['application/x-www-form-urlencoded; charset=plus2']); + expect(serverReceivedBody, 'gau;r]hqa'); // key=value + }); + + test('client.post() with List', () async { + await client.post(Uri.http(host, ''), body: [1, 2, 3, 4, 5]); + + await httpServerQueue.next; // Content-Type. + final serverReceivedBody = await httpServerQueue.next as String; + + // RFC 2616 7.2.1 says that: + // Any HTTP/1.1 message containing an entity-body SHOULD include a + // Content-Type header field defining the media type of that body. + // But we didn't set one explicitly so don't verify what the server + // received. + expect(serverReceivedBody.codeUnits, [1, 2, 3, 4, 5]); + }); + + test('client.post() with List and content-type', () async { + await client.post(Uri.http(host, ''), + headers: {'Content-Type': 'image/png'}, body: [1, 2, 3, 4, 5]); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next as String; + + expect(serverReceivedContentType, ['image/png']); + expect(serverReceivedBody.codeUnits, [1, 2, 3, 4, 5]); + }); + + test('client.post() with List with encoding', () async { + // Encoding should not affect binary payloads. + await client.post(Uri.http(host, ''), + body: [1, 2, 3, 4, 5], encoding: _Plus2Encoding()); + + await httpServerQueue.next; // Content-Type. + final serverReceivedBody = await httpServerQueue.next as String; + + // RFC 2616 7.2.1 says that: + // Any HTTP/1.1 message containing an entity-body SHOULD include a + // Content-Type header field defining the media type of that body. + // But we didn't set one explicitly so don't verify what the server + // received. + expect(serverReceivedBody.codeUnits, [1, 2, 3, 4, 5]); + }); + + test('client.post() with List with encoding and content-type', + () async { + // Encoding should not affect the payload but it should affect the + // content-type. + + await client.post(Uri.http(host, ''), + headers: {'Content-Type': 'image/png'}, + body: [1, 2, 3, 4, 5], + encoding: _Plus2Encoding()); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next as String; + + expect(serverReceivedContentType, ['image/png; charset=plus2']); + expect(serverReceivedBody.codeUnits, [1, 2, 3, 4, 5]); + }); + + test('client.send() with stream containing empty lists', () async { + final request = StreamedRequest('POST', Uri.http(host, '')); + request.headers['Content-Type'] = 'image/png'; + request.sink.add([]); + request.sink.add([]); + request.sink.add([1]); + request.sink.add([2]); + request.sink.add([]); + request.sink.add([3, 4]); + request.sink.add([]); + request.sink.add([5]); + // ignore: unawaited_futures + request.sink.close(); + await client.send(request); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next as String; + + expect(serverReceivedContentType, ['image/png']); + expect(serverReceivedBody.codeUnits, [1, 2, 3, 4, 5]); + }); + + test('client.send() with slow stream', () async { + Stream> stream() async* { + await Future.delayed(const Duration(milliseconds: 100)); + yield [1]; + await Future.delayed(const Duration(milliseconds: 100)); + yield [2]; + await Future.delayed(const Duration(milliseconds: 100)); + yield [3]; + await Future.delayed(const Duration(milliseconds: 100)); + yield [4]; + await Future.delayed(const Duration(milliseconds: 100)); + yield [5]; + await Future.delayed(const Duration(milliseconds: 100)); + yield [6, 7, 8]; + await Future.delayed(const Duration(milliseconds: 100)); + yield [9, 10]; + await Future.delayed(const Duration(milliseconds: 100)); + } + + final request = StreamedRequest('POST', Uri.http(host, '')); + request.headers['Content-Type'] = 'image/png'; + + stream().listen(request.sink.add, + onError: request.sink.addError, onDone: request.sink.close); + await client.send(request); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next as String; + + expect(serverReceivedContentType, ['image/png']); + expect(serverReceivedBody.codeUnits, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + }); + + test('client.send() with stream that raises', () async { + Stream> stream() async* { + yield [0]; + yield [1]; + throw ArgumentError('this is a test'); + } + + final request = StreamedRequest('POST', Uri.http(host, '')); + request.headers['Content-Type'] = 'image/png'; + + stream().listen(request.sink.add, + onError: request.sink.addError, onDone: request.sink.close); + + await expectLater(client.send(request), + throwsA(anyOf(isA(), isA()))); + }); + + test('client.send() GET with empty stream', () async { + final request = StreamedRequest('GET', Uri.http(host, '')); + request.headers['Content-Type'] = 'image/png'; + // ignore: unawaited_futures + request.sink.close(); + + final response = await client.send(request); + expect(response.statusCode, 200); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next as String; + + expect(serverReceivedContentType, ['image/png']); + expect(serverReceivedBody.codeUnits, []); + }); + + test('client.send() GET with stream containing only empty lists', () async { + final request = StreamedRequest('GET', Uri.http(host, '')); + request.headers['Content-Type'] = 'image/png'; + request.sink.add([]); + request.sink.add([]); + request.sink.add([]); + // ignore: unawaited_futures + request.sink.close(); + + final response = await client.send(request); + expect(response.statusCode, 200); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next as String; + + expect(serverReceivedContentType, ['image/png']); + expect(serverReceivedBody.codeUnits, []); + }); + + test('client.send() with persistentConnection', () async { + // Do five requests to verify that the connection persistence logic is + // correct. + for (var i = 0; i < 5; ++i) { + final request = Request('POST', Uri.http(host, '')) + ..headers['Content-Type'] = 'text/plain; charset=utf-8' + ..persistentConnection = true + ..body = 'Hello World $i'; + + final response = await client.send(request); + expect(response.statusCode, 200); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next as String; + + expect(serverReceivedContentType, ['text/plain; charset=utf-8']); + expect(serverReceivedBody, 'Hello World $i'); + } + }); + + test('client.send() with persistentConnection and body >64K', () async { + // 64KiB is special for the HTTP network API: + // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch + // See https://github.com/dart-lang/http/issues/977 + final body = ''.padLeft(64 * 1024, 'XYZ'); + + final request = Request('POST', Uri.http(host, '')) + ..headers['Content-Type'] = 'text/plain; charset=utf-8' + ..persistentConnection = true + ..body = body; + + final response = await client.send(request); + expect(response.statusCode, 200); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next as String; + + expect(serverReceivedContentType, ['text/plain; charset=utf-8']); + expect(serverReceivedBody, body); + }); + + test('client.send() GET with non-empty stream', () async { + final request = StreamedRequest('GET', Uri.http(host, '')); + request.headers['Content-Type'] = 'image/png'; + request.sink.add('Hello World!'.codeUnits); + // ignore: unawaited_futures + request.sink.close(); + + final response = await client.send(request); + expect(response.statusCode, 200); + + final serverReceivedContentType = await httpServerQueue.next; + final serverReceivedBody = await httpServerQueue.next as String; + + expect(serverReceivedContentType, ['image/png']); + expect(serverReceivedBody, 'Hello World!'); + // using io passes, on web body is not transmitted, on cupertino_http + // exception. + }, skip: 'unclear semantics for GET requests with body'); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_cookies_server.dart b/pkgs/http_client_conformance_tests/lib/src/request_cookies_server.dart new file mode 100644 index 0000000000..512fb5b1b4 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_cookies_server.dart @@ -0,0 +1,56 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that captures "cookie" headers. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Request Received: +/// - send a list of header lines starting with "cookie:" +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + late ServerSocket server; + + server = (await ServerSocket.bind('localhost', 0)) + ..listen((Socket socket) async { + final request = utf8.decoder.bind(socket).transform(const LineSplitter()); + + final cookies = []; + await for (final line in request) { + if (line.toLowerCase().startsWith('cookie:')) { + cookies.add(line); + } + + if (line.isEmpty) { + // A blank line indicates the end of the headers. + channel.sink.add(cookies); + break; + } + } + + socket.writeAll( + [ + 'HTTP/1.1 200 OK', + 'Access-Control-Allow-Origin: *', + 'Content-Length: 0', + '\r\n', // Add \r\n at the end of this header section. + ], + '\r\n', // Separate each field by \r\n. + ); + await socket.close(); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_cookies_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/request_cookies_server_vm.dart new file mode 100644 index 0000000000..1f30e5f871 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_cookies_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'request_cookies_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_cookies_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/request_cookies_server_web.dart new file mode 100644 index 0000000000..31d961b047 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_cookies_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/request_cookies_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_cookies_test.dart b/pkgs/http_client_conformance_tests/lib/src/request_cookies_test.dart new file mode 100644 index 0000000000..a4eb78cf56 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_cookies_test.dart @@ -0,0 +1,56 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'request_cookies_server_vm.dart' + if (dart.library.js_interop) 'request_cookies_server_web.dart'; + +// The an HTTP header into [name, value]. +final headerSplitter = RegExp(':[ \t]+'); + +/// Tests that the [Client] correctly sends "cookie" headers in the request. +/// +/// If [canSendCookieHeaders] is `false` then tests that require that "cookie" +/// headers be sent by the client will not be run. +void testRequestCookies(Client client, + {bool canSendCookieHeaders = false}) async { + group('request cookies', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('one cookie', () async { + await client + .get(Uri.http(host, ''), headers: {'cookie': 'SID=298zf09hf012fh2'}); + + final cookies = (await httpServerQueue.next as List).cast(); + expect(cookies, hasLength(1)); + final [header, value] = cookies[0].split(headerSplitter); + expect(header.toLowerCase(), 'cookie'); + expect(value, 'SID=298zf09hf012fh2'); + }, skip: canSendCookieHeaders ? false : 'cannot send cookie headers'); + + test('multiple cookies semicolon separated', () async { + await client.get(Uri.http(host, ''), + headers: {'cookie': 'SID=298zf09hf012fh2; lang=en-US'}); + + final cookies = (await httpServerQueue.next as List).cast(); + expect(cookies, hasLength(1)); + final [header, value] = cookies[0].split(headerSplitter); + expect(header.toLowerCase(), 'cookie'); + expect(value, 'SID=298zf09hf012fh2; lang=en-US'); + }, skip: canSendCookieHeaders ? false : 'cannot send cookie headers'); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_headers_server.dart b/pkgs/http_client_conformance_tests/lib/src/request_headers_server.dart new file mode 100644 index 0000000000..ad3fdfe0cc --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_headers_server.dart @@ -0,0 +1,45 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that captures the request headers. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Request Received: +/// - send headers as `Map>` +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + request.response.headers.set('Access-Control-Allow-Origin', '*'); + if (request.method == 'OPTIONS') { + // Handle a CORS preflight request: + // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#preflighted_requests + request.response.headers + ..set('Access-Control-Allow-Methods', 'GET') + ..set('Access-Control-Allow-Headers', '*'); + } else { + final headers = >{}; + request.headers.forEach((field, value) { + headers[field] = value; + }); + channel.sink.add(headers); + } + unawaited(request.response.close()); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_headers_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/request_headers_server_vm.dart new file mode 100644 index 0000000000..dc930dc528 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_headers_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'request_headers_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_headers_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/request_headers_server_web.dart new file mode 100644 index 0000000000..a15b69b75e --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_headers_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/request_headers_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart new file mode 100644 index 0000000000..24d94d801a --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart @@ -0,0 +1,72 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'request_headers_server_vm.dart' + if (dart.library.js_interop) 'request_headers_server_web.dart'; + +/// Tests that the [Client] correctly sends headers in the request. +void testRequestHeaders(Client client) async { + group('client headers', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('single header', () async { + await client.get(Uri.http(host, ''), headers: {'foo': 'bar'}); + + final headers = await httpServerQueue.next as Map; + expect(headers['foo'], ['bar']); + }); + + test('UPPER case header', () async { + await client.get(Uri.http(host, ''), headers: {'FOO': 'BAR'}); + + final headers = await httpServerQueue.next as Map; + // RFC 2616 14.44 states that header field names are case-insensitive. + // http.Client canonicalizes field names into lower case. + expect(headers['foo'], ['BAR']); + }); + + test('test headers different only in case', () async { + await client + .get(Uri.http(host, ''), headers: {'foo': 'bar', 'Foo': 'Bar'}); + + final headers = await httpServerQueue.next as Map; + // ignore: avoid_dynamic_calls + expect(headers['foo']!.single, isIn(['bar', 'Bar'])); + }); + + test('multiple headers', () async { + // The `http.Client` API does not offer a way of sending the name field + // more than once. + await client + .get(Uri.http(host, ''), headers: {'fruit': 'apple', 'color': 'red'}); + + final headers = await httpServerQueue.next as Map; + expect(headers['fruit'], ['apple']); + expect(headers['color'], ['red']); + }); + + test('multiple values per header', () async { + // The `http.Client` API does not offer a way of sending the same field + // more than once. + await client.get(Uri.http(host, ''), headers: {'list': 'apple, orange'}); + + final headers = await httpServerQueue.next as Map; + expect(headers['list'], ['apple, orange']); + }); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_methods_server.dart b/pkgs/http_client_conformance_tests/lib/src/request_methods_server.dart new file mode 100644 index 0000000000..bf05ec08e2 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_methods_server.dart @@ -0,0 +1,41 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that captures the request headers. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Request Received: +/// - send the received request method (e.g. GET) as a String +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + request.response.headers.set('Access-Control-Allow-Origin', '*'); + if (request.method == 'OPTIONS') { + // Handle a CORS preflight request: + // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#preflighted_requests + request.response.headers + ..set('Access-Control-Allow-Methods', '*') + ..set('Access-Control-Allow-Headers', '*'); + } else { + channel.sink.add(request.method); + } + unawaited(request.response.close()); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_methods_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/request_methods_server_vm.dart new file mode 100644 index 0000000000..fa25735917 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_methods_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'request_methods_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/request_methods_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/request_methods_server_web.dart new file mode 100644 index 0000000000..f9c924e217 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_methods_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/request_methods_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_methods_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_methods_tests.dart new file mode 100644 index 0000000000..802f57eb84 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/request_methods_tests.dart @@ -0,0 +1,88 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'request_methods_server_vm.dart' + if (dart.library.js_interop) 'request_methods_server_web.dart'; + +/// Tests that the [Client] correctly sends HTTP request methods +/// (e.g. GET, HEAD). +/// +/// If [preservesMethodCase] is `false` then tests that assume that the +/// [Client] preserves custom request method casing will be skipped. +void testRequestMethods(Client client, + {bool preservesMethodCase = true}) async { + group('request methods', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('custom method - not case preserving', () async { + await client.send(Request( + 'CuStOm', + Uri.http(host, ''), + )); + final method = await httpServerQueue.next as String; + expect('CUSTOM', method.toUpperCase()); + }); + + test('custom method case preserving', () async { + await client.send(Request( + 'CuStOm', + Uri.http(host, ''), + )); + final method = await httpServerQueue.next as String; + expect('CuStOm', method); + }, + skip: preservesMethodCase + ? false + : 'does not preserve HTTP request method case'); + + test('delete', () async { + await client.delete(Uri.http(host, '')); + final method = await httpServerQueue.next as String; + expect('DELETE', method); + }); + + test('get', () async { + await client.get(Uri.http(host, '')); + final method = await httpServerQueue.next as String; + expect('GET', method); + }); + test('head', () async { + await client.head(Uri.http(host, '')); + final method = await httpServerQueue.next as String; + expect('HEAD', method); + }); + + test('patch', () async { + await client.patch(Uri.http(host, '')); + final method = await httpServerQueue.next as String; + expect('PATCH', method); + }); + + test('post', () async { + await client.post(Uri.http(host, '')); + final method = await httpServerQueue.next as String; + expect('POST', method); + }); + + test('put', () async { + await client.put(Uri.http(host, '')); + final method = await httpServerQueue.next as String; + expect('PUT', method); + }); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_server.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_server.dart new file mode 100644 index 0000000000..396c9c93d5 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_server.dart @@ -0,0 +1,36 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that responds with "Hello World!" +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + final server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + const message = 'Hello World!'; + await request.drain(); + request.response.headers.set('Access-Control-Allow-Origin', '*'); + request.response.headers.set('Content-Type', 'text/plain'); + if (request.requestedUri.pathSegments.isNotEmpty && + request.requestedUri.pathSegments.last == 'length') { + request.response.contentLength = message.length; + } + request.response.write(message); + await request.response.close(); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_server_vm.dart new file mode 100644 index 0000000000..a12b6fb446 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'response_body_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_server_web.dart new file mode 100644 index 0000000000..4d23a48a50 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/response_body_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server.dart new file mode 100644 index 0000000000..5f211d6dec --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server.dart @@ -0,0 +1,42 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that sends a stream of integers. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// When Receive Anything: +/// - close current request +/// - exit server +void hybridMain(StreamChannel channel) async { + final channelQueue = StreamQueue(channel.stream); + var serverWriting = true; + + late HttpServer server; + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Access-Control-Allow-Origin', '*'); + request.response.headers.set('Content-Type', 'text/plain'); + serverWriting = true; + for (var i = 0; serverWriting; ++i) { + request.response.write('$i\n'); + await request.response.flush(); + // Let the event loop run. + await Future(() {}); + } + await request.response.close(); + unawaited(server.close()); + }); + + channel.sink.add(server.port); + unawaited(channelQueue.next.then((value) => serverWriting = false)); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_vm.dart new file mode 100644 index 0000000000..4e4eaff730 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'response_body_streamed_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_web.dart new file mode 100644 index 0000000000..e04ebd622b --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_web.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: + 'http_client_conformance_tests/src/response_body_streamed_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart new file mode 100644 index 0000000000..f355d6c8de --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart @@ -0,0 +1,61 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'response_body_streamed_server_vm.dart' + if (dart.library.js_interop) 'response_body_streamed_server_web.dart'; + +/// Tests that the [Client] correctly implements HTTP responses with bodies of +/// unbounded size. +/// +/// If [canStreamResponseBody] is `false` then tests that assume that the +/// [Client] supports receiving HTTP responses with unbounded body sizes will +/// be skipped +void testResponseBodyStreamed(Client client, + {bool canStreamResponseBody = true}) async { + group('streamed response body', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('large response streamed without content length', () async { + // The server continuously streams data to the client until + // instructed to stop. + // + // This ensures that the client supports streamed responses. + + final request = Request('GET', Uri.http(host, '')); + final response = await client.send(request); + expect(response.contentLength, null); + var lastReceived = 0; + await const LineSplitter() + .bind(const Utf8Decoder().bind(response.stream)) + .forEach((s) { + lastReceived = int.parse(s.trim()); + if (lastReceived == 1000) { + httpServerChannel.sink.add(true); + } + }); + expect(response.headers['content-type'], 'text/plain'); + expect(lastReceived, greaterThanOrEqualTo(1000)); + expect(response.isRedirect, isFalse); + expect(response.reasonPhrase, 'OK'); + expect(response.request!.method, 'GET'); + expect(response.statusCode, 200); + }, skip: canStreamResponseBody ? false : 'does not stream response bodies'); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart new file mode 100644 index 0000000000..34c29f66ae --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart @@ -0,0 +1,76 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'response_body_server_vm.dart' + if (dart.library.js_interop) 'response_body_server_web.dart'; + +/// Tests that the [Client] correctly implements HTTP responses with bodies. +/// +/// If [canStreamResponseBody] is `false` then tests that assume that the +/// [Client] supports receiving HTTP responses with unbounded body sizes will +/// be skipped +void testResponseBody(Client client, + {bool canStreamResponseBody = true}) async { + group('response body', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + const message = 'Hello World!'; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('small response with content length', () async { + final response = await client.get(Uri.http(host, '')); + expect(response.body, message); + expect(response.bodyBytes, message.codeUnits); + expect(response.contentLength, message.length); + expect(response.headers['content-type'], 'text/plain'); + expect(response.isRedirect, isFalse); + expect(response.reasonPhrase, 'OK'); + expect(response.request!.method, 'GET'); + expect(response.statusCode, 200); + }); + + test('small response streamed without content length', () async { + final request = Request('GET', Uri.http(host, '')); + final response = await client.send(request); + expect(await response.stream.bytesToString(), message); + if (canStreamResponseBody) { + expect(response.contentLength, null); + } else { + // If the response body is small then the Client can emulate a streamed + // response without streaming. But `response.contentLength` may or + // may not be set. + expect(response.contentLength, isIn([null, 12])); + } + expect(response.headers['content-type'], 'text/plain'); + expect(response.isRedirect, isFalse); + expect(response.reasonPhrase, 'OK'); + expect(response.request!.method, 'GET'); + expect(response.statusCode, 200); + }); + + test('small response streamed with content length', () async { + final request = Request('GET', Uri.http(host, 'length')); + final response = await client.send(request); + expect(await response.stream.bytesToString(), message); + expect(response.contentLength, 12); + expect(response.headers['content-type'], 'text/plain'); + expect(response.isRedirect, isFalse); + expect(response.reasonPhrase, 'OK'); + expect(response.request!.method, 'GET'); + expect(response.statusCode, 200); + }); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_cookies_server.dart b/pkgs/http_client_conformance_tests/lib/src/response_cookies_server.dart new file mode 100644 index 0000000000..392e22832d --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_cookies_server.dart @@ -0,0 +1,44 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that returns a custom status line. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Request Received: +/// - load response status line from channel +/// - exit +void hybridMain(StreamChannel channel) async { + late HttpServer server; + final clientQueue = StreamQueue(channel.stream); + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + final socket = await request.response.detachSocket(writeHeaders: false); + + final headers = (await clientQueue.next) as List; + socket.writeAll( + [ + 'HTTP/1.1 200 OK', + 'Access-Control-Allow-Origin: *', + 'Content-Length: 0', + ...headers, + '\r\n', // Add \r\n at the end of this header section. + ], + '\r\n', // Separate each field by \r\n. + ); + await socket.close(); + unawaited(server.close()); + }); + + channel.sink.add(server.port); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_cookies_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/response_cookies_server_vm.dart new file mode 100644 index 0000000000..2edbb4581f --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_cookies_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'response_cookies_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_cookies_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/response_cookies_server_web.dart new file mode 100644 index 0000000000..cb8e384ed4 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_cookies_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/response_cookies_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_cookies_test.dart b/pkgs/http_client_conformance_tests/lib/src/response_cookies_test.dart new file mode 100644 index 0000000000..f8e154d611 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_cookies_test.dart @@ -0,0 +1,92 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'response_cookies_server_vm.dart' + if (dart.library.js_interop) 'response_cookies_server_web.dart'; + +/// Tests that the [Client] correctly receives "set-cookie-headers" +/// +/// If [canReceiveSetCookieHeaders] is `false` then tests that require that +/// "set-cookie" headers be received by the client will not be run. +void testResponseCookies(Client client, + {required bool canReceiveSetCookieHeaders}) async { + group('response cookies', () { + late String host; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + + setUp(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + + test('single session cookie', () async { + httpServerChannel.sink.add(['Set-Cookie: SID=1231AB3']); + final response = await client.get(Uri.http(host, '')); + + expect(response.headers['set-cookie'], 'SID=1231AB3'); + }, + skip: canReceiveSetCookieHeaders + ? false + : 'cannot receive set-cookie headers'); + + test('multiple session cookies', () async { + // RFC-2616 4.2 says: + // "The field value MAY be preceded by any amount of LWS, though a single + // SP is preferred." and + // "The field-content does not include any leading or trailing LWS ..." + httpServerChannel.sink + .add(['Set-Cookie: SID=1231AB3', 'Set-Cookie: lang=en_US']); + final response = await client.get(Uri.http(host, '')); + + expect( + response.headers['set-cookie'], + matches(r'SID=1231AB3' + r'[ \t]*,[ \t]*' + r'lang=en_US')); + }, + skip: canReceiveSetCookieHeaders + ? false + : 'cannot receive set-cookie headers'); + + test('permanent cookie with expires', () async { + httpServerChannel.sink + .add(['Set-Cookie: id=a3fWa; Expires=Wed, 10 Jan 2024 07:28:00 GMT']); + final response = await client.get(Uri.http(host, '')); + + expect(response.headers['set-cookie'], + 'id=a3fWa; Expires=Wed, 10 Jan 2024 07:28:00 GMT'); + }, + skip: canReceiveSetCookieHeaders + ? false + : 'cannot receive set-cookie headers'); + + test('multiple permanent cookies with expires', () async { + // RFC-2616 4.2 says: + // "The field value MAY be preceded by any amount of LWS, though a single + // SP is preferred." and + // "The field-content does not include any leading or trailing LWS ..." + httpServerChannel.sink.add([ + 'Set-Cookie: id=a3fWa; Expires=Wed, 10 Jan 2024 07:28:00 GMT', + 'Set-Cookie: id=2fasd; Expires=Wed, 21 Oct 2025 07:28:00 GMT' + ]); + final response = await client.get(Uri.http(host, '')); + + expect( + response.headers['set-cookie'], + matches(r'id=a3fWa; Expires=Wed, 10 Jan 2024 07:28:00 GMT' + r'[ \t]*,[ \t]*' + r'id=2fasd; Expires=Wed, 21 Oct 2025 07:28:00 GMT')); + }, + skip: canReceiveSetCookieHeaders + ? false + : 'cannot receive set-cookie headers'); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_headers_server.dart b/pkgs/http_client_conformance_tests/lib/src/response_headers_server.dart new file mode 100644 index 0000000000..54431edd74 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_headers_server.dart @@ -0,0 +1,44 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that returns custom headers. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Request Received: +/// - load response header map from channel +/// - exit +void hybridMain(StreamChannel channel) async { + late HttpServer server; + final clientQueue = StreamQueue(channel.stream); + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + final socket = await request.response.detachSocket(writeHeaders: false); + + final headers = (await clientQueue.next) as String; + socket + ..writeAll([ + 'HTTP/1.1 200 OK', + 'Access-Control-Allow-Origin: *', + 'Access-Control-Expose-Headers: *', + 'Content-Type: text/plain', + '', // Add \r\n at the end of this header section. + ], '\r\n') + ..write(headers) + ..write('Connection: Closed\r\n\r\n'); + await socket.close(); + unawaited(server.close()); + }); + + channel.sink.add(server.port); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_headers_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/response_headers_server_vm.dart new file mode 100644 index 0000000000..c99a021d1a --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_headers_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'response_headers_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_headers_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/response_headers_server_web.dart new file mode 100644 index 0000000000..0e6dabd17a --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_headers_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/response_headers_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart b/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart new file mode 100644 index 0000000000..4ecb1444b4 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart @@ -0,0 +1,181 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'response_headers_server_vm.dart' + if (dart.library.js_interop) 'response_headers_server_web.dart'; + +/// Tests that the [Client] correctly processes response headers. +void testResponseHeaders(Client client, + {bool supportsFoldedHeaders = true}) async { + group('server headers', () { + late String host; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + + setUp(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + + test('single header', () async { + httpServerChannel.sink.add('foo: bar\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['foo'], 'bar'); + }); + + test('UPPERCASE header name', () async { + // RFC 2616 14.44 states that header field names are case-insensitive. + // http.Client canonicalizes field names into lower case. + httpServerChannel.sink.add('FOO: bar\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['foo'], 'bar'); + }); + + test('UPPERCASE header value', () async { + httpServerChannel.sink.add('foo: BAR\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['foo'], 'BAR'); + }); + + test('space surrounding header value', () async { + httpServerChannel.sink.add('foo: \t BAR \t \r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['foo'], 'BAR'); + }); + + test('space in header value', () async { + httpServerChannel.sink.add('foo: BAR BAZ\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['foo'], 'BAR BAZ'); + }); + + test('multiple spaces in header value', () async { + // RFC 2616 4.2 allows LWS between header values to be replace with a + // single space. + // See https://datatracker.ietf.org/doc/html/rfc2616#section-4.2 + httpServerChannel.sink.add('foo: BAR \t BAZ\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect( + response.headers['foo'], matches(RegExp('BAR {0,2}[ \t] {0,3}BAZ'))); + }); + + test('multiple headers', () async { + httpServerChannel.sink + .add('field1: value1\r\n' 'field2: value2\r\n' 'field3: value3\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['field1'], 'value1'); + expect(response.headers['field2'], 'value2'); + expect(response.headers['field3'], 'value3'); + }); + + test('multiple values per header', () async { + // RFC-2616 4.2 says: + // "The field value MAY be preceded by any amount of LWS, though a single + // SP is preferred." and + // "The field-content does not include any leading or trailing LWS ..." + httpServerChannel.sink.add('list: apple, orange, banana\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['list'], + matches(r'apple[ \t]*,[ \t]*orange[ \t]*,[ \t]*banana')); + }); + + test('multiple values per header surrounded with spaces', () async { + httpServerChannel.sink + .add('list: \t apple \t, \t orange \t , \t banana\t \t \r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['list'], + matches(r'apple[ \t]*,[ \t]*orange[ \t]*,[ \t]*banana')); + }); + + test('multiple headers with the same name', () async { + httpServerChannel.sink.add('list: apple\r\n' + 'list: orange\r\n' + 'list: banana\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['list'], + matches(r'apple[ \t]*,[ \t]*orange[ \t]*,[ \t]*banana')); + }); + + test('multiple headers with the same name but different cases', () async { + httpServerChannel.sink.add('list: apple\r\n' + 'LIST: orange\r\n' + 'List: banana\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['list'], + matches(r'apple[ \t]*,[ \t]*orange[ \t]*,[ \t]*banana')); + }); + + group('content length', () { + test('surrounded in spaces', () async { + // RFC-2616 4.2 says: + // "The field value MAY be preceded by any amount of LWS, though a + // single SP is preferred." and + // "The field-content does not include any leading or trailing LWS ..." + httpServerChannel.sink.add('content-length: \t 0 \t \r\n'); + final response = await client.get(Uri.http(host, '')); + expect(response.contentLength, 0); + }); + + test('non-integer', () async { + httpServerChannel.sink.add('content-length: cat\r\n'); + await expectLater( + client.get(Uri.http(host, '')), throwsA(isA())); + }); + + test('negative', () async { + httpServerChannel.sink.add('content-length: -5\r\n'); + await expectLater( + client.get(Uri.http(host, '')), throwsA(isA())); + }); + + test('bigger than actual body', () async { + httpServerChannel.sink.add('content-length: 100\r\n'); + await expectLater( + client.get(Uri.http(host, '')), throwsA(isA())); + }); + }); + + group('folded headers', () { + // RFC2616 says that HTTP Headers can be split across multiple lines. + // See https://datatracker.ietf.org/doc/html/rfc2616#section-2.2 + test('leading space', () async { + httpServerChannel.sink.add('foo: BAR\r\n BAZ\r\n'); + + final response = await client.get(Uri.http(host, '')); + expect(response.headers['foo'], 'BAR BAZ'); + }); + + test('extra whitespace', () async { + httpServerChannel.sink.add('foo: BAR \t \r\n \t BAZ \t \r\n'); + + final response = await client.get(Uri.http(host, '')); + // RFC 2616 4.2 allows LWS between header values to be replace with a + // single space. + expect( + response.headers['foo'], + allOf(matches(RegExp(r'BAR {0,3}[ \t]? {0,7}[ \t]? {0,3}BAZ')), + contains(' '))); + }); + }, + skip: + !supportsFoldedHeaders ? 'does not support folded headers' : false); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_status_line_server.dart b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server.dart new file mode 100644 index 0000000000..f27aca8896 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server.dart @@ -0,0 +1,43 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that returns a custom status line. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// On Request Received: +/// - load response status line from channel +/// - exit +void hybridMain(StreamChannel channel) async { + late HttpServer server; + final clientQueue = StreamQueue(channel.stream); + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + final socket = await request.response.detachSocket(writeHeaders: false); + + final statusLine = (await clientQueue.next) as String; + socket.writeAll( + [ + statusLine, + 'Access-Control-Allow-Origin: *', + 'Content-Length: 0', + '\r\n', // Add \r\n at the end of this header section. + ], + '\r\n', // Separate each field by \r\n. + ); + await socket.close(); + unawaited(server.close()); + }); + + channel.sink.add(server.port); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_vm.dart new file mode 100644 index 0000000000..053bd111a9 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'response_status_line_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_web.dart new file mode 100644 index 0000000000..d70a325a50 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_web.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: + 'http_client_conformance_tests/src/response_status_line_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart b/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart new file mode 100644 index 0000000000..6eb70c518b --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart @@ -0,0 +1,45 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'response_status_line_server_vm.dart' + if (dart.library.js_interop) 'response_status_line_server_web.dart'; + +/// Tests that the [Client] correctly processes the response status line (e.g. +/// 'HTTP/1.1 200 OK\r\n'). +/// +/// Clients behavior varies considerably if the status line is not valid. +void testResponseStatusLine(Client client) async { + group('response status line', () { + late String host; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + + setUp(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + + test('complete', () async { + httpServerChannel.sink.add('HTTP/1.1 201 Created'); + final response = await client.get(Uri.http(host, '')); + expect(response.statusCode, 201); + expect(response.reasonPhrase, 'Created'); + }); + + test('no reason phrase', () async { + httpServerChannel.sink.add('HTTP/1.1 201'); + final response = await client.get(Uri.http(host, '')); + expect(response.statusCode, 201); + // An empty Reason-Phrase is allowed according to RFC-2616. Any of these + // interpretations seem reasonable. + expect(response.reasonPhrase, anyOf(isNull, '', 'Created')); + }); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/server_errors_server.dart b/pkgs/http_client_conformance_tests/lib/src/server_errors_server.dart new file mode 100644 index 0000000000..47470a41f4 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/server_errors_server.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an HTTP server that disconnects before sending it's headers. +/// +/// Channel protocol: +/// On Startup: +/// - send port +/// When Receive Anything: +/// - exit +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + final socket = await request.response.detachSocket(writeHeaders: false); + socket.destroy(); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/server_errors_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/server_errors_server_vm.dart new file mode 100644 index 0000000000..e5aa09fa60 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/server_errors_server_vm.dart @@ -0,0 +1,14 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'server_errors_server.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/http_client_conformance_tests/lib/src/server_errors_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/server_errors_server_web.dart new file mode 100644 index 0000000000..9614f3601d --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/server_errors_server_web.dart @@ -0,0 +1,11 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'http_client_conformance_tests/src/server_errors_server.dart')); diff --git a/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart b/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart new file mode 100644 index 0000000000..1a83696853 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart @@ -0,0 +1,41 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:http/http.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +import 'server_errors_server_vm.dart' + if (dart.library.js_interop) 'server_errors_server_web.dart'; + +/// Tests that the [Client] correctly handles server errors. +void testServerErrors(Client client, {bool redirectAlwaysAllowed = false}) { + group('server errors', () { + late final String host; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + host = 'localhost:${await httpServerQueue.nextAsInt}'; + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('no such host', () async { + expect( + client.get(Uri.http('thisisnotahost', '')), + throwsA(isA() + .having((e) => e.uri, 'uri', Uri.http('thisisnotahost', '')))); + }); + + test('disconnect', () async { + expect( + client.get(Uri.http(host, '')), + throwsA(isA() + .having((e) => e.uri, 'uri', Uri.http(host, '')))); + }); + }); +} diff --git a/pkgs/http_client_conformance_tests/lib/src/server_queue_helpers.dart b/pkgs/http_client_conformance_tests/lib/src/server_queue_helpers.dart new file mode 100644 index 0000000000..df87ddd177 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/server_queue_helpers.dart @@ -0,0 +1,10 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; + +extension StreamQueueOfNullableObjectExtension on StreamQueue { + /// When run under dart2wasm, JSON numbers are always returned as [double]. + Future get nextAsInt async => ((await next) as num).toInt(); +} diff --git a/pkgs/http_client_conformance_tests/mono_pkg.yaml b/pkgs/http_client_conformance_tests/mono_pkg.yaml new file mode 100644 index 0000000000..16e4e7a5f3 --- /dev/null +++ b/pkgs/http_client_conformance_tests/mono_pkg.yaml @@ -0,0 +1,10 @@ +sdk: +- pubspec +- dev + +stages: +- analyze_and_format: + - analyze: --fatal-infos + - format: + sdk: + - dev diff --git a/pkgs/http_client_conformance_tests/pubspec.yaml b/pkgs/http_client_conformance_tests/pubspec.yaml new file mode 100644 index 0000000000..74d165e6f9 --- /dev/null +++ b/pkgs/http_client_conformance_tests/pubspec.yaml @@ -0,0 +1,20 @@ +name: http_client_conformance_tests +description: >- + A library that tests whether implementations of package:http's `Client` class + behave as expected. +repository: https://github.com/dart-lang/http/tree/master/pkgs/http_client_conformance_tests + +publish_to: none + +environment: + sdk: ^3.4.0 + +dependencies: + async: ^2.8.2 + dart_style: ^2.3.7 + http: ^1.2.0 + stream_channel: ^2.1.1 + test: ^1.21.2 + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 diff --git a/pkgs/http_parser/CHANGELOG.md b/pkgs/http_parser/CHANGELOG.md index 3670ab8144..5c56cf7113 100644 --- a/pkgs/http_parser/CHANGELOG.md +++ b/pkgs/http_parser/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.1.1 + +* Move to `dart-lang/http` monorepo. + ## 4.1.0 * `CaseInsensitiveMap`: added constructor `fromEntries`. diff --git a/pkgs/http_parser/README.md b/pkgs/http_parser/README.md index 73f2f1cfe1..e9d330699b 100644 --- a/pkgs/http_parser/README.md +++ b/pkgs/http_parser/README.md @@ -1,4 +1,3 @@ -[![Build Status](https://github.com/dart-lang/http_parser/workflows/Dart%20CI/badge.svg)](https://github.com/dart-lang/http_parser/actions?query=workflow%3A"Dart+CI"+branch%3Amaster) [![Pub Package](https://img.shields.io/pub/v/http_parser.svg)](https://pub.dartlang.org/packages/http_parser) [![package publisher](https://img.shields.io/pub/publisher/http_parser.svg)](https://pub.dev/packages/http_parser/publisher) diff --git a/pkgs/http_parser/analysis_options.yaml b/pkgs/http_parser/analysis_options.yaml index c0bcfca91e..4def62c655 100644 --- a/pkgs/http_parser/analysis_options.yaml +++ b/pkgs/http_parser/analysis_options.yaml @@ -22,7 +22,6 @@ linter: - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - no_runtimeType_toString - - package_api_docs - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_locals diff --git a/pkgs/http_parser/pubspec.yaml b/pkgs/http_parser/pubspec.yaml index 7bf5b8ba0c..13888276f1 100644 --- a/pkgs/http_parser/pubspec.yaml +++ b/pkgs/http_parser/pubspec.yaml @@ -1,8 +1,8 @@ name: http_parser -version: 4.1.0 +version: 4.1.1 description: >- A platform-independent package for parsing and serializing HTTP formats. -repository: https://github.com/dart-lang/http_parser +repository: https://github.com/dart-lang/http/tree/master/pkgs/http_parser environment: sdk: ^3.4.0 diff --git a/pkgs/http_profile/CHANGELOG.md b/pkgs/http_profile/CHANGELOG.md new file mode 100644 index 0000000000..fdcad42253 --- /dev/null +++ b/pkgs/http_profile/CHANGELOG.md @@ -0,0 +1,7 @@ +## 0.1.1-wip + +* Fixed unintended HTML tags in doc comments. + +## 0.1.0 + +* Initial **experimental** release. diff --git a/pkgs/http_profile/LICENSE b/pkgs/http_profile/LICENSE new file mode 100644 index 0000000000..baa79ce1d3 --- /dev/null +++ b/pkgs/http_profile/LICENSE @@ -0,0 +1,27 @@ +Copyright 2023, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. diff --git a/pkgs/http_profile/README.md b/pkgs/http_profile/README.md new file mode 100644 index 0000000000..2eb490e86e --- /dev/null +++ b/pkgs/http_profile/README.md @@ -0,0 +1,66 @@ +[![pub package](https://img.shields.io/pub/v/http_profile.svg)](https://pub.dev/packages/http_profile) +[![package publisher](https://img.shields.io/pub/publisher/http_profile.svg)](https://pub.dev/packages/http_profile/publisher) + +A package that allows HTTP clients outside of the Dart SDK to integrate with +the DevTools Network View. + +**NOTE:** This package is meant for developers *implementing* HTTP clients, not +developers *using* HTTP clients. + +## Using + +`HttpClientRequestProfile.profile` returns an `HttpClientRequestProfile` object +if HTTP profiling is enabled. Populating the fields of that object with +information about an HTTP request and about the response to that request will +make that information show up in the +[DevTools Network View](https://docs.flutter.dev/tools/devtools/network). + +```dart +import 'package:http_profile/http_profile.dart'; + +Future get(Uri uri) { + final profile = HttpClientRequestProfile.profile( + requestStartTime: DateTime.now(), + requestMethod: 'GET', + requestUri: uri.toString(), + ); + profile?.connectionInfo = { + 'localPort': 1285, + 'remotePort': 443, + 'connectionPoolId': '21x23', + }; + + profile.requestData.proxyDetails = HttpProfileProxyData( + host: 'https://www.example.com', + username: 'abc123', + isDirect: true, + port: 4321, + ); + + // Make the HTTP request and populate the response data. + + profile.responseData.headersListValues = { + 'connection': ['keep-alive'], + 'cache-control': ['max-age=43200'], + 'content-type': ['application/json', 'charset=utf-8'], + }; + + return responseString; +} +``` + +Refer to the source of +[`package:cupertino_http`](https://github.com/dart-lang/http/blob/master/pkgs/cupertino_http/lib/src/cupertino_client.dart) +to see a comprehensive example of how `package:http_profile` can be integrated +into an HTTP client. + +## Status: pre-1.0 + +**NOTE**: We are in the process of collecting feedback and iterating on this +package, so new versions that include API and breaking changes may be published +frequently. + +Your feedback is valuable and will help us evolve this package. For general +feedback, suggestions, and comments, please file an issue in the +[bug tracker](https://github.com/dart-lang/http/issues). + diff --git a/pkgs/http_profile/lib/http_profile.dart b/pkgs/http_profile/lib/http_profile.dart new file mode 100644 index 0000000000..0a1c283f4d --- /dev/null +++ b/pkgs/http_profile/lib/http_profile.dart @@ -0,0 +1 @@ +export 'src/http_profile.dart'; diff --git a/pkgs/http_profile/lib/src/http_client_request_profile.dart b/pkgs/http_profile/lib/src/http_client_request_profile.dart new file mode 100644 index 0000000000..c928735d44 --- /dev/null +++ b/pkgs/http_profile/lib/src/http_client_request_profile.dart @@ -0,0 +1,187 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +part of 'http_profile.dart'; + +/// Describes an event related to an HTTP request. +final class HttpProfileRequestEvent { + final int _timestamp; + final String _name; + + DateTime get timestamp => DateTime.fromMicrosecondsSinceEpoch(_timestamp); + + String get name => _name; + + HttpProfileRequestEvent({required DateTime timestamp, required String name}) + : _timestamp = timestamp.microsecondsSinceEpoch, + _name = name; + + static HttpProfileRequestEvent _fromJson(Map json) => + HttpProfileRequestEvent( + timestamp: + DateTime.fromMicrosecondsSinceEpoch(json['timestamp'] as int), + name: json['event'] as String, + ); + + Map _toJson() => { + 'timestamp': _timestamp, + 'event': _name, + }; +} + +/// A record of debugging information about an HTTP request. +final class HttpClientRequestProfile { + /// Whether HTTP profiling is enabled or not. + /// + /// The value can be changed programmatically or through the DevTools Network + /// UX. + static bool get profilingEnabled => HttpClient.enableTimelineLogging; + static set profilingEnabled(bool enabled) => + HttpClient.enableTimelineLogging = enabled; + + final _data = {}; + + /// The HTTP request method associated with the request. + String get requestMethod => _data['requestMethod'] as String; + + /// The URI to which the request was sent. + String get requestUri => _data['requestUri'] as String; + + /// Records an event related to the request. + /// + /// Usage example: + /// + /// ```dart + /// profile.addEvent( + /// HttpProfileRequestEvent( + /// timestamp: DateTime.now(), + /// name: "Connection Established", + /// ), + /// ); + /// profile.addEvent( + /// HttpProfileRequestEvent( + /// timestamp: DateTime.now(), + /// name: "Remote Disconnected", + /// ), + /// ); + /// ``` + void addEvent(HttpProfileRequestEvent event) { + (_data['events'] as List>).add(event._toJson()); + _updated(); + } + + /// An unmodifiable list containing the events related to the request. + List get events => + UnmodifiableListView((_data['events'] as List>).map( + HttpProfileRequestEvent._fromJson, + )); + + /// Information about the networking connection used. + /// + /// This information is meant to be used for debugging. + /// + /// It can contain any arbitrary data as long as the values are of type + /// [String] or [int]. + /// + /// This field can only be modified by assigning a Map to it. That is: + /// ```dart + /// // Valid + /// profile?.connectionInfo = { + /// 'localPort': 1285, + /// 'remotePort': 443, + /// 'connectionPoolId': '21x23', + /// }; + /// + /// // Invalid + /// profile?.connectionInfo?['localPort'] = 1285; + /// ``` + set connectionInfo(Map? value) { + _updated(); + if (value == null) { + requestData._requestData.remove('connectionInfo'); + responseData._responseData.remove('connectionInfo'); + } else { + for (final v in value.values) { + if (!(v is String || v is int)) { + throw ArgumentError( + 'The values in connectionInfo must be of type String or int.', + ); + } + } + requestData._requestData['connectionInfo'] = {...value}; + responseData._responseData['connectionInfo'] = {...value}; + } + } + + Map? get connectionInfo => + requestData._requestData['connectionInfo'] == null + ? null + : UnmodifiableMapView( + requestData._requestData['connectionInfo'] + as Map, + ); + + /// Details about the request. + late final HttpProfileRequestData requestData; + + /// Details about the response. + late final HttpProfileResponseData responseData; + + void _updated() => + _data['_lastUpdateTime'] = DateTime.now().microsecondsSinceEpoch; + + HttpClientRequestProfile._({ + required DateTime requestStartTime, + required String requestMethod, + required String requestUri, + }) { + _data['isolateId'] = Service.getIsolateId(Isolate.current)!; + _data['requestStartTimestamp'] = requestStartTime.microsecondsSinceEpoch; + _data['requestMethod'] = requestMethod; + _data['requestUri'] = requestUri; + _data['events'] = >[]; + _data['requestData'] = {}; + requestData = HttpProfileRequestData._(_data, _updated); + _data['responseData'] = {}; + responseData = HttpProfileResponseData._(_data, _updated); + _data['requestBodyBytes'] = []; + requestData._body.stream.listen( + (final bytes) => (_data['requestBodyBytes'] as List).addAll(bytes), + onError: (e) {}); + _data['responseBodyBytes'] = []; + responseData._body.stream.listen( + (final bytes) => + (_data['responseBodyBytes'] as List).addAll(bytes), + onError: (e) {}); + // This entry is needed to support the updatedSince parameter of + // ext.dart.io.getHttpProfile. + _updated(); + } + + /// If HTTP profiling is enabled, returns an [HttpClientRequestProfile], + /// otherwise returns `null`. + static HttpClientRequestProfile? profile({ + /// The time at which the request was initiated. + required DateTime requestStartTime, + + /// The HTTP request method associated with the request. + required String requestMethod, + + /// The URI to which the request was sent. + required String requestUri, + }) { + // Always return `null` in product mode so that the profiling code can be + // tree shaken away. + if (const bool.fromEnvironment('dart.vm.product') || !profilingEnabled) { + return null; + } + final requestProfile = HttpClientRequestProfile._( + requestStartTime: requestStartTime, + requestMethod: requestMethod, + requestUri: requestUri, + ); + addHttpClientProfilingData(requestProfile._data); + return requestProfile; + } +} diff --git a/pkgs/http_profile/lib/src/http_profile.dart b/pkgs/http_profile/lib/src/http_profile.dart new file mode 100644 index 0000000000..488b68d683 --- /dev/null +++ b/pkgs/http_profile/lib/src/http_profile.dart @@ -0,0 +1,15 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView; +import 'dart:developer' show Service, addHttpClientProfilingData; +import 'dart:io' show HttpClient, HttpClientResponseCompressionState; +import 'dart:isolate' show Isolate; + +import 'utils.dart'; + +part 'http_client_request_profile.dart'; +part 'http_profile_request_data.dart'; +part 'http_profile_response_data.dart'; diff --git a/pkgs/http_profile/lib/src/http_profile_request_data.dart b/pkgs/http_profile/lib/src/http_profile_request_data.dart new file mode 100644 index 0000000000..60b1d8e8fe --- /dev/null +++ b/pkgs/http_profile/lib/src/http_profile_request_data.dart @@ -0,0 +1,252 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +part of 'http_profile.dart'; + +final class HttpProfileProxyData { + final String? _host; + final String? _username; + final bool? _isDirect; + final int? _port; + + String? get host => _host; + + String? get username => _username; + + bool? get isDirect => _isDirect; + + int? get port => _port; + + HttpProfileProxyData({ + String? host, + String? username, + bool? isDirect, + int? port, + }) : _host = host, + _username = username, + _isDirect = isDirect, + _port = port; + + static HttpProfileProxyData _fromJson(Map json) => + HttpProfileProxyData( + host: json['host'] as String?, + username: json['username'] as String?, + isDirect: json['isDirect'] as bool?, + port: json['port'] as int?, + ); + + Map _toJson() => { + if (_host != null) 'host': _host, + if (_username != null) 'username': _username, + if (_isDirect != null) 'isDirect': _isDirect, + if (_port != null) 'port': _port, + }; +} + +/// Describes details about an HTTP request. +final class HttpProfileRequestData { + final Map _data; + final StreamController> _body = StreamController>(); + bool _isClosed = false; + final void Function() _updated; + + Map get _requestData => + _data['requestData'] as Map; + + /// A sink that can be used to record the body of the request. + /// + /// Errors added to [bodySink] (for example with [StreamSink.addError]) are + /// ignored. + StreamSink> get bodySink => _body.sink; + + /// The body of the request represented as an unmodifiable list of bytes. + List get bodyBytes => + UnmodifiableListView(_data['requestBodyBytes'] as List); + + /// The content length of the request, in bytes. + set contentLength(int? value) { + _checkAndUpdate(); + if (value == null) { + _requestData.remove('contentLength'); + } else { + _requestData['contentLength'] = value; + } + } + + int? get contentLength => _requestData['contentLength'] as int?; + + /// Whether automatic redirect following was enabled for the request. + set followRedirects(bool? value) { + _checkAndUpdate(); + if (value == null) { + _requestData.remove('followRedirects'); + } else { + _requestData['followRedirects'] = value; + } + } + + bool? get followRedirects => _requestData['followRedirects'] as bool?; + + /// The request headers where duplicate headers are represented using a list + /// of values. + /// + /// For example: + /// + /// ```dart + /// // Foo: Bar + /// // Foo: Baz + /// + /// profile?.requestData.headersListValues({'Foo': ['Bar', 'Baz']}); + /// ``` + set headersListValues(Map>? value) { + _checkAndUpdate(); + if (value == null) { + _requestData.remove('headers'); + return; + } + _requestData['headers'] = {...value}; + } + + /// The request headers where duplicate headers are represented using a + /// comma-separated list of values. + /// + /// For example: + /// + /// ```dart + /// // Foo: Bar + /// // Foo: Baz + /// + /// profile?.requestData.headersCommaValues({'Foo': 'Bar, Baz']}); + /// ``` + set headersCommaValues(Map? value) { + _checkAndUpdate(); + if (value == null) { + _requestData.remove('headers'); + return; + } + _requestData['headers'] = splitHeaderValues(value); + } + + /// An unmodifiable map representing the request headers. Duplicate headers + /// are represented using a list of values. + /// + /// For example, the map + /// + /// ```dart + /// {'Foo': ['Bar', 'Baz']}); + /// ``` + /// + /// represents the headers + /// + /// Foo: Bar + /// Foo: Baz + Map>? get headers => _requestData['headers'] == null + ? null + : UnmodifiableMapView( + _requestData['headers'] as Map>); + + /// The maximum number of redirects allowed during the request. + set maxRedirects(int? value) { + _checkAndUpdate(); + if (value == null) { + _requestData.remove('maxRedirects'); + } else { + _requestData['maxRedirects'] = value; + } + } + + int? get maxRedirects => _requestData['maxRedirects'] as int?; + + /// The requested persistent connection state. + set persistentConnection(bool? value) { + _checkAndUpdate(); + if (value == null) { + _requestData.remove('persistentConnection'); + } else { + _requestData['persistentConnection'] = value; + } + } + + bool? get persistentConnection => + _requestData['persistentConnection'] as bool?; + + /// Proxy authentication details for the request. + set proxyDetails(HttpProfileProxyData? value) { + _checkAndUpdate(); + if (value == null) { + _requestData.remove('proxyDetails'); + } else { + _requestData['proxyDetails'] = value._toJson(); + } + } + + HttpProfileProxyData? get proxyDetails => _requestData['proxyDetails'] == null + ? null + : HttpProfileProxyData._fromJson( + _requestData['proxyDetails'] as Map, + ); + + /// The time at which the request was initiated. + DateTime get startTime => DateTime.fromMicrosecondsSinceEpoch( + _data['requestStartTimestamp'] as int, + ); + + /// The time when the request was fully sent. + DateTime? get endTime => _data['requestEndTimestamp'] == null + ? null + : DateTime.fromMicrosecondsSinceEpoch( + _data['requestEndTimestamp'] as int, + ); + + /// The error that the request failed with. + String? get error => + _requestData['error'] == null ? null : _requestData['error'] as String; + + HttpProfileRequestData._( + this._data, + this._updated, + ); + + void _checkAndUpdate() { + if (_isClosed) { + throw StateError('HttpProfileResponseData has been closed, no further ' + 'updates are allowed'); + } + _updated(); + } + + /// Signal that the request, including the entire request body, has been + /// sent. + /// + /// [bodySink] will be closed and the fields of [HttpProfileRequestData] will + /// no longer be changeable. + /// + /// [endTime] is the time when the request was fully sent. It defaults to the + /// current time. + Future close([DateTime? endTime]) async { + _checkAndUpdate(); + _isClosed = true; + await bodySink.close(); + _data['requestEndTimestamp'] = + (endTime ?? DateTime.now()).microsecondsSinceEpoch; + } + + /// Signal that sending the request has failed with an error. + /// + /// [bodySink] will be closed and the fields of [HttpProfileRequestData] will + /// no longer be changeable. + /// + /// [value] is a textual description of the error e.g. 'host does not exist'. + /// + /// [endTime] is the time when the error occurred. It defaults to the current + /// time. + Future closeWithError(String value, [DateTime? endTime]) async { + _checkAndUpdate(); + _isClosed = true; + await bodySink.close(); + _requestData['error'] = value; + _data['requestEndTimestamp'] = + (endTime ?? DateTime.now()).microsecondsSinceEpoch; + } +} diff --git a/pkgs/http_profile/lib/src/http_profile_response_data.dart b/pkgs/http_profile/lib/src/http_profile_response_data.dart new file mode 100644 index 0000000000..7aead9e068 --- /dev/null +++ b/pkgs/http_profile/lib/src/http_profile_response_data.dart @@ -0,0 +1,298 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +part of 'http_profile.dart'; + +/// Describes a redirect that an HTTP connection went through. +class HttpProfileRedirectData { + final int _statusCode; + final String _method; + final String _location; + + int get statusCode => _statusCode; + + String get method => _method; + + String get location => _location; + + HttpProfileRedirectData({ + required int statusCode, + required String method, + required String location, + }) : _statusCode = statusCode, + _method = method, + _location = location; + + static HttpProfileRedirectData _fromJson(Map json) => + HttpProfileRedirectData( + statusCode: json['statusCode'] as int, + method: json['method'] as String, + location: json['location'] as String, + ); + + Map _toJson() => { + 'statusCode': _statusCode, + 'method': _method, + 'location': _location, + }; + + @override + bool operator ==(Object other) => + (other is HttpProfileRedirectData) && + (statusCode == other.statusCode && + method == other.method && + location == other.location); + + @override + int get hashCode => Object.hashAll([statusCode, method, location]); + + @override + String toString() => + 'HttpProfileRedirectData(statusCode: $statusCode, method: $method, ' + 'location: $location)'; +} + +/// Describes details about a response to an HTTP request. +final class HttpProfileResponseData { + bool _isClosed = false; + final Map _data; + final void Function() _updated; + final StreamController> _body = StreamController>(); + + Map get _responseData => + _data['responseData'] as Map; + + /// Records a redirect that the connection went through. + void addRedirect(HttpProfileRedirectData redirect) { + _checkAndUpdate(); + (_responseData['redirects'] as List>) + .add(redirect._toJson()); + } + + /// An unmodifiable list containing the redirects that the connection went + /// through. + List get redirects => UnmodifiableListView( + (_responseData['redirects'] as List>) + .map(HttpProfileRedirectData._fromJson)); + + /// A sink that can be used to record the body of the response. + /// + /// Errors added to [bodySink] (for example with [StreamSink.addError]) are + /// ignored. + StreamSink> get bodySink => _body.sink; + + /// The body of the response represented as an unmodifiable list of bytes. + List get bodyBytes => + UnmodifiableListView(_data['responseBodyBytes'] as List); + + /// The response headers where duplicate headers are represented using a list + /// of values. + /// + /// For example: + /// + /// ```dart + /// // Foo: Bar + /// // Foo: Baz + /// + /// profile?.requestData.headersListValues({'Foo': ['Bar', 'Baz']}); + /// ``` + set headersListValues(Map>? value) { + _checkAndUpdate(); + if (value == null) { + _responseData.remove('headers'); + return; + } + _responseData['headers'] = {...value}; + } + + /// The response headers where duplicate headers are represented using a + /// comma-separated list of values. + /// + /// For example: + /// + /// ```dart + /// // Foo: Bar + /// // Foo: Baz + /// + /// profile?.responseData.headersCommaValues({'Foo': 'Bar, Baz']}); + /// ``` + set headersCommaValues(Map? value) { + _checkAndUpdate(); + if (value == null) { + _responseData.remove('headers'); + return; + } + _responseData['headers'] = splitHeaderValues(value); + } + + /// An unmodifiable map representing the response headers. Duplicate headers + /// are represented using a list of values. + /// + /// For example, the map + /// + /// ```dart + /// {'Foo': ['Bar', 'Baz']}); + /// ``` + /// + /// represents the headers + /// + /// Foo: Bar + /// Foo: Baz + Map>? get headers => _responseData['headers'] == null + ? null + : UnmodifiableMapView( + _responseData['headers'] as Map>); + + // The compression state of the response. + // + // This specifies whether the response bytes were compressed when they were + // received across the wire and whether callers will receive compressed or + // uncompressed bytes when they listen to the response body byte stream. + set compressionState(HttpClientResponseCompressionState? value) { + _checkAndUpdate(); + if (value == null) { + _responseData.remove('compressionState'); + } else { + _responseData['compressionState'] = value.name; + } + } + + HttpClientResponseCompressionState? get compressionState => + _responseData['compressionState'] == null + ? null + : HttpClientResponseCompressionState.values + .firstWhere((v) => v.name == _responseData['compressionState']); + + // The reason phrase associated with the response e.g. "OK". + set reasonPhrase(String? value) { + _checkAndUpdate(); + if (value == null) { + _responseData.remove('reasonPhrase'); + } else { + _responseData['reasonPhrase'] = value; + } + } + + String? get reasonPhrase => _responseData['reasonPhrase'] as String?; + + /// Whether the status code was one of the normal redirect codes. + set isRedirect(bool? value) { + _checkAndUpdate(); + if (value == null) { + _responseData.remove('isRedirect'); + } else { + _responseData['isRedirect'] = value; + } + } + + bool? get isRedirect => _responseData['isRedirect'] as bool?; + + /// The persistent connection state returned by the server. + set persistentConnection(bool? value) { + _checkAndUpdate(); + if (value == null) { + _responseData.remove('persistentConnection'); + } else { + _responseData['persistentConnection'] = value; + } + } + + bool? get persistentConnection => + _responseData['persistentConnection'] as bool?; + + /// The content length of the response body, in bytes. + set contentLength(int? value) { + _checkAndUpdate(); + if (value == null) { + _responseData.remove('contentLength'); + } else { + _responseData['contentLength'] = value; + } + } + + int? get contentLength => _responseData['contentLength'] as int?; + + set statusCode(int? value) { + _checkAndUpdate(); + if (value == null) { + _responseData.remove('statusCode'); + } else { + _responseData['statusCode'] = value; + } + } + + int? get statusCode => _responseData['statusCode'] as int?; + + /// The time at which the initial response was received. + set startTime(DateTime? value) { + _checkAndUpdate(); + if (value == null) { + _responseData.remove('startTime'); + } else { + _responseData['startTime'] = value.microsecondsSinceEpoch; + } + } + + DateTime? get startTime => _responseData['startTime'] == null + ? null + : DateTime.fromMicrosecondsSinceEpoch(_responseData['startTime'] as int); + + /// The time when the response was fully received. + DateTime? get endTime => _responseData['endTime'] == null + ? null + : DateTime.fromMicrosecondsSinceEpoch(_responseData['endTime'] as int); + + /// The error that the response failed with. + String? get error => + _responseData['error'] == null ? null : _responseData['error'] as String; + + HttpProfileResponseData._( + this._data, + this._updated, + ) { + _responseData['redirects'] = >[]; + } + + void _checkAndUpdate() { + if (_isClosed) { + throw StateError('HttpProfileResponseData has been closed, no further ' + 'updates are allowed'); + } + _updated(); + } + + /// Signal that the response, including the entire response body, has been + /// received. + /// + /// [bodySink] will be closed and the fields of [HttpProfileResponseData] will + /// no longer be changeable. + /// + /// [endTime] is the time when the response was fully received. It defaults + /// to the current time. + Future close([DateTime? endTime]) async { + _checkAndUpdate(); + _isClosed = true; + await bodySink.close(); + _responseData['endTime'] = + (endTime ?? DateTime.now()).microsecondsSinceEpoch; + } + + /// Signal that receiving the response has failed with an error. + /// + /// [bodySink] will be closed and the fields of [HttpProfileResponseData] will + /// no longer be changeable. + /// + /// [value] is a textual description of the error e.g. 'host does not exist'. + /// + /// [endTime] is the time when the error occurred. It defaults to the current + /// time. + Future closeWithError(String value, [DateTime? endTime]) async { + _checkAndUpdate(); + _isClosed = true; + await bodySink.close(); + _responseData['error'] = value; + _responseData['endTime'] = + (endTime ?? DateTime.now()).microsecondsSinceEpoch; + } +} diff --git a/pkgs/http_profile/lib/src/utils.dart b/pkgs/http_profile/lib/src/utils.dart new file mode 100644 index 0000000000..780bb446b8 --- /dev/null +++ b/pkgs/http_profile/lib/src/utils.dart @@ -0,0 +1,52 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// "token" as defined in RFC 2616, 2.2 +/// See https://datatracker.ietf.org/doc/html/rfc2616#section-2.2 +const _tokenChars = r"!#$%&'*+\-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`" + 'abcdefghijklmnopqrstuvwxyz|~'; + +/// Splits comma-separated header values. +var _headerSplitter = RegExp(r'[ \t]*,[ \t]*'); + +/// Splits comma-separated "Set-Cookie" header values. +/// +/// Set-Cookie strings can contain commas. In particular, the following +/// productions defined in RFC-6265, section 4.1.1: +/// - `` e.g. "Expires=Sun, 06 Nov 1994 08:49:37 GMT" +/// - `` e.g. "Path=somepath," +/// - `` e.g. "AnyString,Really," +/// +/// Some values are ambiguous e.g. +/// "Set-Cookie: lang=en; Path=/foo/" +/// "Set-Cookie: SID=x23" +/// and: +/// "Set-Cookie: lang=en; Path=/foo/,SID=x23" +/// would both be result in `response.headers` => "lang=en; Path=/foo/,SID=x23" +/// +/// The idea behind this regex is that `,=` is more likely to +/// start a new `` than be part of `` or +/// ``. +/// +/// See https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1 +var _setCookieSplitter = RegExp(r'[ \t]*,[ \t]*(?=[' + _tokenChars + r']+=)'); + +/// Splits comma-separated header values into a [List]. +/// +/// Copied from `package:http`. +Map> splitHeaderValues(Map headers) { + var headersWithFieldLists = >{}; + headers.forEach((key, value) { + if (!value.contains(',')) { + headersWithFieldLists[key] = [value]; + } else { + if (key == 'set-cookie') { + headersWithFieldLists[key] = value.split(_setCookieSplitter); + } else { + headersWithFieldLists[key] = value.split(_headerSplitter); + } + } + }); + return headersWithFieldLists; +} diff --git a/pkgs/http_profile/mono_pkg.yaml b/pkgs/http_profile/mono_pkg.yaml new file mode 100644 index 0000000000..977b336758 --- /dev/null +++ b/pkgs/http_profile/mono_pkg.yaml @@ -0,0 +1,14 @@ +sdk: +- pubspec +- dev + +stages: +- analyze_and_format: + - analyze: --fatal-infos + - format: + sdk: + - dev +- unit_test: + - test: --platform vm + os: + - linux diff --git a/pkgs/http_profile/pubspec.yaml b/pkgs/http_profile/pubspec.yaml new file mode 100644 index 0000000000..1184789c8a --- /dev/null +++ b/pkgs/http_profile/pubspec.yaml @@ -0,0 +1,13 @@ +name: http_profile +description: >- + A library used by HTTP client authors to integrate with the DevTools Network + View. +repository: https://github.com/dart-lang/http/tree/master/pkgs/http_profile +version: 0.1.1-wip + +environment: + sdk: ^3.4.0 + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + test: ^1.24.9 diff --git a/pkgs/http_profile/test/close_test.dart b/pkgs/http_profile/test/close_test.dart new file mode 100644 index 0000000000..ffa3579917 --- /dev/null +++ b/pkgs/http_profile/test/close_test.dart @@ -0,0 +1,115 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:developer' show getHttpClientProfilingData; + +import 'package:http_profile/http_profile.dart'; +import 'package:test/test.dart'; + +void main() { + late HttpClientRequestProfile profile; + late Map backingMap; + + setUp(() { + HttpClientRequestProfile.profilingEnabled = true; + + profile = HttpClientRequestProfile.profile( + requestStartTime: DateTime.parse('2024-03-21'), + requestMethod: 'GET', + requestUri: 'https://www.example.com', + )!; + + final profileBackingMaps = getHttpClientProfilingData(); + expect(profileBackingMaps.length, isPositive); + backingMap = profileBackingMaps.lastOrNull!; + }); + + group('requestData.close', () { + test('no arguments', () async { + expect(backingMap['requestEndTimestamp'], isNull); + await profile.requestData.close(); + + expect( + backingMap['requestEndTimestamp'], + closeTo(DateTime.now().microsecondsSinceEpoch, + Duration.microsecondsPerSecond), + ); + }); + + test('with time', () async { + expect(backingMap['requestEndTimestamp'], isNull); + await profile.requestData.close(DateTime.parse('2024-03-23')); + + expect( + backingMap['requestEndTimestamp'], + DateTime.parse('2024-03-23').microsecondsSinceEpoch, + ); + }); + + test('then write body', () async { + await profile.requestData.close(); + + expect( + () => profile.requestData.bodySink.add([1, 2, 3]), + throwsStateError, + ); + }); + + test('then mutate', () async { + await profile.requestData.close(); + + expect( + () => profile.requestData.contentLength = 5, + throwsStateError, + ); + }); + }); + + group('responseData.close', () { + late Map responseData; + + setUp(() { + responseData = backingMap['responseData'] as Map; + }); + + test('no arguments', () async { + expect(responseData['endTime'], isNull); + await profile.responseData.close(); + + expect( + responseData['endTime'], + closeTo(DateTime.now().microsecondsSinceEpoch, + Duration.microsecondsPerSecond), + ); + }); + + test('with time', () async { + expect(responseData['endTime'], isNull); + await profile.responseData.close(DateTime.parse('2024-03-23')); + + expect( + responseData['endTime'], + DateTime.parse('2024-03-23').microsecondsSinceEpoch, + ); + }); + + test('then write body', () async { + await profile.responseData.close(); + + expect( + () => profile.responseData.bodySink.add([1, 2, 3]), + throwsStateError, + ); + }); + + test('then mutate', () async { + await profile.responseData.close(); + + expect( + () => profile.responseData.contentLength = 5, + throwsStateError, + ); + }); + }); +} diff --git a/pkgs/http_profile/test/http_client_request_profile_test.dart b/pkgs/http_profile/test/http_client_request_profile_test.dart new file mode 100644 index 0000000000..7422bffc20 --- /dev/null +++ b/pkgs/http_profile/test/http_client_request_profile_test.dart @@ -0,0 +1,142 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:developer'; +import 'dart:io'; + +import 'package:http_profile/src/http_profile.dart'; +import 'package:test/test.dart'; + +void main() { + late HttpClientRequestProfile profile; + late Map backingMap; + + setUp(() { + HttpClientRequestProfile.profilingEnabled = true; + + profile = HttpClientRequestProfile.profile( + requestStartTime: DateTime.parse('2024-03-21'), + requestMethod: 'GET', + requestUri: 'https://www.example.com', + )!; + + final profileBackingMaps = getHttpClientProfilingData(); + expect(profileBackingMaps.length, isPositive); + backingMap = profileBackingMaps.lastOrNull!; + }); + + test('profiling enabled', () async { + HttpClientRequestProfile.profilingEnabled = true; + expect(HttpClient.enableTimelineLogging, true); + expect( + HttpClientRequestProfile.profile( + requestStartTime: DateTime.parse('2024-03-21'), + requestMethod: 'GET', + requestUri: 'https://www.example.com', + ), + isNotNull, + ); + }); + + test('profiling disabled', () async { + HttpClientRequestProfile.profilingEnabled = false; + expect(HttpClient.enableTimelineLogging, false); + expect( + HttpClientRequestProfile.profile( + requestStartTime: DateTime.parse('2024-03-21'), + requestMethod: 'GET', + requestUri: 'https://www.example.com', + ), + isNull, + ); + }); + + test('calling HttpClientRequestProfile.addEvent', () async { + final eventsFromBackingMap = + backingMap['events'] as List>; + expect(eventsFromBackingMap, isEmpty); + + expect(profile.events, isEmpty); + + profile.addEvent(HttpProfileRequestEvent( + timestamp: DateTime.parse('2024-03-22'), + name: 'an event', + )); + + expect(eventsFromBackingMap.length, 1); + final eventFromBackingMap = eventsFromBackingMap.last; + expect( + eventFromBackingMap['timestamp'], + DateTime.parse('2024-03-22').microsecondsSinceEpoch, + ); + expect(eventFromBackingMap['event'], 'an event'); + + expect(profile.events.length, 1); + final eventFromGetter = profile.events.first; + expect(eventFromGetter.timestamp, DateTime.parse('2024-03-22')); + expect(eventFromGetter.name, 'an event'); + }); + + test('populating HttpClientRequestProfile.connectionInfo', () async { + final requestData = backingMap['requestData'] as Map; + final responseData = backingMap['responseData'] as Map; + expect(requestData['connectionInfo'], isNull); + expect(responseData['connectionInfo'], isNull); + expect(profile.connectionInfo, isNull); + + profile.connectionInfo = { + 'localPort': 1285, + 'remotePort': 443, + 'connectionPoolId': '21x23' + }; + + final connectionInfoFromRequestData = + requestData['connectionInfo'] as Map; + final connectionInfoFromResponseData = + responseData['connectionInfo'] as Map; + expect(connectionInfoFromRequestData['localPort'], 1285); + expect(connectionInfoFromResponseData['localPort'], 1285); + expect(connectionInfoFromRequestData['remotePort'], 443); + expect(connectionInfoFromResponseData['remotePort'], 443); + expect(connectionInfoFromRequestData['connectionPoolId'], '21x23'); + expect(connectionInfoFromResponseData['connectionPoolId'], '21x23'); + + final connectionInfoFromGetter = profile.connectionInfo!; + expect(connectionInfoFromGetter['localPort'], 1285); + expect(connectionInfoFromGetter['remotePort'], 443); + expect(connectionInfoFromGetter['connectionPoolId'], '21x23'); + }); + + test('HttpClientRequestProfile.connectionInfo = null', () async { + profile.connectionInfo = { + 'localPort': 1285, + 'remotePort': 443, + 'connectionPoolId': '21x23' + }; + + final requestData = backingMap['requestData'] as Map; + final connectionInfoFromRequestData = + requestData['connectionInfo'] as Map; + final responseData = backingMap['responseData'] as Map; + final connectionInfoFromResponseData = + responseData['connectionInfo'] as Map; + expect(connectionInfoFromRequestData['localPort'], 1285); + expect(connectionInfoFromResponseData['localPort'], 1285); + expect(connectionInfoFromRequestData['remotePort'], 443); + expect(connectionInfoFromResponseData['remotePort'], 443); + expect(connectionInfoFromRequestData['connectionPoolId'], '21x23'); + expect(connectionInfoFromResponseData['connectionPoolId'], '21x23'); + + final connectionInfoFromGetter = profile.connectionInfo!; + expect(connectionInfoFromGetter['localPort'], 1285); + expect(connectionInfoFromGetter['remotePort'], 443); + expect(connectionInfoFromGetter['connectionPoolId'], '21x23'); + + profile.connectionInfo = null; + + expect(requestData['connectionInfo'], isNull); + expect(responseData['connectionInfo'], isNull); + expect(profile.connectionInfo, isNull); + }); +} diff --git a/pkgs/http_profile/test/http_profile_request_data_test.dart b/pkgs/http_profile/test/http_profile_request_data_test.dart new file mode 100644 index 0000000000..500cd95f52 --- /dev/null +++ b/pkgs/http_profile/test/http_profile_request_data_test.dart @@ -0,0 +1,358 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:developer' show Service, getHttpClientProfilingData; +import 'dart:isolate' show Isolate; + +import 'package:http_profile/http_profile.dart'; +import 'package:test/test.dart'; + +void main() { + late HttpClientRequestProfile profile; + late Map backingMap; + + setUp(() { + HttpClientRequestProfile.profilingEnabled = true; + + profile = HttpClientRequestProfile.profile( + requestStartTime: DateTime.parse('2024-03-21'), + requestMethod: 'GET', + requestUri: 'https://www.example.com', + )!; + + final profileBackingMaps = getHttpClientProfilingData(); + expect(profileBackingMaps.length, isPositive); + backingMap = profileBackingMaps.lastOrNull!; + }); + + test( + 'mandatory fields are populated when an HttpClientRequestProfile is ' + 'constructed', () async { + expect(backingMap['id'], isNotNull); + expect(backingMap['isolateId'], Service.getIsolateId(Isolate.current)!); + expect( + backingMap['requestStartTimestamp'], + DateTime.parse('2024-03-21').microsecondsSinceEpoch, + ); + expect(backingMap['requestMethod'], 'GET'); + expect(backingMap['requestUri'], 'https://www.example.com'); + + expect(profile.requestData.startTime, DateTime.parse('2024-03-21')); + expect(profile.requestMethod, 'GET'); + expect(profile.requestUri, 'https://www.example.com'); + }); + + test('populating HttpClientRequestProfile.requestEndTimestamp', () async { + expect(backingMap['requestEndTimestamp'], isNull); + expect(profile.requestData.endTime, isNull); + + await profile.requestData.close(DateTime.parse('2024-03-23')); + + expect( + backingMap['requestEndTimestamp'], + DateTime.parse('2024-03-23').microsecondsSinceEpoch, + ); + expect(profile.requestData.endTime, DateTime.parse('2024-03-23')); + }); + + test('populating HttpClientRequestProfile.requestData.contentLength', + () async { + final requestData = backingMap['requestData'] as Map; + expect(requestData['contentLength'], isNull); + expect(profile.requestData.contentLength, isNull); + + profile.requestData.contentLength = 1200; + + expect(requestData['contentLength'], 1200); + expect(profile.requestData.contentLength, 1200); + }); + + test('HttpClientRequestProfile.requestData.contentLength = null', () async { + final requestData = backingMap['requestData'] as Map; + + profile.requestData.contentLength = 1200; + expect(requestData['contentLength'], 1200); + expect(profile.requestData.contentLength, 1200); + + profile.requestData.contentLength = null; + expect(requestData['contentLength'], isNull); + expect(profile.requestData.contentLength, isNull); + }); + + test('populating HttpClientRequestProfile.requestData.error', () async { + final requestData = backingMap['requestData'] as Map; + expect(requestData['error'], isNull); + expect(profile.requestData.error, isNull); + + await profile.requestData.closeWithError('failed'); + + expect(requestData['error'], 'failed'); + expect(profile.requestData.error, 'failed'); + }); + + test('populating HttpClientRequestProfile.requestData.followRedirects', + () async { + final requestData = backingMap['requestData'] as Map; + expect(requestData['followRedirects'], isNull); + expect(profile.requestData.followRedirects, isNull); + + profile.requestData.followRedirects = true; + + expect(requestData['followRedirects'], true); + expect(profile.requestData.followRedirects, true); + }); + + test('HttpClientRequestProfile.requestData.followRedirects = null', () async { + final requestData = backingMap['requestData'] as Map; + + profile.requestData.followRedirects = true; + expect(requestData['followRedirects'], true); + expect(profile.requestData.followRedirects, true); + + profile.requestData.followRedirects = null; + expect(requestData['followRedirects'], isNull); + expect(profile.requestData.followRedirects, isNull); + }); + + test('populating HttpClientRequestProfile.requestData.headersListValues', + () async { + final requestData = backingMap['requestData'] as Map; + expect(requestData['headers'], isNull); + expect(profile.requestData.headers, isNull); + + profile.requestData.headersListValues = { + 'fruit': ['apple', 'banana', 'grape'], + 'content-length': ['0'], + }; + + expect( + requestData['headers'], + { + 'fruit': ['apple', 'banana', 'grape'], + 'content-length': ['0'], + }, + ); + expect( + profile.requestData.headers, + { + 'fruit': ['apple', 'banana', 'grape'], + 'content-length': ['0'], + }, + ); + }); + + test('HttpClientRequestProfile.requestData.headersListValues = null', + () async { + final requestData = backingMap['requestData'] as Map; + + profile.requestData.headersListValues = { + 'fruit': ['apple', 'banana', 'grape'], + 'content-length': ['0'], + }; + expect( + requestData['headers'], + { + 'fruit': ['apple', 'banana', 'grape'], + 'content-length': ['0'], + }, + ); + expect( + profile.requestData.headers, + { + 'fruit': ['apple', 'banana', 'grape'], + 'content-length': ['0'], + }, + ); + + profile.requestData.headersListValues = null; + expect(requestData['headers'], isNull); + expect(profile.requestData.headers, isNull); + }); + + test('populating HttpClientRequestProfile.requestData.headersCommaValues', + () async { + final requestData = backingMap['requestData'] as Map; + expect(requestData['headers'], isNull); + expect(profile.requestData.headers, isNull); + + profile.requestData.headersCommaValues = { + 'set-cookie': + // ignore: missing_whitespace_between_adjacent_strings + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO,' + 'sessionId=e8bb43229de9; Domain=foo.example.com' + }; + + expect( + requestData['headers'], + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }, + ); + expect( + profile.requestData.headers, + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }, + ); + }); + + test('HttpClientRequestProfile.requestData.headersCommaValues = null', + () async { + final requestData = backingMap['requestData'] as Map; + + profile.requestData.headersCommaValues = { + 'set-cookie': + // ignore: missing_whitespace_between_adjacent_strings + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO,' + 'sessionId=e8bb43229de9; Domain=foo.example.com' + }; + expect( + requestData['headers'], + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }, + ); + expect( + profile.requestData.headers, + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }, + ); + + profile.requestData.headersCommaValues = null; + expect(requestData['headers'], isNull); + expect(profile.requestData.headers, isNull); + }); + + test('populating HttpClientRequestProfile.requestData.maxRedirects', + () async { + final requestData = backingMap['requestData'] as Map; + expect(requestData['maxRedirects'], isNull); + expect(profile.requestData.maxRedirects, isNull); + + profile.requestData.maxRedirects = 5; + + expect(requestData['maxRedirects'], 5); + expect(profile.requestData.maxRedirects, 5); + }); + + test('HttpClientRequestProfile.requestData.maxRedirects = null', () async { + final requestData = backingMap['requestData'] as Map; + + profile.requestData.maxRedirects = 5; + expect(requestData['maxRedirects'], 5); + expect(profile.requestData.maxRedirects, 5); + + profile.requestData.maxRedirects = null; + expect(requestData['maxRedirects'], isNull); + expect(profile.requestData.maxRedirects, isNull); + }); + + test('populating HttpClientRequestProfile.requestData.persistentConnection', + () async { + final requestData = backingMap['requestData'] as Map; + expect(requestData['persistentConnection'], isNull); + expect(profile.requestData.persistentConnection, isNull); + + profile.requestData.persistentConnection = true; + + expect(requestData['persistentConnection'], true); + expect(profile.requestData.persistentConnection, true); + }); + + test('HttpClientRequestProfile.requestData.persistentConnection = null', + () async { + final requestData = backingMap['requestData'] as Map; + + profile.requestData.persistentConnection = true; + expect(requestData['persistentConnection'], true); + expect(profile.requestData.persistentConnection, true); + + profile.requestData.persistentConnection = null; + expect(requestData['persistentConnection'], isNull); + expect(profile.requestData.persistentConnection, isNull); + }); + + test('populating HttpClientRequestProfile.requestData.proxyDetails', + () async { + final requestData = backingMap['requestData'] as Map; + expect(requestData['proxyDetails'], isNull); + expect(profile.requestData.proxyDetails, isNull); + + profile.requestData.proxyDetails = HttpProfileProxyData( + host: 'https://www.example.com', + username: 'abc123', + isDirect: true, + port: 4321, + ); + + final proxyDetailsFromBackingMap = + requestData['proxyDetails'] as Map; + expect(proxyDetailsFromBackingMap['host'], 'https://www.example.com'); + expect(proxyDetailsFromBackingMap['username'], 'abc123'); + expect(proxyDetailsFromBackingMap['isDirect'], true); + expect(proxyDetailsFromBackingMap['port'], 4321); + + final proxyDetailsFromGetter = profile.requestData.proxyDetails!; + expect(proxyDetailsFromGetter.host, 'https://www.example.com'); + expect(proxyDetailsFromGetter.username, 'abc123'); + expect(proxyDetailsFromGetter.isDirect, true); + expect(proxyDetailsFromGetter.port, 4321); + }); + + test('HttpClientRequestProfile.requestData.proxyDetails = null', () async { + final requestData = backingMap['requestData'] as Map; + + profile.requestData.proxyDetails = HttpProfileProxyData( + host: 'https://www.example.com', + username: 'abc123', + isDirect: true, + port: 4321, + ); + + final proxyDetailsFromBackingMap = + requestData['proxyDetails'] as Map; + expect(proxyDetailsFromBackingMap['host'], 'https://www.example.com'); + expect(proxyDetailsFromBackingMap['username'], 'abc123'); + expect(proxyDetailsFromBackingMap['isDirect'], true); + expect(proxyDetailsFromBackingMap['port'], 4321); + + final proxyDetailsFromGetter = profile.requestData.proxyDetails!; + expect(proxyDetailsFromGetter.host, 'https://www.example.com'); + expect(proxyDetailsFromGetter.username, 'abc123'); + expect(proxyDetailsFromGetter.isDirect, true); + expect(proxyDetailsFromGetter.port, 4321); + + profile.requestData.proxyDetails = null; + + expect(requestData['proxyDetails'], isNull); + expect(profile.requestData.proxyDetails, isNull); + }); + + test('using HttpClientRequestProfile.requestData.bodySink', () async { + final requestBodyBytes = backingMap['requestBodyBytes'] as List; + expect(requestBodyBytes, isEmpty); + expect(profile.requestData.bodyBytes, isEmpty); + + profile.requestData.bodySink.add([1, 2, 3]); + profile.requestData.bodySink.addError('this is an error'); + profile.requestData.bodySink.add([4, 5]); + await profile.requestData.close(); + + expect(requestBodyBytes, [1, 2, 3, 4, 5]); + expect(profile.requestData.bodyBytes, [1, 2, 3, 4, 5]); + }); +} diff --git a/pkgs/http_profile/test/http_profile_response_data_test.dart b/pkgs/http_profile/test/http_profile_response_data_test.dart new file mode 100644 index 0000000000..646c3e6729 --- /dev/null +++ b/pkgs/http_profile/test/http_profile_response_data_test.dart @@ -0,0 +1,446 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:developer' show getHttpClientProfilingData; +import 'dart:io'; + +import 'package:http_profile/http_profile.dart'; +import 'package:test/test.dart'; + +void main() { + late HttpClientRequestProfile profile; + late Map backingMap; + + setUp(() { + HttpClientRequestProfile.profilingEnabled = true; + + profile = HttpClientRequestProfile.profile( + requestStartTime: DateTime.parse('2024-03-21'), + requestMethod: 'GET', + requestUri: 'https://www.example.com', + )!; + + final profileBackingMaps = getHttpClientProfilingData(); + expect(profileBackingMaps.length, isPositive); + backingMap = profileBackingMaps.lastOrNull!; + }); + + group('HttpProfileRedirectData', () { + test('equal', () { + expect( + HttpProfileRedirectData( + statusCode: 302, method: 'GET', location: 'http://somewhere'), + HttpProfileRedirectData( + statusCode: 302, method: 'GET', location: 'http://somewhere')); + }); + + test('not equal', () { + expect( + HttpProfileRedirectData( + statusCode: 302, method: 'GET', location: 'http://somewhere'), + isNot(Object())); + expect( + HttpProfileRedirectData( + statusCode: 302, method: 'GET', location: 'http://somewhere'), + isNot(HttpProfileRedirectData( + statusCode: 303, method: 'GET', location: 'http://somewhere'))); + expect( + HttpProfileRedirectData( + statusCode: 302, method: 'GET', location: 'http://somewhere'), + isNot(HttpProfileRedirectData( + statusCode: 302, method: 'POST', location: 'http://somewhere'))); + expect( + HttpProfileRedirectData( + statusCode: 302, method: 'GET', location: 'http://somewhere'), + isNot(HttpProfileRedirectData( + statusCode: 302, method: 'GET', location: 'http://notthere'))); + }); + + test('hash', () { + expect( + HttpProfileRedirectData( + statusCode: 302, method: 'GET', location: 'http://somewhere') + .hashCode, + HttpProfileRedirectData( + statusCode: 302, method: 'GET', location: 'http://somewhere') + .hashCode); + }); + }); + + test('calling HttpClientRequestProfile.responseData.addRedirect', () async { + final responseData = backingMap['responseData'] as Map; + final redirectsFromBackingMap = + responseData['redirects'] as List>; + expect(redirectsFromBackingMap, isEmpty); + expect(profile.responseData.redirects, isEmpty); + + profile.responseData.addRedirect(HttpProfileRedirectData( + statusCode: 301, + method: 'GET', + location: 'https://images.example.com/1', + )); + + expect(redirectsFromBackingMap.length, 1); + final redirectFromBackingMap = redirectsFromBackingMap.last; + expect(redirectFromBackingMap['statusCode'], 301); + expect(redirectFromBackingMap['method'], 'GET'); + expect(redirectFromBackingMap['location'], 'https://images.example.com/1'); + + expect(profile.responseData.redirects, [ + HttpProfileRedirectData( + statusCode: 301, + method: 'GET', + location: 'https://images.example.com/1', + ) + ]); + }); + + test('populating HttpClientRequestProfile.responseData.headersListValues', + () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['headers'], isNull); + expect(profile.responseData.headers, isNull); + + profile.responseData.headersListValues = { + 'connection': ['keep-alive'], + 'cache-control': ['max-age=43200'], + 'content-type': ['application/json', 'charset=utf-8'], + }; + + expect( + responseData['headers'], + { + 'connection': ['keep-alive'], + 'cache-control': ['max-age=43200'], + 'content-type': ['application/json', 'charset=utf-8'], + }, + ); + expect( + profile.responseData.headers, + { + 'connection': ['keep-alive'], + 'cache-control': ['max-age=43200'], + 'content-type': ['application/json', 'charset=utf-8'], + }, + ); + }); + + test('HttpClientRequestProfile.responseData.headersListValues = null', + () async { + final responseData = backingMap['responseData'] as Map; + + profile.responseData.headersListValues = { + 'connection': ['keep-alive'], + 'cache-control': ['max-age=43200'], + 'content-type': ['application/json', 'charset=utf-8'], + }; + expect( + responseData['headers'], + { + 'connection': ['keep-alive'], + 'cache-control': ['max-age=43200'], + 'content-type': ['application/json', 'charset=utf-8'], + }, + ); + expect( + profile.responseData.headers, + { + 'connection': ['keep-alive'], + 'cache-control': ['max-age=43200'], + 'content-type': ['application/json', 'charset=utf-8'], + }, + ); + + profile.responseData.headersListValues = null; + expect(responseData['headers'], isNull); + expect(profile.responseData.headers, isNull); + }); + + test('populating HttpClientRequestProfile.responseData.headersCommaValues', + () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['headers'], isNull); + expect(profile.responseData.headers, isNull); + + profile.responseData.headersCommaValues = { + 'set-cookie': + // ignore: missing_whitespace_between_adjacent_strings + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO,' + 'sessionId=e8bb43229de9; Domain=foo.example.com' + }; + + expect( + responseData['headers'], + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }, + ); + expect( + profile.responseData.headers, + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }, + ); + }); + + test('HttpClientRequestProfile.responseData.headersCommaValues = null', + () async { + final responseData = backingMap['responseData'] as Map; + + profile.responseData.headersCommaValues = { + 'set-cookie': + // ignore: missing_whitespace_between_adjacent_strings + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO,' + 'sessionId=e8bb43229de9; Domain=foo.example.com' + }; + expect( + responseData['headers'], + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }, + ); + expect( + profile.responseData.headers, + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }, + ); + + profile.responseData.headersCommaValues = null; + expect(responseData['headers'], isNull); + expect(profile.responseData.headers, isNull); + }); + + test('populating HttpClientRequestProfile.responseData.compressionState', + () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['compressionState'], isNull); + expect(profile.responseData.compressionState, isNull); + + profile.responseData.compressionState = + HttpClientResponseCompressionState.decompressed; + + expect(responseData['compressionState'], 'decompressed'); + expect( + profile.responseData.compressionState, + HttpClientResponseCompressionState.decompressed, + ); + }); + + test('HttpClientRequestProfile.responseData.compressionState = null', + () async { + final responseData = backingMap['responseData'] as Map; + + profile.responseData.compressionState = + HttpClientResponseCompressionState.decompressed; + expect(responseData['compressionState'], 'decompressed'); + expect( + profile.responseData.compressionState, + HttpClientResponseCompressionState.decompressed, + ); + + profile.responseData.compressionState = null; + expect(responseData['compressionState'], isNull); + expect(profile.responseData.compressionState, isNull); + }); + + test('populating HttpClientRequestProfile.responseData.reasonPhrase', + () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['reasonPhrase'], isNull); + expect(profile.responseData.reasonPhrase, isNull); + + profile.responseData.reasonPhrase = 'OK'; + + expect(responseData['reasonPhrase'], 'OK'); + expect(profile.responseData.reasonPhrase, 'OK'); + }); + + test('HttpClientRequestProfile.responseData.reasonPhrase = null', () async { + final responseData = backingMap['responseData'] as Map; + + profile.responseData.reasonPhrase = 'OK'; + expect(responseData['reasonPhrase'], 'OK'); + expect(profile.responseData.reasonPhrase, 'OK'); + + profile.responseData.reasonPhrase = null; + expect(responseData['reasonPhrase'], isNull); + expect(profile.responseData.reasonPhrase, isNull); + }); + + test('populating HttpClientRequestProfile.responseData.isRedirect', () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['isRedirect'], isNull); + expect(profile.responseData.isRedirect, isNull); + + profile.responseData.isRedirect = true; + + expect(responseData['isRedirect'], true); + expect(profile.responseData.isRedirect, true); + }); + + test('HttpClientRequestProfile.responseData.isRedirect = null', () async { + final responseData = backingMap['responseData'] as Map; + + profile.responseData.isRedirect = true; + expect(responseData['isRedirect'], true); + expect(profile.responseData.isRedirect, true); + + profile.responseData.isRedirect = null; + expect(responseData['isRedirect'], isNull); + expect(profile.responseData.isRedirect, isNull); + }); + + test('populating HttpClientRequestProfile.responseData.persistentConnection', + () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['persistentConnection'], isNull); + expect(profile.responseData.persistentConnection, isNull); + + profile.responseData.persistentConnection = true; + + expect(responseData['persistentConnection'], true); + expect(profile.responseData.persistentConnection, true); + }); + + test('HttpClientRequestProfile.responseData.persistentConnection = null', + () async { + final responseData = backingMap['responseData'] as Map; + + profile.responseData.persistentConnection = true; + expect(responseData['persistentConnection'], true); + expect(profile.responseData.persistentConnection, true); + + profile.responseData.persistentConnection = null; + expect(responseData['persistentConnection'], isNull); + expect(profile.responseData.persistentConnection, isNull); + }); + + test('populating HttpClientRequestProfile.responseData.contentLength', + () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['contentLength'], isNull); + expect(profile.responseData.contentLength, isNull); + + profile.responseData.contentLength = 1200; + + expect(responseData['contentLength'], 1200); + expect(profile.responseData.contentLength, 1200); + }); + + test('HttpClientRequestProfile.responseData.contentLength = null', () async { + final responseData = backingMap['responseData'] as Map; + + profile.responseData.contentLength = 1200; + expect(responseData['contentLength'], 1200); + expect(profile.responseData.contentLength, 1200); + + profile.responseData.contentLength = null; + expect(responseData['contentLength'], isNull); + expect(profile.responseData.contentLength, isNull); + }); + + test('populating HttpClientRequestProfile.responseData.statusCode', () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['statusCode'], isNull); + expect(profile.responseData.statusCode, isNull); + + profile.responseData.statusCode = 200; + + expect(responseData['statusCode'], 200); + expect(profile.responseData.statusCode, 200); + }); + + test('HttpClientRequestProfile.responseData.statusCode = null', () async { + final responseData = backingMap['responseData'] as Map; + + profile.responseData.statusCode = 200; + expect(responseData['statusCode'], 200); + expect(profile.responseData.statusCode, 200); + + profile.responseData.statusCode = null; + expect(responseData['statusCode'], isNull); + expect(profile.responseData.statusCode, isNull); + }); + + test('populating HttpClientRequestProfile.responseData.startTime', () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['startTime'], isNull); + expect(profile.responseData.startTime, isNull); + + profile.responseData.startTime = DateTime.parse('2024-03-21'); + + expect( + responseData['startTime'], + DateTime.parse('2024-03-21').microsecondsSinceEpoch, + ); + expect(profile.responseData.startTime, DateTime.parse('2024-03-21')); + }); + + test('HttpClientRequestProfile.responseData.startTime = null', () async { + final responseData = backingMap['responseData'] as Map; + + profile.responseData.startTime = DateTime.parse('2024-03-21'); + expect( + responseData['startTime'], + DateTime.parse('2024-03-21').microsecondsSinceEpoch, + ); + expect(profile.responseData.startTime, DateTime.parse('2024-03-21')); + + profile.responseData.startTime = null; + expect(responseData['startTime'], isNull); + expect(profile.responseData.startTime, isNull); + }); + + test('populating HttpClientRequestProfile.responseData.endTime', () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['endTime'], isNull); + expect(profile.responseData.endTime, isNull); + + await profile.responseData.close(DateTime.parse('2024-03-23')); + + expect( + responseData['endTime'], + DateTime.parse('2024-03-23').microsecondsSinceEpoch, + ); + expect(profile.responseData.endTime, DateTime.parse('2024-03-23')); + }); + + test('populating HttpClientRequestProfile.responseData.error', () async { + final responseData = backingMap['responseData'] as Map; + expect(responseData['error'], isNull); + expect(profile.responseData.error, isNull); + + await profile.responseData.closeWithError('failed'); + + expect(responseData['error'], 'failed'); + expect(profile.responseData.error, 'failed'); + }); + + test('using HttpClientRequestProfile.responseData.bodySink', () async { + final responseBodyBytes = backingMap['responseBodyBytes'] as List; + expect(responseBodyBytes, isEmpty); + expect(profile.responseData.bodyBytes, isEmpty); + + profile.responseData.bodySink.add([1, 2, 3]); + profile.responseData.bodySink.addError('this is an error'); + profile.responseData.bodySink.add([4, 5]); + await profile.responseData.close(); + + expect(responseBodyBytes, [1, 2, 3, 4, 5]); + expect(profile.responseData.bodyBytes, [1, 2, 3, 4, 5]); + }); +} diff --git a/pkgs/http_profile/test/utils_test.dart b/pkgs/http_profile/test/utils_test.dart new file mode 100644 index 0000000000..a15700ec8d --- /dev/null +++ b/pkgs/http_profile/test/utils_test.dart @@ -0,0 +1,74 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http_profile/src/utils.dart'; +import 'package:test/test.dart'; + +void main() { + group('splitHeaderValues', () { + test('no headers', () async { + expect(splitHeaderValues({}), const >{}); + }); + + test('one header', () async { + expect(splitHeaderValues({'fruit': 'apple'}), const { + 'fruit': ['apple'] + }); + }); + + test('two header', () async { + expect(splitHeaderValues({'fruit': 'apple,banana'}), const { + 'fruit': ['apple', 'banana'] + }); + }); + + test('two headers with lots of spaces', () async { + expect(splitHeaderValues({'fruit': 'apple \t , \tbanana'}), const { + 'fruit': ['apple', 'banana'] + }); + }); + + test('one set-cookie', () async { + expect( + splitHeaderValues({ + 'set-cookie': 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT' + }), + { + 'set-cookie': ['id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT'] + }); + }); + + test('two set-cookie, with comma in expires', () async { + expect( + splitHeaderValues({ + // ignore: missing_whitespace_between_adjacent_strings + 'set-cookie': 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT,' + 'sessionId=e8bb43229de9; Domain=foo.example.com' + }), + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }); + }); + + test('two set-cookie, with lots of commas', () async { + expect( + splitHeaderValues({ + // ignore: missing_whitespace_between_adjacent_strings + 'set-cookie': + // ignore: missing_whitespace_between_adjacent_strings + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO,' + 'sessionId=e8bb43229de9; Domain=foo.example.com' + }), + { + 'set-cookie': [ + 'id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/,,HE,=L=LO', + 'sessionId=e8bb43229de9; Domain=foo.example.com' + ] + }); + }); + }); +} diff --git a/pkgs/ok_http/.gitignore b/pkgs/ok_http/.gitignore new file mode 100644 index 0000000000..ac5aa9893e --- /dev/null +++ b/pkgs/ok_http/.gitignore @@ -0,0 +1,29 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +build/ diff --git a/pkgs/ok_http/.metadata b/pkgs/ok_http/.metadata new file mode 100644 index 0000000000..f72bdaaaf8 --- /dev/null +++ b/pkgs/ok_http/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3" + channel: "stable" + +project_type: plugin_ffi + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + - platform: android + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/pkgs/ok_http/CHANGELOG.md b/pkgs/ok_http/CHANGELOG.md new file mode 100644 index 0000000000..baba046e98 --- /dev/null +++ b/pkgs/ok_http/CHANGELOG.md @@ -0,0 +1,12 @@ +## 0.1.1-wip + +- `OkHttpClient` now receives an `OkHttpClientConfiguration` to configure the client on a per-call basis. +- `OkHttpClient` supports setting four types of timeouts: [`connectTimeout`](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/connect-timeout.html), [`readTimeout`](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/read-timeout.html), [`writeTimeout`](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/write-timeout.html), and [`callTimeout`](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/call-timeout.html), using the `OkHttpClientConfiguration`. +- Update to `jnigen` 0.12.2 + +## 0.1.0 + +- Implementation of [`BaseClient`](https://pub.dev/documentation/http/latest/http/BaseClient-class.html) and `send()` method using [`enqueue()` API](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-call/enqueue.html) +- `ok_http` can now send asynchronous requests and stream response bodies. +- Add [DevTools Network View](https://docs.flutter.dev/tools/devtools/network) support. +- WebSockets support is now available in the `ok_http` package. Wraps around the OkHttp [WebSocket API](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html). diff --git a/pkgs/ok_http/LICENSE b/pkgs/ok_http/LICENSE new file mode 100644 index 0000000000..afd9a64bec --- /dev/null +++ b/pkgs/ok_http/LICENSE @@ -0,0 +1,27 @@ +Copyright 2014, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. \ No newline at end of file diff --git a/pkgs/ok_http/README.md b/pkgs/ok_http/README.md new file mode 100644 index 0000000000..513234815e --- /dev/null +++ b/pkgs/ok_http/README.md @@ -0,0 +1,73 @@ +[![pub package](https://img.shields.io/pub/v/ok_http.svg)](https://pub.dev/packages/ok_http) +[![package publisher](https://img.shields.io/pub/publisher/ok_http.svg)](https://pub.dev/packages/ok_http/publisher) + +An Android Flutter plugin that provides access to the +[OkHttp][] HTTP client and the OkHttp [WebSocket][] API. + +## Why use `package:ok_http`? + +### 👍 Increased compatibility and reduced disk profile + +`package:ok_http` is smaller and works on more devices than other packages. + +This size of the [example application][] APK file using different packages: + +| Package | APK Size (MiB) | +|-|-| +| **`ok_http`** | **20.3** | +| [`cronet_http`](https://pub.dev/packages/cronet_http) [^1] | 20.6 | +| [`cronet_http` (embedded)](https://pub.dev/packages/cronet_http#use-embedded-cronet) [^2] | 34.4 | +| `dart:io` [^3] | 20.4 | + +[^1]: Requires [Google Play Services][], which are not available on all devices. +[^2]: Embeds the Cronet HTTP library. +[^3]: Accessed through [`IOClient`](https://pub.dev/documentation/http/latest/io_client/IOClient-class.html). + +### 🔌 Supports WebSockets out of the box + +`package:ok_http` wraps the OkHttp [WebSocket][] API which supports: + +- Configured System Proxy on Android +- HTTP/2 + +**Example Usage of `OkHttpWebSocket`:** + +```dart +import 'package:ok_http/ok_http.dart'; +import 'package:web_socket/web_socket.dart'; +void main() async { + final socket = await OkHttpWebSocket.connect( + Uri.parse('wss://ws.postman-echo.com/raw')); + socket.events.listen((e) async { + switch (e) { + case TextDataReceived(text: final text): + print('Received Text: $text'); + await socket.close(); + case BinaryDataReceived(data: final data): + print('Received Binary: $data'); + case CloseReceived(code: final code, reason: final reason): + print('Connection to server closed: $code [$reason]'); + } + }); +} +``` + +## Status: experimental + +**NOTE**: This package is currently experimental and published under the +[labs.dart.dev](https://dart.dev/dart-team-packages) pub publisher in order to +solicit feedback. + +For packages in the labs.dart.dev publisher we generally plan to either graduate +the package into a supported publisher (dart.dev, tools.dart.dev) after a period +of feedback and iteration, or discontinue the package. These packages have a +much higher expected rate of API and breaking changes. + +Your feedback is valuable and will help us evolve this package. For general +feedback, suggestions, and comments, please file an issue in the +[bug tracker](https://github.com/dart-lang/http/issues). + +[example application]: https://github.com/dart-lang/http/tree/master/pkgs/flutter_http_example +[OkHttp]: https://square.github.io/okhttp/ +[Google Play Services]: https://developers.google.com/android/guides/overview +[WebSocket]: https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html diff --git a/pkgs/ok_http/android/.gitignore b/pkgs/ok_http/android/.gitignore new file mode 100644 index 0000000000..161bdcdaf8 --- /dev/null +++ b/pkgs/ok_http/android/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.cxx diff --git a/pkgs/ok_http/android/build.gradle b/pkgs/ok_http/android/build.gradle new file mode 100644 index 0000000000..c7de868f22 --- /dev/null +++ b/pkgs/ok_http/android/build.gradle @@ -0,0 +1,66 @@ +// The Android Gradle Plugin builds the native code with the Android NDK. + +group = "com.example.ok_http" +version = "1.0" + +buildscript { + // Required to support `okhttp:4.12.0`. + ext.kotlin_version = '1.9.23' + repositories { + google() + mavenCentral() + } + + dependencies { + // The Android Gradle Plugin knows how to build native code with the NDK. + classpath("com.android.tools.build:gradle:7.3.0") + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +rootProject.allprojects { + repositories { + google() + mavenCentral() + } +} + +apply plugin: "com.android.library" +apply plugin: 'kotlin-android' + +android { + if (project.android.hasProperty("namespace")) { + namespace = "com.example.ok_http" + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + // Bumping the plugin compileSdk version requires all clients of this plugin + // to bump the version in their app. + compileSdk = 34 + + // Use the NDK version + // declared in /android/app/build.gradle file of the Flutter project. + // Replace it with a version number if this plugin requires a specific NDK version. + // (e.g. ndkVersion "23.1.7779620") + ndkVersion = android.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + defaultConfig { + minSdk = 21 + } +} + +dependencies { + implementation('com.squareup.okhttp3:okhttp:4.12.0') +} diff --git a/pkgs/ok_http/android/settings.gradle b/pkgs/ok_http/android/settings.gradle new file mode 100644 index 0000000000..64c0d94b15 --- /dev/null +++ b/pkgs/ok_http/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'ok_http' diff --git a/pkgs/ok_http/android/src/main/AndroidManifest.xml b/pkgs/ok_http/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..c4b185786e --- /dev/null +++ b/pkgs/ok_http/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/AsyncInputStreamReader.kt b/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/AsyncInputStreamReader.kt new file mode 100644 index 0000000000..b06b767a9d --- /dev/null +++ b/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/AsyncInputStreamReader.kt @@ -0,0 +1,63 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +package com.example.ok_http + +import java.io.IOException +import java.io.InputStream +import java.util.concurrent.ExecutorService +import java.util.concurrent.Executors +import java.util.concurrent.Future + + +/** + * Callback interface utilized by the [AsyncInputStreamReader]. + */ +interface DataCallback { + fun onDataRead(data: ByteArray) + fun onFinished() + fun onError(e: IOException) +} + +/** + * Provides functions to read data from an InputStream asynchronously. + */ +class AsyncInputStreamReader { + private val executorService: ExecutorService = Executors.newSingleThreadExecutor() + + /** + * Reads data from an InputStream asynchronously using an executor service. + * + * @param inputStream The InputStream to read from + * @param callback The DataCallback to call when data is read, finished, or an error occurs + * + * @return Future<*> + */ + fun readAsync(inputStream: InputStream, callback: DataCallback): Future<*> { + return executorService.submit { + try { + val buffer = ByteArray(4096) + var bytesRead: Int + while (inputStream.read(buffer).also { bytesRead = it } != -1) { + val byteArray = buffer.copyOfRange(0, bytesRead) + callback.onDataRead(byteArray) + } + + } catch (e: IOException) { + callback.onError(e) + } finally { + try { + inputStream.close() + } catch (e: IOException) { + callback.onError(e) + } + callback.onFinished() + } + } + } + + fun shutdown() { + executorService.shutdown() + } +} diff --git a/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/RedirectInterceptor.kt b/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/RedirectInterceptor.kt new file mode 100644 index 0000000000..1aac8ea3ae --- /dev/null +++ b/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/RedirectInterceptor.kt @@ -0,0 +1,69 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// To cause a request failure [with a suitable message] due to too many redirects, +// we need to throw an IOException. This cannot be done using Dart JNI bindings, +// which lead to a deadlock and eventually a `java.net.SocketTimeoutException`. +// https://github.com/dart-lang/native/issues/561 + +package com.example.ok_http + +import okhttp3.Interceptor +import okhttp3.OkHttpClient +import okhttp3.Response +import java.io.IOException + +/** + * Callback interface utilized by the [RedirectInterceptor]. + * + * Allows Dart code to operate upon the intermediate redirect responses. + */ +interface RedirectReceivedCallback { + fun onRedirectReceived(response: Response, location: String) +} + + +class RedirectInterceptor { + companion object { + + /** + * Adds a redirect interceptor to the OkHttpClient.Builder + * + * @param clientBuilder The `OkHttpClient.Builder` to add the interceptor to + * @param maxRedirects The maximum number of redirects to follow + * @param followRedirects Whether to follow redirects + * + * @return OkHttpClient.Builder + */ + fun addRedirectInterceptor( + clientBuilder: OkHttpClient.Builder, + maxRedirects: Int, + followRedirects: Boolean, + redirectCallback: RedirectReceivedCallback, + ): OkHttpClient.Builder { + return clientBuilder.addInterceptor(Interceptor { chain -> + var req = chain.request() + var response = chain.proceed(req) + var redirectCount = 0 + + while (response.isRedirect && followRedirects) { + if (redirectCount >= maxRedirects) { + throw IOException("Redirect limit exceeded") + } + + val location = response.header("location") ?: break + + redirectCallback.onRedirectReceived(response, location) + + req = req.newBuilder().url(location).build() + response.close() + response = chain.proceed(req) + redirectCount++ + } + + response + }) + } + } +} diff --git a/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/WebSocketInterceptor.kt b/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/WebSocketInterceptor.kt new file mode 100644 index 0000000000..da64591576 --- /dev/null +++ b/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/WebSocketInterceptor.kt @@ -0,0 +1,33 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +package com.example.ok_http + +import okhttp3.Interceptor +import okhttp3.OkHttpClient + +/** + * Usage of `chain.proceed(...)` via JNI Bindings leads to threading issues. This is a workaround + * to intercept the response before it is parsed by the WebSocketReader, to prevent response parsing errors. + * + * https://github.com/dart-lang/native/issues/1337 + */ +class WebSocketInterceptor { + companion object { + fun addWSInterceptor( + clientBuilder: OkHttpClient.Builder + ): OkHttpClient.Builder { + return clientBuilder.addInterceptor(Interceptor { chain -> + val request = chain.request() + val response = chain.proceed(request) + + response.newBuilder() + // Removing this header to ensure that OkHttp does not fail due to unexpected values. + .removeHeader("sec-websocket-extensions") + // Adding the header to ensure successful parsing of the response. + .addHeader("sec-websocket-extensions", "permessage-deflate").build() + }) + } + } +} diff --git a/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/WebSocketListenerProxy.kt b/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/WebSocketListenerProxy.kt new file mode 100644 index 0000000000..e0366c78be --- /dev/null +++ b/pkgs/ok_http/android/src/main/kotlin/com/example/ok_http/WebSocketListenerProxy.kt @@ -0,0 +1,51 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +package com.example.ok_http + +import okhttp3.Response +import okhttp3.WebSocket +import okhttp3.WebSocketListener +import okio.ByteString + +/** + * `OkHttp` expects a subclass of the abstract class [`WebSocketListener`](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket-listener/index.html) + * to be passed to the `newWebSocket` method. + * + * `package:jnigen` does not support the ability to subclass abstract Java classes in Dart + * (see https://github.com/dart-lang/jnigen/issues/348). + * + * This file provides an interface `WebSocketListener`, which can + * be implemented in Dart and a wrapper class `WebSocketListenerProxy`, which + * can be passed to the OkHttp API. + */ +class WebSocketListenerProxy(private val listener: WebSocketListener) : WebSocketListener() { + interface WebSocketListener { + fun onOpen(webSocket: WebSocket, response: Response) + fun onMessage(webSocket: WebSocket, text: String) + fun onMessage(webSocket: WebSocket, bytes: ByteString) + fun onClosing(webSocket: WebSocket, code: Int, reason: String) + fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) + } + + override fun onOpen(webSocket: WebSocket, response: Response) { + listener.onOpen(webSocket, response) + } + + override fun onMessage(webSocket: WebSocket, text: String) { + listener.onMessage(webSocket, text) + } + + override fun onMessage(webSocket: WebSocket, bytes: ByteString) { + listener.onMessage(webSocket, bytes) + } + + override fun onClosing(webSocket: WebSocket, code: Int, reason: String) { + listener.onClosing(webSocket, code, reason) + } + + override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) { + listener.onFailure(webSocket, t, response) + } +} diff --git a/pkgs/ok_http/example/.gitignore b/pkgs/ok_http/example/.gitignore new file mode 100644 index 0000000000..29a3a5017f --- /dev/null +++ b/pkgs/ok_http/example/.gitignore @@ -0,0 +1,43 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/pkgs/ok_http/example/README.md b/pkgs/ok_http/example/README.md new file mode 100644 index 0000000000..44f9e18b82 --- /dev/null +++ b/pkgs/ok_http/example/README.md @@ -0,0 +1,16 @@ +# ok_http_example + +Demonstrates how to use the ok_http plugin. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/pkgs/ok_http/example/analysis_options.yaml b/pkgs/ok_http/example/analysis_options.yaml new file mode 100644 index 0000000000..454652ff22 --- /dev/null +++ b/pkgs/ok_http/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:dart_flutter_team_lints/analysis_options.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/tools/analysis diff --git a/pkgs/ok_http/example/android/.gitignore b/pkgs/ok_http/example/android/.gitignore new file mode 100644 index 0000000000..55afd919c6 --- /dev/null +++ b/pkgs/ok_http/example/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/pkgs/ok_http/example/android/app/build.gradle b/pkgs/ok_http/example/android/app/build.gradle new file mode 100644 index 0000000000..dd2e4267ae --- /dev/null +++ b/pkgs/ok_http/example/android/app/build.gradle @@ -0,0 +1,65 @@ +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file("local.properties") +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader("UTF-8") { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty("flutter.versionCode") +if (flutterVersionCode == null) { + flutterVersionCode = "1" +} + +def flutterVersionName = localProperties.getProperty("flutter.versionName") +if (flutterVersionName == null) { + flutterVersionName = "1.0" +} + +android { + namespace = "com.example.ok_http_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.ok_http_example" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutterVersionCode.toInteger() + versionName = flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.debug + } + } +} + +flutter { + source = "../.." +} + +dependencies { + // "com.squareup.okhttp3:okhttp:4.12.0" is only present so that + // `jnigen` will work. Applications should not include this line. + // The version should be synced with `pkgs/ok_http/android/build.gradle`. + implementation('com.squareup.okhttp3:okhttp:4.12.0') +} diff --git a/pkgs/ok_http/example/android/app/src/debug/AndroidManifest.xml b/pkgs/ok_http/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000000..399f6981d5 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml b/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..8670e67f36 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/kotlin/com/example/ok_http_example/MainActivity.kt b/pkgs/ok_http/example/android/app/src/main/kotlin/com/example/ok_http_example/MainActivity.kt new file mode 100644 index 0000000000..7b47f2822b --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/kotlin/com/example/ok_http_example/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.ok_http_example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/pkgs/ok_http/example/android/app/src/main/res/drawable-v21/launch_background.xml b/pkgs/ok_http/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000000..f74085f3f6 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/res/drawable/launch_background.xml b/pkgs/ok_http/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000000..304732f884 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/pkgs/ok_http/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..db77bb4b7b Binary files /dev/null and b/pkgs/ok_http/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/pkgs/ok_http/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/pkgs/ok_http/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..17987b79bb Binary files /dev/null and b/pkgs/ok_http/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/pkgs/ok_http/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/pkgs/ok_http/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..09d4391482 Binary files /dev/null and b/pkgs/ok_http/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..d5f1c8d34e Binary files /dev/null and b/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..4d6372eebd Binary files /dev/null and b/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/pkgs/ok_http/example/android/app/src/main/res/values-night/styles.xml b/pkgs/ok_http/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000000..06952be745 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/res/values/styles.xml b/pkgs/ok_http/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000..cb1ef88056 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/profile/AndroidManifest.xml b/pkgs/ok_http/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000000..399f6981d5 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/pkgs/ok_http/example/android/build.gradle b/pkgs/ok_http/example/android/build.gradle new file mode 100644 index 0000000000..d2ffbffa4c --- /dev/null +++ b/pkgs/ok_http/example/android/build.gradle @@ -0,0 +1,18 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = "../build" +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/pkgs/ok_http/example/android/gradle.properties b/pkgs/ok_http/example/android/gradle.properties new file mode 100644 index 0000000000..3b5b324f6e --- /dev/null +++ b/pkgs/ok_http/example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/pkgs/ok_http/example/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/ok_http/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..e1ca574ef0 --- /dev/null +++ b/pkgs/ok_http/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip diff --git a/pkgs/ok_http/example/android/settings.gradle b/pkgs/ok_http/example/android/settings.gradle new file mode 100644 index 0000000000..a4fcbf6261 --- /dev/null +++ b/pkgs/ok_http/example/android/settings.gradle @@ -0,0 +1,25 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.9.23" apply false +} + +include ":app" diff --git a/pkgs/ok_http/example/integration_test/client_configuration_test.dart b/pkgs/ok_http/example/integration_test/client_configuration_test.dart new file mode 100644 index 0000000000..2cee14afb6 --- /dev/null +++ b/pkgs/ok_http/example/integration_test/client_configuration_test.dart @@ -0,0 +1,98 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:http/http.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:ok_http/ok_http.dart'; +import 'package:test/test.dart'; + +void testTimeouts() { + group('timeouts', () { + group('call timeout', () { + late HttpServer server; + + setUp(() async { + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + // Add a delay of `n` seconds for URI `http://localhost:port/n` + final delay = int.parse(request.requestedUri.pathSegments.last); + await Future.delayed(Duration(seconds: delay)); + + await request.drain(); + await request.response.close(); + }); + }); + tearDown(() { + server.close(); + }); + + test('exceeded', () { + final client = OkHttpClient( + configuration: const OkHttpClientConfiguration( + callTimeout: Duration(milliseconds: 500), + ), + ); + expect( + () async { + await client.get(Uri.parse('http://localhost:${server.port}/1')); + }, + throwsA( + isA().having( + (exception) => exception.message, + 'message', + startsWith('java.io.InterruptedIOException'), + ), + ), + ); + }); + + test('not exceeded', () async { + final client = OkHttpClient( + configuration: const OkHttpClientConfiguration( + callTimeout: Duration(milliseconds: 1500), + ), + ); + final response = await client.send( + Request( + 'GET', + Uri.http('localhost:${server.port}', '1'), + ), + ); + + expect(response.statusCode, 200); + expect(response.contentLength, 0); + }); + + test('not set', () async { + final client = OkHttpClient(); + + expect( + () async { + await client.send( + Request( + 'GET', + Uri.http('localhost:${server.port}', '11'), + ), + ); + }, + throwsA( + isA().having( + (exception) => exception.message, + 'message', + startsWith('java.net.SocketTimeoutException'), + ), + ), + ); + }); + }); + }); +} + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + testTimeouts(); +} diff --git a/pkgs/ok_http/example/integration_test/client_profile_test.dart b/pkgs/ok_http/example/integration_test/client_profile_test.dart new file mode 100644 index 0000000000..44975dd4b7 --- /dev/null +++ b/pkgs/ok_http/example/integration_test/client_profile_test.dart @@ -0,0 +1,288 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart'; +import 'package:http_profile/http_profile.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:ok_http/ok_http.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('profile', () { + final profilingEnabled = HttpClientRequestProfile.profilingEnabled; + + setUpAll(() { + HttpClientRequestProfile.profilingEnabled = true; + }); + + tearDownAll(() { + HttpClientRequestProfile.profilingEnabled = profilingEnabled; + }); + + group('POST', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.headers.set('Content-Length', '11'); + request.response.write('Hello World'); + await request.response.close(); + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + final client = OkHttpClientWithProfile(); + await client.post(successServerUri, + headers: {'Content-Type': 'text/plain'}, body: 'Hi'); + profile = client.profile!; + }); + tearDownAll(() { + successServer.close(); + }); + + test('profile attributes', () { + expect(profile.events, isEmpty); + expect(profile.requestMethod, 'POST'); + expect(profile.requestUri, successServerUri.toString()); + expect( + profile.connectionInfo, containsPair('package', 'package:ok_http')); + }); + + test('request attributes', () { + expect(profile.requestData.bodyBytes, 'Hi'.codeUnits); + expect(profile.requestData.contentLength, 2); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.error, isNull); + expect( + profile.requestData.headers, containsPair('Content-Length', ['2'])); + expect(profile.requestData.headers, + containsPair('Content-Type', ['text/plain; charset=utf-8'])); + expect(profile.requestData.persistentConnection, isNull); + expect(profile.requestData.proxyDetails, isNull); + expect(profile.requestData.startTime, isNotNull); + }); + + test('response attributes', () { + expect(profile.responseData.bodyBytes, 'Hello World'.codeUnits); + expect(profile.responseData.compressionState, isNull); + expect(profile.responseData.contentLength, 11); + expect(profile.responseData.endTime, isNotNull); + expect(profile.responseData.error, isNull); + expect(profile.responseData.headers, + containsPair('content-type', ['text/plain'])); + expect(profile.responseData.headers, + containsPair('content-length', ['11'])); + expect(profile.responseData.isRedirect, false); + expect(profile.responseData.persistentConnection, isNull); + expect(profile.responseData.reasonPhrase, 'OK'); + expect(profile.responseData.redirects, isEmpty); + expect(profile.responseData.startTime, isNotNull); + expect(profile.responseData.statusCode, 200); + }); + }); + + group('failed POST request', () { + late HttpClientRequestProfile profile; + + setUpAll(() async { + final client = OkHttpClientWithProfile(); + try { + await client.post(Uri.http('thisisnotahost'), + headers: {'Content-Type': 'text/plain'}, body: 'Hi'); + fail('expected exception'); + } on ClientException { + // Expected exception. + } + profile = client.profile!; + }); + + test('profile attributes', () { + expect(profile.events, isEmpty); + expect(profile.requestMethod, 'POST'); + expect(profile.requestUri, 'http://thisisnotahost'); + expect( + profile.connectionInfo, containsPair('package', 'package:ok_http')); + }); + + test('request attributes', () { + expect(profile.requestData.bodyBytes, 'Hi'.codeUnits); + expect(profile.requestData.contentLength, 2); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.error, startsWith('ClientException:')); + expect( + profile.requestData.headers, containsPair('Content-Length', ['2'])); + expect(profile.requestData.headers, + containsPair('Content-Type', ['text/plain; charset=utf-8'])); + expect(profile.requestData.persistentConnection, isNull); + expect(profile.requestData.proxyDetails, isNull); + expect(profile.requestData.startTime, isNotNull); + }); + + test('response attributes', () { + expect(profile.responseData.bodyBytes, isEmpty); + expect(profile.responseData.compressionState, isNull); + expect(profile.responseData.contentLength, isNull); + expect(profile.responseData.endTime, isNull); + expect(profile.responseData.error, isNull); + expect(profile.responseData.headers, isNull); + expect(profile.responseData.isRedirect, isNull); + expect(profile.responseData.persistentConnection, isNull); + expect(profile.responseData.reasonPhrase, isNull); + expect(profile.responseData.redirects, isEmpty); + expect(profile.responseData.startTime, isNull); + expect(profile.responseData.statusCode, isNull); + }); + }); + + group('failed POST response', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + await request.drain(); + request.response.headers.set('Content-Type', 'text/plain'); + request.response.headers.set('Content-Length', '11'); + final socket = await request.response.detachSocket(); + await socket.close(); + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + final client = OkHttpClientWithProfile(); + + try { + await client.post(successServerUri, + headers: {'Content-Type': 'text/plain'}, body: 'Hi'); + fail('expected exception'); + } on ClientException { + // Expected exception. + } + profile = client.profile!; + }); + tearDownAll(() { + successServer.close(); + }); + + test('profile attributes', () { + expect(profile.events, isEmpty); + expect(profile.requestMethod, 'POST'); + expect(profile.requestUri, successServerUri.toString()); + expect( + profile.connectionInfo, containsPair('package', 'package:ok_http')); + }); + + test('request attributes', () { + expect(profile.requestData.bodyBytes, 'Hi'.codeUnits); + expect(profile.requestData.contentLength, 2); + expect(profile.requestData.endTime, isNotNull); + expect(profile.requestData.error, isNull); + expect( + profile.requestData.headers, containsPair('Content-Length', ['2'])); + expect(profile.requestData.headers, + containsPair('Content-Type', ['text/plain; charset=utf-8'])); + expect(profile.requestData.persistentConnection, isNull); + expect(profile.requestData.proxyDetails, isNull); + expect(profile.requestData.startTime, isNotNull); + }); + + test('response attributes', () { + expect(profile.responseData.bodyBytes, isEmpty); + expect(profile.responseData.compressionState, isNull); + expect(profile.responseData.contentLength, 11); + expect(profile.responseData.endTime, isNotNull); + expect(profile.responseData.error, startsWith('ClientException:')); + expect(profile.responseData.headers, + containsPair('content-type', ['text/plain'])); + expect(profile.responseData.headers, + containsPair('content-length', ['11'])); + expect(profile.responseData.isRedirect, false); + expect(profile.responseData.persistentConnection, isNull); + expect(profile.responseData.reasonPhrase, 'OK'); + expect(profile.responseData.redirects, isEmpty); + expect(profile.responseData.startTime, isNotNull); + expect(profile.responseData.statusCode, 200); + }); + }); + + group('redirects', () { + late HttpServer successServer; + late Uri successServerUri; + late HttpClientRequestProfile profile; + + setUpAll(() async { + successServer = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + if (request.requestedUri.pathSegments.isEmpty) { + unawaited(request.response.close()); + } else { + final n = int.parse(request.requestedUri.pathSegments.last); + final nextPath = n - 1 == 0 ? '' : '${n - 1}'; + unawaited(request.response + .redirect(successServerUri.replace(path: '/$nextPath'))); + } + }); + successServerUri = Uri.http('localhost:${successServer.port}'); + }); + tearDownAll(() { + successServer.close(); + }); + + test('no redirects', () async { + final client = OkHttpClientWithProfile(); + await client.get(successServerUri); + profile = client.profile!; + + expect(profile.responseData.redirects, isEmpty); + }); + + test('follow redirects', () async { + final client = OkHttpClientWithProfile(); + await client.send(Request('GET', successServerUri.replace(path: '/3')) + ..followRedirects = true + ..maxRedirects = 4); + profile = client.profile!; + + expect(profile.requestData.followRedirects, true); + expect(profile.requestData.maxRedirects, 4); + expect(profile.responseData.isRedirect, false); + + expect(profile.responseData.redirects, [ + HttpProfileRedirectData( + statusCode: 302, + method: 'GET', + location: successServerUri.replace(path: '/2').toString()), + HttpProfileRedirectData( + statusCode: 302, + method: 'GET', + location: successServerUri.replace(path: '/1').toString()), + HttpProfileRedirectData( + statusCode: 302, + method: 'GET', + location: successServerUri.replace(path: '/').toString(), + ) + ]); + }); + + test('no follow redirects', () async { + final client = OkHttpClientWithProfile(); + await client.send(Request('GET', successServerUri.replace(path: '/3')) + ..followRedirects = false); + profile = client.profile!; + + expect(profile.requestData.followRedirects, false); + expect(profile.responseData.isRedirect, true); + expect(profile.responseData.redirects, isEmpty); + }); + }); + }); +} diff --git a/pkgs/ok_http/example/integration_test/client_test.dart b/pkgs/ok_http/example/integration_test/client_test.dart new file mode 100644 index 0000000000..a1d0e5d65b --- /dev/null +++ b/pkgs/ok_http/example/integration_test/client_test.dart @@ -0,0 +1,55 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:http_client_conformance_tests/http_client_conformance_tests.dart'; +import 'package:http_profile/http_profile.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:ok_http/ok_http.dart'; +import 'package:test/test.dart'; + +void main() async { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + await testConformance(); +} + +Future testConformance() async { + group('ok_http client', () { + group('profile enabled', () { + final profile = HttpClientRequestProfile.profilingEnabled; + HttpClientRequestProfile.profilingEnabled = true; + + try { + testAll( + OkHttpClient.new, + canStreamRequestBody: false, + preservesMethodCase: true, + supportsFoldedHeaders: false, + canSendCookieHeaders: true, + canReceiveSetCookieHeaders: true, + ); + } finally { + HttpClientRequestProfile.profilingEnabled = profile; + } + }); + + group('profile disabled', () { + final profile = HttpClientRequestProfile.profilingEnabled; + HttpClientRequestProfile.profilingEnabled = false; + + try { + testAll( + OkHttpClient.new, + canStreamRequestBody: false, + preservesMethodCase: true, + supportsFoldedHeaders: false, + canSendCookieHeaders: true, + canReceiveSetCookieHeaders: true, + ); + } finally { + HttpClientRequestProfile.profilingEnabled = profile; + } + }); + }); +} diff --git a/pkgs/ok_http/example/integration_test/web_socket_test.dart b/pkgs/ok_http/example/integration_test/web_socket_test.dart new file mode 100644 index 0000000000..8f1a9656f8 --- /dev/null +++ b/pkgs/ok_http/example/integration_test/web_socket_test.dart @@ -0,0 +1,10 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:ok_http/ok_http.dart'; +import 'package:web_socket_conformance_tests/web_socket_conformance_tests.dart'; + +void main() { + testAll(OkHttpWebSocket.connect); +} diff --git a/pkgs/ok_http/example/lib/book.dart b/pkgs/ok_http/example/lib/book.dart new file mode 100644 index 0000000000..4954d2509b --- /dev/null +++ b/pkgs/ok_http/example/lib/book.dart @@ -0,0 +1,32 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Book { + String title; + String description; + Uri imageUrl; + + Book(this.title, this.description, this.imageUrl); + + static List listFromJson(Map json) { + final books = []; + + if (json['items'] case final List items) { + for (final item in items) { + if (item case {'volumeInfo': final Map volumeInfo}) { + if (volumeInfo + case { + 'title': final String title, + 'description': final String description, + 'imageLinks': {'smallThumbnail': final String thumbnail} + }) { + books.add(Book(title, description, Uri.parse(thumbnail))); + } + } + } + } + + return books; + } +} diff --git a/pkgs/ok_http/example/lib/main.dart b/pkgs/ok_http/example/lib/main.dart new file mode 100644 index 0000000000..e8177895ec --- /dev/null +++ b/pkgs/ok_http/example/lib/main.dart @@ -0,0 +1,149 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:http/http.dart'; +import 'package:http/io_client.dart'; +import 'package:http_image_provider/http_image_provider.dart'; +import 'package:ok_http/ok_http.dart'; +import 'package:provider/provider.dart'; + +import 'book.dart'; + +void main() { + final Client httpClient; + if (Platform.isAndroid) { + httpClient = OkHttpClient(); + } else { + httpClient = IOClient(HttpClient()..userAgent = 'Book Agent'); + } + + runApp(Provider( + create: (_) => httpClient, + child: const BookSearchApp(), + dispose: (_, client) => client.close())); +} + +class BookSearchApp extends StatelessWidget { + const BookSearchApp({super.key}); + + @override + Widget build(BuildContext context) => const MaterialApp( + // Remove the debug banner. + debugShowCheckedModeBanner: false, + title: 'Book Search', + home: HomePage(), + ); +} + +class HomePage extends StatefulWidget { + const HomePage({super.key}); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + List? _books; + String? _lastQuery; + late Client _client; + + @override + void initState() { + super.initState(); + _client = context.read(); + } + + // Get the list of books matching `query`. + // The `get` call will automatically use the `client` configured in `main`. + Future> _findMatchingBooks(String query) async { + final response = await _client.get( + Uri.https( + 'www.googleapis.com', + '/books/v1/volumes', + {'q': query, 'maxResults': '20', 'printType': 'books'}, + ), + ); + + final json = jsonDecode(utf8.decode(response.bodyBytes)) as Map; + return Book.listFromJson(json); + } + + void _runSearch(String query) async { + _lastQuery = query; + if (query.isEmpty) { + setState(() { + _books = null; + }); + return; + } + + final books = await _findMatchingBooks(query); + // Avoid the situation where a slow-running query finishes late and + // replaces newer search results. + if (query != _lastQuery) return; + setState(() { + _books = books; + }); + } + + @override + Widget build(BuildContext context) { + final searchResult = _books == null + ? const Text('Please enter a query', style: TextStyle(fontSize: 24)) + : _books!.isNotEmpty + ? BookList(_books!) + : const Text('No results found', style: TextStyle(fontSize: 24)); + + return Scaffold( + appBar: AppBar(title: const Text('Book Search')), + body: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + const SizedBox(height: 20), + TextField( + onChanged: _runSearch, + decoration: const InputDecoration( + labelText: 'Search', + suffixIcon: Icon(Icons.search), + ), + ), + const SizedBox(height: 20), + Expanded(child: searchResult), + ], + ), + ), + ); + } +} + +class BookList extends StatefulWidget { + final List books; + const BookList(this.books, {super.key}); + + @override + State createState() => _BookListState(); +} + +class _BookListState extends State { + @override + Widget build(BuildContext context) => ListView.builder( + itemCount: widget.books.length, + itemBuilder: (context, index) => Card( + key: ValueKey(widget.books[index].title), + child: ListTile( + leading: Image( + image: HttpImageProvider( + widget.books[index].imageUrl.replace(scheme: 'https'), + client: context.read())), + title: Text(widget.books[index].title), + subtitle: Text(widget.books[index].description), + ), + ), + ); +} diff --git a/pkgs/ok_http/example/pubspec.yaml b/pkgs/ok_http/example/pubspec.yaml new file mode 100644 index 0000000000..38b21c5923 --- /dev/null +++ b/pkgs/ok_http/example/pubspec.yaml @@ -0,0 +1,35 @@ +name: ok_http_example +description: "Demonstrates how to use the ok_http plugin." + +publish_to: "none" +version: 1.0.0+1 + +environment: + sdk: ">=3.4.1 <4.0.0" + +dependencies: + cupertino_icons: ^1.0.6 + flutter: + sdk: flutter + http: ^1.0.0 + http_image_provider: ^1.0.0 + ok_http: + path: ../ + provider: ^6.1.1 + web_socket: ^0.1.5 + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + flutter_test: + sdk: flutter + http_client_conformance_tests: + path: ../../http_client_conformance_tests/ + http_profile: ^0.1.0 + integration_test: + sdk: flutter + test: ^1.23.1 + web_socket_conformance_tests: + path: ../../web_socket_conformance_tests/ + +flutter: + uses-material-design: true diff --git a/pkgs/ok_http/jnigen.yaml b/pkgs/ok_http/jnigen.yaml new file mode 100644 index 0000000000..0ce3e1c414 --- /dev/null +++ b/pkgs/ok_http/jnigen.yaml @@ -0,0 +1,39 @@ +# Regenerate the JNI Bindings using: dart run jnigen --config jnigen.yaml + +summarizer: + backend: asm + +output: + dart: + path: "lib/src/jni/bindings.dart" + structure: single_file + +android_sdk_config: + add_gradle_deps: true + android_example: "example/" + +classes: + - "okhttp3.Request" + - "okhttp3.RequestBody" + - "okhttp3.Response" + - "okhttp3.ResponseBody" + - "okhttp3.OkHttpClient" + - "okhttp3.Call" + - "okhttp3.Headers" + - "okhttp3.Callback" + - "okhttp3.ConnectionPool" + - "okhttp3.Dispatcher" + - "java.util.concurrent.ExecutorService" + - "okhttp3.Cache" + - "com.example.ok_http.RedirectReceivedCallback" + - "com.example.ok_http.RedirectInterceptor" + - "com.example.ok_http.AsyncInputStreamReader" + - "com.example.ok_http.DataCallback" + - "okhttp3.WebSocket" + - "com.example.ok_http.WebSocketListenerProxy" + - "okio.ByteString" + - "com.example.ok_http.WebSocketInterceptor" + - "java.util.concurrent.TimeUnit" + +preamble: | + // ignore_for_file: prefer_expression_function_bodies diff --git a/pkgs/ok_http/lib/ok_http.dart b/pkgs/ok_http/lib/ok_http.dart new file mode 100644 index 0000000000..75b43ae8a5 --- /dev/null +++ b/pkgs/ok_http/lib/ok_http.dart @@ -0,0 +1,58 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// An Android Flutter plugin that provides access to the +/// [OkHttp](https://square.github.io/okhttp/) HTTP client, and the OkHttp +/// [WebSocket](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html) +/// API +/// +/// ``` +/// import 'package:ok_http/ok_http.dart'; +/// +/// void main() async { +/// var client = OkHttpClient(); +/// final response = await client.get( +/// Uri.https('www.googleapis.com', '/books/v1/volumes', {'q': '{http}'})); +/// if (response.statusCode != 200) { +/// throw HttpException('bad response: ${response.statusCode}'); +/// } +/// +/// final decodedResponse = +/// jsonDecode(utf8.decode(response.bodyBytes)) as Map; +/// +/// final itemCount = decodedResponse['totalItems']; +/// print('Number of books about http: $itemCount.'); +/// for (var i = 0; i < min(itemCount, 10); ++i) { +/// print(decodedResponse['items'][i]['volumeInfo']['title']); +/// } +/// } +/// ``` +/// +/// [OkHttpClient] is an implementation of the `package:http` [Client], +/// which means that it can easily used conditionally based on the current +/// platform. +/// +/// ``` +/// void main() { +/// var clientFactory = Client.new; // Constructs the default client. +/// if (Platform.isAndroid) { +/// clientFactory = () { +/// return OkHttpClient(); +/// }; +/// } +/// runWithClient(() => runApp(const MyFlutterApp()), clientFactory); +/// } +/// ``` +/// +/// After the above setup, calling [Client] methods or any of the +/// `package:http` convenient functions (e.g. [get]) will result in +/// [OkHttpClient] being used on Android. +library; + +import 'package:http/http.dart'; + +import 'src/ok_http_client.dart'; + +export 'src/ok_http_client.dart'; +export 'src/ok_http_web_socket.dart'; diff --git a/pkgs/ok_http/lib/src/jni/bindings.dart b/pkgs/ok_http/lib/src/jni/bindings.dart new file mode 100644 index 0000000000..833c40727a --- /dev/null +++ b/pkgs/ok_http/lib/src/jni/bindings.dart @@ -0,0 +1,15084 @@ +// ignore_for_file: prefer_expression_function_bodies + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: argument_type_not_assignable +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: inference_failure_on_untyped_parameter +// ignore_for_file: invalid_internal_annotation +// ignore_for_file: invalid_use_of_internal_member +// ignore_for_file: library_prefixes +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_library_prefixes +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: only_throw_errors +// ignore_for_file: overridden_fields +// ignore_for_file: prefer_double_quotes +// ignore_for_file: unintended_html_in_doc_comment +// ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import 'dart:core' show Object, String, bool, double, int; +import 'dart:core' as _$core; + +import 'package:jni/_internal.dart' as _$jni; +import 'package:jni/jni.dart' as _$jni; + +/// from: `okhttp3.Request$Builder` +class Request_Builder extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Request_Builder.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Request$Builder'); + + /// The type which includes information such as the signature of this class. + static const type = $Request_Builder$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory Request_Builder() { + return Request_Builder.fromReference( + _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(Lokhttp3/Request;)V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (okhttp3.Request request)` + /// The returned object must be released after use, by calling the [release] method. + factory Request_Builder.new$1( + Request request, + ) { + return Request_Builder.fromReference(_new$1(_class.reference.pointer, + _id_new$1 as _$jni.JMethodIDPtr, request.reference.pointer) + .reference); + } + + static final _id_url = _class.instanceMethodId( + r'url', + r'(Lokhttp3/HttpUrl;)Lokhttp3/Request$Builder;', + ); + + static final _url = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder url(okhttp3.HttpUrl httpUrl)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder url( + _$jni.JObject httpUrl, + ) { + return _url(reference.pointer, _id_url as _$jni.JMethodIDPtr, + httpUrl.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_url$1 = _class.instanceMethodId( + r'url', + r'(Ljava/lang/String;)Lokhttp3/Request$Builder;', + ); + + static final _url$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder url(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder url$1( + _$jni.JString string, + ) { + return _url$1(reference.pointer, _id_url$1 as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_url$2 = _class.instanceMethodId( + r'url', + r'(Ljava/net/URL;)Lokhttp3/Request$Builder;', + ); + + static final _url$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder url(java.net.URL uRL)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder url$2( + _$jni.JObject uRL, + ) { + return _url$2(reference.pointer, _id_url$2 as _$jni.JMethodIDPtr, + uRL.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_header = _class.instanceMethodId( + r'header', + r'(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;', + ); + + static final _header = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder header(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder header( + _$jni.JString string, + _$jni.JString string1, + ) { + return _header(reference.pointer, _id_header as _$jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_addHeader = _class.instanceMethodId( + r'addHeader', + r'(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;', + ); + + static final _addHeader = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder addHeader(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder addHeader( + _$jni.JString string, + _$jni.JString string1, + ) { + return _addHeader(reference.pointer, _id_addHeader as _$jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_removeHeader = _class.instanceMethodId( + r'removeHeader', + r'(Ljava/lang/String;)Lokhttp3/Request$Builder;', + ); + + static final _removeHeader = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder removeHeader(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder removeHeader( + _$jni.JString string, + ) { + return _removeHeader(reference.pointer, + _id_removeHeader as _$jni.JMethodIDPtr, string.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_headers = _class.instanceMethodId( + r'headers', + r'(Lokhttp3/Headers;)Lokhttp3/Request$Builder;', + ); + + static final _headers = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder headers(okhttp3.Headers headers)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder headers( + Headers headers, + ) { + return _headers(reference.pointer, _id_headers as _$jni.JMethodIDPtr, + headers.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_cacheControl = _class.instanceMethodId( + r'cacheControl', + r'(Lokhttp3/CacheControl;)Lokhttp3/Request$Builder;', + ); + + static final _cacheControl = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder cacheControl(okhttp3.CacheControl cacheControl)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder cacheControl( + _$jni.JObject cacheControl, + ) { + return _cacheControl( + reference.pointer, + _id_cacheControl as _$jni.JMethodIDPtr, + cacheControl.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_get = _class.instanceMethodId( + r'get', + r'()Lokhttp3/Request$Builder;', + ); + + static final _get = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public okhttp3.Request$Builder get()` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder get() { + return _get(reference.pointer, _id_get as _$jni.JMethodIDPtr) + .object(const $Request_Builder$Type()); + } + + static final _id_head = _class.instanceMethodId( + r'head', + r'()Lokhttp3/Request$Builder;', + ); + + static final _head = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public okhttp3.Request$Builder head()` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder head() { + return _head(reference.pointer, _id_head as _$jni.JMethodIDPtr) + .object(const $Request_Builder$Type()); + } + + static final _id_post = _class.instanceMethodId( + r'post', + r'(Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;', + ); + + static final _post = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder post(okhttp3.RequestBody requestBody)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder post( + RequestBody requestBody, + ) { + return _post(reference.pointer, _id_post as _$jni.JMethodIDPtr, + requestBody.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_delete = _class.instanceMethodId( + r'delete', + r'(Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;', + ); + + static final _delete = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder delete(okhttp3.RequestBody requestBody)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder delete( + RequestBody requestBody, + ) { + return _delete(reference.pointer, _id_delete as _$jni.JMethodIDPtr, + requestBody.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_put = _class.instanceMethodId( + r'put', + r'(Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;', + ); + + static final _put = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder put(okhttp3.RequestBody requestBody)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder put( + RequestBody requestBody, + ) { + return _put(reference.pointer, _id_put as _$jni.JMethodIDPtr, + requestBody.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_patch = _class.instanceMethodId( + r'patch', + r'(Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;', + ); + + static final _patch = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder patch(okhttp3.RequestBody requestBody)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder patch( + RequestBody requestBody, + ) { + return _patch(reference.pointer, _id_patch as _$jni.JMethodIDPtr, + requestBody.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_method = _class.instanceMethodId( + r'method', + r'(Ljava/lang/String;Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;', + ); + + static final _method = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder method(java.lang.String string, okhttp3.RequestBody requestBody)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder method( + _$jni.JString string, + RequestBody requestBody, + ) { + return _method(reference.pointer, _id_method as _$jni.JMethodIDPtr, + string.reference.pointer, requestBody.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_tag = _class.instanceMethodId( + r'tag', + r'(Ljava/lang/Object;)Lokhttp3/Request$Builder;', + ); + + static final _tag = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder tag(java.lang.Object object)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder tag( + _$jni.JObject object, + ) { + return _tag(reference.pointer, _id_tag as _$jni.JMethodIDPtr, + object.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_tag$1 = _class.instanceMethodId( + r'tag', + r'(Ljava/lang/Class;Ljava/lang/Object;)Lokhttp3/Request$Builder;', + ); + + static final _tag$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Request$Builder tag(java.lang.Class class, T object)` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder tag$1<$T extends _$jni.JObject>( + _$jni.JObject class$, + $T object, { + _$jni.JObjType<$T>? T, + }) { + T ??= _$jni.lowestCommonSuperType([ + object.$type, + ]) as _$jni.JObjType<$T>; + return _tag$1(reference.pointer, _id_tag$1 as _$jni.JMethodIDPtr, + class$.reference.pointer, object.reference.pointer) + .object(const $Request_Builder$Type()); + } + + static final _id_build = _class.instanceMethodId( + r'build', + r'()Lokhttp3/Request;', + ); + + static final _build = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public okhttp3.Request build()` + /// The returned object must be released after use, by calling the [release] method. + Request build() { + return _build(reference.pointer, _id_build as _$jni.JMethodIDPtr) + .object(const $Request$Type()); + } + + static final _id_delete$1 = _class.instanceMethodId( + r'delete', + r'()Lokhttp3/Request$Builder;', + ); + + static final _delete$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Request$Builder delete()` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder delete$1() { + return _delete$1(reference.pointer, _id_delete$1 as _$jni.JMethodIDPtr) + .object(const $Request_Builder$Type()); + } +} + +final class $Request_Builder$Type extends _$jni.JObjType { + @_$jni.internal + const $Request_Builder$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Request$Builder;'; + + @_$jni.internal + @_$core.override + Request_Builder fromReference(_$jni.JReference reference) => + Request_Builder.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Request_Builder$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Request_Builder$Type) && + other is $Request_Builder$Type; + } +} + +/// from: `okhttp3.Request` +class Request extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Request.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Request'); + + /// The type which includes information such as the signature of this class. + static const type = $Request$Type(); + static final _id_new$ = _class.constructorId( + r'(Lokhttp3/HttpUrl;Ljava/lang/String;Lokhttp3/Headers;Lokhttp3/RequestBody;Ljava/util/Map;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (okhttp3.HttpUrl httpUrl, java.lang.String string, okhttp3.Headers headers, okhttp3.RequestBody requestBody, java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + factory Request( + _$jni.JObject httpUrl, + _$jni.JString string, + Headers headers, + RequestBody requestBody, + _$jni.JMap<_$jni.JObject, _$jni.JObject> map, + ) { + return Request.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + httpUrl.reference.pointer, + string.reference.pointer, + headers.reference.pointer, + requestBody.reference.pointer, + map.reference.pointer) + .reference); + } + + static final _id_url = _class.instanceMethodId( + r'url', + r'()Lokhttp3/HttpUrl;', + ); + + static final _url = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.HttpUrl url()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject url() { + return _url(reference.pointer, _id_url as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_method = _class.instanceMethodId( + r'method', + r'()Ljava/lang/String;', + ); + + static final _method = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String method()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString method() { + return _method(reference.pointer, _id_method as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_headers = _class.instanceMethodId( + r'headers', + r'()Lokhttp3/Headers;', + ); + + static final _headers = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Headers headers()` + /// The returned object must be released after use, by calling the [release] method. + Headers headers() { + return _headers(reference.pointer, _id_headers as _$jni.JMethodIDPtr) + .object(const $Headers$Type()); + } + + static final _id_body = _class.instanceMethodId( + r'body', + r'()Lokhttp3/RequestBody;', + ); + + static final _body = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.RequestBody body()` + /// The returned object must be released after use, by calling the [release] method. + RequestBody body() { + return _body(reference.pointer, _id_body as _$jni.JMethodIDPtr) + .object(const $RequestBody$Type()); + } + + static final _id_isHttps = _class.instanceMethodId( + r'isHttps', + r'()Z', + ); + + static final _isHttps = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final boolean isHttps()` + bool isHttps() { + return _isHttps(reference.pointer, _id_isHttps as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_header = _class.instanceMethodId( + r'header', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _header = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.lang.String header(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString header( + _$jni.JString string, + ) { + return _header(reference.pointer, _id_header as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const _$jni.JStringType()); + } + + static final _id_headers$1 = _class.instanceMethodId( + r'headers', + r'(Ljava/lang/String;)Ljava/util/List;', + ); + + static final _headers$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.util.List headers(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JString> headers$1( + _$jni.JString string, + ) { + return _headers$1(reference.pointer, _id_headers$1 as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const _$jni.JListType(_$jni.JStringType())); + } + + static final _id_tag = _class.instanceMethodId( + r'tag', + r'()Ljava/lang/Object;', + ); + + static final _tag = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Object tag()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject tag() { + return _tag(reference.pointer, _id_tag as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_tag$1 = _class.instanceMethodId( + r'tag', + r'(Ljava/lang/Class;)Ljava/lang/Object;', + ); + + static final _tag$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final T tag(java.lang.Class class)` + /// The returned object must be released after use, by calling the [release] method. + $T tag$1<$T extends _$jni.JObject>( + _$jni.JObject class$, { + required _$jni.JObjType<$T> T, + }) { + return _tag$1(reference.pointer, _id_tag$1 as _$jni.JMethodIDPtr, + class$.reference.pointer) + .object(T); + } + + static final _id_newBuilder = _class.instanceMethodId( + r'newBuilder', + r'()Lokhttp3/Request$Builder;', + ); + + static final _newBuilder = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Request$Builder newBuilder()` + /// The returned object must be released after use, by calling the [release] method. + Request_Builder newBuilder() { + return _newBuilder(reference.pointer, _id_newBuilder as _$jni.JMethodIDPtr) + .object(const $Request_Builder$Type()); + } + + static final _id_cacheControl = _class.instanceMethodId( + r'cacheControl', + r'()Lokhttp3/CacheControl;', + ); + + static final _cacheControl = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.CacheControl cacheControl()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject cacheControl() { + return _cacheControl( + reference.pointer, _id_cacheControl as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_toString$1 = _class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } +} + +final class $Request$Type extends _$jni.JObjType { + @_$jni.internal + const $Request$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Request;'; + + @_$jni.internal + @_$core.override + Request fromReference(_$jni.JReference reference) => + Request.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Request$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Request$Type) && other is $Request$Type; + } +} + +/// from: `okhttp3.RequestBody$Companion` +class RequestBody_Companion extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + RequestBody_Companion.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/RequestBody$Companion'); + + /// The type which includes information such as the signature of this class. + static const type = $RequestBody_Companion$Type(); + static final _id_create = _class.instanceMethodId( + r'create', + r'(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/RequestBody;', + ); + + static final _create = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.RequestBody create(java.lang.String string, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create( + _$jni.JString string, + _$jni.JObject mediaType, + ) { + return _create(reference.pointer, _id_create as _$jni.JMethodIDPtr, + string.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$1 = _class.instanceMethodId( + r'create', + r'(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/RequestBody;', + ); + + static final _create$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.RequestBody create(okio.ByteString byteString, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$1( + ByteString byteString, + _$jni.JObject mediaType, + ) { + return _create$1(reference.pointer, _id_create$1 as _$jni.JMethodIDPtr, + byteString.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$2 = _class.instanceMethodId( + r'create', + r'([BLokhttp3/MediaType;II)Lokhttp3/RequestBody;', + ); + + static final _create$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int, + int)>(); + + /// from: `public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType, int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$2( + _$jni.JArray<_$jni.jbyte> bs, + _$jni.JObject mediaType, + int i, + int i1, + ) { + return _create$2(reference.pointer, _id_create$2 as _$jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer, i, i1) + .object(const $RequestBody$Type()); + } + + static final _id_create$3 = _class.instanceMethodId( + r'create', + r'(Ljava/io/File;Lokhttp3/MediaType;)Lokhttp3/RequestBody;', + ); + + static final _create$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.RequestBody create(java.io.File file, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$3( + _$jni.JObject file, + _$jni.JObject mediaType, + ) { + return _create$3(reference.pointer, _id_create$3 as _$jni.JMethodIDPtr, + file.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$4 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/RequestBody;', + ); + + static final _create$4 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$4( + _$jni.JObject mediaType, + _$jni.JString string, + ) { + return _create$4(reference.pointer, _id_create$4 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, string.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$5 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/RequestBody;', + ); + + static final _create$5 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, okio.ByteString byteString)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$5( + _$jni.JObject mediaType, + ByteString byteString, + ) { + return _create$5(reference.pointer, _id_create$5 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, byteString.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$6 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;[BII)Lokhttp3/RequestBody;', + ); + + static final _create$6 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int, + int)>(); + + /// from: `public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs, int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$6( + _$jni.JObject mediaType, + _$jni.JArray<_$jni.jbyte> bs, + int i, + int i1, + ) { + return _create$6(reference.pointer, _id_create$6 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer, i, i1) + .object(const $RequestBody$Type()); + } + + static final _id_create$7 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;Ljava/io/File;)Lokhttp3/RequestBody;', + ); + + static final _create$7 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, java.io.File file)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$7( + _$jni.JObject mediaType, + _$jni.JObject file, + ) { + return _create$7(reference.pointer, _id_create$7 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, file.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$8 = _class.instanceMethodId( + r'create', + r'([BLokhttp3/MediaType;I)Lokhttp3/RequestBody;', + ); + + static final _create$8 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32 + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int)>(); + + /// from: `public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType, int i)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$8( + _$jni.JArray<_$jni.jbyte> bs, + _$jni.JObject mediaType, + int i, + ) { + return _create$8(reference.pointer, _id_create$8 as _$jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer, i) + .object(const $RequestBody$Type()); + } + + static final _id_create$9 = _class.instanceMethodId( + r'create', + r'([BLokhttp3/MediaType;)Lokhttp3/RequestBody;', + ); + + static final _create$9 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$9( + _$jni.JArray<_$jni.jbyte> bs, + _$jni.JObject mediaType, + ) { + return _create$9(reference.pointer, _id_create$9 as _$jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$10 = _class.instanceMethodId( + r'create', + r'([B)Lokhttp3/RequestBody;', + ); + + static final _create$10 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.RequestBody create(byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$10( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _create$10(reference.pointer, _id_create$10 as _$jni.JMethodIDPtr, + bs.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$11 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;[BI)Lokhttp3/RequestBody;', + ); + + static final _create$11 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32 + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int)>(); + + /// from: `public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs, int i)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$11( + _$jni.JObject mediaType, + _$jni.JArray<_$jni.jbyte> bs, + int i, + ) { + return _create$11(reference.pointer, _id_create$11 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer, i) + .object(const $RequestBody$Type()); + } + + static final _id_create$12 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;[B)Lokhttp3/RequestBody;', + ); + + static final _create$12 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + RequestBody create$12( + _$jni.JObject mediaType, + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _create$12(reference.pointer, _id_create$12 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory RequestBody_Companion( + _$jni.JObject defaultConstructorMarker, + ) { + return RequestBody_Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $RequestBody_Companion$Type + extends _$jni.JObjType { + @_$jni.internal + const $RequestBody_Companion$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/RequestBody$Companion;'; + + @_$jni.internal + @_$core.override + RequestBody_Companion fromReference(_$jni.JReference reference) => + RequestBody_Companion.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($RequestBody_Companion$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($RequestBody_Companion$Type) && + other is $RequestBody_Companion$Type; + } +} + +/// from: `okhttp3.RequestBody` +class RequestBody extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + RequestBody.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/RequestBody'); + + /// The type which includes information such as the signature of this class. + static const type = $RequestBody$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'Lokhttp3/RequestBody$Companion;', + ); + + /// from: `static public final okhttp3.RequestBody$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody_Companion get Companion => + _id_Companion.get(_class, const $RequestBody_Companion$Type()); + + static final _id_contentType = _class.instanceMethodId( + r'contentType', + r'()Lokhttp3/MediaType;', + ); + + static final _contentType = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract okhttp3.MediaType contentType()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject contentType() { + return _contentType( + reference.pointer, _id_contentType as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_contentLength = _class.instanceMethodId( + r'contentLength', + r'()J', + ); + + static final _contentLength = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public long contentLength()` + int contentLength() { + return _contentLength( + reference.pointer, _id_contentLength as _$jni.JMethodIDPtr) + .long; + } + + static final _id_writeTo = _class.instanceMethodId( + r'writeTo', + r'(Lokio/BufferedSink;)V', + ); + + static final _writeTo = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void writeTo(okio.BufferedSink bufferedSink)` + void writeTo( + _$jni.JObject bufferedSink, + ) { + _writeTo(reference.pointer, _id_writeTo as _$jni.JMethodIDPtr, + bufferedSink.reference.pointer) + .check(); + } + + static final _id_isDuplex = _class.instanceMethodId( + r'isDuplex', + r'()Z', + ); + + static final _isDuplex = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean isDuplex()` + bool isDuplex() { + return _isDuplex(reference.pointer, _id_isDuplex as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_isOneShot = _class.instanceMethodId( + r'isOneShot', + r'()Z', + ); + + static final _isOneShot = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean isOneShot()` + bool isOneShot() { + return _isOneShot(reference.pointer, _id_isOneShot as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_create = _class.staticMethodId( + r'create', + r'(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/RequestBody;', + ); + + static final _create = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.RequestBody create(java.lang.String string, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create( + _$jni.JString string, + _$jni.JObject mediaType, + ) { + return _create(_class.reference.pointer, _id_create as _$jni.JMethodIDPtr, + string.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$1 = _class.staticMethodId( + r'create', + r'(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/RequestBody;', + ); + + static final _create$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.RequestBody create(okio.ByteString byteString, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$1( + ByteString byteString, + _$jni.JObject mediaType, + ) { + return _create$1( + _class.reference.pointer, + _id_create$1 as _$jni.JMethodIDPtr, + byteString.reference.pointer, + mediaType.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$2 = _class.staticMethodId( + r'create', + r'([BLokhttp3/MediaType;II)Lokhttp3/RequestBody;', + ); + + static final _create$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int, + int)>(); + + /// from: `static public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType, int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$2( + _$jni.JArray<_$jni.jbyte> bs, + _$jni.JObject mediaType, + int i, + int i1, + ) { + return _create$2( + _class.reference.pointer, + _id_create$2 as _$jni.JMethodIDPtr, + bs.reference.pointer, + mediaType.reference.pointer, + i, + i1) + .object(const $RequestBody$Type()); + } + + static final _id_create$3 = _class.staticMethodId( + r'create', + r'(Ljava/io/File;Lokhttp3/MediaType;)Lokhttp3/RequestBody;', + ); + + static final _create$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.RequestBody create(java.io.File file, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$3( + _$jni.JObject file, + _$jni.JObject mediaType, + ) { + return _create$3( + _class.reference.pointer, + _id_create$3 as _$jni.JMethodIDPtr, + file.reference.pointer, + mediaType.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$4 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/RequestBody;', + ); + + static final _create$4 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$4( + _$jni.JObject mediaType, + _$jni.JString string, + ) { + return _create$4( + _class.reference.pointer, + _id_create$4 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + string.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$5 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/RequestBody;', + ); + + static final _create$5 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, okio.ByteString byteString)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$5( + _$jni.JObject mediaType, + ByteString byteString, + ) { + return _create$5( + _class.reference.pointer, + _id_create$5 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + byteString.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$6 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;[BII)Lokhttp3/RequestBody;', + ); + + static final _create$6 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int, + int)>(); + + /// from: `static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs, int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$6( + _$jni.JObject mediaType, + _$jni.JArray<_$jni.jbyte> bs, + int i, + int i1, + ) { + return _create$6( + _class.reference.pointer, + _id_create$6 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + bs.reference.pointer, + i, + i1) + .object(const $RequestBody$Type()); + } + + static final _id_create$7 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;Ljava/io/File;)Lokhttp3/RequestBody;', + ); + + static final _create$7 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, java.io.File file)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$7( + _$jni.JObject mediaType, + _$jni.JObject file, + ) { + return _create$7( + _class.reference.pointer, + _id_create$7 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + file.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$8 = _class.staticMethodId( + r'create', + r'([BLokhttp3/MediaType;I)Lokhttp3/RequestBody;', + ); + + static final _create$8 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int)>(); + + /// from: `static public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType, int i)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$8( + _$jni.JArray<_$jni.jbyte> bs, + _$jni.JObject mediaType, + int i, + ) { + return _create$8( + _class.reference.pointer, + _id_create$8 as _$jni.JMethodIDPtr, + bs.reference.pointer, + mediaType.reference.pointer, + i) + .object(const $RequestBody$Type()); + } + + static final _id_create$9 = _class.staticMethodId( + r'create', + r'([BLokhttp3/MediaType;)Lokhttp3/RequestBody;', + ); + + static final _create$9 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$9( + _$jni.JArray<_$jni.jbyte> bs, + _$jni.JObject mediaType, + ) { + return _create$9( + _class.reference.pointer, + _id_create$9 as _$jni.JMethodIDPtr, + bs.reference.pointer, + mediaType.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$10 = _class.staticMethodId( + r'create', + r'([B)Lokhttp3/RequestBody;', + ); + + static final _create$10 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.RequestBody create(byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$10( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _create$10(_class.reference.pointer, + _id_create$10 as _$jni.JMethodIDPtr, bs.reference.pointer) + .object(const $RequestBody$Type()); + } + + static final _id_create$11 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;[BI)Lokhttp3/RequestBody;', + ); + + static final _create$11 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int)>(); + + /// from: `static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs, int i)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$11( + _$jni.JObject mediaType, + _$jni.JArray<_$jni.jbyte> bs, + int i, + ) { + return _create$11( + _class.reference.pointer, + _id_create$11 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + bs.reference.pointer, + i) + .object(const $RequestBody$Type()); + } + + static final _id_create$12 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;[B)Lokhttp3/RequestBody;', + ); + + static final _create$12 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create$12( + _$jni.JObject mediaType, + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _create$12( + _class.reference.pointer, + _id_create$12 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + bs.reference.pointer) + .object(const $RequestBody$Type()); + } +} + +final class $RequestBody$Type extends _$jni.JObjType { + @_$jni.internal + const $RequestBody$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/RequestBody;'; + + @_$jni.internal + @_$core.override + RequestBody fromReference(_$jni.JReference reference) => + RequestBody.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($RequestBody$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($RequestBody$Type) && + other is $RequestBody$Type; + } +} + +/// from: `okhttp3.Response$Builder` +class Response_Builder extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Response_Builder.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Response$Builder'); + + /// The type which includes information such as the signature of this class. + static const type = $Response_Builder$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory Response_Builder() { + return Response_Builder.fromReference( + _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(Lokhttp3/Response;)V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (okhttp3.Response response)` + /// The returned object must be released after use, by calling the [release] method. + factory Response_Builder.new$1( + Response response, + ) { + return Response_Builder.fromReference(_new$1(_class.reference.pointer, + _id_new$1 as _$jni.JMethodIDPtr, response.reference.pointer) + .reference); + } + + static final _id_request = _class.instanceMethodId( + r'request', + r'(Lokhttp3/Request;)Lokhttp3/Response$Builder;', + ); + + static final _request = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder request(okhttp3.Request request)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder request( + Request request, + ) { + return _request(reference.pointer, _id_request as _$jni.JMethodIDPtr, + request.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_protocol = _class.instanceMethodId( + r'protocol', + r'(Lokhttp3/Protocol;)Lokhttp3/Response$Builder;', + ); + + static final _protocol = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder protocol(okhttp3.Protocol protocol)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder protocol( + _$jni.JObject protocol, + ) { + return _protocol(reference.pointer, _id_protocol as _$jni.JMethodIDPtr, + protocol.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_code = _class.instanceMethodId( + r'code', + r'(I)Lokhttp3/Response$Builder;', + ); + + static final _code = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public okhttp3.Response$Builder code(int i)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder code( + int i, + ) { + return _code(reference.pointer, _id_code as _$jni.JMethodIDPtr, i) + .object(const $Response_Builder$Type()); + } + + static final _id_message = _class.instanceMethodId( + r'message', + r'(Ljava/lang/String;)Lokhttp3/Response$Builder;', + ); + + static final _message = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder message(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder message( + _$jni.JString string, + ) { + return _message(reference.pointer, _id_message as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_handshake = _class.instanceMethodId( + r'handshake', + r'(Lokhttp3/Handshake;)Lokhttp3/Response$Builder;', + ); + + static final _handshake = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder handshake(okhttp3.Handshake handshake)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder handshake( + _$jni.JObject handshake, + ) { + return _handshake(reference.pointer, _id_handshake as _$jni.JMethodIDPtr, + handshake.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_header = _class.instanceMethodId( + r'header', + r'(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Response$Builder;', + ); + + static final _header = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder header(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder header( + _$jni.JString string, + _$jni.JString string1, + ) { + return _header(reference.pointer, _id_header as _$jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_addHeader = _class.instanceMethodId( + r'addHeader', + r'(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Response$Builder;', + ); + + static final _addHeader = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder addHeader(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder addHeader( + _$jni.JString string, + _$jni.JString string1, + ) { + return _addHeader(reference.pointer, _id_addHeader as _$jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_removeHeader = _class.instanceMethodId( + r'removeHeader', + r'(Ljava/lang/String;)Lokhttp3/Response$Builder;', + ); + + static final _removeHeader = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder removeHeader(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder removeHeader( + _$jni.JString string, + ) { + return _removeHeader(reference.pointer, + _id_removeHeader as _$jni.JMethodIDPtr, string.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_headers = _class.instanceMethodId( + r'headers', + r'(Lokhttp3/Headers;)Lokhttp3/Response$Builder;', + ); + + static final _headers = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder headers(okhttp3.Headers headers)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder headers( + Headers headers, + ) { + return _headers(reference.pointer, _id_headers as _$jni.JMethodIDPtr, + headers.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_body = _class.instanceMethodId( + r'body', + r'(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;', + ); + + static final _body = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder body(okhttp3.ResponseBody responseBody)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder body( + ResponseBody responseBody, + ) { + return _body(reference.pointer, _id_body as _$jni.JMethodIDPtr, + responseBody.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_networkResponse = _class.instanceMethodId( + r'networkResponse', + r'(Lokhttp3/Response;)Lokhttp3/Response$Builder;', + ); + + static final _networkResponse = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder networkResponse(okhttp3.Response response)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder networkResponse( + Response response, + ) { + return _networkResponse( + reference.pointer, + _id_networkResponse as _$jni.JMethodIDPtr, + response.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_cacheResponse = _class.instanceMethodId( + r'cacheResponse', + r'(Lokhttp3/Response;)Lokhttp3/Response$Builder;', + ); + + static final _cacheResponse = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder cacheResponse(okhttp3.Response response)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder cacheResponse( + Response response, + ) { + return _cacheResponse(reference.pointer, + _id_cacheResponse as _$jni.JMethodIDPtr, response.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_priorResponse = _class.instanceMethodId( + r'priorResponse', + r'(Lokhttp3/Response;)Lokhttp3/Response$Builder;', + ); + + static final _priorResponse = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Response$Builder priorResponse(okhttp3.Response response)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder priorResponse( + Response response, + ) { + return _priorResponse(reference.pointer, + _id_priorResponse as _$jni.JMethodIDPtr, response.reference.pointer) + .object(const $Response_Builder$Type()); + } + + static final _id_sentRequestAtMillis = _class.instanceMethodId( + r'sentRequestAtMillis', + r'(J)Lokhttp3/Response$Builder;', + ); + + static final _sentRequestAtMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public okhttp3.Response$Builder sentRequestAtMillis(long j)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder sentRequestAtMillis( + int j, + ) { + return _sentRequestAtMillis( + reference.pointer, _id_sentRequestAtMillis as _$jni.JMethodIDPtr, j) + .object(const $Response_Builder$Type()); + } + + static final _id_receivedResponseAtMillis = _class.instanceMethodId( + r'receivedResponseAtMillis', + r'(J)Lokhttp3/Response$Builder;', + ); + + static final _receivedResponseAtMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public okhttp3.Response$Builder receivedResponseAtMillis(long j)` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder receivedResponseAtMillis( + int j, + ) { + return _receivedResponseAtMillis(reference.pointer, + _id_receivedResponseAtMillis as _$jni.JMethodIDPtr, j) + .object(const $Response_Builder$Type()); + } + + static final _id_build = _class.instanceMethodId( + r'build', + r'()Lokhttp3/Response;', + ); + + static final _build = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public okhttp3.Response build()` + /// The returned object must be released after use, by calling the [release] method. + Response build() { + return _build(reference.pointer, _id_build as _$jni.JMethodIDPtr) + .object(const $Response$Type()); + } +} + +final class $Response_Builder$Type extends _$jni.JObjType { + @_$jni.internal + const $Response_Builder$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Response$Builder;'; + + @_$jni.internal + @_$core.override + Response_Builder fromReference(_$jni.JReference reference) => + Response_Builder.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Response_Builder$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Response_Builder$Type) && + other is $Response_Builder$Type; + } +} + +/// from: `okhttp3.Response` +class Response extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Response.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Response'); + + /// The type which includes information such as the signature of this class. + static const type = $Response$Type(); + static final _id_new$ = _class.constructorId( + r'(Lokhttp3/Request;Lokhttp3/Protocol;Ljava/lang/String;ILokhttp3/Handshake;Lokhttp3/Headers;Lokhttp3/ResponseBody;Lokhttp3/Response;Lokhttp3/Response;Lokhttp3/Response;JJLokhttp3/internal/connection/Exchange;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int64, + _$jni.Int64, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (okhttp3.Request request, okhttp3.Protocol protocol, java.lang.String string, int i, okhttp3.Handshake handshake, okhttp3.Headers headers, okhttp3.ResponseBody responseBody, okhttp3.Response response, okhttp3.Response response1, okhttp3.Response response2, long j, long j1, okhttp3.internal.connection.Exchange exchange)` + /// The returned object must be released after use, by calling the [release] method. + factory Response( + Request request, + _$jni.JObject protocol, + _$jni.JString string, + int i, + _$jni.JObject handshake, + Headers headers, + ResponseBody responseBody, + Response response, + Response response1, + Response response2, + int j, + int j1, + _$jni.JObject exchange, + ) { + return Response.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + request.reference.pointer, + protocol.reference.pointer, + string.reference.pointer, + i, + handshake.reference.pointer, + headers.reference.pointer, + responseBody.reference.pointer, + response.reference.pointer, + response1.reference.pointer, + response2.reference.pointer, + j, + j1, + exchange.reference.pointer) + .reference); + } + + static final _id_request = _class.instanceMethodId( + r'request', + r'()Lokhttp3/Request;', + ); + + static final _request = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Request request()` + /// The returned object must be released after use, by calling the [release] method. + Request request() { + return _request(reference.pointer, _id_request as _$jni.JMethodIDPtr) + .object(const $Request$Type()); + } + + static final _id_protocol = _class.instanceMethodId( + r'protocol', + r'()Lokhttp3/Protocol;', + ); + + static final _protocol = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Protocol protocol()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject protocol() { + return _protocol(reference.pointer, _id_protocol as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_message = _class.instanceMethodId( + r'message', + r'()Ljava/lang/String;', + ); + + static final _message = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String message()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString message() { + return _message(reference.pointer, _id_message as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_code = _class.instanceMethodId( + r'code', + r'()I', + ); + + static final _code = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int code()` + int code() { + return _code(reference.pointer, _id_code as _$jni.JMethodIDPtr).integer; + } + + static final _id_handshake = _class.instanceMethodId( + r'handshake', + r'()Lokhttp3/Handshake;', + ); + + static final _handshake = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Handshake handshake()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject handshake() { + return _handshake(reference.pointer, _id_handshake as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_headers = _class.instanceMethodId( + r'headers', + r'()Lokhttp3/Headers;', + ); + + static final _headers = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Headers headers()` + /// The returned object must be released after use, by calling the [release] method. + Headers headers() { + return _headers(reference.pointer, _id_headers as _$jni.JMethodIDPtr) + .object(const $Headers$Type()); + } + + static final _id_body = _class.instanceMethodId( + r'body', + r'()Lokhttp3/ResponseBody;', + ); + + static final _body = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.ResponseBody body()` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody body() { + return _body(reference.pointer, _id_body as _$jni.JMethodIDPtr) + .object(const $ResponseBody$Type()); + } + + static final _id_networkResponse = _class.instanceMethodId( + r'networkResponse', + r'()Lokhttp3/Response;', + ); + + static final _networkResponse = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Response networkResponse()` + /// The returned object must be released after use, by calling the [release] method. + Response networkResponse() { + return _networkResponse( + reference.pointer, _id_networkResponse as _$jni.JMethodIDPtr) + .object(const $Response$Type()); + } + + static final _id_cacheResponse = _class.instanceMethodId( + r'cacheResponse', + r'()Lokhttp3/Response;', + ); + + static final _cacheResponse = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Response cacheResponse()` + /// The returned object must be released after use, by calling the [release] method. + Response cacheResponse() { + return _cacheResponse( + reference.pointer, _id_cacheResponse as _$jni.JMethodIDPtr) + .object(const $Response$Type()); + } + + static final _id_priorResponse = _class.instanceMethodId( + r'priorResponse', + r'()Lokhttp3/Response;', + ); + + static final _priorResponse = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Response priorResponse()` + /// The returned object must be released after use, by calling the [release] method. + Response priorResponse() { + return _priorResponse( + reference.pointer, _id_priorResponse as _$jni.JMethodIDPtr) + .object(const $Response$Type()); + } + + static final _id_sentRequestAtMillis = _class.instanceMethodId( + r'sentRequestAtMillis', + r'()J', + ); + + static final _sentRequestAtMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final long sentRequestAtMillis()` + int sentRequestAtMillis() { + return _sentRequestAtMillis( + reference.pointer, _id_sentRequestAtMillis as _$jni.JMethodIDPtr) + .long; + } + + static final _id_receivedResponseAtMillis = _class.instanceMethodId( + r'receivedResponseAtMillis', + r'()J', + ); + + static final _receivedResponseAtMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final long receivedResponseAtMillis()` + int receivedResponseAtMillis() { + return _receivedResponseAtMillis(reference.pointer, + _id_receivedResponseAtMillis as _$jni.JMethodIDPtr) + .long; + } + + static final _id_exchange = _class.instanceMethodId( + r'exchange', + r'()Lokhttp3/internal/connection/Exchange;', + ); + + static final _exchange = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.internal.connection.Exchange exchange()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject exchange() { + return _exchange(reference.pointer, _id_exchange as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_isSuccessful = _class.instanceMethodId( + r'isSuccessful', + r'()Z', + ); + + static final _isSuccessful = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final boolean isSuccessful()` + bool isSuccessful() { + return _isSuccessful( + reference.pointer, _id_isSuccessful as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_headers$1 = _class.instanceMethodId( + r'headers', + r'(Ljava/lang/String;)Ljava/util/List;', + ); + + static final _headers$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.util.List headers(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JString> headers$1( + _$jni.JString string, + ) { + return _headers$1(reference.pointer, _id_headers$1 as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const _$jni.JListType(_$jni.JStringType())); + } + + static final _id_header = _class.instanceMethodId( + r'header', + r'(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _header = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.lang.String header(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString header( + _$jni.JString string, + _$jni.JString string1, + ) { + return _header(reference.pointer, _id_header as _$jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const _$jni.JStringType()); + } + + static final _id_trailers = _class.instanceMethodId( + r'trailers', + r'()Lokhttp3/Headers;', + ); + + static final _trailers = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Headers trailers()` + /// The returned object must be released after use, by calling the [release] method. + Headers trailers() { + return _trailers(reference.pointer, _id_trailers as _$jni.JMethodIDPtr) + .object(const $Headers$Type()); + } + + static final _id_peekBody = _class.instanceMethodId( + r'peekBody', + r'(J)Lokhttp3/ResponseBody;', + ); + + static final _peekBody = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final okhttp3.ResponseBody peekBody(long j)` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody peekBody( + int j, + ) { + return _peekBody(reference.pointer, _id_peekBody as _$jni.JMethodIDPtr, j) + .object(const $ResponseBody$Type()); + } + + static final _id_newBuilder = _class.instanceMethodId( + r'newBuilder', + r'()Lokhttp3/Response$Builder;', + ); + + static final _newBuilder = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Response$Builder newBuilder()` + /// The returned object must be released after use, by calling the [release] method. + Response_Builder newBuilder() { + return _newBuilder(reference.pointer, _id_newBuilder as _$jni.JMethodIDPtr) + .object(const $Response_Builder$Type()); + } + + static final _id_isRedirect = _class.instanceMethodId( + r'isRedirect', + r'()Z', + ); + + static final _isRedirect = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final boolean isRedirect()` + bool isRedirect() { + return _isRedirect(reference.pointer, _id_isRedirect as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_challenges = _class.instanceMethodId( + r'challenges', + r'()Ljava/util/List;', + ); + + static final _challenges = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List challenges()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> challenges() { + return _challenges(reference.pointer, _id_challenges as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_cacheControl = _class.instanceMethodId( + r'cacheControl', + r'()Lokhttp3/CacheControl;', + ); + + static final _cacheControl = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.CacheControl cacheControl()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject cacheControl() { + return _cacheControl( + reference.pointer, _id_cacheControl as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_close = _class.instanceMethodId( + r'close', + r'()V', + ); + + static final _close = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void close()` + void close() { + _close(reference.pointer, _id_close as _$jni.JMethodIDPtr).check(); + } + + static final _id_toString$1 = _class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_header$1 = _class.instanceMethodId( + r'header', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _header$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.lang.String header(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString header$1( + _$jni.JString string, + ) { + return _header$1(reference.pointer, _id_header$1 as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const _$jni.JStringType()); + } +} + +final class $Response$Type extends _$jni.JObjType { + @_$jni.internal + const $Response$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Response;'; + + @_$jni.internal + @_$core.override + Response fromReference(_$jni.JReference reference) => + Response.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Response$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Response$Type) && other is $Response$Type; + } +} + +/// from: `okhttp3.ResponseBody$BomAwareReader` +class ResponseBody_BomAwareReader extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + ResponseBody_BomAwareReader.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'okhttp3/ResponseBody$BomAwareReader'); + + /// The type which includes information such as the signature of this class. + static const type = $ResponseBody_BomAwareReader$Type(); + static final _id_new$ = _class.constructorId( + r'(Lokio/BufferedSource;Ljava/nio/charset/Charset;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (okio.BufferedSource bufferedSource, java.nio.charset.Charset charset)` + /// The returned object must be released after use, by calling the [release] method. + factory ResponseBody_BomAwareReader( + _$jni.JObject bufferedSource, + _$jni.JObject charset, + ) { + return ResponseBody_BomAwareReader.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + bufferedSource.reference.pointer, + charset.reference.pointer) + .reference); + } + + static final _id_read = _class.instanceMethodId( + r'read', + r'([CII)I', + ); + + static final _read = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); + + /// from: `public int read(char[] cs, int i, int i1)` + int read( + _$jni.JArray<_$jni.jchar> cs, + int i, + int i1, + ) { + return _read(reference.pointer, _id_read as _$jni.JMethodIDPtr, + cs.reference.pointer, i, i1) + .integer; + } + + static final _id_close = _class.instanceMethodId( + r'close', + r'()V', + ); + + static final _close = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void close()` + void close() { + _close(reference.pointer, _id_close as _$jni.JMethodIDPtr).check(); + } +} + +final class $ResponseBody_BomAwareReader$Type + extends _$jni.JObjType { + @_$jni.internal + const $ResponseBody_BomAwareReader$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/ResponseBody$BomAwareReader;'; + + @_$jni.internal + @_$core.override + ResponseBody_BomAwareReader fromReference(_$jni.JReference reference) => + ResponseBody_BomAwareReader.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($ResponseBody_BomAwareReader$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($ResponseBody_BomAwareReader$Type) && + other is $ResponseBody_BomAwareReader$Type; + } +} + +/// from: `okhttp3.ResponseBody$Companion` +class ResponseBody_Companion extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + ResponseBody_Companion.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/ResponseBody$Companion'); + + /// The type which includes information such as the signature of this class. + static const type = $ResponseBody_Companion$Type(); + static final _id_create = _class.instanceMethodId( + r'create', + r'(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/ResponseBody;', + ); + + static final _create = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.ResponseBody create(java.lang.String string, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create( + _$jni.JString string, + _$jni.JObject mediaType, + ) { + return _create(reference.pointer, _id_create as _$jni.JMethodIDPtr, + string.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$1 = _class.instanceMethodId( + r'create', + r'([BLokhttp3/MediaType;)Lokhttp3/ResponseBody;', + ); + + static final _create$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.ResponseBody create(byte[] bs, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create$1( + _$jni.JArray<_$jni.jbyte> bs, + _$jni.JObject mediaType, + ) { + return _create$1(reference.pointer, _id_create$1 as _$jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$2 = _class.instanceMethodId( + r'create', + r'(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/ResponseBody;', + ); + + static final _create$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.ResponseBody create(okio.ByteString byteString, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create$2( + ByteString byteString, + _$jni.JObject mediaType, + ) { + return _create$2(reference.pointer, _id_create$2 as _$jni.JMethodIDPtr, + byteString.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$3 = _class.instanceMethodId( + r'create', + r'(Lokio/BufferedSource;Lokhttp3/MediaType;J)Lokhttp3/ResponseBody;', + ); + + static final _create$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int64 + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int)>(); + + /// from: `public final okhttp3.ResponseBody create(okio.BufferedSource bufferedSource, okhttp3.MediaType mediaType, long j)` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create$3( + _$jni.JObject bufferedSource, + _$jni.JObject mediaType, + int j, + ) { + return _create$3(reference.pointer, _id_create$3 as _$jni.JMethodIDPtr, + bufferedSource.reference.pointer, mediaType.reference.pointer, j) + .object(const $ResponseBody$Type()); + } + + static final _id_create$4 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/ResponseBody;', + ); + + static final _create$4 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create$4( + _$jni.JObject mediaType, + _$jni.JString string, + ) { + return _create$4(reference.pointer, _id_create$4 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, string.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$5 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;[B)Lokhttp3/ResponseBody;', + ); + + static final _create$5 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create$5( + _$jni.JObject mediaType, + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _create$5(reference.pointer, _id_create$5 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$6 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/ResponseBody;', + ); + + static final _create$6 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, okio.ByteString byteString)` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create$6( + _$jni.JObject mediaType, + ByteString byteString, + ) { + return _create$6(reference.pointer, _id_create$6 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, byteString.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$7 = _class.instanceMethodId( + r'create', + r'(Lokhttp3/MediaType;JLokio/BufferedSource;)Lokhttp3/ResponseBody;', + ); + + static final _create$7 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int64, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, long j, okio.BufferedSource bufferedSource)` + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create$7( + _$jni.JObject mediaType, + int j, + _$jni.JObject bufferedSource, + ) { + return _create$7(reference.pointer, _id_create$7 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, j, bufferedSource.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory ResponseBody_Companion( + _$jni.JObject defaultConstructorMarker, + ) { + return ResponseBody_Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $ResponseBody_Companion$Type + extends _$jni.JObjType { + @_$jni.internal + const $ResponseBody_Companion$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/ResponseBody$Companion;'; + + @_$jni.internal + @_$core.override + ResponseBody_Companion fromReference(_$jni.JReference reference) => + ResponseBody_Companion.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($ResponseBody_Companion$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($ResponseBody_Companion$Type) && + other is $ResponseBody_Companion$Type; + } +} + +/// from: `okhttp3.ResponseBody` +class ResponseBody extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + ResponseBody.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/ResponseBody'); + + /// The type which includes information such as the signature of this class. + static const type = $ResponseBody$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'Lokhttp3/ResponseBody$Companion;', + ); + + /// from: `static public final okhttp3.ResponseBody$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody_Companion get Companion => + _id_Companion.get(_class, const $ResponseBody_Companion$Type()); + + static final _id_contentType = _class.instanceMethodId( + r'contentType', + r'()Lokhttp3/MediaType;', + ); + + static final _contentType = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract okhttp3.MediaType contentType()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject contentType() { + return _contentType( + reference.pointer, _id_contentType as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_contentLength = _class.instanceMethodId( + r'contentLength', + r'()J', + ); + + static final _contentLength = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract long contentLength()` + int contentLength() { + return _contentLength( + reference.pointer, _id_contentLength as _$jni.JMethodIDPtr) + .long; + } + + static final _id_byteStream = _class.instanceMethodId( + r'byteStream', + r'()Ljava/io/InputStream;', + ); + + static final _byteStream = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.io.InputStream byteStream()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject byteStream() { + return _byteStream(reference.pointer, _id_byteStream as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_source = _class.instanceMethodId( + r'source', + r'()Lokio/BufferedSource;', + ); + + static final _source = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract okio.BufferedSource source()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject source() { + return _source(reference.pointer, _id_source as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_bytes = _class.instanceMethodId( + r'bytes', + r'()[B', + ); + + static final _bytes = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final byte[] bytes()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JArray<_$jni.jbyte> bytes() { + return _bytes(reference.pointer, _id_bytes as _$jni.JMethodIDPtr) + .object(const _$jni.JArrayType(_$jni.jbyteType())); + } + + static final _id_byteString = _class.instanceMethodId( + r'byteString', + r'()Lokio/ByteString;', + ); + + static final _byteString = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okio.ByteString byteString()` + /// The returned object must be released after use, by calling the [release] method. + ByteString byteString() { + return _byteString(reference.pointer, _id_byteString as _$jni.JMethodIDPtr) + .object(const $ByteString$Type()); + } + + static final _id_charStream = _class.instanceMethodId( + r'charStream', + r'()Ljava/io/Reader;', + ); + + static final _charStream = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.io.Reader charStream()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject charStream() { + return _charStream(reference.pointer, _id_charStream as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_string = _class.instanceMethodId( + r'string', + r'()Ljava/lang/String;', + ); + + static final _string = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.String string()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString string() { + return _string(reference.pointer, _id_string as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_close = _class.instanceMethodId( + r'close', + r'()V', + ); + + static final _close = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void close()` + void close() { + _close(reference.pointer, _id_close as _$jni.JMethodIDPtr).check(); + } + + static final _id_create = _class.staticMethodId( + r'create', + r'(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/ResponseBody;', + ); + + static final _create = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.ResponseBody create(java.lang.String string, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create( + _$jni.JString string, + _$jni.JObject mediaType, + ) { + return _create(_class.reference.pointer, _id_create as _$jni.JMethodIDPtr, + string.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$1 = _class.staticMethodId( + r'create', + r'([BLokhttp3/MediaType;)Lokhttp3/ResponseBody;', + ); + + static final _create$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.ResponseBody create(byte[] bs, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create$1( + _$jni.JArray<_$jni.jbyte> bs, + _$jni.JObject mediaType, + ) { + return _create$1( + _class.reference.pointer, + _id_create$1 as _$jni.JMethodIDPtr, + bs.reference.pointer, + mediaType.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$2 = _class.staticMethodId( + r'create', + r'(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/ResponseBody;', + ); + + static final _create$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.ResponseBody create(okio.ByteString byteString, okhttp3.MediaType mediaType)` + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create$2( + ByteString byteString, + _$jni.JObject mediaType, + ) { + return _create$2( + _class.reference.pointer, + _id_create$2 as _$jni.JMethodIDPtr, + byteString.reference.pointer, + mediaType.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$3 = _class.staticMethodId( + r'create', + r'(Lokio/BufferedSource;Lokhttp3/MediaType;J)Lokhttp3/ResponseBody;', + ); + + static final _create$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Int64 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + int)>(); + + /// from: `static public final okhttp3.ResponseBody create(okio.BufferedSource bufferedSource, okhttp3.MediaType mediaType, long j)` + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create$3( + _$jni.JObject bufferedSource, + _$jni.JObject mediaType, + int j, + ) { + return _create$3( + _class.reference.pointer, + _id_create$3 as _$jni.JMethodIDPtr, + bufferedSource.reference.pointer, + mediaType.reference.pointer, + j) + .object(const $ResponseBody$Type()); + } + + static final _id_create$4 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/ResponseBody;', + ); + + static final _create$4 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create$4( + _$jni.JObject mediaType, + _$jni.JString string, + ) { + return _create$4( + _class.reference.pointer, + _id_create$4 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + string.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$5 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;[B)Lokhttp3/ResponseBody;', + ); + + static final _create$5 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create$5( + _$jni.JObject mediaType, + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _create$5( + _class.reference.pointer, + _id_create$5 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + bs.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$6 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/ResponseBody;', + ); + + static final _create$6 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, okio.ByteString byteString)` + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create$6( + _$jni.JObject mediaType, + ByteString byteString, + ) { + return _create$6( + _class.reference.pointer, + _id_create$6 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + byteString.reference.pointer) + .object(const $ResponseBody$Type()); + } + + static final _id_create$7 = _class.staticMethodId( + r'create', + r'(Lokhttp3/MediaType;JLokio/BufferedSource;)Lokhttp3/ResponseBody;', + ); + + static final _create$7 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int64, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, long j, okio.BufferedSource bufferedSource)` + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create$7( + _$jni.JObject mediaType, + int j, + _$jni.JObject bufferedSource, + ) { + return _create$7( + _class.reference.pointer, + _id_create$7 as _$jni.JMethodIDPtr, + mediaType.reference.pointer, + j, + bufferedSource.reference.pointer) + .object(const $ResponseBody$Type()); + } +} + +final class $ResponseBody$Type extends _$jni.JObjType { + @_$jni.internal + const $ResponseBody$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/ResponseBody;'; + + @_$jni.internal + @_$core.override + ResponseBody fromReference(_$jni.JReference reference) => + ResponseBody.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($ResponseBody$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($ResponseBody$Type) && + other is $ResponseBody$Type; + } +} + +/// from: `okhttp3.OkHttpClient$Builder` +class OkHttpClient_Builder extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + OkHttpClient_Builder.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/OkHttpClient$Builder'); + + /// The type which includes information such as the signature of this class. + static const type = $OkHttpClient_Builder$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient_Builder() { + return OkHttpClient_Builder.fromReference( + _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(Lokhttp3/OkHttpClient;)V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (okhttp3.OkHttpClient okHttpClient)` + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient_Builder.new$1( + OkHttpClient okHttpClient, + ) { + return OkHttpClient_Builder.fromReference(_new$1(_class.reference.pointer, + _id_new$1 as _$jni.JMethodIDPtr, okHttpClient.reference.pointer) + .reference); + } + + static final _id_dispatcher = _class.instanceMethodId( + r'dispatcher', + r'(Lokhttp3/Dispatcher;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _dispatcher = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder dispatcher(okhttp3.Dispatcher dispatcher)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder dispatcher( + Dispatcher dispatcher, + ) { + return _dispatcher(reference.pointer, _id_dispatcher as _$jni.JMethodIDPtr, + dispatcher.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_connectionPool = _class.instanceMethodId( + r'connectionPool', + r'(Lokhttp3/ConnectionPool;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _connectionPool = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder connectionPool(okhttp3.ConnectionPool connectionPool)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder connectionPool( + ConnectionPool connectionPool, + ) { + return _connectionPool( + reference.pointer, + _id_connectionPool as _$jni.JMethodIDPtr, + connectionPool.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_interceptors = _class.instanceMethodId( + r'interceptors', + r'()Ljava/util/List;', + ); + + static final _interceptors = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List interceptors()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> interceptors() { + return _interceptors( + reference.pointer, _id_interceptors as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_addInterceptor = _class.instanceMethodId( + r'addInterceptor', + r'(Lokhttp3/Interceptor;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _addInterceptor = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder addInterceptor(okhttp3.Interceptor interceptor)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder addInterceptor( + _$jni.JObject interceptor, + ) { + return _addInterceptor( + reference.pointer, + _id_addInterceptor as _$jni.JMethodIDPtr, + interceptor.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_networkInterceptors = _class.instanceMethodId( + r'networkInterceptors', + r'()Ljava/util/List;', + ); + + static final _networkInterceptors = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List networkInterceptors()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> networkInterceptors() { + return _networkInterceptors( + reference.pointer, _id_networkInterceptors as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_addNetworkInterceptor = _class.instanceMethodId( + r'addNetworkInterceptor', + r'(Lokhttp3/Interceptor;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _addNetworkInterceptor = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder addNetworkInterceptor(okhttp3.Interceptor interceptor)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder addNetworkInterceptor( + _$jni.JObject interceptor, + ) { + return _addNetworkInterceptor( + reference.pointer, + _id_addNetworkInterceptor as _$jni.JMethodIDPtr, + interceptor.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_eventListener = _class.instanceMethodId( + r'eventListener', + r'(Lokhttp3/EventListener;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _eventListener = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder eventListener(okhttp3.EventListener eventListener)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder eventListener( + _$jni.JObject eventListener, + ) { + return _eventListener( + reference.pointer, + _id_eventListener as _$jni.JMethodIDPtr, + eventListener.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_eventListenerFactory = _class.instanceMethodId( + r'eventListenerFactory', + r'(Lokhttp3/EventListener$Factory;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _eventListenerFactory = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder eventListenerFactory(okhttp3.EventListener$Factory factory)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder eventListenerFactory( + _$jni.JObject factory, + ) { + return _eventListenerFactory( + reference.pointer, + _id_eventListenerFactory as _$jni.JMethodIDPtr, + factory.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_retryOnConnectionFailure = _class.instanceMethodId( + r'retryOnConnectionFailure', + r'(Z)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _retryOnConnectionFailure = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder retryOnConnectionFailure(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder retryOnConnectionFailure( + bool z, + ) { + return _retryOnConnectionFailure(reference.pointer, + _id_retryOnConnectionFailure as _$jni.JMethodIDPtr, z ? 1 : 0) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_authenticator = _class.instanceMethodId( + r'authenticator', + r'(Lokhttp3/Authenticator;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _authenticator = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder authenticator(okhttp3.Authenticator authenticator)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder authenticator( + _$jni.JObject authenticator, + ) { + return _authenticator( + reference.pointer, + _id_authenticator as _$jni.JMethodIDPtr, + authenticator.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_followRedirects = _class.instanceMethodId( + r'followRedirects', + r'(Z)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _followRedirects = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder followRedirects(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder followRedirects( + bool z, + ) { + return _followRedirects(reference.pointer, + _id_followRedirects as _$jni.JMethodIDPtr, z ? 1 : 0) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_followSslRedirects = _class.instanceMethodId( + r'followSslRedirects', + r'(Z)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _followSslRedirects = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder followSslRedirects(boolean z)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder followSslRedirects( + bool z, + ) { + return _followSslRedirects(reference.pointer, + _id_followSslRedirects as _$jni.JMethodIDPtr, z ? 1 : 0) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_cookieJar = _class.instanceMethodId( + r'cookieJar', + r'(Lokhttp3/CookieJar;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _cookieJar = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder cookieJar(okhttp3.CookieJar cookieJar)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder cookieJar( + _$jni.JObject cookieJar, + ) { + return _cookieJar(reference.pointer, _id_cookieJar as _$jni.JMethodIDPtr, + cookieJar.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_cache = _class.instanceMethodId( + r'cache', + r'(Lokhttp3/Cache;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _cache = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder cache(okhttp3.Cache cache)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder cache( + Cache cache, + ) { + return _cache(reference.pointer, _id_cache as _$jni.JMethodIDPtr, + cache.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_dns = _class.instanceMethodId( + r'dns', + r'(Lokhttp3/Dns;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _dns = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder dns(okhttp3.Dns dns)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder dns( + _$jni.JObject dns, + ) { + return _dns(reference.pointer, _id_dns as _$jni.JMethodIDPtr, + dns.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_proxy = _class.instanceMethodId( + r'proxy', + r'(Ljava/net/Proxy;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _proxy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder proxy(java.net.Proxy proxy)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder proxy( + _$jni.JObject proxy, + ) { + return _proxy(reference.pointer, _id_proxy as _$jni.JMethodIDPtr, + proxy.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_proxySelector = _class.instanceMethodId( + r'proxySelector', + r'(Ljava/net/ProxySelector;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _proxySelector = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder proxySelector(java.net.ProxySelector proxySelector)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder proxySelector( + _$jni.JObject proxySelector, + ) { + return _proxySelector( + reference.pointer, + _id_proxySelector as _$jni.JMethodIDPtr, + proxySelector.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_proxyAuthenticator = _class.instanceMethodId( + r'proxyAuthenticator', + r'(Lokhttp3/Authenticator;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _proxyAuthenticator = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder proxyAuthenticator(okhttp3.Authenticator authenticator)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder proxyAuthenticator( + _$jni.JObject authenticator, + ) { + return _proxyAuthenticator( + reference.pointer, + _id_proxyAuthenticator as _$jni.JMethodIDPtr, + authenticator.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_socketFactory = _class.instanceMethodId( + r'socketFactory', + r'(Ljavax/net/SocketFactory;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _socketFactory = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder socketFactory(javax.net.SocketFactory socketFactory)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder socketFactory( + _$jni.JObject socketFactory, + ) { + return _socketFactory( + reference.pointer, + _id_socketFactory as _$jni.JMethodIDPtr, + socketFactory.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_sslSocketFactory = _class.instanceMethodId( + r'sslSocketFactory', + r'(Ljavax/net/ssl/SSLSocketFactory;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _sslSocketFactory = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder sslSocketFactory(javax.net.ssl.SSLSocketFactory sSLSocketFactory)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder sslSocketFactory( + _$jni.JObject sSLSocketFactory, + ) { + return _sslSocketFactory( + reference.pointer, + _id_sslSocketFactory as _$jni.JMethodIDPtr, + sSLSocketFactory.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_sslSocketFactory$1 = _class.instanceMethodId( + r'sslSocketFactory', + r'(Ljavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/X509TrustManager;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _sslSocketFactory$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder sslSocketFactory(javax.net.ssl.SSLSocketFactory sSLSocketFactory, javax.net.ssl.X509TrustManager x509TrustManager)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder sslSocketFactory$1( + _$jni.JObject sSLSocketFactory, + _$jni.JObject x509TrustManager, + ) { + return _sslSocketFactory$1( + reference.pointer, + _id_sslSocketFactory$1 as _$jni.JMethodIDPtr, + sSLSocketFactory.reference.pointer, + x509TrustManager.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_connectionSpecs = _class.instanceMethodId( + r'connectionSpecs', + r'(Ljava/util/List;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _connectionSpecs = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder connectionSpecs(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder connectionSpecs( + _$jni.JList<_$jni.JObject> list, + ) { + return _connectionSpecs(reference.pointer, + _id_connectionSpecs as _$jni.JMethodIDPtr, list.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_protocols = _class.instanceMethodId( + r'protocols', + r'(Ljava/util/List;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _protocols = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder protocols(java.util.List list)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder protocols( + _$jni.JList<_$jni.JObject> list, + ) { + return _protocols(reference.pointer, _id_protocols as _$jni.JMethodIDPtr, + list.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_hostnameVerifier = _class.instanceMethodId( + r'hostnameVerifier', + r'(Ljavax/net/ssl/HostnameVerifier;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _hostnameVerifier = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder hostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder hostnameVerifier( + _$jni.JObject hostnameVerifier, + ) { + return _hostnameVerifier( + reference.pointer, + _id_hostnameVerifier as _$jni.JMethodIDPtr, + hostnameVerifier.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_certificatePinner = _class.instanceMethodId( + r'certificatePinner', + r'(Lokhttp3/CertificatePinner;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _certificatePinner = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder certificatePinner(okhttp3.CertificatePinner certificatePinner)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder certificatePinner( + _$jni.JObject certificatePinner, + ) { + return _certificatePinner( + reference.pointer, + _id_certificatePinner as _$jni.JMethodIDPtr, + certificatePinner.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_callTimeout = _class.instanceMethodId( + r'callTimeout', + r'(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _callTimeout = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int64, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder callTimeout(long j, java.util.concurrent.TimeUnit timeUnit)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder callTimeout( + int j, + TimeUnit timeUnit, + ) { + return _callTimeout( + reference.pointer, + _id_callTimeout as _$jni.JMethodIDPtr, + j, + timeUnit.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_callTimeout$1 = _class.instanceMethodId( + r'callTimeout', + r'(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _callTimeout$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder callTimeout(java.time.Duration duration)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder callTimeout$1( + _$jni.JObject duration, + ) { + return _callTimeout$1(reference.pointer, + _id_callTimeout$1 as _$jni.JMethodIDPtr, duration.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_connectTimeout = _class.instanceMethodId( + r'connectTimeout', + r'(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _connectTimeout = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int64, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder connectTimeout(long j, java.util.concurrent.TimeUnit timeUnit)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder connectTimeout( + int j, + TimeUnit timeUnit, + ) { + return _connectTimeout( + reference.pointer, + _id_connectTimeout as _$jni.JMethodIDPtr, + j, + timeUnit.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_connectTimeout$1 = _class.instanceMethodId( + r'connectTimeout', + r'(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _connectTimeout$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder connectTimeout(java.time.Duration duration)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder connectTimeout$1( + _$jni.JObject duration, + ) { + return _connectTimeout$1( + reference.pointer, + _id_connectTimeout$1 as _$jni.JMethodIDPtr, + duration.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_readTimeout = _class.instanceMethodId( + r'readTimeout', + r'(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _readTimeout = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int64, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder readTimeout(long j, java.util.concurrent.TimeUnit timeUnit)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder readTimeout( + int j, + TimeUnit timeUnit, + ) { + return _readTimeout( + reference.pointer, + _id_readTimeout as _$jni.JMethodIDPtr, + j, + timeUnit.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_readTimeout$1 = _class.instanceMethodId( + r'readTimeout', + r'(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _readTimeout$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder readTimeout(java.time.Duration duration)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder readTimeout$1( + _$jni.JObject duration, + ) { + return _readTimeout$1(reference.pointer, + _id_readTimeout$1 as _$jni.JMethodIDPtr, duration.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_writeTimeout = _class.instanceMethodId( + r'writeTimeout', + r'(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _writeTimeout = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int64, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder writeTimeout(long j, java.util.concurrent.TimeUnit timeUnit)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder writeTimeout( + int j, + TimeUnit timeUnit, + ) { + return _writeTimeout( + reference.pointer, + _id_writeTimeout as _$jni.JMethodIDPtr, + j, + timeUnit.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_writeTimeout$1 = _class.instanceMethodId( + r'writeTimeout', + r'(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _writeTimeout$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder writeTimeout(java.time.Duration duration)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder writeTimeout$1( + _$jni.JObject duration, + ) { + return _writeTimeout$1( + reference.pointer, + _id_writeTimeout$1 as _$jni.JMethodIDPtr, + duration.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_pingInterval = _class.instanceMethodId( + r'pingInterval', + r'(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _pingInterval = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int64, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder pingInterval(long j, java.util.concurrent.TimeUnit timeUnit)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder pingInterval( + int j, + TimeUnit timeUnit, + ) { + return _pingInterval( + reference.pointer, + _id_pingInterval as _$jni.JMethodIDPtr, + j, + timeUnit.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_pingInterval$1 = _class.instanceMethodId( + r'pingInterval', + r'(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _pingInterval$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder pingInterval(java.time.Duration duration)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder pingInterval$1( + _$jni.JObject duration, + ) { + return _pingInterval$1( + reference.pointer, + _id_pingInterval$1 as _$jni.JMethodIDPtr, + duration.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_minWebSocketMessageToCompress = _class.instanceMethodId( + r'minWebSocketMessageToCompress', + r'(J)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _minWebSocketMessageToCompress = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int64,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder minWebSocketMessageToCompress(long j)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder minWebSocketMessageToCompress( + int j, + ) { + return _minWebSocketMessageToCompress(reference.pointer, + _id_minWebSocketMessageToCompress as _$jni.JMethodIDPtr, j) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_build = _class.instanceMethodId( + r'build', + r'()Lokhttp3/OkHttpClient;', + ); + + static final _build = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.OkHttpClient build()` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient build() { + return _build(reference.pointer, _id_build as _$jni.JMethodIDPtr) + .object(const $OkHttpClient$Type()); + } +} + +final class $OkHttpClient_Builder$Type + extends _$jni.JObjType { + @_$jni.internal + const $OkHttpClient_Builder$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/OkHttpClient$Builder;'; + + @_$jni.internal + @_$core.override + OkHttpClient_Builder fromReference(_$jni.JReference reference) => + OkHttpClient_Builder.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($OkHttpClient_Builder$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($OkHttpClient_Builder$Type) && + other is $OkHttpClient_Builder$Type; + } +} + +/// from: `okhttp3.OkHttpClient$Companion` +class OkHttpClient_Companion extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + OkHttpClient_Companion.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/OkHttpClient$Companion'); + + /// The type which includes information such as the signature of this class. + static const type = $OkHttpClient_Companion$Type(); + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient_Companion( + _$jni.JObject defaultConstructorMarker, + ) { + return OkHttpClient_Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $OkHttpClient_Companion$Type + extends _$jni.JObjType { + @_$jni.internal + const $OkHttpClient_Companion$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/OkHttpClient$Companion;'; + + @_$jni.internal + @_$core.override + OkHttpClient_Companion fromReference(_$jni.JReference reference) => + OkHttpClient_Companion.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($OkHttpClient_Companion$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($OkHttpClient_Companion$Type) && + other is $OkHttpClient_Companion$Type; + } +} + +/// from: `okhttp3.OkHttpClient` +class OkHttpClient extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + OkHttpClient.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/OkHttpClient'); + + /// The type which includes information such as the signature of this class. + static const type = $OkHttpClient$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'Lokhttp3/OkHttpClient$Companion;', + ); + + /// from: `static public final okhttp3.OkHttpClient$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static OkHttpClient_Companion get Companion => + _id_Companion.get(_class, const $OkHttpClient_Companion$Type()); + + static final _id_new$ = _class.constructorId( + r'(Lokhttp3/OkHttpClient$Builder;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (okhttp3.OkHttpClient$Builder builder)` + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient( + OkHttpClient_Builder builder, + ) { + return OkHttpClient.fromReference(_new$(_class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, builder.reference.pointer) + .reference); + } + + static final _id_dispatcher = _class.instanceMethodId( + r'dispatcher', + r'()Lokhttp3/Dispatcher;', + ); + + static final _dispatcher = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Dispatcher dispatcher()` + /// The returned object must be released after use, by calling the [release] method. + Dispatcher dispatcher() { + return _dispatcher(reference.pointer, _id_dispatcher as _$jni.JMethodIDPtr) + .object(const $Dispatcher$Type()); + } + + static final _id_connectionPool = _class.instanceMethodId( + r'connectionPool', + r'()Lokhttp3/ConnectionPool;', + ); + + static final _connectionPool = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.ConnectionPool connectionPool()` + /// The returned object must be released after use, by calling the [release] method. + ConnectionPool connectionPool() { + return _connectionPool( + reference.pointer, _id_connectionPool as _$jni.JMethodIDPtr) + .object(const $ConnectionPool$Type()); + } + + static final _id_interceptors = _class.instanceMethodId( + r'interceptors', + r'()Ljava/util/List;', + ); + + static final _interceptors = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List interceptors()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> interceptors() { + return _interceptors( + reference.pointer, _id_interceptors as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_networkInterceptors = _class.instanceMethodId( + r'networkInterceptors', + r'()Ljava/util/List;', + ); + + static final _networkInterceptors = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List networkInterceptors()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> networkInterceptors() { + return _networkInterceptors( + reference.pointer, _id_networkInterceptors as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_eventListenerFactory = _class.instanceMethodId( + r'eventListenerFactory', + r'()Lokhttp3/EventListener$Factory;', + ); + + static final _eventListenerFactory = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.EventListener$Factory eventListenerFactory()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject eventListenerFactory() { + return _eventListenerFactory( + reference.pointer, _id_eventListenerFactory as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_retryOnConnectionFailure = _class.instanceMethodId( + r'retryOnConnectionFailure', + r'()Z', + ); + + static final _retryOnConnectionFailure = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final boolean retryOnConnectionFailure()` + bool retryOnConnectionFailure() { + return _retryOnConnectionFailure(reference.pointer, + _id_retryOnConnectionFailure as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_authenticator = _class.instanceMethodId( + r'authenticator', + r'()Lokhttp3/Authenticator;', + ); + + static final _authenticator = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Authenticator authenticator()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject authenticator() { + return _authenticator( + reference.pointer, _id_authenticator as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_followRedirects = _class.instanceMethodId( + r'followRedirects', + r'()Z', + ); + + static final _followRedirects = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final boolean followRedirects()` + bool followRedirects() { + return _followRedirects( + reference.pointer, _id_followRedirects as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_followSslRedirects = _class.instanceMethodId( + r'followSslRedirects', + r'()Z', + ); + + static final _followSslRedirects = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final boolean followSslRedirects()` + bool followSslRedirects() { + return _followSslRedirects( + reference.pointer, _id_followSslRedirects as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_cookieJar = _class.instanceMethodId( + r'cookieJar', + r'()Lokhttp3/CookieJar;', + ); + + static final _cookieJar = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.CookieJar cookieJar()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject cookieJar() { + return _cookieJar(reference.pointer, _id_cookieJar as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_cache = _class.instanceMethodId( + r'cache', + r'()Lokhttp3/Cache;', + ); + + static final _cache = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Cache cache()` + /// The returned object must be released after use, by calling the [release] method. + Cache cache() { + return _cache(reference.pointer, _id_cache as _$jni.JMethodIDPtr) + .object(const $Cache$Type()); + } + + static final _id_dns = _class.instanceMethodId( + r'dns', + r'()Lokhttp3/Dns;', + ); + + static final _dns = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Dns dns()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject dns() { + return _dns(reference.pointer, _id_dns as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_proxy = _class.instanceMethodId( + r'proxy', + r'()Ljava/net/Proxy;', + ); + + static final _proxy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.net.Proxy proxy()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject proxy() { + return _proxy(reference.pointer, _id_proxy as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_proxySelector = _class.instanceMethodId( + r'proxySelector', + r'()Ljava/net/ProxySelector;', + ); + + static final _proxySelector = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.net.ProxySelector proxySelector()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject proxySelector() { + return _proxySelector( + reference.pointer, _id_proxySelector as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_proxyAuthenticator = _class.instanceMethodId( + r'proxyAuthenticator', + r'()Lokhttp3/Authenticator;', + ); + + static final _proxyAuthenticator = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Authenticator proxyAuthenticator()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject proxyAuthenticator() { + return _proxyAuthenticator( + reference.pointer, _id_proxyAuthenticator as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_socketFactory = _class.instanceMethodId( + r'socketFactory', + r'()Ljavax/net/SocketFactory;', + ); + + static final _socketFactory = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final javax.net.SocketFactory socketFactory()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject socketFactory() { + return _socketFactory( + reference.pointer, _id_socketFactory as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_sslSocketFactory = _class.instanceMethodId( + r'sslSocketFactory', + r'()Ljavax/net/ssl/SSLSocketFactory;', + ); + + static final _sslSocketFactory = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final javax.net.ssl.SSLSocketFactory sslSocketFactory()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject sslSocketFactory() { + return _sslSocketFactory( + reference.pointer, _id_sslSocketFactory as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_x509TrustManager = _class.instanceMethodId( + r'x509TrustManager', + r'()Ljavax/net/ssl/X509TrustManager;', + ); + + static final _x509TrustManager = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final javax.net.ssl.X509TrustManager x509TrustManager()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject x509TrustManager() { + return _x509TrustManager( + reference.pointer, _id_x509TrustManager as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_connectionSpecs = _class.instanceMethodId( + r'connectionSpecs', + r'()Ljava/util/List;', + ); + + static final _connectionSpecs = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List connectionSpecs()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> connectionSpecs() { + return _connectionSpecs( + reference.pointer, _id_connectionSpecs as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_protocols = _class.instanceMethodId( + r'protocols', + r'()Ljava/util/List;', + ); + + static final _protocols = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List protocols()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> protocols() { + return _protocols(reference.pointer, _id_protocols as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_hostnameVerifier = _class.instanceMethodId( + r'hostnameVerifier', + r'()Ljavax/net/ssl/HostnameVerifier;', + ); + + static final _hostnameVerifier = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final javax.net.ssl.HostnameVerifier hostnameVerifier()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject hostnameVerifier() { + return _hostnameVerifier( + reference.pointer, _id_hostnameVerifier as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_certificatePinner = _class.instanceMethodId( + r'certificatePinner', + r'()Lokhttp3/CertificatePinner;', + ); + + static final _certificatePinner = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.CertificatePinner certificatePinner()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject certificatePinner() { + return _certificatePinner( + reference.pointer, _id_certificatePinner as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_certificateChainCleaner = _class.instanceMethodId( + r'certificateChainCleaner', + r'()Lokhttp3/internal/tls/CertificateChainCleaner;', + ); + + static final _certificateChainCleaner = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.internal.tls.CertificateChainCleaner certificateChainCleaner()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject certificateChainCleaner() { + return _certificateChainCleaner(reference.pointer, + _id_certificateChainCleaner as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_callTimeoutMillis = _class.instanceMethodId( + r'callTimeoutMillis', + r'()I', + ); + + static final _callTimeoutMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int callTimeoutMillis()` + int callTimeoutMillis() { + return _callTimeoutMillis( + reference.pointer, _id_callTimeoutMillis as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_connectTimeoutMillis = _class.instanceMethodId( + r'connectTimeoutMillis', + r'()I', + ); + + static final _connectTimeoutMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int connectTimeoutMillis()` + int connectTimeoutMillis() { + return _connectTimeoutMillis( + reference.pointer, _id_connectTimeoutMillis as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_readTimeoutMillis = _class.instanceMethodId( + r'readTimeoutMillis', + r'()I', + ); + + static final _readTimeoutMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int readTimeoutMillis()` + int readTimeoutMillis() { + return _readTimeoutMillis( + reference.pointer, _id_readTimeoutMillis as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_writeTimeoutMillis = _class.instanceMethodId( + r'writeTimeoutMillis', + r'()I', + ); + + static final _writeTimeoutMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int writeTimeoutMillis()` + int writeTimeoutMillis() { + return _writeTimeoutMillis( + reference.pointer, _id_writeTimeoutMillis as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_pingIntervalMillis = _class.instanceMethodId( + r'pingIntervalMillis', + r'()I', + ); + + static final _pingIntervalMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int pingIntervalMillis()` + int pingIntervalMillis() { + return _pingIntervalMillis( + reference.pointer, _id_pingIntervalMillis as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_minWebSocketMessageToCompress = _class.instanceMethodId( + r'minWebSocketMessageToCompress', + r'()J', + ); + + static final _minWebSocketMessageToCompress = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final long minWebSocketMessageToCompress()` + int minWebSocketMessageToCompress() { + return _minWebSocketMessageToCompress(reference.pointer, + _id_minWebSocketMessageToCompress as _$jni.JMethodIDPtr) + .long; + } + + static final _id_getRouteDatabase = _class.instanceMethodId( + r'getRouteDatabase', + r'()Lokhttp3/internal/connection/RouteDatabase;', + ); + + static final _getRouteDatabase = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.internal.connection.RouteDatabase getRouteDatabase()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject getRouteDatabase() { + return _getRouteDatabase( + reference.pointer, _id_getRouteDatabase as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_new$1 = _class.constructorId( + r'()V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient.new$1() { + return OkHttpClient.fromReference( + _new$1(_class.reference.pointer, _id_new$1 as _$jni.JMethodIDPtr) + .reference); + } + + static final _id_newCall = _class.instanceMethodId( + r'newCall', + r'(Lokhttp3/Request;)Lokhttp3/Call;', + ); + + static final _newCall = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.Call newCall(okhttp3.Request request)` + /// The returned object must be released after use, by calling the [release] method. + Call newCall( + Request request, + ) { + return _newCall(reference.pointer, _id_newCall as _$jni.JMethodIDPtr, + request.reference.pointer) + .object(const $Call$Type()); + } + + static final _id_newWebSocket = _class.instanceMethodId( + r'newWebSocket', + r'(Lokhttp3/Request;Lokhttp3/WebSocketListener;)Lokhttp3/WebSocket;', + ); + + static final _newWebSocket = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okhttp3.WebSocket newWebSocket(okhttp3.Request request, okhttp3.WebSocketListener webSocketListener)` + /// The returned object must be released after use, by calling the [release] method. + WebSocket newWebSocket( + Request request, + _$jni.JObject webSocketListener, + ) { + return _newWebSocket( + reference.pointer, + _id_newWebSocket as _$jni.JMethodIDPtr, + request.reference.pointer, + webSocketListener.reference.pointer) + .object(const $WebSocket$Type()); + } + + static final _id_newBuilder = _class.instanceMethodId( + r'newBuilder', + r'()Lokhttp3/OkHttpClient$Builder;', + ); + + static final _newBuilder = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public okhttp3.OkHttpClient$Builder newBuilder()` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder newBuilder() { + return _newBuilder(reference.pointer, _id_newBuilder as _$jni.JMethodIDPtr) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_clone = _class.instanceMethodId( + r'clone', + r'()Ljava/lang/Object;', + ); + + static final _clone = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.Object clone()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject clone() { + return _clone(reference.pointer, _id_clone as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } +} + +final class $OkHttpClient$Type extends _$jni.JObjType { + @_$jni.internal + const $OkHttpClient$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/OkHttpClient;'; + + @_$jni.internal + @_$core.override + OkHttpClient fromReference(_$jni.JReference reference) => + OkHttpClient.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($OkHttpClient$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($OkHttpClient$Type) && + other is $OkHttpClient$Type; + } +} + +/// from: `okhttp3.Call$Factory` +class Call_Factory extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Call_Factory.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Call$Factory'); + + /// The type which includes information such as the signature of this class. + static const type = $Call_Factory$Type(); + static final _id_newCall = _class.instanceMethodId( + r'newCall', + r'(Lokhttp3/Request;)Lokhttp3/Call;', + ); + + static final _newCall = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract okhttp3.Call newCall(okhttp3.Request request)` + /// The returned object must be released after use, by calling the [release] method. + Call newCall( + Request request, + ) { + return _newCall(reference.pointer, _id_newCall as _$jni.JMethodIDPtr, + request.reference.pointer) + .object(const $Call$Type()); + } + + /// Maps a specific port to the implemented interface. + static final _$core.Map _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r'newCall(Lokhttp3/Request;)Lokhttp3/Call;') { + final $r = _$impls[$p]!.newCall( + $a[0].as(const $Request$Type(), releaseOriginal: true), + ); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $Call_Factory $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'okhttp3.Call$Factory', + $p, + _$invokePointer, + [], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory Call_Factory.implement( + $Call_Factory $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return Call_Factory.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $Call_Factory { + factory $Call_Factory({ + required Call Function(Request request) newCall, + }) = _$Call_Factory; + + Call newCall(Request request); +} + +final class _$Call_Factory with $Call_Factory { + _$Call_Factory({ + required Call Function(Request request) newCall, + }) : _newCall = newCall; + + final Call Function(Request request) _newCall; + + Call newCall(Request request) { + return _newCall(request); + } +} + +final class $Call_Factory$Type extends _$jni.JObjType { + @_$jni.internal + const $Call_Factory$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Call$Factory;'; + + @_$jni.internal + @_$core.override + Call_Factory fromReference(_$jni.JReference reference) => + Call_Factory.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Call_Factory$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Call_Factory$Type) && + other is $Call_Factory$Type; + } +} + +/// from: `okhttp3.Call` +class Call extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Call.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Call'); + + /// The type which includes information such as the signature of this class. + static const type = $Call$Type(); + static final _id_request = _class.instanceMethodId( + r'request', + r'()Lokhttp3/Request;', + ); + + static final _request = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract okhttp3.Request request()` + /// The returned object must be released after use, by calling the [release] method. + Request request() { + return _request(reference.pointer, _id_request as _$jni.JMethodIDPtr) + .object(const $Request$Type()); + } + + static final _id_execute = _class.instanceMethodId( + r'execute', + r'()Lokhttp3/Response;', + ); + + static final _execute = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract okhttp3.Response execute()` + /// The returned object must be released after use, by calling the [release] method. + Response execute() { + return _execute(reference.pointer, _id_execute as _$jni.JMethodIDPtr) + .object(const $Response$Type()); + } + + static final _id_enqueue = _class.instanceMethodId( + r'enqueue', + r'(Lokhttp3/Callback;)V', + ); + + static final _enqueue = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void enqueue(okhttp3.Callback callback)` + void enqueue( + Callback callback, + ) { + _enqueue(reference.pointer, _id_enqueue as _$jni.JMethodIDPtr, + callback.reference.pointer) + .check(); + } + + static final _id_cancel = _class.instanceMethodId( + r'cancel', + r'()V', + ); + + static final _cancel = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract void cancel()` + void cancel() { + _cancel(reference.pointer, _id_cancel as _$jni.JMethodIDPtr).check(); + } + + static final _id_isExecuted = _class.instanceMethodId( + r'isExecuted', + r'()Z', + ); + + static final _isExecuted = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract boolean isExecuted()` + bool isExecuted() { + return _isExecuted(reference.pointer, _id_isExecuted as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_isCanceled = _class.instanceMethodId( + r'isCanceled', + r'()Z', + ); + + static final _isCanceled = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract boolean isCanceled()` + bool isCanceled() { + return _isCanceled(reference.pointer, _id_isCanceled as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_timeout = _class.instanceMethodId( + r'timeout', + r'()Lokio/Timeout;', + ); + + static final _timeout = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract okio.Timeout timeout()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject timeout() { + return _timeout(reference.pointer, _id_timeout as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_clone = _class.instanceMethodId( + r'clone', + r'()Lokhttp3/Call;', + ); + + static final _clone = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract okhttp3.Call clone()` + /// The returned object must be released after use, by calling the [release] method. + Call clone() { + return _clone(reference.pointer, _id_clone as _$jni.JMethodIDPtr) + .object(const $Call$Type()); + } + + /// Maps a specific port to the implemented interface. + static final _$core.Map _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r'request()Lokhttp3/Request;') { + final $r = _$impls[$p]!.request(); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r'execute()Lokhttp3/Response;') { + final $r = _$impls[$p]!.execute(); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r'enqueue(Lokhttp3/Callback;)V') { + _$impls[$p]!.enqueue( + $a[0].as(const $Callback$Type(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == r'cancel()V') { + _$impls[$p]!.cancel(); + return _$jni.nullptr; + } + if ($d == r'isExecuted()Z') { + final $r = _$impls[$p]!.isExecuted(); + return _$jni.JBoolean($r).reference.toPointer(); + } + if ($d == r'isCanceled()Z') { + final $r = _$impls[$p]!.isCanceled(); + return _$jni.JBoolean($r).reference.toPointer(); + } + if ($d == r'timeout()Lokio/Timeout;') { + final $r = _$impls[$p]!.timeout(); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r'clone()Lokhttp3/Call;') { + final $r = _$impls[$p]!.clone(); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $Call $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'okhttp3.Call', + $p, + _$invokePointer, + [ + if ($impl.enqueue$async) r'enqueue(Lokhttp3/Callback;)V', + if ($impl.cancel$async) r'cancel()V', + ], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory Call.implement( + $Call $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return Call.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $Call { + factory $Call({ + required Request Function() request, + required Response Function() execute, + required void Function(Callback callback) enqueue, + bool enqueue$async, + required void Function() cancel, + bool cancel$async, + required bool Function() isExecuted, + required bool Function() isCanceled, + required _$jni.JObject Function() timeout, + required Call Function() clone, + }) = _$Call; + + Request request(); + Response execute(); + void enqueue(Callback callback); + bool get enqueue$async => false; + void cancel(); + bool get cancel$async => false; + bool isExecuted(); + bool isCanceled(); + _$jni.JObject timeout(); + Call clone(); +} + +final class _$Call with $Call { + _$Call({ + required Request Function() request, + required Response Function() execute, + required void Function(Callback callback) enqueue, + this.enqueue$async = false, + required void Function() cancel, + this.cancel$async = false, + required bool Function() isExecuted, + required bool Function() isCanceled, + required _$jni.JObject Function() timeout, + required Call Function() clone, + }) : _request = request, + _execute = execute, + _enqueue = enqueue, + _cancel = cancel, + _isExecuted = isExecuted, + _isCanceled = isCanceled, + _timeout = timeout, + _clone = clone; + + final Request Function() _request; + final Response Function() _execute; + final void Function(Callback callback) _enqueue; + final bool enqueue$async; + final void Function() _cancel; + final bool cancel$async; + final bool Function() _isExecuted; + final bool Function() _isCanceled; + final _$jni.JObject Function() _timeout; + final Call Function() _clone; + + Request request() { + return _request(); + } + + Response execute() { + return _execute(); + } + + void enqueue(Callback callback) { + return _enqueue(callback); + } + + void cancel() { + return _cancel(); + } + + bool isExecuted() { + return _isExecuted(); + } + + bool isCanceled() { + return _isCanceled(); + } + + _$jni.JObject timeout() { + return _timeout(); + } + + Call clone() { + return _clone(); + } +} + +final class $Call$Type extends _$jni.JObjType { + @_$jni.internal + const $Call$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Call;'; + + @_$jni.internal + @_$core.override + Call fromReference(_$jni.JReference reference) => + Call.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Call$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Call$Type) && other is $Call$Type; + } +} + +/// from: `okhttp3.Headers$Builder` +class Headers_Builder extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Headers_Builder.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Headers$Builder'); + + /// The type which includes information such as the signature of this class. + static const type = $Headers_Builder$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory Headers_Builder() { + return Headers_Builder.fromReference( + _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + .reference); + } + + static final _id_add = _class.instanceMethodId( + r'add', + r'(Ljava/lang/String;)Lokhttp3/Headers$Builder;', + ); + + static final _add = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder add(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder add( + _$jni.JString string, + ) { + return _add(reference.pointer, _id_add as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_add$1 = _class.instanceMethodId( + r'add', + r'(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$Builder;', + ); + + static final _add$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder add(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder add$1( + _$jni.JString string, + _$jni.JString string1, + ) { + return _add$1(reference.pointer, _id_add$1 as _$jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_addUnsafeNonAscii = _class.instanceMethodId( + r'addUnsafeNonAscii', + r'(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$Builder;', + ); + + static final _addUnsafeNonAscii = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder addUnsafeNonAscii(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder addUnsafeNonAscii( + _$jni.JString string, + _$jni.JString string1, + ) { + return _addUnsafeNonAscii( + reference.pointer, + _id_addUnsafeNonAscii as _$jni.JMethodIDPtr, + string.reference.pointer, + string1.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_addAll = _class.instanceMethodId( + r'addAll', + r'(Lokhttp3/Headers;)Lokhttp3/Headers$Builder;', + ); + + static final _addAll = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder addAll(okhttp3.Headers headers)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder addAll( + Headers headers, + ) { + return _addAll(reference.pointer, _id_addAll as _$jni.JMethodIDPtr, + headers.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_add$2 = _class.instanceMethodId( + r'add', + r'(Ljava/lang/String;Ljava/util/Date;)Lokhttp3/Headers$Builder;', + ); + + static final _add$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder add(java.lang.String string, java.util.Date date)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder add$2( + _$jni.JString string, + _$jni.JObject date, + ) { + return _add$2(reference.pointer, _id_add$2 as _$jni.JMethodIDPtr, + string.reference.pointer, date.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_add$3 = _class.instanceMethodId( + r'add', + r'(Ljava/lang/String;Ljava/time/Instant;)Lokhttp3/Headers$Builder;', + ); + + static final _add$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder add(java.lang.String string, java.time.Instant instant)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder add$3( + _$jni.JString string, + _$jni.JObject instant, + ) { + return _add$3(reference.pointer, _id_add$3 as _$jni.JMethodIDPtr, + string.reference.pointer, instant.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_set = _class.instanceMethodId( + r'set', + r'(Ljava/lang/String;Ljava/util/Date;)Lokhttp3/Headers$Builder;', + ); + + static final _set = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder set(java.lang.String string, java.util.Date date)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder set( + _$jni.JString string, + _$jni.JObject date, + ) { + return _set(reference.pointer, _id_set as _$jni.JMethodIDPtr, + string.reference.pointer, date.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_set$1 = _class.instanceMethodId( + r'set', + r'(Ljava/lang/String;Ljava/time/Instant;)Lokhttp3/Headers$Builder;', + ); + + static final _set$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder set(java.lang.String string, java.time.Instant instant)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder set$1( + _$jni.JString string, + _$jni.JObject instant, + ) { + return _set$1(reference.pointer, _id_set$1 as _$jni.JMethodIDPtr, + string.reference.pointer, instant.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_removeAll = _class.instanceMethodId( + r'removeAll', + r'(Ljava/lang/String;)Lokhttp3/Headers$Builder;', + ); + + static final _removeAll = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder removeAll(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder removeAll( + _$jni.JString string, + ) { + return _removeAll(reference.pointer, _id_removeAll as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_set$2 = _class.instanceMethodId( + r'set', + r'(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$Builder;', + ); + + static final _set$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers$Builder set(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder set$2( + _$jni.JString string, + _$jni.JString string1, + ) { + return _set$2(reference.pointer, _id_set$2 as _$jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Headers_Builder$Type()); + } + + static final _id_get = _class.instanceMethodId( + r'get', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _get = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.lang.String get(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString get( + _$jni.JString string, + ) { + return _get(reference.pointer, _id_get as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const _$jni.JStringType()); + } + + static final _id_build = _class.instanceMethodId( + r'build', + r'()Lokhttp3/Headers;', + ); + + static final _build = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Headers build()` + /// The returned object must be released after use, by calling the [release] method. + Headers build() { + return _build(reference.pointer, _id_build as _$jni.JMethodIDPtr) + .object(const $Headers$Type()); + } +} + +final class $Headers_Builder$Type extends _$jni.JObjType { + @_$jni.internal + const $Headers_Builder$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Headers$Builder;'; + + @_$jni.internal + @_$core.override + Headers_Builder fromReference(_$jni.JReference reference) => + Headers_Builder.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Headers_Builder$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Headers_Builder$Type) && + other is $Headers_Builder$Type; + } +} + +/// from: `okhttp3.Headers$Companion` +class Headers_Companion extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Headers_Companion.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Headers$Companion'); + + /// The type which includes information such as the signature of this class. + static const type = $Headers_Companion$Type(); + static final _id_of = _class.instanceMethodId( + r'of', + r'([Ljava/lang/String;)Lokhttp3/Headers;', + ); + + static final _of = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers of(java.lang.String[] strings)` + /// The returned object must be released after use, by calling the [release] method. + Headers of( + _$jni.JArray<_$jni.JString> strings, + ) { + return _of(reference.pointer, _id_of as _$jni.JMethodIDPtr, + strings.reference.pointer) + .object(const $Headers$Type()); + } + + static final _id_of$1 = _class.instanceMethodId( + r'of', + r'(Ljava/util/Map;)Lokhttp3/Headers;', + ); + + static final _of$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers of(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + Headers of$1( + _$jni.JMap<_$jni.JString, _$jni.JString> map, + ) { + return _of$1(reference.pointer, _id_of$1 as _$jni.JMethodIDPtr, + map.reference.pointer) + .object(const $Headers$Type()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory Headers_Companion( + _$jni.JObject defaultConstructorMarker, + ) { + return Headers_Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $Headers_Companion$Type extends _$jni.JObjType { + @_$jni.internal + const $Headers_Companion$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Headers$Companion;'; + + @_$jni.internal + @_$core.override + Headers_Companion fromReference(_$jni.JReference reference) => + Headers_Companion.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Headers_Companion$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Headers_Companion$Type) && + other is $Headers_Companion$Type; + } +} + +/// from: `okhttp3.Headers` +class Headers extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Headers.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Headers'); + + /// The type which includes information such as the signature of this class. + static const type = $Headers$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'Lokhttp3/Headers$Companion;', + ); + + /// from: `static public final okhttp3.Headers$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static Headers_Companion get Companion => + _id_Companion.get(_class, const $Headers_Companion$Type()); + + static final _id_get = _class.instanceMethodId( + r'get', + r'(Ljava/lang/String;)Ljava/lang/String;', + ); + + static final _get = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.lang.String get(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString get( + _$jni.JString string, + ) { + return _get(reference.pointer, _id_get as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const _$jni.JStringType()); + } + + static final _id_getDate = _class.instanceMethodId( + r'getDate', + r'(Ljava/lang/String;)Ljava/util/Date;', + ); + + static final _getDate = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.util.Date getDate(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject getDate( + _$jni.JString string, + ) { + return _getDate(reference.pointer, _id_getDate as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_getInstant = _class.instanceMethodId( + r'getInstant', + r'(Ljava/lang/String;)Ljava/time/Instant;', + ); + + static final _getInstant = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.time.Instant getInstant(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject getInstant( + _$jni.JString string, + ) { + return _getInstant(reference.pointer, _id_getInstant as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_size = _class.instanceMethodId( + r'size', + r'()I', + ); + + static final _size = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int size()` + int size() { + return _size(reference.pointer, _id_size as _$jni.JMethodIDPtr).integer; + } + + static final _id_name = _class.instanceMethodId( + r'name', + r'(I)Ljava/lang/String;', + ); + + static final _name = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final java.lang.String name(int i)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString name( + int i, + ) { + return _name(reference.pointer, _id_name as _$jni.JMethodIDPtr, i) + .object(const _$jni.JStringType()); + } + + static final _id_value = _class.instanceMethodId( + r'value', + r'(I)Ljava/lang/String;', + ); + + static final _value = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final java.lang.String value(int i)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString value( + int i, + ) { + return _value(reference.pointer, _id_value as _$jni.JMethodIDPtr, i) + .object(const _$jni.JStringType()); + } + + static final _id_names = _class.instanceMethodId( + r'names', + r'()Ljava/util/Set;', + ); + + static final _names = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.Set names()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JSet<_$jni.JString> names() { + return _names(reference.pointer, _id_names as _$jni.JMethodIDPtr) + .object(const _$jni.JSetType(_$jni.JStringType())); + } + + static final _id_values = _class.instanceMethodId( + r'values', + r'(Ljava/lang/String;)Ljava/util/List;', + ); + + static final _values = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.util.List values(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JString> values( + _$jni.JString string, + ) { + return _values(reference.pointer, _id_values as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const _$jni.JListType(_$jni.JStringType())); + } + + static final _id_byteCount = _class.instanceMethodId( + r'byteCount', + r'()J', + ); + + static final _byteCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final long byteCount()` + int byteCount() { + return _byteCount(reference.pointer, _id_byteCount as _$jni.JMethodIDPtr) + .long; + } + + static final _id_iterator = _class.instanceMethodId( + r'iterator', + r'()Ljava/util/Iterator;', + ); + + static final _iterator = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.util.Iterator iterator()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JIterator<_$jni.JObject> iterator() { + return _iterator(reference.pointer, _id_iterator as _$jni.JMethodIDPtr) + .object(const _$jni.JIteratorType(_$jni.JObjectType())); + } + + static final _id_newBuilder = _class.instanceMethodId( + r'newBuilder', + r'()Lokhttp3/Headers$Builder;', + ); + + static final _newBuilder = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okhttp3.Headers$Builder newBuilder()` + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder newBuilder() { + return _newBuilder(reference.pointer, _id_newBuilder as _$jni.JMethodIDPtr) + .object(const $Headers_Builder$Type()); + } + + static final _id_equals = _class.instanceMethodId( + r'equals', + r'(Ljava/lang/Object;)Z', + ); + + static final _equals = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public boolean equals(java.lang.Object object)` + bool equals( + _$jni.JObject object, + ) { + return _equals(reference.pointer, _id_equals as _$jni.JMethodIDPtr, + object.reference.pointer) + .boolean; + } + + static final _id_hashCode$1 = _class.instanceMethodId( + r'hashCode', + r'()I', + ); + + static final _hashCode$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public int hashCode()` + int hashCode$1() { + return _hashCode$1(reference.pointer, _id_hashCode$1 as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_toString$1 = _class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_toMultimap = _class.instanceMethodId( + r'toMultimap', + r'()Ljava/util/Map;', + ); + + static final _toMultimap = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.Map toMultimap()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JMap<_$jni.JString, _$jni.JList<_$jni.JString>> toMultimap() { + return _toMultimap(reference.pointer, _id_toMultimap as _$jni.JMethodIDPtr) + .object(const _$jni.JMapType( + _$jni.JStringType(), _$jni.JListType(_$jni.JStringType()))); + } + + static final _id_of = _class.staticMethodId( + r'of', + r'([Ljava/lang/String;)Lokhttp3/Headers;', + ); + + static final _of = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.Headers of(java.lang.String[] strings)` + /// The returned object must be released after use, by calling the [release] method. + static Headers of( + _$jni.JArray<_$jni.JString> strings, + ) { + return _of(_class.reference.pointer, _id_of as _$jni.JMethodIDPtr, + strings.reference.pointer) + .object(const $Headers$Type()); + } + + static final _id_of$1 = _class.staticMethodId( + r'of', + r'(Ljava/util/Map;)Lokhttp3/Headers;', + ); + + static final _of$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okhttp3.Headers of(java.util.Map map)` + /// The returned object must be released after use, by calling the [release] method. + static Headers of$1( + _$jni.JMap<_$jni.JString, _$jni.JString> map, + ) { + return _of$1(_class.reference.pointer, _id_of$1 as _$jni.JMethodIDPtr, + map.reference.pointer) + .object(const $Headers$Type()); + } + + static final _id_new$ = _class.constructorId( + r'([Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (java.lang.String[] strings, kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory Headers( + _$jni.JArray<_$jni.JString> strings, + _$jni.JObject defaultConstructorMarker, + ) { + return Headers.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + strings.reference.pointer, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $Headers$Type extends _$jni.JObjType { + @_$jni.internal + const $Headers$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Headers;'; + + @_$jni.internal + @_$core.override + Headers fromReference(_$jni.JReference reference) => + Headers.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Headers$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Headers$Type) && other is $Headers$Type; + } +} + +/// from: `okhttp3.Callback` +class Callback extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Callback.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Callback'); + + /// The type which includes information such as the signature of this class. + static const type = $Callback$Type(); + static final _id_onFailure = _class.instanceMethodId( + r'onFailure', + r'(Lokhttp3/Call;Ljava/io/IOException;)V', + ); + + static final _onFailure = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onFailure(okhttp3.Call call, java.io.IOException iOException)` + void onFailure( + Call call, + _$jni.JObject iOException, + ) { + _onFailure(reference.pointer, _id_onFailure as _$jni.JMethodIDPtr, + call.reference.pointer, iOException.reference.pointer) + .check(); + } + + static final _id_onResponse = _class.instanceMethodId( + r'onResponse', + r'(Lokhttp3/Call;Lokhttp3/Response;)V', + ); + + static final _onResponse = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onResponse(okhttp3.Call call, okhttp3.Response response)` + void onResponse( + Call call, + Response response, + ) { + _onResponse(reference.pointer, _id_onResponse as _$jni.JMethodIDPtr, + call.reference.pointer, response.reference.pointer) + .check(); + } + + /// Maps a specific port to the implemented interface. + static final _$core.Map _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r'onFailure(Lokhttp3/Call;Ljava/io/IOException;)V') { + _$impls[$p]!.onFailure( + $a[0].as(const $Call$Type(), releaseOriginal: true), + $a[1].as(const _$jni.JObjectType(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == r'onResponse(Lokhttp3/Call;Lokhttp3/Response;)V') { + _$impls[$p]!.onResponse( + $a[0].as(const $Call$Type(), releaseOriginal: true), + $a[1].as(const $Response$Type(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $Callback $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'okhttp3.Callback', + $p, + _$invokePointer, + [ + if ($impl.onFailure$async) + r'onFailure(Lokhttp3/Call;Ljava/io/IOException;)V', + if ($impl.onResponse$async) + r'onResponse(Lokhttp3/Call;Lokhttp3/Response;)V', + ], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory Callback.implement( + $Callback $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return Callback.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $Callback { + factory $Callback({ + required void Function(Call call, _$jni.JObject iOException) onFailure, + bool onFailure$async, + required void Function(Call call, Response response) onResponse, + bool onResponse$async, + }) = _$Callback; + + void onFailure(Call call, _$jni.JObject iOException); + bool get onFailure$async => false; + void onResponse(Call call, Response response); + bool get onResponse$async => false; +} + +final class _$Callback with $Callback { + _$Callback({ + required void Function(Call call, _$jni.JObject iOException) onFailure, + this.onFailure$async = false, + required void Function(Call call, Response response) onResponse, + this.onResponse$async = false, + }) : _onFailure = onFailure, + _onResponse = onResponse; + + final void Function(Call call, _$jni.JObject iOException) _onFailure; + final bool onFailure$async; + final void Function(Call call, Response response) _onResponse; + final bool onResponse$async; + + void onFailure(Call call, _$jni.JObject iOException) { + return _onFailure(call, iOException); + } + + void onResponse(Call call, Response response) { + return _onResponse(call, response); + } +} + +final class $Callback$Type extends _$jni.JObjType { + @_$jni.internal + const $Callback$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Callback;'; + + @_$jni.internal + @_$core.override + Callback fromReference(_$jni.JReference reference) => + Callback.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Callback$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Callback$Type) && other is $Callback$Type; + } +} + +/// from: `okhttp3.ConnectionPool` +class ConnectionPool extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + ConnectionPool.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/ConnectionPool'); + + /// The type which includes information such as the signature of this class. + static const type = $ConnectionPool$Type(); + static final _id_new$ = _class.constructorId( + r'(Lokhttp3/internal/connection/RealConnectionPool;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (okhttp3.internal.connection.RealConnectionPool realConnectionPool)` + /// The returned object must be released after use, by calling the [release] method. + factory ConnectionPool( + _$jni.JObject realConnectionPool, + ) { + return ConnectionPool.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + realConnectionPool.reference.pointer) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(IJLjava/util/concurrent/TimeUnit;)V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Int32, + _$jni.Int64, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (int i, long j, java.util.concurrent.TimeUnit timeUnit)` + /// The returned object must be released after use, by calling the [release] method. + factory ConnectionPool.new$1( + int i, + int j, + TimeUnit timeUnit, + ) { + return ConnectionPool.fromReference(_new$1(_class.reference.pointer, + _id_new$1 as _$jni.JMethodIDPtr, i, j, timeUnit.reference.pointer) + .reference); + } + + static final _id_new$2 = _class.constructorId( + r'()V', + ); + + static final _new$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory ConnectionPool.new$2() { + return ConnectionPool.fromReference( + _new$2(_class.reference.pointer, _id_new$2 as _$jni.JMethodIDPtr) + .reference); + } + + static final _id_idleConnectionCount = _class.instanceMethodId( + r'idleConnectionCount', + r'()I', + ); + + static final _idleConnectionCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int idleConnectionCount()` + int idleConnectionCount() { + return _idleConnectionCount( + reference.pointer, _id_idleConnectionCount as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_connectionCount = _class.instanceMethodId( + r'connectionCount', + r'()I', + ); + + static final _connectionCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int connectionCount()` + int connectionCount() { + return _connectionCount( + reference.pointer, _id_connectionCount as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_evictAll = _class.instanceMethodId( + r'evictAll', + r'()V', + ); + + static final _evictAll = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final void evictAll()` + void evictAll() { + _evictAll(reference.pointer, _id_evictAll as _$jni.JMethodIDPtr).check(); + } +} + +final class $ConnectionPool$Type extends _$jni.JObjType { + @_$jni.internal + const $ConnectionPool$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/ConnectionPool;'; + + @_$jni.internal + @_$core.override + ConnectionPool fromReference(_$jni.JReference reference) => + ConnectionPool.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($ConnectionPool$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($ConnectionPool$Type) && + other is $ConnectionPool$Type; + } +} + +/// from: `okhttp3.Dispatcher` +class Dispatcher extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Dispatcher.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Dispatcher'); + + /// The type which includes information such as the signature of this class. + static const type = $Dispatcher$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory Dispatcher() { + return Dispatcher.fromReference( + _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + .reference); + } + + static final _id_getMaxRequests = _class.instanceMethodId( + r'getMaxRequests', + r'()I', + ); + + static final _getMaxRequests = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int getMaxRequests()` + int getMaxRequests() { + return _getMaxRequests( + reference.pointer, _id_getMaxRequests as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_setMaxRequests = _class.instanceMethodId( + r'setMaxRequests', + r'(I)V', + ); + + static final _setMaxRequests = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final void setMaxRequests(int i)` + void setMaxRequests( + int i, + ) { + _setMaxRequests( + reference.pointer, _id_setMaxRequests as _$jni.JMethodIDPtr, i) + .check(); + } + + static final _id_getMaxRequestsPerHost = _class.instanceMethodId( + r'getMaxRequestsPerHost', + r'()I', + ); + + static final _getMaxRequestsPerHost = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int getMaxRequestsPerHost()` + int getMaxRequestsPerHost() { + return _getMaxRequestsPerHost( + reference.pointer, _id_getMaxRequestsPerHost as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_setMaxRequestsPerHost = _class.instanceMethodId( + r'setMaxRequestsPerHost', + r'(I)V', + ); + + static final _setMaxRequestsPerHost = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final void setMaxRequestsPerHost(int i)` + void setMaxRequestsPerHost( + int i, + ) { + _setMaxRequestsPerHost(reference.pointer, + _id_setMaxRequestsPerHost as _$jni.JMethodIDPtr, i) + .check(); + } + + static final _id_getIdleCallback = _class.instanceMethodId( + r'getIdleCallback', + r'()Ljava/lang/Runnable;', + ); + + static final _getIdleCallback = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.lang.Runnable getIdleCallback()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject getIdleCallback() { + return _getIdleCallback( + reference.pointer, _id_getIdleCallback as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_setIdleCallback = _class.instanceMethodId( + r'setIdleCallback', + r'(Ljava/lang/Runnable;)V', + ); + + static final _setIdleCallback = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final void setIdleCallback(java.lang.Runnable runnable)` + void setIdleCallback( + _$jni.JObject runnable, + ) { + _setIdleCallback( + reference.pointer, + _id_setIdleCallback as _$jni.JMethodIDPtr, + runnable.reference.pointer) + .check(); + } + + static final _id_executorService = _class.instanceMethodId( + r'executorService', + r'()Ljava/util/concurrent/ExecutorService;', + ); + + static final _executorService = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.concurrent.ExecutorService executorService()` + /// The returned object must be released after use, by calling the [release] method. + ExecutorService executorService() { + return _executorService( + reference.pointer, _id_executorService as _$jni.JMethodIDPtr) + .object(const $ExecutorService$Type()); + } + + static final _id_new$1 = _class.constructorId( + r'(Ljava/util/concurrent/ExecutorService;)V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (java.util.concurrent.ExecutorService executorService)` + /// The returned object must be released after use, by calling the [release] method. + factory Dispatcher.new$1( + ExecutorService executorService, + ) { + return Dispatcher.fromReference(_new$1(_class.reference.pointer, + _id_new$1 as _$jni.JMethodIDPtr, executorService.reference.pointer) + .reference); + } + + static final _id_cancelAll = _class.instanceMethodId( + r'cancelAll', + r'()V', + ); + + static final _cancelAll = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final void cancelAll()` + void cancelAll() { + _cancelAll(reference.pointer, _id_cancelAll as _$jni.JMethodIDPtr).check(); + } + + static final _id_queuedCalls = _class.instanceMethodId( + r'queuedCalls', + r'()Ljava/util/List;', + ); + + static final _queuedCalls = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List queuedCalls()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList queuedCalls() { + return _queuedCalls( + reference.pointer, _id_queuedCalls as _$jni.JMethodIDPtr) + .object(const _$jni.JListType($Call$Type())); + } + + static final _id_runningCalls = _class.instanceMethodId( + r'runningCalls', + r'()Ljava/util/List;', + ); + + static final _runningCalls = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.List runningCalls()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList runningCalls() { + return _runningCalls( + reference.pointer, _id_runningCalls as _$jni.JMethodIDPtr) + .object(const _$jni.JListType($Call$Type())); + } + + static final _id_queuedCallsCount = _class.instanceMethodId( + r'queuedCallsCount', + r'()I', + ); + + static final _queuedCallsCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int queuedCallsCount()` + int queuedCallsCount() { + return _queuedCallsCount( + reference.pointer, _id_queuedCallsCount as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_runningCallsCount = _class.instanceMethodId( + r'runningCallsCount', + r'()I', + ); + + static final _runningCallsCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int runningCallsCount()` + int runningCallsCount() { + return _runningCallsCount( + reference.pointer, _id_runningCallsCount as _$jni.JMethodIDPtr) + .integer; + } +} + +final class $Dispatcher$Type extends _$jni.JObjType { + @_$jni.internal + const $Dispatcher$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Dispatcher;'; + + @_$jni.internal + @_$core.override + Dispatcher fromReference(_$jni.JReference reference) => + Dispatcher.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Dispatcher$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Dispatcher$Type) && other is $Dispatcher$Type; + } +} + +/// from: `java.util.concurrent.ExecutorService` +class ExecutorService extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + ExecutorService.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'java/util/concurrent/ExecutorService'); + + /// The type which includes information such as the signature of this class. + static const type = $ExecutorService$Type(); + static final _id_shutdown = _class.instanceMethodId( + r'shutdown', + r'()V', + ); + + static final _shutdown = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract void shutdown()` + void shutdown() { + _shutdown(reference.pointer, _id_shutdown as _$jni.JMethodIDPtr).check(); + } + + static final _id_shutdownNow = _class.instanceMethodId( + r'shutdownNow', + r'()Ljava/util/List;', + ); + + static final _shutdownNow = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract java.util.List shutdownNow()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> shutdownNow() { + return _shutdownNow( + reference.pointer, _id_shutdownNow as _$jni.JMethodIDPtr) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_isShutdown = _class.instanceMethodId( + r'isShutdown', + r'()Z', + ); + + static final _isShutdown = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract boolean isShutdown()` + bool isShutdown() { + return _isShutdown(reference.pointer, _id_isShutdown as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_isTerminated = _class.instanceMethodId( + r'isTerminated', + r'()Z', + ); + + static final _isTerminated = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract boolean isTerminated()` + bool isTerminated() { + return _isTerminated( + reference.pointer, _id_isTerminated as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_awaitTermination = _class.instanceMethodId( + r'awaitTermination', + r'(JLjava/util/concurrent/TimeUnit;)Z', + ); + + static final _awaitTermination = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int64, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract boolean awaitTermination(long j, java.util.concurrent.TimeUnit timeUnit)` + bool awaitTermination( + int j, + TimeUnit timeUnit, + ) { + return _awaitTermination( + reference.pointer, + _id_awaitTermination as _$jni.JMethodIDPtr, + j, + timeUnit.reference.pointer) + .boolean; + } + + static final _id_submit = _class.instanceMethodId( + r'submit', + r'(Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future;', + ); + + static final _submit = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract java.util.concurrent.Future submit(java.util.concurrent.Callable callable)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject submit<$T extends _$jni.JObject>( + _$jni.JObject callable, { + required _$jni.JObjType<$T> T, + }) { + return _submit(reference.pointer, _id_submit as _$jni.JMethodIDPtr, + callable.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_submit$1 = _class.instanceMethodId( + r'submit', + r'(Ljava/lang/Runnable;Ljava/lang/Object;)Ljava/util/concurrent/Future;', + ); + + static final _submit$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract java.util.concurrent.Future submit(java.lang.Runnable runnable, T object)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject submit$1<$T extends _$jni.JObject>( + _$jni.JObject runnable, + $T object, { + _$jni.JObjType<$T>? T, + }) { + T ??= _$jni.lowestCommonSuperType([ + object.$type, + ]) as _$jni.JObjType<$T>; + return _submit$1(reference.pointer, _id_submit$1 as _$jni.JMethodIDPtr, + runnable.reference.pointer, object.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_submit$2 = _class.instanceMethodId( + r'submit', + r'(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;', + ); + + static final _submit$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract java.util.concurrent.Future submit(java.lang.Runnable runnable)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject submit$2( + _$jni.JObject runnable, + ) { + return _submit$2(reference.pointer, _id_submit$2 as _$jni.JMethodIDPtr, + runnable.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_invokeAll = _class.instanceMethodId( + r'invokeAll', + r'(Ljava/util/Collection;)Ljava/util/List;', + ); + + static final _invokeAll = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract java.util.List invokeAll(java.util.Collection collection)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> invokeAll<$T extends _$jni.JObject>( + _$jni.JObject collection, { + required _$jni.JObjType<$T> T, + }) { + return _invokeAll(reference.pointer, _id_invokeAll as _$jni.JMethodIDPtr, + collection.reference.pointer) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_invokeAll$1 = _class.instanceMethodId( + r'invokeAll', + r'(Ljava/util/Collection;JLjava/util/concurrent/TimeUnit;)Ljava/util/List;', + ); + + static final _invokeAll$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int64, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract java.util.List invokeAll(java.util.Collection collection, long j, java.util.concurrent.TimeUnit timeUnit)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JList<_$jni.JObject> invokeAll$1<$T extends _$jni.JObject>( + _$jni.JObject collection, + int j, + TimeUnit timeUnit, { + required _$jni.JObjType<$T> T, + }) { + return _invokeAll$1( + reference.pointer, + _id_invokeAll$1 as _$jni.JMethodIDPtr, + collection.reference.pointer, + j, + timeUnit.reference.pointer) + .object(const _$jni.JListType(_$jni.JObjectType())); + } + + static final _id_invokeAny = _class.instanceMethodId( + r'invokeAny', + r'(Ljava/util/Collection;)Ljava/lang/Object;', + ); + + static final _invokeAny = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract T invokeAny(java.util.Collection collection)` + /// The returned object must be released after use, by calling the [release] method. + $T invokeAny<$T extends _$jni.JObject>( + _$jni.JObject collection, { + required _$jni.JObjType<$T> T, + }) { + return _invokeAny(reference.pointer, _id_invokeAny as _$jni.JMethodIDPtr, + collection.reference.pointer) + .object(T); + } + + static final _id_invokeAny$1 = _class.instanceMethodId( + r'invokeAny', + r'(Ljava/util/Collection;JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;', + ); + + static final _invokeAny$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int64, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract T invokeAny(java.util.Collection collection, long j, java.util.concurrent.TimeUnit timeUnit)` + /// The returned object must be released after use, by calling the [release] method. + $T invokeAny$1<$T extends _$jni.JObject>( + _$jni.JObject collection, + int j, + TimeUnit timeUnit, { + required _$jni.JObjType<$T> T, + }) { + return _invokeAny$1( + reference.pointer, + _id_invokeAny$1 as _$jni.JMethodIDPtr, + collection.reference.pointer, + j, + timeUnit.reference.pointer) + .object(T); + } + + /// Maps a specific port to the implemented interface. + static final _$core.Map _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r'shutdown()V') { + _$impls[$p]!.shutdown(); + return _$jni.nullptr; + } + if ($d == r'shutdownNow()Ljava/util/List;') { + final $r = _$impls[$p]!.shutdownNow(); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r'isShutdown()Z') { + final $r = _$impls[$p]!.isShutdown(); + return _$jni.JBoolean($r).reference.toPointer(); + } + if ($d == r'isTerminated()Z') { + final $r = _$impls[$p]!.isTerminated(); + return _$jni.JBoolean($r).reference.toPointer(); + } + if ($d == r'awaitTermination(JLjava/util/concurrent/TimeUnit;)Z') { + final $r = _$impls[$p]!.awaitTermination( + $a[0] + .as(const _$jni.JLongType(), releaseOriginal: true) + .longValue(releaseOriginal: true), + $a[1].as(const $TimeUnit$Type(), releaseOriginal: true), + ); + return _$jni.JBoolean($r).reference.toPointer(); + } + if ($d == + r'submit(Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future;') { + final $r = _$impls[$p]!.submit( + $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + ); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == + r'submit(Ljava/lang/Runnable;Ljava/lang/Object;)Ljava/util/concurrent/Future;') { + final $r = _$impls[$p]!.submit$1( + $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + $a[1].as(const _$jni.JObjectType(), releaseOriginal: true), + ); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r'submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;') { + final $r = _$impls[$p]!.submit$2( + $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + ); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r'invokeAll(Ljava/util/Collection;)Ljava/util/List;') { + final $r = _$impls[$p]!.invokeAll( + $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + ); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == + r'invokeAll(Ljava/util/Collection;JLjava/util/concurrent/TimeUnit;)Ljava/util/List;') { + final $r = _$impls[$p]!.invokeAll$1( + $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + $a[1] + .as(const _$jni.JLongType(), releaseOriginal: true) + .longValue(releaseOriginal: true), + $a[2].as(const $TimeUnit$Type(), releaseOriginal: true), + ); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r'invokeAny(Ljava/util/Collection;)Ljava/lang/Object;') { + final $r = _$impls[$p]!.invokeAny( + $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + ); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == + r'invokeAny(Ljava/util/Collection;JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;') { + final $r = _$impls[$p]!.invokeAny$1( + $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + $a[1] + .as(const _$jni.JLongType(), releaseOriginal: true) + .longValue(releaseOriginal: true), + $a[2].as(const $TimeUnit$Type(), releaseOriginal: true), + ); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $ExecutorService $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'java.util.concurrent.ExecutorService', + $p, + _$invokePointer, + [ + if ($impl.shutdown$async) r'shutdown()V', + ], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory ExecutorService.implement( + $ExecutorService $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return ExecutorService.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $ExecutorService { + factory $ExecutorService({ + required void Function() shutdown, + bool shutdown$async, + required _$jni.JList<_$jni.JObject> Function() shutdownNow, + required bool Function() isShutdown, + required bool Function() isTerminated, + required bool Function(int j, TimeUnit timeUnit) awaitTermination, + required _$jni.JObject Function(_$jni.JObject callable) submit, + required _$jni.JObject Function( + _$jni.JObject runnable, _$jni.JObject object) + submit$1, + required _$jni.JObject Function(_$jni.JObject runnable) submit$2, + required _$jni.JList<_$jni.JObject> Function(_$jni.JObject collection) + invokeAll, + required _$jni.JList<_$jni.JObject> Function( + _$jni.JObject collection, int j, TimeUnit timeUnit) + invokeAll$1, + required _$jni.JObject Function(_$jni.JObject collection) invokeAny, + required _$jni.JObject Function( + _$jni.JObject collection, int j, TimeUnit timeUnit) + invokeAny$1, + }) = _$ExecutorService; + + void shutdown(); + bool get shutdown$async => false; + _$jni.JList<_$jni.JObject> shutdownNow(); + bool isShutdown(); + bool isTerminated(); + bool awaitTermination(int j, TimeUnit timeUnit); + _$jni.JObject submit(_$jni.JObject callable); + _$jni.JObject submit$1(_$jni.JObject runnable, _$jni.JObject object); + _$jni.JObject submit$2(_$jni.JObject runnable); + _$jni.JList<_$jni.JObject> invokeAll(_$jni.JObject collection); + _$jni.JList<_$jni.JObject> invokeAll$1( + _$jni.JObject collection, int j, TimeUnit timeUnit); + _$jni.JObject invokeAny(_$jni.JObject collection); + _$jni.JObject invokeAny$1(_$jni.JObject collection, int j, TimeUnit timeUnit); +} + +final class _$ExecutorService with $ExecutorService { + _$ExecutorService({ + required void Function() shutdown, + this.shutdown$async = false, + required _$jni.JList<_$jni.JObject> Function() shutdownNow, + required bool Function() isShutdown, + required bool Function() isTerminated, + required bool Function(int j, TimeUnit timeUnit) awaitTermination, + required _$jni.JObject Function(_$jni.JObject callable) submit, + required _$jni.JObject Function( + _$jni.JObject runnable, _$jni.JObject object) + submit$1, + required _$jni.JObject Function(_$jni.JObject runnable) submit$2, + required _$jni.JList<_$jni.JObject> Function(_$jni.JObject collection) + invokeAll, + required _$jni.JList<_$jni.JObject> Function( + _$jni.JObject collection, int j, TimeUnit timeUnit) + invokeAll$1, + required _$jni.JObject Function(_$jni.JObject collection) invokeAny, + required _$jni.JObject Function( + _$jni.JObject collection, int j, TimeUnit timeUnit) + invokeAny$1, + }) : _shutdown = shutdown, + _shutdownNow = shutdownNow, + _isShutdown = isShutdown, + _isTerminated = isTerminated, + _awaitTermination = awaitTermination, + _submit = submit, + _submit$1 = submit$1, + _submit$2 = submit$2, + _invokeAll = invokeAll, + _invokeAll$1 = invokeAll$1, + _invokeAny = invokeAny, + _invokeAny$1 = invokeAny$1; + + final void Function() _shutdown; + final bool shutdown$async; + final _$jni.JList<_$jni.JObject> Function() _shutdownNow; + final bool Function() _isShutdown; + final bool Function() _isTerminated; + final bool Function(int j, TimeUnit timeUnit) _awaitTermination; + final _$jni.JObject Function(_$jni.JObject callable) _submit; + final _$jni.JObject Function(_$jni.JObject runnable, _$jni.JObject object) + _submit$1; + final _$jni.JObject Function(_$jni.JObject runnable) _submit$2; + final _$jni.JList<_$jni.JObject> Function(_$jni.JObject collection) + _invokeAll; + final _$jni.JList<_$jni.JObject> Function( + _$jni.JObject collection, int j, TimeUnit timeUnit) _invokeAll$1; + final _$jni.JObject Function(_$jni.JObject collection) _invokeAny; + final _$jni.JObject Function( + _$jni.JObject collection, int j, TimeUnit timeUnit) _invokeAny$1; + + void shutdown() { + return _shutdown(); + } + + _$jni.JList<_$jni.JObject> shutdownNow() { + return _shutdownNow(); + } + + bool isShutdown() { + return _isShutdown(); + } + + bool isTerminated() { + return _isTerminated(); + } + + bool awaitTermination(int j, TimeUnit timeUnit) { + return _awaitTermination(j, timeUnit); + } + + _$jni.JObject submit(_$jni.JObject callable) { + return _submit(callable); + } + + _$jni.JObject submit$1(_$jni.JObject runnable, _$jni.JObject object) { + return _submit$1(runnable, object); + } + + _$jni.JObject submit$2(_$jni.JObject runnable) { + return _submit$2(runnable); + } + + _$jni.JList<_$jni.JObject> invokeAll(_$jni.JObject collection) { + return _invokeAll(collection); + } + + _$jni.JList<_$jni.JObject> invokeAll$1( + _$jni.JObject collection, int j, TimeUnit timeUnit) { + return _invokeAll$1(collection, j, timeUnit); + } + + _$jni.JObject invokeAny(_$jni.JObject collection) { + return _invokeAny(collection); + } + + _$jni.JObject invokeAny$1( + _$jni.JObject collection, int j, TimeUnit timeUnit) { + return _invokeAny$1(collection, j, timeUnit); + } +} + +final class $ExecutorService$Type extends _$jni.JObjType { + @_$jni.internal + const $ExecutorService$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Ljava/util/concurrent/ExecutorService;'; + + @_$jni.internal + @_$core.override + ExecutorService fromReference(_$jni.JReference reference) => + ExecutorService.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($ExecutorService$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($ExecutorService$Type) && + other is $ExecutorService$Type; + } +} + +/// from: `okhttp3.Cache$Companion` +class Cache_Companion extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Cache_Companion.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Cache$Companion'); + + /// The type which includes information such as the signature of this class. + static const type = $Cache_Companion$Type(); + static final _id_key = _class.instanceMethodId( + r'key', + r'(Lokhttp3/HttpUrl;)Ljava/lang/String;', + ); + + static final _key = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.lang.String key(okhttp3.HttpUrl httpUrl)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString key( + _$jni.JObject httpUrl, + ) { + return _key(reference.pointer, _id_key as _$jni.JMethodIDPtr, + httpUrl.reference.pointer) + .object(const _$jni.JStringType()); + } + + static final _id_varyMatches = _class.instanceMethodId( + r'varyMatches', + r'(Lokhttp3/Response;Lokhttp3/Headers;Lokhttp3/Request;)Z', + ); + + static final _varyMatches = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final boolean varyMatches(okhttp3.Response response, okhttp3.Headers headers, okhttp3.Request request)` + bool varyMatches( + Response response, + Headers headers, + Request request, + ) { + return _varyMatches( + reference.pointer, + _id_varyMatches as _$jni.JMethodIDPtr, + response.reference.pointer, + headers.reference.pointer, + request.reference.pointer) + .boolean; + } + + static final _id_hasVaryAll = _class.instanceMethodId( + r'hasVaryAll', + r'(Lokhttp3/Response;)Z', + ); + + static final _hasVaryAll = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final boolean hasVaryAll(okhttp3.Response response)` + bool hasVaryAll( + Response response, + ) { + return _hasVaryAll(reference.pointer, _id_hasVaryAll as _$jni.JMethodIDPtr, + response.reference.pointer) + .boolean; + } + + static final _id_varyHeaders = _class.instanceMethodId( + r'varyHeaders', + r'(Lokhttp3/Response;)Lokhttp3/Headers;', + ); + + static final _varyHeaders = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.Headers varyHeaders(okhttp3.Response response)` + /// The returned object must be released after use, by calling the [release] method. + Headers varyHeaders( + Response response, + ) { + return _varyHeaders(reference.pointer, + _id_varyHeaders as _$jni.JMethodIDPtr, response.reference.pointer) + .object(const $Headers$Type()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory Cache_Companion( + _$jni.JObject defaultConstructorMarker, + ) { + return Cache_Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $Cache_Companion$Type extends _$jni.JObjType { + @_$jni.internal + const $Cache_Companion$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Cache$Companion;'; + + @_$jni.internal + @_$core.override + Cache_Companion fromReference(_$jni.JReference reference) => + Cache_Companion.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Cache_Companion$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Cache_Companion$Type) && + other is $Cache_Companion$Type; + } +} + +/// from: `okhttp3.Cache$Entry$Companion` +class Cache_Entry_Companion extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Cache_Entry_Companion.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Cache$Entry$Companion'); + + /// The type which includes information such as the signature of this class. + static const type = $Cache_Entry_Companion$Type(); + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory Cache_Entry_Companion( + _$jni.JObject defaultConstructorMarker, + ) { + return Cache_Entry_Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $Cache_Entry_Companion$Type + extends _$jni.JObjType { + @_$jni.internal + const $Cache_Entry_Companion$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Cache$Entry$Companion;'; + + @_$jni.internal + @_$core.override + Cache_Entry_Companion fromReference(_$jni.JReference reference) => + Cache_Entry_Companion.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Cache_Entry_Companion$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Cache_Entry_Companion$Type) && + other is $Cache_Entry_Companion$Type; + } +} + +/// from: `okhttp3.Cache` +class Cache extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Cache.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/Cache'); + + /// The type which includes information such as the signature of this class. + static const type = $Cache$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'Lokhttp3/Cache$Companion;', + ); + + /// from: `static public final okhttp3.Cache$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static Cache_Companion get Companion => + _id_Companion.get(_class, const $Cache_Companion$Type()); + + static final _id_new$ = _class.constructorId( + r'(Ljava/io/File;JLokhttp3/internal/io/FileSystem;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int64, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (java.io.File file, long j, okhttp3.internal.io.FileSystem fileSystem)` + /// The returned object must be released after use, by calling the [release] method. + factory Cache( + _$jni.JObject file, + int j, + _$jni.JObject fileSystem, + ) { + return Cache.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + file.reference.pointer, + j, + fileSystem.reference.pointer) + .reference); + } + + static final _id_isClosed = _class.instanceMethodId( + r'isClosed', + r'()Z', + ); + + static final _isClosed = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final boolean isClosed()` + bool isClosed() { + return _isClosed(reference.pointer, _id_isClosed as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_new$1 = _class.constructorId( + r'(Ljava/io/File;J)V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int64)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public void (java.io.File file, long j)` + /// The returned object must be released after use, by calling the [release] method. + factory Cache.new$1( + _$jni.JObject file, + int j, + ) { + return Cache.fromReference(_new$1(_class.reference.pointer, + _id_new$1 as _$jni.JMethodIDPtr, file.reference.pointer, j) + .reference); + } + + static final _id_initialize = _class.instanceMethodId( + r'initialize', + r'()V', + ); + + static final _initialize = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final void initialize()` + void initialize() { + _initialize(reference.pointer, _id_initialize as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_delete = _class.instanceMethodId( + r'delete', + r'()V', + ); + + static final _delete = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final void delete()` + void delete() { + _delete(reference.pointer, _id_delete as _$jni.JMethodIDPtr).check(); + } + + static final _id_evictAll = _class.instanceMethodId( + r'evictAll', + r'()V', + ); + + static final _evictAll = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final void evictAll()` + void evictAll() { + _evictAll(reference.pointer, _id_evictAll as _$jni.JMethodIDPtr).check(); + } + + static final _id_urls = _class.instanceMethodId( + r'urls', + r'()Ljava/util/Iterator;', + ); + + static final _urls = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.util.Iterator urls()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JIterator<_$jni.JString> urls() { + return _urls(reference.pointer, _id_urls as _$jni.JMethodIDPtr) + .object(const _$jni.JIteratorType(_$jni.JStringType())); + } + + static final _id_writeAbortCount = _class.instanceMethodId( + r'writeAbortCount', + r'()I', + ); + + static final _writeAbortCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int writeAbortCount()` + int writeAbortCount() { + return _writeAbortCount( + reference.pointer, _id_writeAbortCount as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_writeSuccessCount = _class.instanceMethodId( + r'writeSuccessCount', + r'()I', + ); + + static final _writeSuccessCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int writeSuccessCount()` + int writeSuccessCount() { + return _writeSuccessCount( + reference.pointer, _id_writeSuccessCount as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_size = _class.instanceMethodId( + r'size', + r'()J', + ); + + static final _size = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final long size()` + int size() { + return _size(reference.pointer, _id_size as _$jni.JMethodIDPtr).long; + } + + static final _id_maxSize = _class.instanceMethodId( + r'maxSize', + r'()J', + ); + + static final _maxSize = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final long maxSize()` + int maxSize() { + return _maxSize(reference.pointer, _id_maxSize as _$jni.JMethodIDPtr).long; + } + + static final _id_flush = _class.instanceMethodId( + r'flush', + r'()V', + ); + + static final _flush = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void flush()` + void flush() { + _flush(reference.pointer, _id_flush as _$jni.JMethodIDPtr).check(); + } + + static final _id_close = _class.instanceMethodId( + r'close', + r'()V', + ); + + static final _close = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void close()` + void close() { + _close(reference.pointer, _id_close as _$jni.JMethodIDPtr).check(); + } + + static final _id_directory = _class.instanceMethodId( + r'directory', + r'()Ljava/io/File;', + ); + + static final _directory = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final java.io.File directory()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject directory() { + return _directory(reference.pointer, _id_directory as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_networkCount = _class.instanceMethodId( + r'networkCount', + r'()I', + ); + + static final _networkCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int networkCount()` + int networkCount() { + return _networkCount( + reference.pointer, _id_networkCount as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_hitCount = _class.instanceMethodId( + r'hitCount', + r'()I', + ); + + static final _hitCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int hitCount()` + int hitCount() { + return _hitCount(reference.pointer, _id_hitCount as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_requestCount = _class.instanceMethodId( + r'requestCount', + r'()I', + ); + + static final _requestCount = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int requestCount()` + int requestCount() { + return _requestCount( + reference.pointer, _id_requestCount as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_key = _class.staticMethodId( + r'key', + r'(Lokhttp3/HttpUrl;)Ljava/lang/String;', + ); + + static final _key = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final java.lang.String key(okhttp3.HttpUrl httpUrl)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JString key( + _$jni.JObject httpUrl, + ) { + return _key(_class.reference.pointer, _id_key as _$jni.JMethodIDPtr, + httpUrl.reference.pointer) + .object(const _$jni.JStringType()); + } +} + +final class $Cache$Type extends _$jni.JObjType { + @_$jni.internal + const $Cache$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/Cache;'; + + @_$jni.internal + @_$core.override + Cache fromReference(_$jni.JReference reference) => + Cache.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Cache$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Cache$Type) && other is $Cache$Type; + } +} + +/// from: `com.example.ok_http.RedirectReceivedCallback` +class RedirectReceivedCallback extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + RedirectReceivedCallback.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'com/example/ok_http/RedirectReceivedCallback'); + + /// The type which includes information such as the signature of this class. + static const type = $RedirectReceivedCallback$Type(); + static final _id_onRedirectReceived = _class.instanceMethodId( + r'onRedirectReceived', + r'(Lokhttp3/Response;Ljava/lang/String;)V', + ); + + static final _onRedirectReceived = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onRedirectReceived(okhttp3.Response response, java.lang.String string)` + void onRedirectReceived( + Response response, + _$jni.JString string, + ) { + _onRedirectReceived( + reference.pointer, + _id_onRedirectReceived as _$jni.JMethodIDPtr, + response.reference.pointer, + string.reference.pointer) + .check(); + } + + /// Maps a specific port to the implemented interface. + static final _$core.Map _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r'onRedirectReceived(Lokhttp3/Response;Ljava/lang/String;)V') { + _$impls[$p]!.onRedirectReceived( + $a[0].as(const $Response$Type(), releaseOriginal: true), + $a[1].as(const _$jni.JStringType(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $RedirectReceivedCallback $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'com.example.ok_http.RedirectReceivedCallback', + $p, + _$invokePointer, + [ + if ($impl.onRedirectReceived$async) + r'onRedirectReceived(Lokhttp3/Response;Ljava/lang/String;)V', + ], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory RedirectReceivedCallback.implement( + $RedirectReceivedCallback $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return RedirectReceivedCallback.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $RedirectReceivedCallback { + factory $RedirectReceivedCallback({ + required void Function(Response response, _$jni.JString string) + onRedirectReceived, + bool onRedirectReceived$async, + }) = _$RedirectReceivedCallback; + + void onRedirectReceived(Response response, _$jni.JString string); + bool get onRedirectReceived$async => false; +} + +final class _$RedirectReceivedCallback with $RedirectReceivedCallback { + _$RedirectReceivedCallback({ + required void Function(Response response, _$jni.JString string) + onRedirectReceived, + this.onRedirectReceived$async = false, + }) : _onRedirectReceived = onRedirectReceived; + + final void Function(Response response, _$jni.JString string) + _onRedirectReceived; + final bool onRedirectReceived$async; + + void onRedirectReceived(Response response, _$jni.JString string) { + return _onRedirectReceived(response, string); + } +} + +final class $RedirectReceivedCallback$Type + extends _$jni.JObjType { + @_$jni.internal + const $RedirectReceivedCallback$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lcom/example/ok_http/RedirectReceivedCallback;'; + + @_$jni.internal + @_$core.override + RedirectReceivedCallback fromReference(_$jni.JReference reference) => + RedirectReceivedCallback.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($RedirectReceivedCallback$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($RedirectReceivedCallback$Type) && + other is $RedirectReceivedCallback$Type; + } +} + +/// from: `com.example.ok_http.RedirectInterceptor$Companion` +class RedirectInterceptor_Companion extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + RedirectInterceptor_Companion.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName( + r'com/example/ok_http/RedirectInterceptor$Companion'); + + /// The type which includes information such as the signature of this class. + static const type = $RedirectInterceptor_Companion$Type(); + static final _id_addRedirectInterceptor = _class.instanceMethodId( + r'addRedirectInterceptor', + r'(Lokhttp3/OkHttpClient$Builder;IZLcom/example/ok_http/RedirectReceivedCallback;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _addRedirectInterceptor = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + int, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder addRedirectInterceptor(okhttp3.OkHttpClient$Builder builder, int i, boolean z, com.example.ok_http.RedirectReceivedCallback redirectReceivedCallback)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder addRedirectInterceptor( + OkHttpClient_Builder builder, + int i, + bool z, + RedirectReceivedCallback redirectReceivedCallback, + ) { + return _addRedirectInterceptor( + reference.pointer, + _id_addRedirectInterceptor as _$jni.JMethodIDPtr, + builder.reference.pointer, + i, + z ? 1 : 0, + redirectReceivedCallback.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory RedirectInterceptor_Companion( + _$jni.JObject defaultConstructorMarker, + ) { + return RedirectInterceptor_Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $RedirectInterceptor_Companion$Type + extends _$jni.JObjType { + @_$jni.internal + const $RedirectInterceptor_Companion$Type(); + + @_$jni.internal + @_$core.override + String get signature => + r'Lcom/example/ok_http/RedirectInterceptor$Companion;'; + + @_$jni.internal + @_$core.override + RedirectInterceptor_Companion fromReference(_$jni.JReference reference) => + RedirectInterceptor_Companion.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($RedirectInterceptor_Companion$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($RedirectInterceptor_Companion$Type) && + other is $RedirectInterceptor_Companion$Type; + } +} + +/// from: `com.example.ok_http.RedirectInterceptor` +class RedirectInterceptor extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + RedirectInterceptor.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'com/example/ok_http/RedirectInterceptor'); + + /// The type which includes information such as the signature of this class. + static const type = $RedirectInterceptor$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'Lcom/example/ok_http/RedirectInterceptor$Companion;', + ); + + /// from: `static public final com.example.ok_http.RedirectInterceptor$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static RedirectInterceptor_Companion get Companion => + _id_Companion.get(_class, const $RedirectInterceptor_Companion$Type()); + + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory RedirectInterceptor() { + return RedirectInterceptor.fromReference( + _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + .reference); + } +} + +final class $RedirectInterceptor$Type + extends _$jni.JObjType { + @_$jni.internal + const $RedirectInterceptor$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lcom/example/ok_http/RedirectInterceptor;'; + + @_$jni.internal + @_$core.override + RedirectInterceptor fromReference(_$jni.JReference reference) => + RedirectInterceptor.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($RedirectInterceptor$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($RedirectInterceptor$Type) && + other is $RedirectInterceptor$Type; + } +} + +/// from: `com.example.ok_http.AsyncInputStreamReader` +class AsyncInputStreamReader extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + AsyncInputStreamReader.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'com/example/ok_http/AsyncInputStreamReader'); + + /// The type which includes information such as the signature of this class. + static const type = $AsyncInputStreamReader$Type(); + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory AsyncInputStreamReader() { + return AsyncInputStreamReader.fromReference( + _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + .reference); + } + + static final _id_readAsync = _class.instanceMethodId( + r'readAsync', + r'(Ljava/io/InputStream;Lcom/example/ok_http/DataCallback;)Ljava/util/concurrent/Future;', + ); + + static final _readAsync = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final java.util.concurrent.Future readAsync(java.io.InputStream inputStream, com.example.ok_http.DataCallback dataCallback)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject readAsync( + _$jni.JObject inputStream, + DataCallback dataCallback, + ) { + return _readAsync(reference.pointer, _id_readAsync as _$jni.JMethodIDPtr, + inputStream.reference.pointer, dataCallback.reference.pointer) + .object(const _$jni.JObjectType()); + } + + static final _id_shutdown = _class.instanceMethodId( + r'shutdown', + r'()V', + ); + + static final _shutdown = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final void shutdown()` + void shutdown() { + _shutdown(reference.pointer, _id_shutdown as _$jni.JMethodIDPtr).check(); + } +} + +final class $AsyncInputStreamReader$Type + extends _$jni.JObjType { + @_$jni.internal + const $AsyncInputStreamReader$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lcom/example/ok_http/AsyncInputStreamReader;'; + + @_$jni.internal + @_$core.override + AsyncInputStreamReader fromReference(_$jni.JReference reference) => + AsyncInputStreamReader.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($AsyncInputStreamReader$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($AsyncInputStreamReader$Type) && + other is $AsyncInputStreamReader$Type; + } +} + +/// from: `com.example.ok_http.DataCallback` +class DataCallback extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + DataCallback.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'com/example/ok_http/DataCallback'); + + /// The type which includes information such as the signature of this class. + static const type = $DataCallback$Type(); + static final _id_onDataRead = _class.instanceMethodId( + r'onDataRead', + r'([B)V', + ); + + static final _onDataRead = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onDataRead(byte[] bs)` + void onDataRead( + _$jni.JArray<_$jni.jbyte> bs, + ) { + _onDataRead(reference.pointer, _id_onDataRead as _$jni.JMethodIDPtr, + bs.reference.pointer) + .check(); + } + + static final _id_onFinished = _class.instanceMethodId( + r'onFinished', + r'()V', + ); + + static final _onFinished = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract void onFinished()` + void onFinished() { + _onFinished(reference.pointer, _id_onFinished as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_onError = _class.instanceMethodId( + r'onError', + r'(Ljava/io/IOException;)V', + ); + + static final _onError = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onError(java.io.IOException iOException)` + void onError( + _$jni.JObject iOException, + ) { + _onError(reference.pointer, _id_onError as _$jni.JMethodIDPtr, + iOException.reference.pointer) + .check(); + } + + /// Maps a specific port to the implemented interface. + static final _$core.Map _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r'onDataRead([B)V') { + _$impls[$p]!.onDataRead( + $a[0].as(const _$jni.JArrayType(_$jni.jbyteType()), + releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == r'onFinished()V') { + _$impls[$p]!.onFinished(); + return _$jni.nullptr; + } + if ($d == r'onError(Ljava/io/IOException;)V') { + _$impls[$p]!.onError( + $a[0].as(const _$jni.JObjectType(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $DataCallback $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'com.example.ok_http.DataCallback', + $p, + _$invokePointer, + [ + if ($impl.onDataRead$async) r'onDataRead([B)V', + if ($impl.onFinished$async) r'onFinished()V', + if ($impl.onError$async) r'onError(Ljava/io/IOException;)V', + ], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory DataCallback.implement( + $DataCallback $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return DataCallback.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $DataCallback { + factory $DataCallback({ + required void Function(_$jni.JArray<_$jni.jbyte> bs) onDataRead, + bool onDataRead$async, + required void Function() onFinished, + bool onFinished$async, + required void Function(_$jni.JObject iOException) onError, + bool onError$async, + }) = _$DataCallback; + + void onDataRead(_$jni.JArray<_$jni.jbyte> bs); + bool get onDataRead$async => false; + void onFinished(); + bool get onFinished$async => false; + void onError(_$jni.JObject iOException); + bool get onError$async => false; +} + +final class _$DataCallback with $DataCallback { + _$DataCallback({ + required void Function(_$jni.JArray<_$jni.jbyte> bs) onDataRead, + this.onDataRead$async = false, + required void Function() onFinished, + this.onFinished$async = false, + required void Function(_$jni.JObject iOException) onError, + this.onError$async = false, + }) : _onDataRead = onDataRead, + _onFinished = onFinished, + _onError = onError; + + final void Function(_$jni.JArray<_$jni.jbyte> bs) _onDataRead; + final bool onDataRead$async; + final void Function() _onFinished; + final bool onFinished$async; + final void Function(_$jni.JObject iOException) _onError; + final bool onError$async; + + void onDataRead(_$jni.JArray<_$jni.jbyte> bs) { + return _onDataRead(bs); + } + + void onFinished() { + return _onFinished(); + } + + void onError(_$jni.JObject iOException) { + return _onError(iOException); + } +} + +final class $DataCallback$Type extends _$jni.JObjType { + @_$jni.internal + const $DataCallback$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lcom/example/ok_http/DataCallback;'; + + @_$jni.internal + @_$core.override + DataCallback fromReference(_$jni.JReference reference) => + DataCallback.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($DataCallback$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($DataCallback$Type) && + other is $DataCallback$Type; + } +} + +/// from: `okhttp3.WebSocket$Factory` +class WebSocket_Factory extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + WebSocket_Factory.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/WebSocket$Factory'); + + /// The type which includes information such as the signature of this class. + static const type = $WebSocket_Factory$Type(); + static final _id_newWebSocket = _class.instanceMethodId( + r'newWebSocket', + r'(Lokhttp3/Request;Lokhttp3/WebSocketListener;)Lokhttp3/WebSocket;', + ); + + static final _newWebSocket = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract okhttp3.WebSocket newWebSocket(okhttp3.Request request, okhttp3.WebSocketListener webSocketListener)` + /// The returned object must be released after use, by calling the [release] method. + WebSocket newWebSocket( + Request request, + _$jni.JObject webSocketListener, + ) { + return _newWebSocket( + reference.pointer, + _id_newWebSocket as _$jni.JMethodIDPtr, + request.reference.pointer, + webSocketListener.reference.pointer) + .object(const $WebSocket$Type()); + } + + /// Maps a specific port to the implemented interface. + static final _$core.Map _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == + r'newWebSocket(Lokhttp3/Request;Lokhttp3/WebSocketListener;)Lokhttp3/WebSocket;') { + final $r = _$impls[$p]!.newWebSocket( + $a[0].as(const $Request$Type(), releaseOriginal: true), + $a[1].as(const _$jni.JObjectType(), releaseOriginal: true), + ); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $WebSocket_Factory $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'okhttp3.WebSocket$Factory', + $p, + _$invokePointer, + [], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory WebSocket_Factory.implement( + $WebSocket_Factory $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return WebSocket_Factory.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $WebSocket_Factory { + factory $WebSocket_Factory({ + required WebSocket Function( + Request request, _$jni.JObject webSocketListener) + newWebSocket, + }) = _$WebSocket_Factory; + + WebSocket newWebSocket(Request request, _$jni.JObject webSocketListener); +} + +final class _$WebSocket_Factory with $WebSocket_Factory { + _$WebSocket_Factory({ + required WebSocket Function( + Request request, _$jni.JObject webSocketListener) + newWebSocket, + }) : _newWebSocket = newWebSocket; + + final WebSocket Function(Request request, _$jni.JObject webSocketListener) + _newWebSocket; + + WebSocket newWebSocket(Request request, _$jni.JObject webSocketListener) { + return _newWebSocket(request, webSocketListener); + } +} + +final class $WebSocket_Factory$Type extends _$jni.JObjType { + @_$jni.internal + const $WebSocket_Factory$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/WebSocket$Factory;'; + + @_$jni.internal + @_$core.override + WebSocket_Factory fromReference(_$jni.JReference reference) => + WebSocket_Factory.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($WebSocket_Factory$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($WebSocket_Factory$Type) && + other is $WebSocket_Factory$Type; + } +} + +/// from: `okhttp3.WebSocket` +class WebSocket extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + WebSocket.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okhttp3/WebSocket'); + + /// The type which includes information such as the signature of this class. + static const type = $WebSocket$Type(); + static final _id_request = _class.instanceMethodId( + r'request', + r'()Lokhttp3/Request;', + ); + + static final _request = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract okhttp3.Request request()` + /// The returned object must be released after use, by calling the [release] method. + Request request() { + return _request(reference.pointer, _id_request as _$jni.JMethodIDPtr) + .object(const $Request$Type()); + } + + static final _id_queueSize = _class.instanceMethodId( + r'queueSize', + r'()J', + ); + + static final _queueSize = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract long queueSize()` + int queueSize() { + return _queueSize(reference.pointer, _id_queueSize as _$jni.JMethodIDPtr) + .long; + } + + static final _id_send = _class.instanceMethodId( + r'send', + r'(Ljava/lang/String;)Z', + ); + + static final _send = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract boolean send(java.lang.String string)` + bool send( + _$jni.JString string, + ) { + return _send(reference.pointer, _id_send as _$jni.JMethodIDPtr, + string.reference.pointer) + .boolean; + } + + static final _id_send$1 = _class.instanceMethodId( + r'send', + r'(Lokio/ByteString;)Z', + ); + + static final _send$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract boolean send(okio.ByteString byteString)` + bool send$1( + ByteString byteString, + ) { + return _send$1(reference.pointer, _id_send$1 as _$jni.JMethodIDPtr, + byteString.reference.pointer) + .boolean; + } + + static final _id_close = _class.instanceMethodId( + r'close', + r'(ILjava/lang/String;)Z', + ); + + static final _close = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int32, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract boolean close(int i, java.lang.String string)` + bool close( + int i, + _$jni.JString string, + ) { + return _close(reference.pointer, _id_close as _$jni.JMethodIDPtr, i, + string.reference.pointer) + .boolean; + } + + static final _id_cancel = _class.instanceMethodId( + r'cancel', + r'()V', + ); + + static final _cancel = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public abstract void cancel()` + void cancel() { + _cancel(reference.pointer, _id_cancel as _$jni.JMethodIDPtr).check(); + } + + /// Maps a specific port to the implemented interface. + static final _$core.Map _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r'request()Lokhttp3/Request;') { + final $r = _$impls[$p]!.request(); + return ($r as _$jni.JObject) + .as(const _$jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r'queueSize()J') { + final $r = _$impls[$p]!.queueSize(); + return _$jni.JLong($r).reference.toPointer(); + } + if ($d == r'send(Ljava/lang/String;)Z') { + final $r = _$impls[$p]!.send( + $a[0].as(const _$jni.JStringType(), releaseOriginal: true), + ); + return _$jni.JBoolean($r).reference.toPointer(); + } + if ($d == r'send(Lokio/ByteString;)Z') { + final $r = _$impls[$p]!.send$1( + $a[0].as(const $ByteString$Type(), releaseOriginal: true), + ); + return _$jni.JBoolean($r).reference.toPointer(); + } + if ($d == r'close(ILjava/lang/String;)Z') { + final $r = _$impls[$p]!.close( + $a[0] + .as(const _$jni.JIntegerType(), releaseOriginal: true) + .intValue(releaseOriginal: true), + $a[1].as(const _$jni.JStringType(), releaseOriginal: true), + ); + return _$jni.JBoolean($r).reference.toPointer(); + } + if ($d == r'cancel()V') { + _$impls[$p]!.cancel(); + return _$jni.nullptr; + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $WebSocket $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'okhttp3.WebSocket', + $p, + _$invokePointer, + [ + if ($impl.cancel$async) r'cancel()V', + ], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory WebSocket.implement( + $WebSocket $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return WebSocket.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $WebSocket { + factory $WebSocket({ + required Request Function() request, + required int Function() queueSize, + required bool Function(_$jni.JString string) send, + required bool Function(ByteString byteString) send$1, + required bool Function(int i, _$jni.JString string) close, + required void Function() cancel, + bool cancel$async, + }) = _$WebSocket; + + Request request(); + int queueSize(); + bool send(_$jni.JString string); + bool send$1(ByteString byteString); + bool close(int i, _$jni.JString string); + void cancel(); + bool get cancel$async => false; +} + +final class _$WebSocket with $WebSocket { + _$WebSocket({ + required Request Function() request, + required int Function() queueSize, + required bool Function(_$jni.JString string) send, + required bool Function(ByteString byteString) send$1, + required bool Function(int i, _$jni.JString string) close, + required void Function() cancel, + this.cancel$async = false, + }) : _request = request, + _queueSize = queueSize, + _send = send, + _send$1 = send$1, + _close = close, + _cancel = cancel; + + final Request Function() _request; + final int Function() _queueSize; + final bool Function(_$jni.JString string) _send; + final bool Function(ByteString byteString) _send$1; + final bool Function(int i, _$jni.JString string) _close; + final void Function() _cancel; + final bool cancel$async; + + Request request() { + return _request(); + } + + int queueSize() { + return _queueSize(); + } + + bool send(_$jni.JString string) { + return _send(string); + } + + bool send$1(ByteString byteString) { + return _send$1(byteString); + } + + bool close(int i, _$jni.JString string) { + return _close(i, string); + } + + void cancel() { + return _cancel(); + } +} + +final class $WebSocket$Type extends _$jni.JObjType { + @_$jni.internal + const $WebSocket$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokhttp3/WebSocket;'; + + @_$jni.internal + @_$core.override + WebSocket fromReference(_$jni.JReference reference) => + WebSocket.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($WebSocket$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($WebSocket$Type) && other is $WebSocket$Type; + } +} + +/// from: `com.example.ok_http.WebSocketListenerProxy$WebSocketListener` +class WebSocketListenerProxy_WebSocketListener extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + WebSocketListenerProxy_WebSocketListener.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName( + r'com/example/ok_http/WebSocketListenerProxy$WebSocketListener'); + + /// The type which includes information such as the signature of this class. + static const type = $WebSocketListenerProxy_WebSocketListener$Type(); + static final _id_onOpen = _class.instanceMethodId( + r'onOpen', + r'(Lokhttp3/WebSocket;Lokhttp3/Response;)V', + ); + + static final _onOpen = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onOpen(okhttp3.WebSocket webSocket, okhttp3.Response response)` + void onOpen( + WebSocket webSocket, + Response response, + ) { + _onOpen(reference.pointer, _id_onOpen as _$jni.JMethodIDPtr, + webSocket.reference.pointer, response.reference.pointer) + .check(); + } + + static final _id_onMessage = _class.instanceMethodId( + r'onMessage', + r'(Lokhttp3/WebSocket;Ljava/lang/String;)V', + ); + + static final _onMessage = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onMessage(okhttp3.WebSocket webSocket, java.lang.String string)` + void onMessage( + WebSocket webSocket, + _$jni.JString string, + ) { + _onMessage(reference.pointer, _id_onMessage as _$jni.JMethodIDPtr, + webSocket.reference.pointer, string.reference.pointer) + .check(); + } + + static final _id_onMessage$1 = _class.instanceMethodId( + r'onMessage', + r'(Lokhttp3/WebSocket;Lokio/ByteString;)V', + ); + + static final _onMessage$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onMessage(okhttp3.WebSocket webSocket, okio.ByteString byteString)` + void onMessage$1( + WebSocket webSocket, + ByteString byteString, + ) { + _onMessage$1(reference.pointer, _id_onMessage$1 as _$jni.JMethodIDPtr, + webSocket.reference.pointer, byteString.reference.pointer) + .check(); + } + + static final _id_onClosing = _class.instanceMethodId( + r'onClosing', + r'(Lokhttp3/WebSocket;ILjava/lang/String;)V', + ); + + static final _onClosing = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onClosing(okhttp3.WebSocket webSocket, int i, java.lang.String string)` + void onClosing( + WebSocket webSocket, + int i, + _$jni.JString string, + ) { + _onClosing(reference.pointer, _id_onClosing as _$jni.JMethodIDPtr, + webSocket.reference.pointer, i, string.reference.pointer) + .check(); + } + + static final _id_onFailure = _class.instanceMethodId( + r'onFailure', + r'(Lokhttp3/WebSocket;Ljava/lang/Throwable;Lokhttp3/Response;)V', + ); + + static final _onFailure = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public abstract void onFailure(okhttp3.WebSocket webSocket, java.lang.Throwable throwable, okhttp3.Response response)` + void onFailure( + WebSocket webSocket, + _$jni.JObject throwable, + Response response, + ) { + _onFailure( + reference.pointer, + _id_onFailure as _$jni.JMethodIDPtr, + webSocket.reference.pointer, + throwable.reference.pointer, + response.reference.pointer) + .check(); + } + + /// Maps a specific port to the implemented interface. + static final _$core.Map + _$impls = {}; + static _$jni.JObjectPtr _$invoke( + int port, + _$jni.JObjectPtr descriptor, + _$jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + _$jni.MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final _$jni.Pointer< + _$jni.NativeFunction< + _$jni.JObjectPtr Function( + _$jni.Int64, _$jni.JObjectPtr, _$jni.JObjectPtr)>> + _$invokePointer = _$jni.Pointer.fromFunction(_$invoke); + + static _$jni.Pointer<_$jni.Void> _$invokeMethod( + int $p, + _$jni.MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r'onOpen(Lokhttp3/WebSocket;Lokhttp3/Response;)V') { + _$impls[$p]!.onOpen( + $a[0].as(const $WebSocket$Type(), releaseOriginal: true), + $a[1].as(const $Response$Type(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == r'onMessage(Lokhttp3/WebSocket;Ljava/lang/String;)V') { + _$impls[$p]!.onMessage( + $a[0].as(const $WebSocket$Type(), releaseOriginal: true), + $a[1].as(const _$jni.JStringType(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == r'onMessage(Lokhttp3/WebSocket;Lokio/ByteString;)V') { + _$impls[$p]!.onMessage$1( + $a[0].as(const $WebSocket$Type(), releaseOriginal: true), + $a[1].as(const $ByteString$Type(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == r'onClosing(Lokhttp3/WebSocket;ILjava/lang/String;)V') { + _$impls[$p]!.onClosing( + $a[0].as(const $WebSocket$Type(), releaseOriginal: true), + $a[1] + .as(const _$jni.JIntegerType(), releaseOriginal: true) + .intValue(releaseOriginal: true), + $a[2].as(const _$jni.JStringType(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + if ($d == + r'onFailure(Lokhttp3/WebSocket;Ljava/lang/Throwable;Lokhttp3/Response;)V') { + _$impls[$p]!.onFailure( + $a[0].as(const $WebSocket$Type(), releaseOriginal: true), + $a[1].as(const _$jni.JObjectType(), releaseOriginal: true), + $a[2].as(const $Response$Type(), releaseOriginal: true), + ); + return _$jni.nullptr; + } + } catch (e) { + return _$jni.ProtectedJniExtensions.newDartException(e); + } + return _$jni.nullptr; + } + + static void implementIn( + _$jni.JImplementer implementer, + $WebSocketListenerProxy_WebSocketListener $impl, + ) { + late final _$jni.RawReceivePort $p; + $p = _$jni.RawReceivePort(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = _$jni.MethodInvocation.fromMessage($m); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + _$jni.ProtectedJniExtensions.returnResult($i.result, $r); + }); + implementer.add( + r'com.example.ok_http.WebSocketListenerProxy$WebSocketListener', + $p, + _$invokePointer, + [ + if ($impl.onOpen$async) + r'onOpen(Lokhttp3/WebSocket;Lokhttp3/Response;)V', + if ($impl.onMessage$async) + r'onMessage(Lokhttp3/WebSocket;Ljava/lang/String;)V', + if ($impl.onMessage$1$async) + r'onMessage(Lokhttp3/WebSocket;Lokio/ByteString;)V', + if ($impl.onClosing$async) + r'onClosing(Lokhttp3/WebSocket;ILjava/lang/String;)V', + if ($impl.onFailure$async) + r'onFailure(Lokhttp3/WebSocket;Ljava/lang/Throwable;Lokhttp3/Response;)V', + ], + ); + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + } + + factory WebSocketListenerProxy_WebSocketListener.implement( + $WebSocketListenerProxy_WebSocketListener $impl, + ) { + final $i = _$jni.JImplementer(); + implementIn($i, $impl); + return WebSocketListenerProxy_WebSocketListener.fromReference( + $i.implementReference(), + ); + } +} + +abstract base mixin class $WebSocketListenerProxy_WebSocketListener { + factory $WebSocketListenerProxy_WebSocketListener({ + required void Function(WebSocket webSocket, Response response) onOpen, + bool onOpen$async, + required void Function(WebSocket webSocket, _$jni.JString string) onMessage, + bool onMessage$async, + required void Function(WebSocket webSocket, ByteString byteString) + onMessage$1, + bool onMessage$1$async, + required void Function(WebSocket webSocket, int i, _$jni.JString string) + onClosing, + bool onClosing$async, + required void Function( + WebSocket webSocket, _$jni.JObject throwable, Response response) + onFailure, + bool onFailure$async, + }) = _$WebSocketListenerProxy_WebSocketListener; + + void onOpen(WebSocket webSocket, Response response); + bool get onOpen$async => false; + void onMessage(WebSocket webSocket, _$jni.JString string); + bool get onMessage$async => false; + void onMessage$1(WebSocket webSocket, ByteString byteString); + bool get onMessage$1$async => false; + void onClosing(WebSocket webSocket, int i, _$jni.JString string); + bool get onClosing$async => false; + void onFailure( + WebSocket webSocket, _$jni.JObject throwable, Response response); + bool get onFailure$async => false; +} + +final class _$WebSocketListenerProxy_WebSocketListener + with $WebSocketListenerProxy_WebSocketListener { + _$WebSocketListenerProxy_WebSocketListener({ + required void Function(WebSocket webSocket, Response response) onOpen, + this.onOpen$async = false, + required void Function(WebSocket webSocket, _$jni.JString string) onMessage, + this.onMessage$async = false, + required void Function(WebSocket webSocket, ByteString byteString) + onMessage$1, + this.onMessage$1$async = false, + required void Function(WebSocket webSocket, int i, _$jni.JString string) + onClosing, + this.onClosing$async = false, + required void Function( + WebSocket webSocket, _$jni.JObject throwable, Response response) + onFailure, + this.onFailure$async = false, + }) : _onOpen = onOpen, + _onMessage = onMessage, + _onMessage$1 = onMessage$1, + _onClosing = onClosing, + _onFailure = onFailure; + + final void Function(WebSocket webSocket, Response response) _onOpen; + final bool onOpen$async; + final void Function(WebSocket webSocket, _$jni.JString string) _onMessage; + final bool onMessage$async; + final void Function(WebSocket webSocket, ByteString byteString) _onMessage$1; + final bool onMessage$1$async; + final void Function(WebSocket webSocket, int i, _$jni.JString string) + _onClosing; + final bool onClosing$async; + final void Function( + WebSocket webSocket, _$jni.JObject throwable, Response response) + _onFailure; + final bool onFailure$async; + + void onOpen(WebSocket webSocket, Response response) { + return _onOpen(webSocket, response); + } + + void onMessage(WebSocket webSocket, _$jni.JString string) { + return _onMessage(webSocket, string); + } + + void onMessage$1(WebSocket webSocket, ByteString byteString) { + return _onMessage$1(webSocket, byteString); + } + + void onClosing(WebSocket webSocket, int i, _$jni.JString string) { + return _onClosing(webSocket, i, string); + } + + void onFailure( + WebSocket webSocket, _$jni.JObject throwable, Response response) { + return _onFailure(webSocket, throwable, response); + } +} + +final class $WebSocketListenerProxy_WebSocketListener$Type + extends _$jni.JObjType { + @_$jni.internal + const $WebSocketListenerProxy_WebSocketListener$Type(); + + @_$jni.internal + @_$core.override + String get signature => + r'Lcom/example/ok_http/WebSocketListenerProxy$WebSocketListener;'; + + @_$jni.internal + @_$core.override + WebSocketListenerProxy_WebSocketListener fromReference( + _$jni.JReference reference) => + WebSocketListenerProxy_WebSocketListener.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($WebSocketListenerProxy_WebSocketListener$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == + ($WebSocketListenerProxy_WebSocketListener$Type) && + other is $WebSocketListenerProxy_WebSocketListener$Type; + } +} + +/// from: `com.example.ok_http.WebSocketListenerProxy` +class WebSocketListenerProxy extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + WebSocketListenerProxy.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'com/example/ok_http/WebSocketListenerProxy'); + + /// The type which includes information such as the signature of this class. + static const type = $WebSocketListenerProxy$Type(); + static final _id_new$ = _class.constructorId( + r'(Lcom/example/ok_http/WebSocketListenerProxy$WebSocketListener;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (com.example.ok_http.WebSocketListenerProxy$WebSocketListener webSocketListener)` + /// The returned object must be released after use, by calling the [release] method. + factory WebSocketListenerProxy( + WebSocketListenerProxy_WebSocketListener webSocketListener, + ) { + return WebSocketListenerProxy.fromReference(_new$(_class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, webSocketListener.reference.pointer) + .reference); + } + + static final _id_onOpen = _class.instanceMethodId( + r'onOpen', + r'(Lokhttp3/WebSocket;Lokhttp3/Response;)V', + ); + + static final _onOpen = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onOpen(okhttp3.WebSocket webSocket, okhttp3.Response response)` + void onOpen( + WebSocket webSocket, + Response response, + ) { + _onOpen(reference.pointer, _id_onOpen as _$jni.JMethodIDPtr, + webSocket.reference.pointer, response.reference.pointer) + .check(); + } + + static final _id_onMessage = _class.instanceMethodId( + r'onMessage', + r'(Lokhttp3/WebSocket;Ljava/lang/String;)V', + ); + + static final _onMessage = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onMessage(okhttp3.WebSocket webSocket, java.lang.String string)` + void onMessage( + WebSocket webSocket, + _$jni.JString string, + ) { + _onMessage(reference.pointer, _id_onMessage as _$jni.JMethodIDPtr, + webSocket.reference.pointer, string.reference.pointer) + .check(); + } + + static final _id_onMessage$1 = _class.instanceMethodId( + r'onMessage', + r'(Lokhttp3/WebSocket;Lokio/ByteString;)V', + ); + + static final _onMessage$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onMessage(okhttp3.WebSocket webSocket, okio.ByteString byteString)` + void onMessage$1( + WebSocket webSocket, + ByteString byteString, + ) { + _onMessage$1(reference.pointer, _id_onMessage$1 as _$jni.JMethodIDPtr, + webSocket.reference.pointer, byteString.reference.pointer) + .check(); + } + + static final _id_onClosing = _class.instanceMethodId( + r'onClosing', + r'(Lokhttp3/WebSocket;ILjava/lang/String;)V', + ); + + static final _onClosing = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + int, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onClosing(okhttp3.WebSocket webSocket, int i, java.lang.String string)` + void onClosing( + WebSocket webSocket, + int i, + _$jni.JString string, + ) { + _onClosing(reference.pointer, _id_onClosing as _$jni.JMethodIDPtr, + webSocket.reference.pointer, i, string.reference.pointer) + .check(); + } + + static final _id_onFailure = _class.instanceMethodId( + r'onFailure', + r'(Lokhttp3/WebSocket;Ljava/lang/Throwable;Lokhttp3/Response;)V', + ); + + static final _onFailure = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void onFailure(okhttp3.WebSocket webSocket, java.lang.Throwable throwable, okhttp3.Response response)` + void onFailure( + WebSocket webSocket, + _$jni.JObject throwable, + Response response, + ) { + _onFailure( + reference.pointer, + _id_onFailure as _$jni.JMethodIDPtr, + webSocket.reference.pointer, + throwable.reference.pointer, + response.reference.pointer) + .check(); + } +} + +final class $WebSocketListenerProxy$Type + extends _$jni.JObjType { + @_$jni.internal + const $WebSocketListenerProxy$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lcom/example/ok_http/WebSocketListenerProxy;'; + + @_$jni.internal + @_$core.override + WebSocketListenerProxy fromReference(_$jni.JReference reference) => + WebSocketListenerProxy.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($WebSocketListenerProxy$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($WebSocketListenerProxy$Type) && + other is $WebSocketListenerProxy$Type; + } +} + +/// from: `okio.ByteString$Companion` +class ByteString_Companion extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + ByteString_Companion.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okio/ByteString$Companion'); + + /// The type which includes information such as the signature of this class. + static const type = $ByteString_Companion$Type(); + static final _id_of = _class.instanceMethodId( + r'of', + r'([B)Lokio/ByteString;', + ); + + static final _of = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okio.ByteString of(byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + ByteString of( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _of(reference.pointer, _id_of as _$jni.JMethodIDPtr, + bs.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_of$1 = _class.instanceMethodId( + r'of', + r'([BII)Lokio/ByteString;', + ); + + static final _of$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); + + /// from: `public final okio.ByteString of(byte[] bs, int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + ByteString of$1( + _$jni.JArray<_$jni.jbyte> bs, + int i, + int i1, + ) { + return _of$1(reference.pointer, _id_of$1 as _$jni.JMethodIDPtr, + bs.reference.pointer, i, i1) + .object(const $ByteString$Type()); + } + + static final _id_of$2 = _class.instanceMethodId( + r'of', + r'(Ljava/nio/ByteBuffer;)Lokio/ByteString;', + ); + + static final _of$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okio.ByteString of(java.nio.ByteBuffer byteBuffer)` + /// The returned object must be released after use, by calling the [release] method. + ByteString of$2( + _$jni.JByteBuffer byteBuffer, + ) { + return _of$2(reference.pointer, _id_of$2 as _$jni.JMethodIDPtr, + byteBuffer.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_encodeUtf8 = _class.instanceMethodId( + r'encodeUtf8', + r'(Ljava/lang/String;)Lokio/ByteString;', + ); + + static final _encodeUtf8 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okio.ByteString encodeUtf8(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + ByteString encodeUtf8( + _$jni.JString string, + ) { + return _encodeUtf8(reference.pointer, _id_encodeUtf8 as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_encodeString = _class.instanceMethodId( + r'encodeString', + r'(Ljava/lang/String;Ljava/nio/charset/Charset;)Lokio/ByteString;', + ); + + static final _encodeString = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okio.ByteString encodeString(java.lang.String string, java.nio.charset.Charset charset)` + /// The returned object must be released after use, by calling the [release] method. + ByteString encodeString( + _$jni.JString string, + _$jni.JObject charset, + ) { + return _encodeString( + reference.pointer, + _id_encodeString as _$jni.JMethodIDPtr, + string.reference.pointer, + charset.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_decodeBase64 = _class.instanceMethodId( + r'decodeBase64', + r'(Ljava/lang/String;)Lokio/ByteString;', + ); + + static final _decodeBase64 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okio.ByteString decodeBase64(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + ByteString decodeBase64( + _$jni.JString string, + ) { + return _decodeBase64(reference.pointer, + _id_decodeBase64 as _$jni.JMethodIDPtr, string.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_decodeHex = _class.instanceMethodId( + r'decodeHex', + r'(Ljava/lang/String;)Lokio/ByteString;', + ); + + static final _decodeHex = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okio.ByteString decodeHex(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + ByteString decodeHex( + _$jni.JString string, + ) { + return _decodeHex(reference.pointer, _id_decodeHex as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_read = _class.instanceMethodId( + r'read', + r'(Ljava/io/InputStream;I)Lokio/ByteString;', + ); + + static final _read = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public final okio.ByteString read(java.io.InputStream inputStream, int i)` + /// The returned object must be released after use, by calling the [release] method. + ByteString read( + _$jni.JObject inputStream, + int i, + ) { + return _read(reference.pointer, _id_read as _$jni.JMethodIDPtr, + inputStream.reference.pointer, i) + .object(const $ByteString$Type()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory ByteString_Companion( + _$jni.JObject defaultConstructorMarker, + ) { + return ByteString_Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $ByteString_Companion$Type + extends _$jni.JObjType { + @_$jni.internal + const $ByteString_Companion$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokio/ByteString$Companion;'; + + @_$jni.internal + @_$core.override + ByteString_Companion fromReference(_$jni.JReference reference) => + ByteString_Companion.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($ByteString_Companion$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($ByteString_Companion$Type) && + other is $ByteString_Companion$Type; + } +} + +/// from: `okio.ByteString` +class ByteString extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + ByteString.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'okio/ByteString'); + + /// The type which includes information such as the signature of this class. + static const type = $ByteString$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'Lokio/ByteString$Companion;', + ); + + /// from: `static public final okio.ByteString$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static ByteString_Companion get Companion => + _id_Companion.get(_class, const $ByteString_Companion$Type()); + + static final _id_EMPTY = _class.staticFieldId( + r'EMPTY', + r'Lokio/ByteString;', + ); + + /// from: `static public final okio.ByteString EMPTY` + /// The returned object must be released after use, by calling the [release] method. + static ByteString get EMPTY => + _id_EMPTY.get(_class, const $ByteString$Type()); + + static final _id_new$ = _class.constructorId( + r'([B)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + factory ByteString( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return ByteString.fromReference(_new$(_class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, bs.reference.pointer) + .reference); + } + + static final _id_utf8 = _class.instanceMethodId( + r'utf8', + r'()Ljava/lang/String;', + ); + + static final _utf8 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String utf8()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString utf8() { + return _utf8(reference.pointer, _id_utf8 as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_string = _class.instanceMethodId( + r'string', + r'(Ljava/nio/charset/Charset;)Ljava/lang/String;', + ); + + static final _string = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public java.lang.String string(java.nio.charset.Charset charset)` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString string( + _$jni.JObject charset, + ) { + return _string(reference.pointer, _id_string as _$jni.JMethodIDPtr, + charset.reference.pointer) + .object(const _$jni.JStringType()); + } + + static final _id_base64 = _class.instanceMethodId( + r'base64', + r'()Ljava/lang/String;', + ); + + static final _base64 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String base64()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString base64() { + return _base64(reference.pointer, _id_base64 as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_md5 = _class.instanceMethodId( + r'md5', + r'()Lokio/ByteString;', + ); + + static final _md5 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okio.ByteString md5()` + /// The returned object must be released after use, by calling the [release] method. + ByteString md5() { + return _md5(reference.pointer, _id_md5 as _$jni.JMethodIDPtr) + .object(const $ByteString$Type()); + } + + static final _id_sha1 = _class.instanceMethodId( + r'sha1', + r'()Lokio/ByteString;', + ); + + static final _sha1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okio.ByteString sha1()` + /// The returned object must be released after use, by calling the [release] method. + ByteString sha1() { + return _sha1(reference.pointer, _id_sha1 as _$jni.JMethodIDPtr) + .object(const $ByteString$Type()); + } + + static final _id_sha256 = _class.instanceMethodId( + r'sha256', + r'()Lokio/ByteString;', + ); + + static final _sha256 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okio.ByteString sha256()` + /// The returned object must be released after use, by calling the [release] method. + ByteString sha256() { + return _sha256(reference.pointer, _id_sha256 as _$jni.JMethodIDPtr) + .object(const $ByteString$Type()); + } + + static final _id_sha512 = _class.instanceMethodId( + r'sha512', + r'()Lokio/ByteString;', + ); + + static final _sha512 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okio.ByteString sha512()` + /// The returned object must be released after use, by calling the [release] method. + ByteString sha512() { + return _sha512(reference.pointer, _id_sha512 as _$jni.JMethodIDPtr) + .object(const $ByteString$Type()); + } + + static final _id_hmacSha1 = _class.instanceMethodId( + r'hmacSha1', + r'(Lokio/ByteString;)Lokio/ByteString;', + ); + + static final _hmacSha1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okio.ByteString hmacSha1(okio.ByteString byteString)` + /// The returned object must be released after use, by calling the [release] method. + ByteString hmacSha1( + ByteString byteString, + ) { + return _hmacSha1(reference.pointer, _id_hmacSha1 as _$jni.JMethodIDPtr, + byteString.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_hmacSha256 = _class.instanceMethodId( + r'hmacSha256', + r'(Lokio/ByteString;)Lokio/ByteString;', + ); + + static final _hmacSha256 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okio.ByteString hmacSha256(okio.ByteString byteString)` + /// The returned object must be released after use, by calling the [release] method. + ByteString hmacSha256( + ByteString byteString, + ) { + return _hmacSha256(reference.pointer, _id_hmacSha256 as _$jni.JMethodIDPtr, + byteString.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_hmacSha512 = _class.instanceMethodId( + r'hmacSha512', + r'(Lokio/ByteString;)Lokio/ByteString;', + ); + + static final _hmacSha512 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public okio.ByteString hmacSha512(okio.ByteString byteString)` + /// The returned object must be released after use, by calling the [release] method. + ByteString hmacSha512( + ByteString byteString, + ) { + return _hmacSha512(reference.pointer, _id_hmacSha512 as _$jni.JMethodIDPtr, + byteString.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_base64Url = _class.instanceMethodId( + r'base64Url', + r'()Ljava/lang/String;', + ); + + static final _base64Url = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String base64Url()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString base64Url() { + return _base64Url(reference.pointer, _id_base64Url as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_hex = _class.instanceMethodId( + r'hex', + r'()Ljava/lang/String;', + ); + + static final _hex = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String hex()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString hex() { + return _hex(reference.pointer, _id_hex as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_toAsciiLowercase = _class.instanceMethodId( + r'toAsciiLowercase', + r'()Lokio/ByteString;', + ); + + static final _toAsciiLowercase = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public okio.ByteString toAsciiLowercase()` + /// The returned object must be released after use, by calling the [release] method. + ByteString toAsciiLowercase() { + return _toAsciiLowercase( + reference.pointer, _id_toAsciiLowercase as _$jni.JMethodIDPtr) + .object(const $ByteString$Type()); + } + + static final _id_toAsciiUppercase = _class.instanceMethodId( + r'toAsciiUppercase', + r'()Lokio/ByteString;', + ); + + static final _toAsciiUppercase = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public okio.ByteString toAsciiUppercase()` + /// The returned object must be released after use, by calling the [release] method. + ByteString toAsciiUppercase() { + return _toAsciiUppercase( + reference.pointer, _id_toAsciiUppercase as _$jni.JMethodIDPtr) + .object(const $ByteString$Type()); + } + + static final _id_substring = _class.instanceMethodId( + r'substring', + r'(II)Lokio/ByteString;', + ); + + static final _substring = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32, _$jni.Int32)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int, int)>(); + + /// from: `public okio.ByteString substring(int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + ByteString substring( + int i, + int i1, + ) { + return _substring( + reference.pointer, _id_substring as _$jni.JMethodIDPtr, i, i1) + .object(const $ByteString$Type()); + } + + static final _id_getByte = _class.instanceMethodId( + r'getByte', + r'(I)B', + ); + + static final _getByte = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallByteMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final byte getByte(int i)` + int getByte( + int i, + ) { + return _getByte(reference.pointer, _id_getByte as _$jni.JMethodIDPtr, i) + .byte; + } + + static final _id_size = _class.instanceMethodId( + r'size', + r'()I', + ); + + static final _size = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final int size()` + int size() { + return _size(reference.pointer, _id_size as _$jni.JMethodIDPtr).integer; + } + + static final _id_toByteArray = _class.instanceMethodId( + r'toByteArray', + r'()[B', + ); + + static final _toByteArray = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public byte[] toByteArray()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JArray<_$jni.jbyte> toByteArray() { + return _toByteArray( + reference.pointer, _id_toByteArray as _$jni.JMethodIDPtr) + .object(const _$jni.JArrayType(_$jni.jbyteType())); + } + + static final _id_asByteBuffer = _class.instanceMethodId( + r'asByteBuffer', + r'()Ljava/nio/ByteBuffer;', + ); + + static final _asByteBuffer = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.nio.ByteBuffer asByteBuffer()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JByteBuffer asByteBuffer() { + return _asByteBuffer( + reference.pointer, _id_asByteBuffer as _$jni.JMethodIDPtr) + .object(const _$jni.JByteBufferType()); + } + + static final _id_write = _class.instanceMethodId( + r'write', + r'(Ljava/io/OutputStream;)V', + ); + + static final _write = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void write(java.io.OutputStream outputStream)` + void write( + _$jni.JObject outputStream, + ) { + _write(reference.pointer, _id_write as _$jni.JMethodIDPtr, + outputStream.reference.pointer) + .check(); + } + + static final _id_rangeEquals = _class.instanceMethodId( + r'rangeEquals', + r'(ILokio/ByteString;II)Z', + ); + + static final _rangeEquals = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Int32, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>, int, int)>(); + + /// from: `public boolean rangeEquals(int i, okio.ByteString byteString, int i1, int i2)` + bool rangeEquals( + int i, + ByteString byteString, + int i1, + int i2, + ) { + return _rangeEquals( + reference.pointer, + _id_rangeEquals as _$jni.JMethodIDPtr, + i, + byteString.reference.pointer, + i1, + i2) + .boolean; + } + + static final _id_rangeEquals$1 = _class.instanceMethodId( + r'rangeEquals', + r'(I[BII)Z', + ); + + static final _rangeEquals$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Int32, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>, int, int)>(); + + /// from: `public boolean rangeEquals(int i, byte[] bs, int i1, int i2)` + bool rangeEquals$1( + int i, + _$jni.JArray<_$jni.jbyte> bs, + int i1, + int i2, + ) { + return _rangeEquals$1( + reference.pointer, + _id_rangeEquals$1 as _$jni.JMethodIDPtr, + i, + bs.reference.pointer, + i1, + i2) + .boolean; + } + + static final _id_copyInto = _class.instanceMethodId( + r'copyInto', + r'(I[BII)V', + ); + + static final _copyInto = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Int32, + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>, int, int)>(); + + /// from: `public void copyInto(int i, byte[] bs, int i1, int i2)` + void copyInto( + int i, + _$jni.JArray<_$jni.jbyte> bs, + int i1, + int i2, + ) { + _copyInto(reference.pointer, _id_copyInto as _$jni.JMethodIDPtr, i, + bs.reference.pointer, i1, i2) + .check(); + } + + static final _id_startsWith = _class.instanceMethodId( + r'startsWith', + r'(Lokio/ByteString;)Z', + ); + + static final _startsWith = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final boolean startsWith(okio.ByteString byteString)` + bool startsWith( + ByteString byteString, + ) { + return _startsWith(reference.pointer, _id_startsWith as _$jni.JMethodIDPtr, + byteString.reference.pointer) + .boolean; + } + + static final _id_startsWith$1 = _class.instanceMethodId( + r'startsWith', + r'([B)Z', + ); + + static final _startsWith$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final boolean startsWith(byte[] bs)` + bool startsWith$1( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _startsWith$1(reference.pointer, + _id_startsWith$1 as _$jni.JMethodIDPtr, bs.reference.pointer) + .boolean; + } + + static final _id_endsWith = _class.instanceMethodId( + r'endsWith', + r'(Lokio/ByteString;)Z', + ); + + static final _endsWith = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final boolean endsWith(okio.ByteString byteString)` + bool endsWith( + ByteString byteString, + ) { + return _endsWith(reference.pointer, _id_endsWith as _$jni.JMethodIDPtr, + byteString.reference.pointer) + .boolean; + } + + static final _id_endsWith$1 = _class.instanceMethodId( + r'endsWith', + r'([B)Z', + ); + + static final _endsWith$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final boolean endsWith(byte[] bs)` + bool endsWith$1( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _endsWith$1(reference.pointer, _id_endsWith$1 as _$jni.JMethodIDPtr, + bs.reference.pointer) + .boolean; + } + + static final _id_indexOf = _class.instanceMethodId( + r'indexOf', + r'(Lokio/ByteString;I)I', + ); + + static final _indexOf = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public final int indexOf(okio.ByteString byteString, int i)` + int indexOf( + ByteString byteString, + int i, + ) { + return _indexOf(reference.pointer, _id_indexOf as _$jni.JMethodIDPtr, + byteString.reference.pointer, i) + .integer; + } + + static final _id_indexOf$1 = _class.instanceMethodId( + r'indexOf', + r'([BI)I', + ); + + static final _indexOf$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public int indexOf(byte[] bs, int i)` + int indexOf$1( + _$jni.JArray<_$jni.jbyte> bs, + int i, + ) { + return _indexOf$1(reference.pointer, _id_indexOf$1 as _$jni.JMethodIDPtr, + bs.reference.pointer, i) + .integer; + } + + static final _id_lastIndexOf = _class.instanceMethodId( + r'lastIndexOf', + r'(Lokio/ByteString;I)I', + ); + + static final _lastIndexOf = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public final int lastIndexOf(okio.ByteString byteString, int i)` + int lastIndexOf( + ByteString byteString, + int i, + ) { + return _lastIndexOf( + reference.pointer, + _id_lastIndexOf as _$jni.JMethodIDPtr, + byteString.reference.pointer, + i) + .integer; + } + + static final _id_lastIndexOf$1 = _class.instanceMethodId( + r'lastIndexOf', + r'([BI)I', + ); + + static final _lastIndexOf$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public int lastIndexOf(byte[] bs, int i)` + int lastIndexOf$1( + _$jni.JArray<_$jni.jbyte> bs, + int i, + ) { + return _lastIndexOf$1(reference.pointer, + _id_lastIndexOf$1 as _$jni.JMethodIDPtr, bs.reference.pointer, i) + .integer; + } + + static final _id_equals = _class.instanceMethodId( + r'equals', + r'(Ljava/lang/Object;)Z', + ); + + static final _equals = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public boolean equals(java.lang.Object object)` + bool equals( + _$jni.JObject object, + ) { + return _equals(reference.pointer, _id_equals as _$jni.JMethodIDPtr, + object.reference.pointer) + .boolean; + } + + static final _id_hashCode$1 = _class.instanceMethodId( + r'hashCode', + r'()I', + ); + + static final _hashCode$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public int hashCode()` + int hashCode$1() { + return _hashCode$1(reference.pointer, _id_hashCode$1 as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_compareTo = _class.instanceMethodId( + r'compareTo', + r'(Lokio/ByteString;)I', + ); + + static final _compareTo = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public int compareTo(okio.ByteString byteString)` + int compareTo( + ByteString byteString, + ) { + return _compareTo(reference.pointer, _id_compareTo as _$jni.JMethodIDPtr, + byteString.reference.pointer) + .integer; + } + + static final _id_toString$1 = _class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_substring$1 = _class.instanceMethodId( + r'substring', + r'(I)Lokio/ByteString;', + ); + + static final _substring$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public final okio.ByteString substring(int i)` + /// The returned object must be released after use, by calling the [release] method. + ByteString substring$1( + int i, + ) { + return _substring$1( + reference.pointer, _id_substring$1 as _$jni.JMethodIDPtr, i) + .object(const $ByteString$Type()); + } + + static final _id_substring$2 = _class.instanceMethodId( + r'substring', + r'()Lokio/ByteString;', + ); + + static final _substring$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final okio.ByteString substring()` + /// The returned object must be released after use, by calling the [release] method. + ByteString substring$2() { + return _substring$2( + reference.pointer, _id_substring$2 as _$jni.JMethodIDPtr) + .object(const $ByteString$Type()); + } + + static final _id_indexOf$2 = _class.instanceMethodId( + r'indexOf', + r'(Lokio/ByteString;)I', + ); + + static final _indexOf$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final int indexOf(okio.ByteString byteString)` + int indexOf$2( + ByteString byteString, + ) { + return _indexOf$2(reference.pointer, _id_indexOf$2 as _$jni.JMethodIDPtr, + byteString.reference.pointer) + .integer; + } + + static final _id_indexOf$3 = _class.instanceMethodId( + r'indexOf', + r'([B)I', + ); + + static final _indexOf$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final int indexOf(byte[] bs)` + int indexOf$3( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _indexOf$3(reference.pointer, _id_indexOf$3 as _$jni.JMethodIDPtr, + bs.reference.pointer) + .integer; + } + + static final _id_lastIndexOf$2 = _class.instanceMethodId( + r'lastIndexOf', + r'(Lokio/ByteString;)I', + ); + + static final _lastIndexOf$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final int lastIndexOf(okio.ByteString byteString)` + int lastIndexOf$2( + ByteString byteString, + ) { + return _lastIndexOf$2( + reference.pointer, + _id_lastIndexOf$2 as _$jni.JMethodIDPtr, + byteString.reference.pointer) + .integer; + } + + static final _id_lastIndexOf$3 = _class.instanceMethodId( + r'lastIndexOf', + r'([B)I', + ); + + static final _lastIndexOf$3 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final int lastIndexOf(byte[] bs)` + int lastIndexOf$3( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _lastIndexOf$3(reference.pointer, + _id_lastIndexOf$3 as _$jni.JMethodIDPtr, bs.reference.pointer) + .integer; + } + + static final _id_of = _class.staticMethodId( + r'of', + r'([B)Lokio/ByteString;', + ); + + static final _of = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okio.ByteString of(byte[] bs)` + /// The returned object must be released after use, by calling the [release] method. + static ByteString of( + _$jni.JArray<_$jni.jbyte> bs, + ) { + return _of(_class.reference.pointer, _id_of as _$jni.JMethodIDPtr, + bs.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_of$1 = _class.staticMethodId( + r'of', + r'([BII)Lokio/ByteString;', + ); + + static final _of$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Int32, + _$jni.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); + + /// from: `static public final okio.ByteString of(byte[] bs, int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + static ByteString of$1( + _$jni.JArray<_$jni.jbyte> bs, + int i, + int i1, + ) { + return _of$1(_class.reference.pointer, _id_of$1 as _$jni.JMethodIDPtr, + bs.reference.pointer, i, i1) + .object(const $ByteString$Type()); + } + + static final _id_of$2 = _class.staticMethodId( + r'of', + r'(Ljava/nio/ByteBuffer;)Lokio/ByteString;', + ); + + static final _of$2 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okio.ByteString of(java.nio.ByteBuffer byteBuffer)` + /// The returned object must be released after use, by calling the [release] method. + static ByteString of$2( + _$jni.JByteBuffer byteBuffer, + ) { + return _of$2(_class.reference.pointer, _id_of$2 as _$jni.JMethodIDPtr, + byteBuffer.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_encodeUtf8 = _class.staticMethodId( + r'encodeUtf8', + r'(Ljava/lang/String;)Lokio/ByteString;', + ); + + static final _encodeUtf8 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okio.ByteString encodeUtf8(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + static ByteString encodeUtf8( + _$jni.JString string, + ) { + return _encodeUtf8(_class.reference.pointer, + _id_encodeUtf8 as _$jni.JMethodIDPtr, string.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_encodeString = _class.staticMethodId( + r'encodeString', + r'(Ljava/lang/String;Ljava/nio/charset/Charset;)Lokio/ByteString;', + ); + + static final _encodeString = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okio.ByteString encodeString(java.lang.String string, java.nio.charset.Charset charset)` + /// The returned object must be released after use, by calling the [release] method. + static ByteString encodeString( + _$jni.JString string, + _$jni.JObject charset, + ) { + return _encodeString( + _class.reference.pointer, + _id_encodeString as _$jni.JMethodIDPtr, + string.reference.pointer, + charset.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_decodeBase64 = _class.staticMethodId( + r'decodeBase64', + r'(Ljava/lang/String;)Lokio/ByteString;', + ); + + static final _decodeBase64 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okio.ByteString decodeBase64(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + static ByteString decodeBase64( + _$jni.JString string, + ) { + return _decodeBase64(_class.reference.pointer, + _id_decodeBase64 as _$jni.JMethodIDPtr, string.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_decodeHex = _class.staticMethodId( + r'decodeHex', + r'(Ljava/lang/String;)Lokio/ByteString;', + ); + + static final _decodeHex = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public final okio.ByteString decodeHex(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + static ByteString decodeHex( + _$jni.JString string, + ) { + return _decodeHex(_class.reference.pointer, + _id_decodeHex as _$jni.JMethodIDPtr, string.reference.pointer) + .object(const $ByteString$Type()); + } + + static final _id_read = _class.staticMethodId( + r'read', + r'(Ljava/io/InputStream;I)Lokio/ByteString;', + ); + + static final _read = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `static public final okio.ByteString read(java.io.InputStream inputStream, int i)` + /// The returned object must be released after use, by calling the [release] method. + static ByteString read( + _$jni.JObject inputStream, + int i, + ) { + return _read(_class.reference.pointer, _id_read as _$jni.JMethodIDPtr, + inputStream.reference.pointer, i) + .object(const $ByteString$Type()); + } +} + +final class $ByteString$Type extends _$jni.JObjType { + @_$jni.internal + const $ByteString$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lokio/ByteString;'; + + @_$jni.internal + @_$core.override + ByteString fromReference(_$jni.JReference reference) => + ByteString.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($ByteString$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($ByteString$Type) && other is $ByteString$Type; + } +} + +/// from: `com.example.ok_http.WebSocketInterceptor$Companion` +class WebSocketInterceptor_Companion extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + WebSocketInterceptor_Companion.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName( + r'com/example/ok_http/WebSocketInterceptor$Companion'); + + /// The type which includes information such as the signature of this class. + static const type = $WebSocketInterceptor_Companion$Type(); + static final _id_addWSInterceptor = _class.instanceMethodId( + r'addWSInterceptor', + r'(Lokhttp3/OkHttpClient$Builder;)Lokhttp3/OkHttpClient$Builder;', + ); + + static final _addWSInterceptor = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final okhttp3.OkHttpClient$Builder addWSInterceptor(okhttp3.OkHttpClient$Builder builder)` + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder addWSInterceptor( + OkHttpClient_Builder builder, + ) { + return _addWSInterceptor( + reference.pointer, + _id_addWSInterceptor as _$jni.JMethodIDPtr, + builder.reference.pointer) + .object(const $OkHttpClient_Builder$Type()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory WebSocketInterceptor_Companion( + _$jni.JObject defaultConstructorMarker, + ) { + return WebSocketInterceptor_Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $WebSocketInterceptor_Companion$Type + extends _$jni.JObjType { + @_$jni.internal + const $WebSocketInterceptor_Companion$Type(); + + @_$jni.internal + @_$core.override + String get signature => + r'Lcom/example/ok_http/WebSocketInterceptor$Companion;'; + + @_$jni.internal + @_$core.override + WebSocketInterceptor_Companion fromReference(_$jni.JReference reference) => + WebSocketInterceptor_Companion.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($WebSocketInterceptor_Companion$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($WebSocketInterceptor_Companion$Type) && + other is $WebSocketInterceptor_Companion$Type; + } +} + +/// from: `com.example.ok_http.WebSocketInterceptor` +class WebSocketInterceptor extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + WebSocketInterceptor.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + _$jni.JClass.forName(r'com/example/ok_http/WebSocketInterceptor'); + + /// The type which includes information such as the signature of this class. + static const type = $WebSocketInterceptor$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'Lcom/example/ok_http/WebSocketInterceptor$Companion;', + ); + + /// from: `static public final com.example.ok_http.WebSocketInterceptor$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static WebSocketInterceptor_Companion get Companion => + _id_Companion.get(_class, const $WebSocketInterceptor_Companion$Type()); + + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory WebSocketInterceptor() { + return WebSocketInterceptor.fromReference( + _new$(_class.reference.pointer, _id_new$ as _$jni.JMethodIDPtr) + .reference); + } +} + +final class $WebSocketInterceptor$Type + extends _$jni.JObjType { + @_$jni.internal + const $WebSocketInterceptor$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Lcom/example/ok_http/WebSocketInterceptor;'; + + @_$jni.internal + @_$core.override + WebSocketInterceptor fromReference(_$jni.JReference reference) => + WebSocketInterceptor.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($WebSocketInterceptor$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($WebSocketInterceptor$Type) && + other is $WebSocketInterceptor$Type; + } +} + +/// from: `java.util.concurrent.TimeUnit` +class TimeUnit extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + TimeUnit.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'java/util/concurrent/TimeUnit'); + + /// The type which includes information such as the signature of this class. + static const type = $TimeUnit$Type(); + static final _id_NANOSECONDS = _class.staticFieldId( + r'NANOSECONDS', + r'Ljava/util/concurrent/TimeUnit;', + ); + + /// from: `static public final java.util.concurrent.TimeUnit NANOSECONDS` + /// The returned object must be released after use, by calling the [release] method. + static TimeUnit get NANOSECONDS => + _id_NANOSECONDS.get(_class, const $TimeUnit$Type()); + + static final _id_MICROSECONDS = _class.staticFieldId( + r'MICROSECONDS', + r'Ljava/util/concurrent/TimeUnit;', + ); + + /// from: `static public final java.util.concurrent.TimeUnit MICROSECONDS` + /// The returned object must be released after use, by calling the [release] method. + static TimeUnit get MICROSECONDS => + _id_MICROSECONDS.get(_class, const $TimeUnit$Type()); + + static final _id_MILLISECONDS = _class.staticFieldId( + r'MILLISECONDS', + r'Ljava/util/concurrent/TimeUnit;', + ); + + /// from: `static public final java.util.concurrent.TimeUnit MILLISECONDS` + /// The returned object must be released after use, by calling the [release] method. + static TimeUnit get MILLISECONDS => + _id_MILLISECONDS.get(_class, const $TimeUnit$Type()); + + static final _id_SECONDS = _class.staticFieldId( + r'SECONDS', + r'Ljava/util/concurrent/TimeUnit;', + ); + + /// from: `static public final java.util.concurrent.TimeUnit SECONDS` + /// The returned object must be released after use, by calling the [release] method. + static TimeUnit get SECONDS => + _id_SECONDS.get(_class, const $TimeUnit$Type()); + + static final _id_MINUTES = _class.staticFieldId( + r'MINUTES', + r'Ljava/util/concurrent/TimeUnit;', + ); + + /// from: `static public final java.util.concurrent.TimeUnit MINUTES` + /// The returned object must be released after use, by calling the [release] method. + static TimeUnit get MINUTES => + _id_MINUTES.get(_class, const $TimeUnit$Type()); + + static final _id_HOURS = _class.staticFieldId( + r'HOURS', + r'Ljava/util/concurrent/TimeUnit;', + ); + + /// from: `static public final java.util.concurrent.TimeUnit HOURS` + /// The returned object must be released after use, by calling the [release] method. + static TimeUnit get HOURS => _id_HOURS.get(_class, const $TimeUnit$Type()); + + static final _id_DAYS = _class.staticFieldId( + r'DAYS', + r'Ljava/util/concurrent/TimeUnit;', + ); + + /// from: `static public final java.util.concurrent.TimeUnit DAYS` + /// The returned object must be released after use, by calling the [release] method. + static TimeUnit get DAYS => _id_DAYS.get(_class, const $TimeUnit$Type()); + + static final _id_values = _class.staticMethodId( + r'values', + r'()[Ljava/util/concurrent/TimeUnit;', + ); + + static final _values = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `static public java.util.concurrent.TimeUnit[] values()` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JArray values() { + return _values(_class.reference.pointer, _id_values as _$jni.JMethodIDPtr) + .object(const _$jni.JArrayType($TimeUnit$Type())); + } + + static final _id_valueOf = _class.staticMethodId( + r'valueOf', + r'(Ljava/lang/String;)Ljava/util/concurrent/TimeUnit;', + ); + + static final _valueOf = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.TimeUnit valueOf(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + static TimeUnit valueOf( + _$jni.JString string, + ) { + return _valueOf(_class.reference.pointer, _id_valueOf as _$jni.JMethodIDPtr, + string.reference.pointer) + .object(const $TimeUnit$Type()); + } + + static final _id_convert = _class.instanceMethodId( + r'convert', + r'(JLjava/util/concurrent/TimeUnit;)J', + ); + + static final _convert = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Int64, _$jni.Pointer<_$jni.Void>)>)>>( + 'globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, int, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public long convert(long j, java.util.concurrent.TimeUnit timeUnit)` + int convert( + int j, + TimeUnit timeUnit, + ) { + return _convert(reference.pointer, _id_convert as _$jni.JMethodIDPtr, j, + timeUnit.reference.pointer) + .long; + } + + static final _id_convert$1 = _class.instanceMethodId( + r'convert', + r'(Ljava/time/Duration;)J', + ); + + static final _convert$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public long convert(java.time.Duration duration)` + int convert$1( + _$jni.JObject duration, + ) { + return _convert$1(reference.pointer, _id_convert$1 as _$jni.JMethodIDPtr, + duration.reference.pointer) + .long; + } + + static final _id_toNanos = _class.instanceMethodId( + r'toNanos', + r'(J)J', + ); + + static final _toNanos = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public long toNanos(long j)` + int toNanos( + int j, + ) { + return _toNanos(reference.pointer, _id_toNanos as _$jni.JMethodIDPtr, j) + .long; + } + + static final _id_toMicros = _class.instanceMethodId( + r'toMicros', + r'(J)J', + ); + + static final _toMicros = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public long toMicros(long j)` + int toMicros( + int j, + ) { + return _toMicros(reference.pointer, _id_toMicros as _$jni.JMethodIDPtr, j) + .long; + } + + static final _id_toMillis = _class.instanceMethodId( + r'toMillis', + r'(J)J', + ); + + static final _toMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public long toMillis(long j)` + int toMillis( + int j, + ) { + return _toMillis(reference.pointer, _id_toMillis as _$jni.JMethodIDPtr, j) + .long; + } + + static final _id_toSeconds = _class.instanceMethodId( + r'toSeconds', + r'(J)J', + ); + + static final _toSeconds = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public long toSeconds(long j)` + int toSeconds( + int j, + ) { + return _toSeconds(reference.pointer, _id_toSeconds as _$jni.JMethodIDPtr, j) + .long; + } + + static final _id_toMinutes = _class.instanceMethodId( + r'toMinutes', + r'(J)J', + ); + + static final _toMinutes = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public long toMinutes(long j)` + int toMinutes( + int j, + ) { + return _toMinutes(reference.pointer, _id_toMinutes as _$jni.JMethodIDPtr, j) + .long; + } + + static final _id_toHours = _class.instanceMethodId( + r'toHours', + r'(J)J', + ); + + static final _toHours = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public long toHours(long j)` + int toHours( + int j, + ) { + return _toHours(reference.pointer, _id_toHours as _$jni.JMethodIDPtr, j) + .long; + } + + static final _id_toDays = _class.instanceMethodId( + r'toDays', + r'(J)J', + ); + + static final _toDays = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public long toDays(long j)` + int toDays( + int j, + ) { + return _toDays(reference.pointer, _id_toDays as _$jni.JMethodIDPtr, j).long; + } + + static final _id_timedWait = _class.instanceMethodId( + r'timedWait', + r'(Ljava/lang/Object;J)V', + ); + + static final _timedWait = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int64)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public void timedWait(java.lang.Object object, long j)` + void timedWait( + _$jni.JObject object, + int j, + ) { + _timedWait(reference.pointer, _id_timedWait as _$jni.JMethodIDPtr, + object.reference.pointer, j) + .check(); + } + + static final _id_timedJoin = _class.instanceMethodId( + r'timedJoin', + r'(Ljava/lang/Thread;J)V', + ); + + static final _timedJoin = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int64)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public void timedJoin(java.lang.Thread thread, long j)` + void timedJoin( + _$jni.JObject thread, + int j, + ) { + _timedJoin(reference.pointer, _id_timedJoin as _$jni.JMethodIDPtr, + thread.reference.pointer, j) + .check(); + } + + static final _id_sleep = _class.instanceMethodId( + r'sleep', + r'(J)V', + ); + + static final _sleep = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public void sleep(long j)` + void sleep( + int j, + ) { + _sleep(reference.pointer, _id_sleep as _$jni.JMethodIDPtr, j).check(); + } + + static final _id_toChronoUnit = _class.instanceMethodId( + r'toChronoUnit', + r'()Ljava/time/temporal/ChronoUnit;', + ); + + static final _toChronoUnit = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.time.temporal.ChronoUnit toChronoUnit()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject toChronoUnit() { + return _toChronoUnit( + reference.pointer, _id_toChronoUnit as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_of = _class.staticMethodId( + r'of', + r'(Ljava/time/temporal/ChronoUnit;)Ljava/util/concurrent/TimeUnit;', + ); + + static final _of = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public java.util.concurrent.TimeUnit of(java.time.temporal.ChronoUnit chronoUnit)` + /// The returned object must be released after use, by calling the [release] method. + static TimeUnit of( + _$jni.JObject chronoUnit, + ) { + return _of(_class.reference.pointer, _id_of as _$jni.JMethodIDPtr, + chronoUnit.reference.pointer) + .object(const $TimeUnit$Type()); + } +} + +final class $TimeUnit$Type extends _$jni.JObjType { + @_$jni.internal + const $TimeUnit$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Ljava/util/concurrent/TimeUnit;'; + + @_$jni.internal + @_$core.override + TimeUnit fromReference(_$jni.JReference reference) => + TimeUnit.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($TimeUnit$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($TimeUnit$Type) && other is $TimeUnit$Type; + } +} diff --git a/pkgs/ok_http/lib/src/ok_http_client.dart b/pkgs/ok_http/lib/src/ok_http_client.dart new file mode 100644 index 0000000000..5b81b34b8b --- /dev/null +++ b/pkgs/ok_http/lib/src/ok_http_client.dart @@ -0,0 +1,346 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// An Android Flutter plugin that exposes the +/// [OkHttp](https://square.github.io/okhttp/) HTTP client. +/// +/// The platform interface must be initialized before using this plugin e.g. by +/// calling +/// [`WidgetsFlutterBinding.ensureInitialized`](https://api.flutter.dev/flutter/widgets/WidgetsFlutterBinding/ensureInitialized.html) +/// or +/// [`runApp`](https://api.flutter.dev/flutter/widgets/runApp.html). +library; + +import 'dart:async'; +import 'dart:typed_data'; + +import 'package:http/http.dart'; +import 'package:http_profile/http_profile.dart'; +import 'package:jni/jni.dart'; + +import 'jni/bindings.dart' as bindings; + +/// Configurations for the [OkHttpClient]. +class OkHttpClientConfiguration { + /// The maximum duration to wait for a call to complete. + /// + /// If a call does not finish within the specified time, it will throw a + /// [ClientException] with the message "java.io.InterruptedIOException...". + /// + /// [Duration.zero] indicates no timeout. + /// + /// See [OkHttpClient.Builder.callTimeout](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/call-timeout.html). + final Duration callTimeout; + + /// The maximum duration to wait while connecting a TCP Socket to the target + /// host. + /// + /// See [OkHttpClient.Builder.connectTimeout](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/connect-timeout.html). + final Duration connectTimeout; + + /// The maximum duration to wait for a TCP Socket and for individual read + /// IO operations. + /// + /// See [OkHttpClient.Builder.readTimeout](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/read-timeout.html). + final Duration readTimeout; + + /// The maximum duration to wait for individual write IO operations. + /// + /// See [OkHttpClient.Builder.writeTimeout](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/-builder/write-timeout.html). + final Duration writeTimeout; + + const OkHttpClientConfiguration({ + this.callTimeout = Duration.zero, + this.connectTimeout = const Duration(milliseconds: 10000), + this.readTimeout = const Duration(milliseconds: 10000), + this.writeTimeout = const Duration(milliseconds: 10000), + }); +} + +/// An HTTP [Client] utilizing the [OkHttp](https://square.github.io/okhttp/) client. +/// +/// Example Usage: +/// ``` +/// void main() async { +/// var client = OkHttpClient(); +/// final response = await client.get( +/// Uri.https('www.googleapis.com', '/books/v1/volumes', {'q': '{http}'})); +/// if (response.statusCode != 200) { +/// throw HttpException('bad response: ${response.statusCode}'); +/// } +/// +/// final decodedResponse = +/// jsonDecode(utf8.decode(response.bodyBytes)) as Map; +/// +/// final itemCount = decodedResponse['totalItems']; +/// print('Number of books about http: $itemCount.'); +/// for (var i = 0; i < min(itemCount, 10); ++i) { +/// print(decodedResponse['items'][i]['volumeInfo']['title']); +/// } +/// } +/// ``` +class OkHttpClient extends BaseClient { + late bindings.OkHttpClient _client; + bool _isClosed = false; + + /// The configuration for this client, applied on a per-call basis. + /// It can be updated multiple times during the client's lifecycle. + OkHttpClientConfiguration configuration; + + /// Creates a new instance of [OkHttpClient] with the given [configuration]. + OkHttpClient({ + this.configuration = const OkHttpClientConfiguration(), + }) { + _client = bindings.OkHttpClient_Builder().build(); + } + + @override + void close() { + if (!_isClosed) { + // Refer to OkHttp documentation for the shutdown procedure: + // https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/index.html#:~:text=Shutdown + + _client.dispatcher().executorService().shutdown(); + + // Remove all idle connections from the resource pool. + _client.connectionPool().evictAll(); + + // Close the cache and release the JNI reference to the client. + var cache = _client.cache(); + if (!cache.isNull) { + cache.close(); + } + _client.release(); + } + _isClosed = true; + } + + HttpClientRequestProfile? _createProfile(BaseRequest request) => + HttpClientRequestProfile.profile( + requestStartTime: DateTime.now(), + requestMethod: request.method, + requestUri: request.url.toString()); + + void addProfileError(HttpClientRequestProfile? profile, Exception error) { + if (profile != null) { + if (profile.requestData.endTime == null) { + profile.requestData.closeWithError(error.toString()); + } else { + profile.responseData.closeWithError(error.toString()); + } + } + } + + @override + Future send(BaseRequest request) async { + if (_isClosed) { + throw ClientException( + 'HTTP request failed. Client is already closed.', request.url); + } + + final profile = _createProfile(request); + profile?.connectionInfo = { + 'package': 'package:ok_http', + 'client': 'OkHttpClient', + }; + + profile?.requestData + ?..contentLength = request.contentLength + ..followRedirects = request.followRedirects + ..headersCommaValues = request.headers + ..maxRedirects = request.maxRedirects; + + if (profile != null && request.contentLength != null) { + profile.requestData.headersListValues = { + 'Content-Length': ['${request.contentLength}'], + ...profile.requestData.headers! + }; + } + + var requestUrl = request.url.toString(); + var requestHeaders = request.headers; + var requestMethod = request.method; + var requestBody = await request.finalize().toBytes(); + var maxRedirects = request.maxRedirects; + var followRedirects = request.followRedirects; + + profile?.requestData.bodySink.add(requestBody); + var profileRespClosed = false; + + final responseCompleter = Completer(); + + var reqBuilder = bindings.Request_Builder().url$1(requestUrl.toJString()); + + requestHeaders.forEach((headerName, headerValue) { + reqBuilder.addHeader(headerName.toJString(), headerValue.toJString()); + }); + + // OkHttp doesn't allow a non-null RequestBody for GET and HEAD requests. + // So, we need to handle this case separately. + bindings.RequestBody okReqBody; + if (requestMethod != 'GET' && requestMethod != 'HEAD') { + okReqBody = bindings.RequestBody.create$10(requestBody.toJArray()); + } else { + okReqBody = bindings.RequestBody.fromReference(jNullReference); + } + + reqBuilder.method( + requestMethod.toJString(), + okReqBody, + ); + + // To configure the client per-request, we create a new client with the + // builder associated with `_client`. + // They share the same connection pool and dispatcher. + // https://square.github.io/okhttp/recipes/#per-call-configuration-kt-java + // + // `followRedirects` is set to `false` to handle redirects manually. + // (Since OkHttp sets a hard limit of 20 redirects.) + // https://github.com/square/okhttp/blob/54238b4c713080c3fd32fb1a070fb5d6814c9a09/okhttp/src/main/kotlin/okhttp3/internal/http/RetryAndFollowUpInterceptor.kt#L350 + final reqConfiguredClient = bindings.RedirectInterceptor.Companion + .addRedirectInterceptor( + _client.newBuilder().followRedirects(false), + maxRedirects, + followRedirects, bindings.RedirectReceivedCallback.implement( + bindings.$RedirectReceivedCallback( + onRedirectReceived: (response, newLocation) { + profile?.responseData.addRedirect(HttpProfileRedirectData( + statusCode: response.code(), + method: response + .request() + .method() + .toDartString(releaseOriginal: true), + location: newLocation.toDartString(releaseOriginal: true), + )); + }, + ))) + .callTimeout(configuration.callTimeout.inMilliseconds, + bindings.TimeUnit.MILLISECONDS) + .connectTimeout(configuration.connectTimeout.inMilliseconds, + bindings.TimeUnit.MILLISECONDS) + .readTimeout(configuration.readTimeout.inMilliseconds, + bindings.TimeUnit.MILLISECONDS) + .writeTimeout(configuration.writeTimeout.inMilliseconds, + bindings.TimeUnit.MILLISECONDS) + .build(); + + // `enqueue()` schedules the request to be executed in the future. + // https://square.github.io/okhttp/5.x/okhttp/okhttp3/-call/enqueue.html + reqConfiguredClient + .newCall(reqBuilder.build()) + .enqueue(bindings.Callback.implement(bindings.$Callback( + onResponse: (bindings.Call call, bindings.Response response) { + var reader = bindings.AsyncInputStreamReader(); + var respBodyStreamController = StreamController>(); + + var responseHeaders = {}; + + response.headers().toMultimap().forEach((key, value) { + responseHeaders[key.toDartString(releaseOriginal: true)] = + value.join(','); + }); + + int? contentLength; + if (responseHeaders.containsKey('content-length')) { + contentLength = int.tryParse(responseHeaders['content-length']!); + + // To be conformant with RFC 2616 14.13, we need to check if the + // content-length is a non-negative integer. + if (contentLength == null || contentLength < 0) { + responseCompleter.completeError(ClientException( + 'Invalid content-length header', request.url)); + return; + } + } + + var responseBodyByteStream = response.body().byteStream(); + reader.readAsync( + responseBodyByteStream, + bindings.DataCallback.implement( + bindings.$DataCallback( + onDataRead: (JArray bytesRead) { + var data = bytesRead.toUint8List(); + + respBodyStreamController.sink.add(data); + profile?.responseData.bodySink.add(data); + }, + onFinished: () { + reader.shutdown(); + respBodyStreamController.sink.close(); + if (!profileRespClosed) { + profile?.responseData.close(); + profileRespClosed = true; + } + }, + onError: (iOException) { + var exception = + ClientException(iOException.toString(), request.url); + + respBodyStreamController.sink.addError(exception); + addProfileError(profile, exception); + profileRespClosed = true; + + reader.shutdown(); + respBodyStreamController.sink.close(); + }, + ), + )); + + responseCompleter.complete(StreamedResponse( + respBodyStreamController.stream, + response.code(), + reasonPhrase: + response.message().toDartString(releaseOriginal: true), + headers: responseHeaders, + request: request, + contentLength: contentLength, + isRedirect: response.isRedirect(), + )); + + profile?.requestData.close(); + profile?.responseData + ?..contentLength = contentLength + ..headersCommaValues = responseHeaders + ..isRedirect = response.isRedirect() + ..reasonPhrase = + response.message().toDartString(releaseOriginal: true) + ..startTime = DateTime.now() + ..statusCode = response.code(); + }, + onFailure: (bindings.Call call, JObject ioException) { + var msg = ioException.toString(); + if (msg.contains('Redirect limit exceeded')) { + msg = 'Redirect limit exceeded'; + } + var exception = ClientException(msg, request.url); + responseCompleter.completeError(exception); + addProfileError(profile, exception); + profileRespClosed = true; + }, + ))); + + return responseCompleter.future; + } +} + +/// A test-only class that makes the [HttpClientRequestProfile] data available. +class OkHttpClientWithProfile extends OkHttpClient { + HttpClientRequestProfile? profile; + + @override + HttpClientRequestProfile? _createProfile(BaseRequest request) => + profile = super._createProfile(request); + + OkHttpClientWithProfile() : super(); +} + +extension on Uint8List { + JArray toJArray() => + JArray(jbyte.type, length)..setRange(0, length, this); +} + +extension on JArray { + Uint8List toUint8List({int? length}) => + getRange(0, length ?? this.length).buffer.asUint8List(); +} diff --git a/pkgs/ok_http/lib/src/ok_http_web_socket.dart b/pkgs/ok_http/lib/src/ok_http_web_socket.dart new file mode 100644 index 0000000000..4d72994192 --- /dev/null +++ b/pkgs/ok_http/lib/src/ok_http_web_socket.dart @@ -0,0 +1,237 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:jni/jni.dart'; +import 'package:web_socket/web_socket.dart'; + +import 'jni/bindings.dart' as bindings; + +/// A [WebSocket] implemented using the OkHttp library's +/// [WebSocket](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html) +/// API. +/// +/// > [!NOTE] +/// > The [WebSocket] interface is currently experimental and may change in the +/// > future. +/// +/// Example usage of [OkHttpWebSocket]: +/// ```dart +/// import 'package:ok_http/ok_http.dart'; +/// import 'package:web_socket/web_socket.dart'; +/// +/// void main() async { +/// final socket = await OkHttpWebSocket.connect( +/// Uri.parse('wss://ws.postman-echo.com/raw')); +/// +/// socket.events.listen((e) async { +/// switch (e) { +/// case TextDataReceived(text: final text): +/// print('Received Text: $text'); +/// await socket.close(); +/// case BinaryDataReceived(data: final data): +/// print('Received Binary: $data'); +/// case CloseReceived(code: final code, reason: final reason): +/// print('Connection to server closed: $code [$reason]'); +/// } +/// }); +/// } +/// ``` +/// +/// > [!TIP] +/// > [`AdapterWebSocketChannel`](https://pub.dev/documentation/web_socket_channel/latest/adapter_web_socket_channel/AdapterWebSocketChannel-class.html) +/// > can be used to adapt a [OkHttpWebSocket] into a +/// > [`WebSocketChannel`](https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketChannel-class.html). +class OkHttpWebSocket implements WebSocket { + late bindings.OkHttpClient _client; + late final bindings.WebSocket _webSocket; + final _events = StreamController(); + String? _protocol; + + /// Private constructor to prevent direct instantiation. + /// + /// Used by [connect] to create a new WebSocket connection, which requires a + /// [bindings.OkHttpClient] instance (see [_connect]), and cannot be accessed + /// statically. + OkHttpWebSocket._() { + // Add the WebSocketInterceptor to prevent response parsing errors. + _client = bindings.WebSocketInterceptor.Companion + .addWSInterceptor(bindings.OkHttpClient_Builder()) + .build(); + } + + /// Create a new WebSocket connection using `OkHttp`'s + /// [WebSocket](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html) + /// API. + /// + /// The URL supplied in [url] must use the scheme ws or wss. + /// + /// If provided, the [protocols] argument indicates the subprotocols that + /// the peer is able to select. See + /// [RFC-6455 1.9](https://datatracker.ietf.org/doc/html/rfc6455#section-1.9). + static Future connect(Uri url, + {Iterable? protocols}) async => + OkHttpWebSocket._()._connect(url, protocols); + + Future _connect(Uri url, Iterable? protocols) async { + if (!url.isScheme('ws') && !url.isScheme('wss')) { + throw ArgumentError.value( + url, 'url', 'only ws: and wss: schemes are supported'); + } + final requestBuilder = + bindings.Request_Builder().url$1(url.toString().toJString()); + + if (protocols != null) { + requestBuilder.addHeader('Sec-WebSocket-Protocol'.toJString(), + protocols.join(', ').toJString()); + } + + var openCompleter = Completer(); + + _client.newWebSocket( + requestBuilder.build(), + bindings.WebSocketListenerProxy( + bindings.WebSocketListenerProxy_WebSocketListener.implement( + bindings.$WebSocketListenerProxy_WebSocketListener( + onOpen: (webSocket, response) { + _webSocket = webSocket; + + var protocolHeader = + response.header$1('sec-websocket-protocol'.toJString()); + if (!protocolHeader.isNull) { + _protocol = protocolHeader.toDartString(releaseOriginal: true); + if (!(protocols?.contains(_protocol) ?? true)) { + openCompleter + .completeError(WebSocketException('Protocol mismatch. ' + 'Expected one of $protocols, but received $_protocol')); + return; + } + } + + openCompleter.complete(this); + }, + onMessage: (bindings.WebSocket webSocket, JString string) { + if (_events.isClosed) return; + _events.add(TextDataReceived(string.toDartString())); + }, + onMessage$1: + (bindings.WebSocket webSocket, bindings.ByteString byteString) { + if (_events.isClosed) return; + _events.add( + BinaryDataReceived(byteString.toByteArray().toUint8List())); + }, + onClosing: + (bindings.WebSocket webSocket, int i, JString string) async { + _okHttpClientClose(); + + if (_events.isClosed) return; + + _events.add(CloseReceived(i, string.toDartString())); + await _events.close(); + }, + onFailure: (bindings.WebSocket webSocket, JObject throwable, + bindings.Response response) { + if (_events.isClosed) return; + + var throwableString = throwable.toString(); + + // If the throwable is: + // - java.net.ProtocolException: Control frames must be final. + // - java.io.EOFException + // - java.net.SocketException: Socket closed + // Then the connection was closed abnormally. + if (throwableString.contains(RegExp( + r'(java\.net\.ProtocolException: Control frames must be final\.|java\.io\.EOFException|java\.net\.SocketException: Socket closed)'))) { + _events.add(CloseReceived(1006, 'abnormal close')); + unawaited(_events.close()); + return; + } + var error = WebSocketException( + 'Connection ended unexpectedly $throwableString'); + if (openCompleter.isCompleted) { + _events.addError(error); + return; + } + openCompleter.completeError(error); + }, + )))); + + return openCompleter.future; + } + + @override + Future close([int? code, String? reason]) async { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + + if (code != null && code != 1000 && !(code >= 3000 && code <= 4999)) { + throw ArgumentError('Invalid argument: $code, close code must be 1000 or ' + 'in the range 3000-4999'); + } + if (reason != null && utf8.encode(reason).length > 123) { + throw ArgumentError.value(reason, 'reason', + 'reason must be <= 123 bytes long when encoded as UTF-8'); + } + + unawaited(_events.close()); + + // When no code is provided, cause an abnormal closure to send 1005. + if (code == null) { + _webSocket.cancel(); + return; + } + + _webSocket.close( + code, reason?.toJString() ?? JString.fromReference(jNullReference)); + } + + @override + Stream get events => _events.stream; + + @override + String get protocol => _protocol ?? ''; + + @override + void sendBytes(Uint8List b) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + _webSocket.send$1(bindings.ByteString.of(b.toJArray())); + } + + @override + void sendText(String s) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + _webSocket.send(s.toJString()); + } + + /// Closes the OkHttpClient using the recommended shutdown procedure. + /// + /// https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/index.html#:~:text=Shutdown + void _okHttpClientClose() { + _client.dispatcher().executorService().shutdown(); + _client.connectionPool().evictAll(); + var cache = _client.cache(); + if (!cache.isNull) { + cache.close(); + } + _client.release(); + } +} + +extension on Uint8List { + JArray toJArray() => + JArray(jbyte.type, length)..setRange(0, length, this); +} + +extension on JArray { + Uint8List toUint8List({int? length}) => + getRange(0, length ?? this.length).buffer.asUint8List(); +} diff --git a/pkgs/ok_http/pubspec.yaml b/pkgs/ok_http/pubspec.yaml new file mode 100644 index 0000000000..7476f28bdd --- /dev/null +++ b/pkgs/ok_http/pubspec.yaml @@ -0,0 +1,28 @@ +name: ok_http +version: 0.1.1-wip +description: >- + An Android Flutter plugin that provides access to the OkHttp HTTP client. +repository: https://github.com/dart-lang/http/tree/master/pkgs/ok_http + +environment: + sdk: ^3.4.0 + flutter: ">=3.22.0" + +dependencies: + flutter: + sdk: flutter + http: ^1.2.1 + http_profile: ^0.1.0 + jni: ^0.12.2 + plugin_platform_interface: ^2.0.2 + web_socket: ^0.1.5 + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + jnigen: ^0.12.2 + +flutter: + plugin: + platforms: + android: + ffiPlugin: true diff --git a/pkgs/web_socket/CHANGELOG.md b/pkgs/web_socket/CHANGELOG.md new file mode 100644 index 0000000000..fd421d76ce --- /dev/null +++ b/pkgs/web_socket/CHANGELOG.md @@ -0,0 +1,32 @@ +## 0.1.6 + +- Allow `web: '>=0.5.0 <2.0.0'`. + +## 0.1.5 + +- Allow `1000` as a close code. + +## 0.1.4 + +- Add a `fakes` function that returns a pair of `WebSocket`s useful in + testing. + +## 0.1.3 + +- Bring the behavior in line with the documentation by throwing + `WebSocketConnectionClosed` rather `StateError` when attempting to send + data to or close an already closed `WebSocket`. + +## 0.1.2 + +- Fix a `StateError` in `IOWebSocket` when data is received from the peer + after the connection has been closed locally. + +## 0.1.1 + +- Add the ability to create a `package:web_socket` `WebSocket` given a + `dart:io` `WebSocket`. + +## 0.1.0 + +- Basic functionality in place. diff --git a/pkgs/web_socket/LICENSE b/pkgs/web_socket/LICENSE new file mode 100644 index 0000000000..e5b2b46dcf --- /dev/null +++ b/pkgs/web_socket/LICENSE @@ -0,0 +1,27 @@ +Copyright 2024, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. diff --git a/pkgs/web_socket/README.md b/pkgs/web_socket/README.md new file mode 100644 index 0000000000..1356d9c1e3 --- /dev/null +++ b/pkgs/web_socket/README.md @@ -0,0 +1,67 @@ +[![pub package](https://img.shields.io/pub/v/web_socket.svg)](https://pub.dev/packages/web_socket) +[![package publisher](https://img.shields.io/pub/publisher/web_socket.svg)](https://pub.dev/packages/web_socket/publisher) + +Any easy-to-use library for communicating with +[WebSockets](https://en.wikipedia.org/wiki/WebSocket) that has multiple +implementations. + +## Why another WebSocket package? + +The goal of `package:web_socket` is to provide a simple, well-defined +[WebSockets](https://en.wikipedia.org/wiki/WebSocket) interface that has +consistent behavior across implementations. + +[`package:web_socket_channel`](https://pub.dev/documentation/web_socket_channel/) +is currently the most popular WebSocket package. It has +two implementations, one based on `package:web` and the other based on +`dart:io` `WebSocket`. But those implementations do not have consistent +behavior. + +[`WebSocket`](https://pub.dev/documentation/web_socket/latest/web_socket/WebSocket-class.html) +currently has three implementations (with more on the way) that +all pass the same set of +[conformance tests](https://github.com/dart-lang/http/tree/master/pkgs/web_socket_conformance_tests): + +* [`BrowserWebSocket`](https://pub.dev/documentation/web_socket/latest/browser_web_socket/BrowserWebSocket-class.html) +* [`CupertinoWebSocket`](https://pub.dev/documentation/cupertino_http/latest/cupertino_http/CupertinoWebSocket-class.html) +* [`IOWebSocket`](https://pub.dev/documentation/web_socket/latest/io_web_socket/IOWebSocket-class.html) + +## Using + +```dart +import 'package:web_socket/web_socket.dart'; + +void main() async { + final socket = + await WebSocket.connect(Uri.parse('wss://ws.postman-echo.com/raw')); + + socket.events.listen((e) async { + switch (e) { + case TextDataReceived(text: final text): + print('Received Text: $text'); + await socket.close(); + case BinaryDataReceived(data: final data): + print('Received Binary: $data'); + case CloseReceived(code: final code, reason: final reason): + print('Connection to server closed: $code [$reason]'); + } + }); + + socket.sendText('Hello Dart WebSockets! 🎉'); +} +``` + +## Status: experimental + +**NOTE**: This package is currently experimental and published under the +[labs.dart.dev](https://dart.dev/dart-team-packages) pub publisher in order to +solicit feedback. + +For packages in the labs.dart.dev publisher we generally plan to either graduate +the package into a supported publisher (dart.dev, tools.dart.dev) after a period +of feedback and iteration, or discontinue the package. These packages have a +much higher expected rate of API and breaking changes. + +Your feedback is valuable and will help us evolve this package. For general +feedback, suggestions, and comments, please file an issue in the +[bug tracker](https://github.com/dart-lang/http/issues). diff --git a/pkgs/web_socket/example/web_socket_example.dart b/pkgs/web_socket/example/web_socket_example.dart new file mode 100644 index 0000000000..423b2016ed --- /dev/null +++ b/pkgs/web_socket/example/web_socket_example.dart @@ -0,0 +1,40 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:web_socket/web_socket.dart'; + +const requestId = 305; + +/// Prints the US dollar value of Bitcoins continuously. +void main() async { + // Whitebit public WebSocket API documentation: + // https://docs.whitebit.com/public/websocket/ + final socket = + await WebSocket.connect(Uri.parse('wss://api.whitebit.com/ws')); + + socket.events.listen((e) { + switch (e) { + case TextDataReceived(text: final text): + final json = jsonDecode(text) as Map; + if (json['id'] == requestId) { + if (json['error'] != null) { + stderr.writeln('Failure: ${json['error']}'); + socket.close(); + } + } else { + final params = (json['params'] as List).cast>(); + print('₿1 = USD\$${params[0][2]}'); + } + case BinaryDataReceived(): + stderr.writeln('Unexpected binary response from server'); + socket.close(); + case CloseReceived(): + stderr.writeln('Connection to server closed'); + } + }); + socket.sendText(jsonEncode({ + 'id': requestId, + 'method': 'candles_subscribe', + 'params': ['BTC_USD', 5] + })); +} diff --git a/pkgs/web_socket/lib/browser_web_socket.dart b/pkgs/web_socket/lib/browser_web_socket.dart new file mode 100644 index 0000000000..e418d3d827 --- /dev/null +++ b/pkgs/web_socket/lib/browser_web_socket.dart @@ -0,0 +1,5 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'src/browser_web_socket.dart' show BrowserWebSocket; diff --git a/pkgs/web_socket/lib/io_web_socket.dart b/pkgs/web_socket/lib/io_web_socket.dart new file mode 100644 index 0000000000..674dda11dc --- /dev/null +++ b/pkgs/web_socket/lib/io_web_socket.dart @@ -0,0 +1,5 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'src/io_web_socket.dart' show IOWebSocket; diff --git a/pkgs/web_socket/lib/src/browser_web_socket.dart b/pkgs/web_socket/lib/src/browser_web_socket.dart new file mode 100644 index 0000000000..fc66628b7a --- /dev/null +++ b/pkgs/web_socket/lib/src/browser_web_socket.dart @@ -0,0 +1,148 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:js_interop'; +import 'dart:typed_data'; + +import 'package:web/web.dart' as web; + +import '../web_socket.dart'; +import 'utils.dart'; + +/// A [WebSocket] using the browser WebSocket API. +/// +/// Usable when targeting the browser using either JavaScript or WASM. +class BrowserWebSocket implements WebSocket { + final web.WebSocket _webSocket; + final _events = StreamController(); + + /// Create a new WebSocket connection using the JavaScript WebSocket API. + /// + /// The URL supplied in [url] must use the scheme ws or wss. + /// + /// If provided, the [protocols] argument indicates that subprotocols that + /// the peer is able to select. See + /// [RFC-6455 1.9](https://datatracker.ietf.org/doc/html/rfc6455#section-1.9). + static Future connect(Uri url, + {Iterable? protocols}) async { + if (!url.isScheme('ws') && !url.isScheme('wss')) { + throw ArgumentError.value( + url, 'url', 'only ws: and wss: schemes are supported'); + } + + final webSocket = web.WebSocket(url.toString(), + protocols?.map((e) => e.toJS).toList().toJS ?? JSArray()) + ..binaryType = 'arraybuffer'; + final browserSocket = BrowserWebSocket._(webSocket); + final webSocketConnected = Completer(); + + if (webSocket.readyState == web.WebSocket.OPEN) { + webSocketConnected.complete(browserSocket); + } else { + if (webSocket.readyState == web.WebSocket.CLOSING || + webSocket.readyState == web.WebSocket.CLOSED) { + webSocketConnected.completeError(WebSocketException( + 'Unexpected WebSocket state: ${webSocket.readyState}, ' + 'expected CONNECTING (0) or OPEN (1)')); + } else { + // The socket API guarantees that only a single open event will be + // emitted. + unawaited(webSocket.onOpen.first.then((_) { + webSocketConnected.complete(browserSocket); + })); + } + } + + unawaited(webSocket.onError.first.then((e) { + // Unfortunately, the underlying WebSocket API doesn't expose any + // specific information about the error itself. + if (!webSocketConnected.isCompleted) { + final error = WebSocketException('Failed to connect WebSocket'); + webSocketConnected.completeError(error); + } else { + browserSocket._closed(1006, 'error'); + } + })); + + webSocket.onMessage.listen((e) { + if (browserSocket._events.isClosed) return; + + final eventData = e.data!; + late WebSocketEvent data; + if (eventData.typeofEquals('string')) { + data = TextDataReceived((eventData as JSString).toDart); + } else if (eventData.typeofEquals('object') && + (eventData as JSObject).instanceOfString('ArrayBuffer')) { + data = BinaryDataReceived( + (eventData as JSArrayBuffer).toDart.asUint8List()); + } else { + throw StateError('unexpected message type: ${eventData.runtimeType}'); + } + browserSocket._events.add(data); + }); + + unawaited(webSocket.onClose.first.then((event) { + if (!webSocketConnected.isCompleted) { + webSocketConnected.complete(browserSocket); + } + browserSocket._closed(event.code, event.reason); + })); + + return webSocketConnected.future; + } + + void _closed(int? code, String? reason) { + if (_events.isClosed) return; + _events.add(CloseReceived(code, reason ?? '')); + unawaited(_events.close()); + } + + BrowserWebSocket._(this._webSocket); + + @override + void sendBytes(Uint8List b) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + // Silently discards the data if the connection is closed. + _webSocket.send(b.jsify()!); + } + + @override + void sendText(String s) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + // Silently discards the data if the connection is closed. + _webSocket.send(s.jsify()!); + } + + @override + Future close([int? code, String? reason]) async { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + + checkCloseCode(code); + checkCloseReason(reason); + + unawaited(_events.close()); + if ((code, reason) case (final closeCode?, final closeReason?)) { + _webSocket.close(closeCode, closeReason); + } else if (code case final closeCode?) { + _webSocket.close(closeCode); + } else { + _webSocket.close(); + } + } + + @override + Stream get events => _events.stream; + + @override + String get protocol => _webSocket.protocol; +} + +const connect = BrowserWebSocket.connect; diff --git a/pkgs/web_socket/lib/src/connect_stub.dart b/pkgs/web_socket/lib/src/connect_stub.dart new file mode 100644 index 0000000000..3a420deeec --- /dev/null +++ b/pkgs/web_socket/lib/src/connect_stub.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import '../web_socket.dart'; + +Future connect(Uri url, {Iterable? protocols}) { + throw UnsupportedError('Cannot connect without dart:js_interop or dart:io.'); +} diff --git a/pkgs/web_socket/lib/src/fake_web_socket.dart b/pkgs/web_socket/lib/src/fake_web_socket.dart new file mode 100644 index 0000000000..1e4d07198a --- /dev/null +++ b/pkgs/web_socket/lib/src/fake_web_socket.dart @@ -0,0 +1,123 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:typed_data'; + +import '../web_socket.dart'; +import 'utils.dart'; +import 'web_socket.dart'; + +class FakeWebSocket implements WebSocket { + late FakeWebSocket _other; + + final String _protocol; + final _events = StreamController(); + + FakeWebSocket(this._protocol); + + @override + Future close([int? code, String? reason]) async { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + + checkCloseCode(code); + checkCloseReason(reason); + + unawaited(_events.close()); + if (!_other._events.isClosed) { + _other._events.add(CloseReceived(code ?? 1005, reason ?? '')); + unawaited(_other._events.close()); + } + } + + @override + Stream get events => _events.stream; + + @override + String get protocol => _protocol; + + @override + void sendBytes(Uint8List b) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + if (_other._events.isClosed) return; + _other._events.add(BinaryDataReceived(b)); + } + + @override + void sendText(String s) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + if (_other._events.isClosed) return; + _other._events.add(TextDataReceived(s)); + } +} + +/// Create a pair of fake [WebSocket]s that are connected to each other. +/// +/// Sending a message on one [WebSocket] will result in that same message being +/// received by the other. +/// +/// This can be useful in constructing tests. +/// +/// For example: +/// +/// ```dart +/// import 'dart:async'; +/// +/// import 'package:test/test.dart'; +/// import 'package:web_socket/src/web_socket.dart'; +/// import 'package:web_socket/testing.dart'; +/// import 'package:web_socket/web_socket.dart'; +/// +/// Future fakeTimeServer(WebSocket webSocket, String time) async { +/// await webSocket.events.forEach((event) { +/// switch (event) { +/// case TextDataReceived(): +/// case BinaryDataReceived(): +/// webSocket.sendText(time); +/// case CloseReceived(): +/// } +/// }); +/// } +/// +/// Future getTime(WebSocket webSocket) async { +/// webSocket.sendText(''); +/// final time = switch (await webSocket.events.first) { +/// TextDataReceived(:final text) => DateTime.parse(text), +/// _ => throw Exception('unexpected response') +/// }; +/// await webSocket.close(); +/// return time; +/// } +/// +/// void main() async { +/// late WebSocket client; +/// late WebSocket server; +/// +/// setUp(() { +/// (client, server) = fakes(); +/// }); +/// +/// test('test valid time', () async { +/// unawaited(fakeTimeServer(server, '2024-05-15T01:18:10.456Z')); +/// expect( +/// await getTime(client), +/// DateTime.parse('2024-05-15T01:18:10.456Z')); +/// }); +/// } +/// ``` +(WebSocket, WebSocket) fakes({String protocol = ''}) { + final peer1 = FakeWebSocket(protocol); + final peer2 = FakeWebSocket(protocol); + + peer1._other = peer2; + peer2._other = peer1; + + return (peer1, peer2); +} diff --git a/pkgs/web_socket/lib/src/io_web_socket.dart b/pkgs/web_socket/lib/src/io_web_socket.dart new file mode 100644 index 0000000000..7ea084bec3 --- /dev/null +++ b/pkgs/web_socket/lib/src/io_web_socket.dart @@ -0,0 +1,126 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io' as io; +import 'dart:typed_data'; + +import 'utils.dart'; +import 'web_socket.dart'; + +/// A `dart-io`-based [WebSocket] implementation. +/// +/// Usable when targeting native platforms. +class IOWebSocket implements WebSocket { + final io.WebSocket _webSocket; + final _events = StreamController(); + + /// Create a new WebSocket connection using dart:io WebSocket. + /// + /// The URL supplied in [url] must use the scheme ws or wss. + /// + /// If provided, the [protocols] argument indicates that subprotocols that + /// the peer is able to select. See + /// [RFC-6455 1.9](https://datatracker.ietf.org/doc/html/rfc6455#section-1.9). + static Future connect(Uri url, + {Iterable? protocols}) async { + if (!url.isScheme('ws') && !url.isScheme('wss')) { + throw ArgumentError.value( + url, 'url', 'only ws: and wss: schemes are supported'); + } + + final io.WebSocket webSocket; + try { + webSocket = + await io.WebSocket.connect(url.toString(), protocols: protocols); + } on io.WebSocketException catch (e) { + throw WebSocketException(e.message); + } + + if (webSocket.protocol != null && + !(protocols ?? []).contains(webSocket.protocol)) { + // dart:io WebSocket does not correctly validate the returned protocol. + // See https://github.com/dart-lang/sdk/issues/55106 + await webSocket.close(1002); // protocol error + throw WebSocketException( + 'unexpected protocol selected by peer: ${webSocket.protocol}'); + } + return IOWebSocket._(webSocket); + } + + // Create an `IOWebSocket` from an existing `dart:io` `WebSocket`. + factory IOWebSocket.fromWebSocket(io.WebSocket webSocket) => + IOWebSocket._(webSocket); + + IOWebSocket._(this._webSocket) { + _webSocket.listen( + (event) { + if (_events.isClosed) return; + switch (event) { + case String e: + _events.add(TextDataReceived(e)); + case List e: + _events.add(BinaryDataReceived(Uint8List.fromList(e))); + } + }, + onError: (Object e, StackTrace st) { + if (_events.isClosed) return; + final wse = switch (e) { + io.WebSocketException(message: final message) => + WebSocketException(message), + _ => WebSocketException(e.toString()), + }; + _events.addError(wse, st); + }, + onDone: () { + if (_events.isClosed) return; + _events + ..add( + CloseReceived(_webSocket.closeCode, _webSocket.closeReason ?? '')) + ..close(); + }, + ); + } + + @override + void sendBytes(Uint8List b) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + _webSocket.add(b); + } + + @override + void sendText(String s) { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + _webSocket.add(s); + } + + @override + Future close([int? code, String? reason]) async { + if (_events.isClosed) { + throw WebSocketConnectionClosed(); + } + + checkCloseCode(code); + checkCloseReason(reason); + + unawaited(_events.close()); + try { + await _webSocket.close(code, reason); + } on io.WebSocketException catch (e) { + throw WebSocketException(e.message); + } + } + + @override + Stream get events => _events.stream; + + @override + String get protocol => _webSocket.protocol ?? ''; +} + +const connect = IOWebSocket.connect; diff --git a/pkgs/web_socket/lib/src/utils.dart b/pkgs/web_socket/lib/src/utils.dart new file mode 100644 index 0000000000..7331840f62 --- /dev/null +++ b/pkgs/web_socket/lib/src/utils.dart @@ -0,0 +1,21 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; + +/// Throw if the given close code is not valid. +void checkCloseCode(int? code) { + if (code != null && code != 1000 && !(code >= 3000 && code <= 4999)) { + throw ArgumentError('Invalid argument: $code, close code must be 1000 or ' + 'in the range 3000-4999'); + } +} + +/// Throw if the given close reason is not valid. +void checkCloseReason(String? reason) { + if (reason != null && utf8.encode(reason).length > 123) { + throw ArgumentError.value(reason, 'reason', + 'reason must be <= 123 bytes long when encoded as UTF-8'); + } +} diff --git a/pkgs/web_socket/lib/src/web_socket.dart b/pkgs/web_socket/lib/src/web_socket.dart new file mode 100644 index 0000000000..255c6e6c6d --- /dev/null +++ b/pkgs/web_socket/lib/src/web_socket.dart @@ -0,0 +1,187 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:typed_data'; + +import 'connect_stub.dart' + if (dart.library.js_interop) 'browser_web_socket.dart' + if (dart.library.io) 'io_web_socket.dart' as connector; + +/// An event received from the peer through the [WebSocket]. +sealed class WebSocketEvent {} + +/// Text data received from the peer through the [WebSocket]. +/// +/// See [WebSocket.events]. +final class TextDataReceived extends WebSocketEvent { + final String text; + TextDataReceived(this.text); + + @override + bool operator ==(Object other) => + other is TextDataReceived && other.text == text; + + @override + int get hashCode => text.hashCode; +} + +/// Binary data received from the peer through the [WebSocket]. +/// +/// See [WebSocket.events]. +final class BinaryDataReceived extends WebSocketEvent { + final Uint8List data; + BinaryDataReceived(this.data); + + @override + bool operator ==(Object other) { + if (other is BinaryDataReceived && other.data.length == data.length) { + for (var i = 0; i < data.length; ++i) { + if (other.data[i] != data[i]) return false; + } + return true; + } + return false; + } + + @override + int get hashCode => data.hashCode; + + @override + String toString() => 'BinaryDataReceived($data)'; +} + +/// A close notification (Close frame) received from the peer through the +/// [WebSocket] or a failure indication. +/// +/// See [WebSocket.events]. +final class CloseReceived extends WebSocketEvent { + /// A numerical code indicating the reason why the WebSocket was closed. + /// + /// See [RFC-6455 7.4](https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4) + /// for guidance on how to interpret these codes. + final int? code; + + /// A textual explanation of the reason why the WebSocket was closed. + /// + /// Will be empty if the peer did not specify a reason. + final String reason; + + CloseReceived([this.code, this.reason = '']); + + @override + bool operator ==(Object other) => + other is CloseReceived && other.code == code && other.reason == reason; + + @override + int get hashCode => [code, reason].hashCode; + + @override + String toString() => 'CloseReceived($code, $reason)'; +} + +class WebSocketException implements Exception { + final String message; + WebSocketException([this.message = '']); +} + +/// Thrown if [WebSocket.sendText], [WebSocket.sendBytes], or +/// [WebSocket.close] is called when the [WebSocket] is closed. +class WebSocketConnectionClosed extends WebSocketException { + WebSocketConnectionClosed([super.message = 'Connection Closed']); +} + +/// The interface for WebSocket connections. +/// +/// ```dart +/// import 'package:web_socket/src/web_socket.dart'; +/// +/// void main() async { +/// final socket = +/// await WebSocket.connect(Uri.parse('wss://ws.postman-echo.com/raw')); +/// +/// socket.events.listen((e) async { +/// switch (e) { +/// case TextDataReceived(text: final text): +/// print('Received Text: $text'); +/// await socket.close(); +/// case BinaryDataReceived(data: final data): +/// print('Received Binary: $data'); +/// case CloseReceived(code: final code, reason: final reason): +/// print('Connection to server closed: $code [$reason]'); +/// } +/// }); +/// +/// socket.sendText('Hello Dart WebSockets! 🎉'); +/// } +abstract interface class WebSocket { + /// Create a new WebSocket connection. + /// + /// The URL supplied in [url] must use the scheme ws or wss. + /// + /// If provided, the [protocols] argument indicates that subprotocols that + /// the peer is able to select. See + /// [RFC-6455 1.9](https://datatracker.ietf.org/doc/html/rfc6455#section-1.9). + static Future connect(Uri url, {Iterable? protocols}) => + connector.connect(url, protocols: protocols); + + /// Sends text data to the connected peer. + /// + /// Throws [WebSocketConnectionClosed] if the [WebSocket] is + /// closed (either through [close] or by the peer). + /// + /// Data sent through [sendText] will be silently discarded if the peer is + /// disconnected but the disconnect has not yet been detected. + void sendText(String s); + + /// Sends binary data to the connected peer. + /// + /// Throws [WebSocketConnectionClosed] if the [WebSocket] is + /// closed (either through [close] or by the peer). + /// + /// Data sent through [sendBytes] will be silently discarded if the peer is + /// disconnected but the disconnect has not yet been detected. + void sendBytes(Uint8List b); + + /// Closes the WebSocket connection and the [events] `Stream`. + /// + /// Sends a Close frame to the peer. If the optional [code] and [reason] + /// arguments are given, they will be included in the Close frame. If no + /// [code] is set then the peer will see a 1005 status code. If no [reason] + /// is set then the peer will not receive a reason string. + /// + /// Throws an [ArgumentError] if [code] is not 1000 or in the range 3000-4999. + /// + /// Throws an [ArgumentError] if [reason] is longer than 123 bytes when + /// encoded as UTF-8 + /// + /// Throws [WebSocketConnectionClosed] if the connection is already + /// closed (including by the peer). + Future close([int? code, String? reason]); + + /// A [Stream] of [WebSocketEvent] received from the peer. + /// + /// Data received by the peer will be delivered as a [TextDataReceived] or + /// [BinaryDataReceived]. + /// + /// If a [CloseReceived] event is received then the [Stream] will be closed. A + /// [CloseReceived] event indicates either that: + /// + /// - A close frame was received from the peer. [CloseReceived.code] and + /// [CloseReceived.reason] will be set by the peer. + /// - A failure occurred (e.g. the peer disconnected). [CloseReceived.code] + /// and [CloseReceived.reason] will be a failure code defined by + /// (RFC-6455)[https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1] + /// (e.g. 1006). + /// + /// Errors will never appear in this [Stream]. + Stream get events; + + /// The WebSocket subprotocol negotiated with the peer. + /// + /// Will be the empty string if no subprotocol was negotiated. + /// + /// See + /// [RFC-6455 1.9](https://datatracker.ietf.org/doc/html/rfc6455#section-1.9). + String get protocol; +} diff --git a/pkgs/web_socket/lib/testing.dart b/pkgs/web_socket/lib/testing.dart new file mode 100644 index 0000000000..669bf1dfb3 --- /dev/null +++ b/pkgs/web_socket/lib/testing.dart @@ -0,0 +1 @@ +export 'src/fake_web_socket.dart' show fakes; diff --git a/pkgs/web_socket/lib/web_socket.dart b/pkgs/web_socket/lib/web_socket.dart new file mode 100644 index 0000000000..33c8fec00e --- /dev/null +++ b/pkgs/web_socket/lib/web_socket.dart @@ -0,0 +1,5 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'src/web_socket.dart'; diff --git a/pkgs/web_socket/mono_pkg.yaml b/pkgs/web_socket/mono_pkg.yaml new file mode 100644 index 0000000000..13baee341e --- /dev/null +++ b/pkgs/web_socket/mono_pkg.yaml @@ -0,0 +1,17 @@ +sdk: +- pubspec +- dev + +stages: +- analyze_and_format: + - analyze: --fatal-infos + - format: + sdk: + - dev +- unit_test: + - test: --test-randomize-ordering-seed=random -p vm + os: + - linux + - test: --test-randomize-ordering-seed=random -p chrome -c dart2js + os: + - linux diff --git a/pkgs/web_socket/pubspec.yaml b/pkgs/web_socket/pubspec.yaml new file mode 100644 index 0000000000..57d243ed80 --- /dev/null +++ b/pkgs/web_socket/pubspec.yaml @@ -0,0 +1,18 @@ +name: web_socket +description: >- + Any easy-to-use library for communicating with WebSockets + that has multiple implementations. +repository: https://github.com/dart-lang/http/tree/master/pkgs/web_socket +version: 0.1.6 + +environment: + sdk: ^3.4.0 + +dependencies: + web: '>=0.5.0 <2.0.0' + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + test: ^1.24.0 + web_socket_conformance_tests: + path: ../web_socket_conformance_tests/ diff --git a/pkgs/web_socket/test/browser_web_socket_conformance_test.dart b/pkgs/web_socket/test/browser_web_socket_conformance_test.dart new file mode 100644 index 0000000000..2105a45508 --- /dev/null +++ b/pkgs/web_socket/test/browser_web_socket_conformance_test.dart @@ -0,0 +1,14 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('browser') +library; + +import 'package:test/test.dart'; +import 'package:web_socket/browser_web_socket.dart'; +import 'package:web_socket_conformance_tests/web_socket_conformance_tests.dart'; + +void main() { + testAll(BrowserWebSocket.connect); +} diff --git a/pkgs/web_socket/test/fake_web_socket_test.dart b/pkgs/web_socket/test/fake_web_socket_test.dart new file mode 100644 index 0000000000..3cef748cf8 --- /dev/null +++ b/pkgs/web_socket/test/fake_web_socket_test.dart @@ -0,0 +1,59 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:web_socket/src/fake_web_socket.dart'; +import 'package:web_socket/web_socket.dart'; +import 'package:web_socket_conformance_tests/web_socket_conformance_tests.dart'; + +/// Forward data received from [from] to [to]. +void proxy(WebSocket from, WebSocket to) { + from.events.listen((event) { + try { + switch (event) { + case TextDataReceived(:final text): + to.sendText(text); + case BinaryDataReceived(:final data): + to.sendBytes(data); + case CloseReceived(:var code, :final reason): + if (code != null && code != 1000 && (code < 3000 || code > 4999)) { + code = null; + } + to.close(code, reason); + } + } on WebSocketConnectionClosed { + // `to` may have been closed locally so ignore failures to forward the + // data. + } + }); +} + +/// Create a bidirectional proxy relationship between [a] and [b]. +/// +/// That means that events received by [a] will be forwarded to [b] and +/// vise-versa. +void bidirectionalProxy(WebSocket a, WebSocket b) { + proxy(a, b); + proxy(b, a); +} + +void main() { + // In order to use `testAll`, we need to provide a method that will connect + // to a real WebSocket server. + // + // The approach is to connect to the server with a real WebSocket and forward + // the data received by that data to one of the fakes. + // + // Like: + // + // 'hello' sendText('hello') TextDataReceived('hello') + // [Server] -> [realClient] -> [FakeServer] -> [fakeClient] + Future connect(Uri url, {Iterable? protocols}) async { + final realClient = await WebSocket.connect(url, protocols: protocols); + final (fakeServer, fakeClient) = fakes(protocol: realClient.protocol); + bidirectionalProxy(realClient, fakeServer); + return fakeClient; + } + + testAll(connect); +} diff --git a/pkgs/web_socket/test/io_web_socket_conformance_test.dart b/pkgs/web_socket/test/io_web_socket_conformance_test.dart new file mode 100644 index 0000000000..cc313a6a0d --- /dev/null +++ b/pkgs/web_socket/test/io_web_socket_conformance_test.dart @@ -0,0 +1,14 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('vm') +library; + +import 'package:test/test.dart'; +import 'package:web_socket/io_web_socket.dart'; +import 'package:web_socket_conformance_tests/web_socket_conformance_tests.dart'; + +void main() { + testAll(IOWebSocket.connect); +} diff --git a/pkgs/web_socket/test/io_web_socket_test.dart b/pkgs/web_socket/test/io_web_socket_test.dart new file mode 100644 index 0000000000..a0ee671ddd --- /dev/null +++ b/pkgs/web_socket/test/io_web_socket_test.dart @@ -0,0 +1,40 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@TestOn('vm') +library; + +import 'dart:io' as io; + +import 'package:test/test.dart'; +import 'package:web_socket/io_web_socket.dart'; +import 'package:web_socket/web_socket.dart'; + +void main() { + group('fromWebSocket', () { + late final io.HttpServer server; + late io.HttpHeaders headers; + late Uri uri; + + setUp(() async { + server = (await io.HttpServer.bind('localhost', 0)) + ..listen((request) async { + headers = request.headers; + await io.WebSocketTransformer.upgrade(request) + .then((webSocket) => webSocket.listen(webSocket.add)); + }); + uri = Uri.parse('ws://localhost:${server.port}'); + }); + + test('custom headers', () async { + final ws = IOWebSocket.fromWebSocket(await io.WebSocket.connect( + uri.toString(), + headers: {'fruit': 'apple'})); + expect(headers['fruit'], ['apple']); + ws.sendText('Hello World!'); + expect(await ws.events.first, TextDataReceived('Hello World!')); + await ws.close(); + }); + }); +} diff --git a/pkgs/web_socket/test/websocket_test.dart b/pkgs/web_socket/test/websocket_test.dart new file mode 100644 index 0000000000..859e4fe636 --- /dev/null +++ b/pkgs/web_socket/test/websocket_test.dart @@ -0,0 +1,10 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:web_socket/web_socket.dart'; +import 'package:web_socket_conformance_tests/web_socket_conformance_tests.dart'; + +void main() { + testAll(WebSocket.connect); +} diff --git a/pkgs/web_socket_conformance_tests/.gitattributes b/pkgs/web_socket_conformance_tests/.gitattributes new file mode 100644 index 0000000000..104d0ecaf9 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/.gitattributes @@ -0,0 +1,2 @@ +lib/src/*_server_vm.dart linguist-generated=true +lib/src/*_server_web.dart linguist-generated=true diff --git a/pkgs/web_socket_conformance_tests/LICENSE b/pkgs/web_socket_conformance_tests/LICENSE new file mode 100644 index 0000000000..e5b2b46dcf --- /dev/null +++ b/pkgs/web_socket_conformance_tests/LICENSE @@ -0,0 +1,27 @@ +Copyright 2024, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of Google LLC 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. diff --git a/pkgs/web_socket_conformance_tests/README.md b/pkgs/web_socket_conformance_tests/README.md new file mode 100644 index 0000000000..deabae0c55 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/README.md @@ -0,0 +1,35 @@ +[![pub package](https://img.shields.io/pub/v/web_socket_conformance_tests.svg)](https://pub.dev/packages/web_socket_conformance_tests) + +A library that tests whether implementations of `package:web_socket` +`WebSocket` behave as expected. + +This package is intended to be used in the tests of packages that implement +`package:web_socket` `Socket`. + +The tests work by starting a series of test servers and running the provided +`package:web_socket` `WebSocket` against them. + +## Usage + +`package:web_socket_conformance_tests` is meant to be used in the tests suite +of a `package:web_socket` `WebSocket` like: + +```dart +import 'package:web_socket/web_socket.dart'; +import 'package:test/test.dart'; + +import 'package:web_socket_conformance_tests/web_socket_conformance_tests.dart'; + +class MyWebSocket implements WebSocket { + // Your implementation here. +} + +void main() { + group('WebSocket conformance tests', () { + testAll(MyWebSocket()); + }); +} +``` + +**Note**: This package does not have its own tests, instead it is +exercised by the tests in `package:web_socket`. diff --git a/pkgs/web_socket_conformance_tests/bin/generate_server_wrappers.dart b/pkgs/web_socket_conformance_tests/bin/generate_server_wrappers.dart new file mode 100644 index 0000000000..045b7ba3f5 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/bin/generate_server_wrappers.dart @@ -0,0 +1,52 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Generates the '*_server_vm.dart' and '*_server_web.dart' support files. +library; + +import 'dart:core'; +import 'dart:io'; + +import 'package:dart_style/dart_style.dart'; + +const vm = '''// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import ''; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} +'''; + +const web = '''// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'web_socket_conformance_tests/src/')); +'''; + +void main() async { + final files = await Directory('lib/src').list().toList(); + final formatter = + DartFormatter(languageVersion: DartFormatter.latestLanguageVersion); + + files.where((file) => file.path.endsWith('_server.dart')).forEach((file) { + final vmPath = file.path.replaceAll('_server.dart', '_server_vm.dart'); + File(vmPath).writeAsStringSync(formatter.format(vm.replaceAll( + '', file.uri.pathSegments.last))); + + final webPath = file.path.replaceAll('_server.dart', '_server_web.dart'); + File(webPath).writeAsStringSync(formatter.format(web.replaceAll( + '', file.uri.pathSegments.last))); + }); +} diff --git a/pkgs/web_socket_conformance_tests/example/client_test.dart b/pkgs/web_socket_conformance_tests/example/client_test.dart new file mode 100644 index 0000000000..d08dad94c1 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/example/client_test.dart @@ -0,0 +1,32 @@ +import 'dart:typed_data'; + +import 'package:test/test.dart'; +import 'package:web_socket/web_socket.dart'; +import 'package:web_socket_conformance_tests/web_socket_conformance_tests.dart'; + +class MyWebSocketImplementation implements WebSocket { + static Future connect(Uri uri, + {Iterable? protocols}) async => + MyWebSocketImplementation(); + + @override + Future close([int? code, String? reason]) => throw UnimplementedError(); + + @override + Stream get events => throw UnimplementedError(); + + @override + void sendBytes(Uint8List b) => throw UnimplementedError(); + + @override + void sendText(String s) => throw UnimplementedError(); + + @override + String get protocol => throw UnimplementedError(); +} + +void main() { + group('client conformance tests', () { + testAll(MyWebSocketImplementation.connect); + }); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/close_local_server.dart b/pkgs/web_socket_conformance_tests/lib/src/close_local_server.dart new file mode 100644 index 0000000000..8991de3cc8 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/close_local_server.dart @@ -0,0 +1,33 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an WebSocket server that waits for the peer to send a Close frame. +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + final webSocket = await WebSocketTransformer.upgrade( + request, + ); + + webSocket.listen((event) { + channel.sink.add(event); + }, onDone: () { + webSocket.close(4123, 'server closed the connection'); + channel.sink.add(webSocket.closeCode); + channel.sink.add(webSocket.closeReason); + }); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/close_local_server_vm.dart b/pkgs/web_socket_conformance_tests/lib/src/close_local_server_vm.dart new file mode 100644 index 0000000000..c0d0652326 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/close_local_server_vm.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'close_local_server.dart'; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/close_local_server_web.dart b/pkgs/web_socket_conformance_tests/lib/src/close_local_server_web.dart new file mode 100644 index 0000000000..f7bb3810a6 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/close_local_server_web.dart @@ -0,0 +1,9 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'web_socket_conformance_tests/src/close_local_server.dart')); diff --git a/pkgs/web_socket_conformance_tests/lib/src/close_local_tests.dart b/pkgs/web_socket_conformance_tests/lib/src/close_local_tests.dart new file mode 100644 index 0000000000..cf39f95eb3 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/close_local_tests.dart @@ -0,0 +1,170 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:typed_data'; + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; +import 'package:web_socket/web_socket.dart'; + +import 'close_local_server_vm.dart' + if (dart.library.html) 'close_local_server_web.dart'; + +import 'continuously_writing_server_vm.dart' + if (dart.library.html) 'continuously_writing_server_web.dart' + as writing_server; + +/// Tests that the [WebSocket] can correctly close the connection to the peer. +void testCloseLocal( + Future Function(Uri uri, {Iterable? protocols}) + channelFactory) { + group('remote writing', () { + late Uri uri; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + + setUp(() async { + httpServerChannel = await writing_server.startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + uri = Uri.parse('ws://localhost:${await httpServerQueue.next}'); + }); + tearDown(() async { + httpServerChannel.sink.add(null); + }); + + test('peer writes after close are ignored', () async { + final channel = await channelFactory(uri); + await channel.close(); + expect(await channel.events.isEmpty, true); + }); + }); + + group('local close', () { + late Uri uri; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + + setUp(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + uri = Uri.parse('ws://localhost:${await httpServerQueue.next}'); + }); + tearDown(() async { + httpServerChannel.sink.add(null); + }); + + test('reserved close code: 1004', () async { + final channel = await channelFactory(uri); + await expectLater( + () => channel.close(1004), throwsA(isA())); + }); + + test('reserved close code: 2999', () async { + final channel = await channelFactory(uri); + await expectLater( + () => channel.close(2999), throwsA(isA())); + }); + + test('reserved close code: 5000', () async { + final channel = await channelFactory(uri); + await expectLater( + () => channel.close(5000), throwsA(isA())); + }); + + test('too long close reason', () async { + final channel = await channelFactory(uri); + await expectLater(() => channel.close(3000, 'a'.padLeft(124)), + throwsA(isA())); + }); + + test('close', () async { + final channel = await channelFactory(uri); + + await channel.close(); + final closeCode = await httpServerQueue.next as int?; + final closeReason = await httpServerQueue.next as String?; + + expect(closeCode, 1005); + expect(closeReason, ''); + expect(await channel.events.isEmpty, true); + }); + + test('close with 1000', () async { + final channel = await channelFactory(uri); + + await channel.close(1000); + final closeCode = await httpServerQueue.next as int?; + final closeReason = await httpServerQueue.next as String?; + + expect(closeCode, 1000); + expect(closeReason, ''); + expect(await channel.events.isEmpty, true); + }); + + test('with code 3000', () async { + final channel = await channelFactory(uri); + + await channel.close(3000); + final closeCode = await httpServerQueue.next as int?; + final closeReason = await httpServerQueue.next as String?; + + expect(closeCode, 3000); + expect(closeReason, ''); + expect(await channel.events.isEmpty, true); + }); + + test('with code 4999', () async { + final channel = await channelFactory(uri); + + await channel.close(4999); + final closeCode = await httpServerQueue.next as int?; + final closeReason = await httpServerQueue.next as String?; + + expect(closeCode, 4999); + expect(closeReason, ''); + expect(await channel.events.isEmpty, true); + }); + + test('with code and reason', () async { + final channel = await channelFactory(uri); + + await channel.close(3000, 'Client initiated closure'); + final closeCode = await httpServerQueue.next as int?; + final closeReason = await httpServerQueue.next as String?; + + expect(closeCode, 3000); + expect(closeReason, 'Client initiated closure'); + expect(await channel.events.isEmpty, true); + }); + + test('close after close', () async { + final channel = await channelFactory(uri); + + await channel.close(3000, 'Client initiated closure'); + + await expectLater( + () async => await channel.close(3001, 'Client initiated closure'), + throwsA(isA())); + }); + + test('sendBytes after close', () async { + final channel = await channelFactory(uri); + + await channel.close(3000, 'Client initiated closure'); + + expect(() => channel.sendBytes(Uint8List(10)), + throwsA(isA())); + }); + + test('sendText after close', () async { + final channel = await channelFactory(uri); + + await channel.close(3000, 'Client initiated closure'); + + expect(() => channel.sendText('Hello World'), + throwsA(isA())); + }); + }); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/close_remote_server.dart b/pkgs/web_socket_conformance_tests/lib/src/close_remote_server.dart new file mode 100644 index 0000000000..9bbf84ed48 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/close_remote_server.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an WebSocket server that sends a Close frame after receiving any +/// data. +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + final webSocket = await WebSocketTransformer.upgrade( + request, + ); + + webSocket.listen((event) { + channel.sink.add(event); + webSocket.close(4123, 'server closed the connection'); + }); + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/close_remote_server_vm.dart b/pkgs/web_socket_conformance_tests/lib/src/close_remote_server_vm.dart new file mode 100644 index 0000000000..4cc6dba56e --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/close_remote_server_vm.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'close_remote_server.dart'; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/close_remote_server_web.dart b/pkgs/web_socket_conformance_tests/lib/src/close_remote_server_web.dart new file mode 100644 index 0000000000..6e832bacac --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/close_remote_server_web.dart @@ -0,0 +1,9 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'web_socket_conformance_tests/src/close_remote_server.dart')); diff --git a/pkgs/web_socket_conformance_tests/lib/src/close_remote_tests.dart b/pkgs/web_socket_conformance_tests/lib/src/close_remote_tests.dart new file mode 100644 index 0000000000..b7b3e5956f --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/close_remote_tests.dart @@ -0,0 +1,71 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:typed_data'; + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; +import 'package:web_socket/web_socket.dart'; + +import 'close_remote_server_vm.dart' + if (dart.library.html) 'close_remote_server_web.dart'; + +/// Tests that the [WebSocket] can correctly receive Close frames from the peer. +void testCloseRemote( + Future Function(Uri uri, {Iterable? protocols}) + channelFactory) { + group('remote close', () { + late Uri uri; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + + setUp(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + uri = Uri.parse('ws://localhost:${await httpServerQueue.next}'); + }); + tearDown(() async { + httpServerChannel.sink.add(null); + }); + + test('with code and reason', () async { + final channel = await channelFactory(uri); + + channel.sendText('Please close'); + expect(await channel.events.toList(), + [CloseReceived(4123, 'server closed the connection')]); + }); + + test('sendBytes after close received', () async { + final channel = await channelFactory(uri); + + channel.sendBytes(Uint8List(10)); + expect(await channel.events.toList(), + [CloseReceived(4123, 'server closed the connection')]); + expect(() => channel.sendText('test'), + throwsA(isA())); + }); + + test('sendText after close received', () async { + final channel = await channelFactory(uri); + + channel.sendText('Please close'); + expect(await channel.events.toList(), + [CloseReceived(4123, 'server closed the connection')]); + expect(() => channel.sendText('test'), + throwsA(isA())); + }); + + test('close after close received', () async { + final channel = await channelFactory(uri); + + channel.sendText('Please close'); + expect(await channel.events.toList(), + [CloseReceived(4123, 'server closed the connection')]); + await expectLater( + channel.close, throwsA(isA())); + }); + }); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/connect_uri_tests.dart b/pkgs/web_socket_conformance_tests/lib/src/connect_uri_tests.dart new file mode 100644 index 0000000000..0caa9e6f8c --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/connect_uri_tests.dart @@ -0,0 +1,18 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:test/test.dart'; +import 'package:web_socket/web_socket.dart'; + +/// Tests that the [WebSocket] rejects invalid connection URIs. +void testConnectUri( + Future Function(Uri uri, {Iterable? protocols}) + channelFactory) { + group('connect uri', () { + test('no protocol', () async { + await expectLater(() => channelFactory(Uri.https('www.example.com', '/')), + throwsA(isA())); + }); + }); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server.dart b/pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server.dart new file mode 100644 index 0000000000..a082d96238 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server.dart @@ -0,0 +1,25 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an WebSocket server that sends a lot of data to the peer. +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..transform(WebSocketTransformer()).listen((WebSocket webSocket) { + for (var i = 0; i < 10000; ++i) { + webSocket.add('Hello World!'); + } + }); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server_vm.dart b/pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server_vm.dart new file mode 100644 index 0000000000..51246c2dcb --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server_vm.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'continuously_writing_server.dart'; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server_web.dart b/pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server_web.dart new file mode 100644 index 0000000000..c28fe3f11c --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server_web.dart @@ -0,0 +1,9 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'web_socket_conformance_tests/src/continuously_writing_server.dart')); diff --git a/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server.dart b/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server.dart new file mode 100644 index 0000000000..965521c439 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server.dart @@ -0,0 +1,36 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; +import 'package:crypto/crypto.dart'; +import 'package:stream_channel/stream_channel.dart'; + +const _webSocketGuid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; + +/// Starts an WebSocket server that disconnects after WebSocket upgrade. +void hybridMain(StreamChannel channel) async { + late final HttpServer server; + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + var key = request.headers.value('Sec-WebSocket-Key'); + var digest = sha1.convert('$key$_webSocketGuid'.codeUnits); + var accept = base64.encode(digest.bytes); + request.response + ..statusCode = HttpStatus.switchingProtocols + ..headers.add(HttpHeaders.connectionHeader, 'Upgrade') + ..headers.add(HttpHeaders.upgradeHeader, 'websocket') + ..headers.add('Sec-WebSocket-Accept', accept); + request.response.contentLength = 0; + final socket = await request.response.detachSocket(); + socket.destroy(); + }); + + channel.sink.add(server.port); + + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server_vm.dart b/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server_vm.dart new file mode 100644 index 0000000000..0bc7426239 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server_vm.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'disconnect_after_upgrade_server.dart'; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server_web.dart b/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server_web.dart new file mode 100644 index 0000000000..9e1a13771f --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server_web.dart @@ -0,0 +1,10 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: + 'web_socket_conformance_tests/src/disconnect_after_upgrade_server.dart')); diff --git a/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_tests.dart b/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_tests.dart new file mode 100644 index 0000000000..b5f52e9503 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_tests.dart @@ -0,0 +1,42 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; +import 'package:web_socket/web_socket.dart'; + +import 'disconnect_after_upgrade_server_vm.dart' + if (dart.library.html) 'disconnect_after_upgrade_server_web.dart'; + +/// Tests that the [WebSocket] generates a correct [CloseReceived] event if +/// the peer disconnects after WebSocket upgrade. +void testDisconnectAfterUpgrade( + Future Function(Uri uri, {Iterable? protocols}) + channelFactory) { + group('disconnect', () { + late final Uri uri; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + uri = Uri.parse('ws://localhost:${await httpServerQueue.next}'); + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('disconnect after upgrade', () async { + final channel = await channelFactory(uri); + channel.sendText('test'); + expect( + (await channel.events.single as CloseReceived).code, + anyOf([ + 1002, // protocol error + 1005, // closed no status + 1006, // closed abnormal + ])); + }); + }); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/echo_server.dart b/pkgs/web_socket_conformance_tests/lib/src/echo_server.dart new file mode 100644 index 0000000000..6728507a35 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/echo_server.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an WebSocket server that echos the payload of the request. +void hybridMain(StreamChannel channel) async { + late HttpServer server; + + server = (await HttpServer.bind('localhost', 0)) + ..transform(WebSocketTransformer()) + .listen((WebSocket webSocket) => webSocket.listen(webSocket.add)); + + channel.sink.add(server.port); + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/echo_server_vm.dart b/pkgs/web_socket_conformance_tests/lib/src/echo_server_vm.dart new file mode 100644 index 0000000000..a589cc0d1c --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/echo_server_vm.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'echo_server.dart'; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/echo_server_web.dart b/pkgs/web_socket_conformance_tests/lib/src/echo_server_web.dart new file mode 100644 index 0000000000..b553554f69 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/echo_server_web.dart @@ -0,0 +1,9 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'web_socket_conformance_tests/src/echo_server.dart')); diff --git a/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server.dart b/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server.dart new file mode 100644 index 0000000000..dec194186f --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; +import 'package:stream_channel/stream_channel.dart'; + +/// Starts an WebSocket server that closes the HTTP connection before WebSocket +/// upgrade. +void hybridMain(StreamChannel channel) async { + final server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + request.response.statusCode = 200; + await request.response.close(); + }); + channel.sink.add(server.port); + + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server_vm.dart b/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server_vm.dart new file mode 100644 index 0000000000..7f8cd5cf5a --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server_vm.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'no_upgrade_server.dart'; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server_web.dart b/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server_web.dart new file mode 100644 index 0000000000..97409bc34a --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server_web.dart @@ -0,0 +1,9 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'web_socket_conformance_tests/src/no_upgrade_server.dart')); diff --git a/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_tests.dart b/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_tests.dart new file mode 100644 index 0000000000..c06955c70d --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/no_upgrade_tests.dart @@ -0,0 +1,35 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; +import 'package:web_socket/web_socket.dart'; + +import 'no_upgrade_server_vm.dart' + if (dart.library.html) 'no_upgrade_server_web.dart'; + +/// Tests that the [WebSocket] generates the correct exception if the peer +/// closes the HTTP connection before WebSocket upgrade. +void testNoUpgrade( + Future Function(Uri uri, {Iterable? protocols}) + channelFactory) { + group('no upgrade', () { + late final Uri uri; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + uri = Uri.parse('ws://localhost:${await httpServerQueue.next}'); + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('close before upgrade', () async { + await expectLater( + () => channelFactory(uri), throwsA(isA())); + }); + }); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/payload_transfer_tests.dart b/pkgs/web_socket_conformance_tests/lib/src/payload_transfer_tests.dart new file mode 100644 index 0000000000..6b04b91bb5 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/payload_transfer_tests.dart @@ -0,0 +1,102 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:typed_data'; + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; +import 'package:web_socket/web_socket.dart'; + +import 'echo_server_vm.dart' if (dart.library.html) 'echo_server_web.dart'; + +/// Tests that the [WebSocket] can correctly transmit and receive text +/// and binary payloads. +void testPayloadTransfer( + Future Function(Uri uri, {Iterable? protocols}) + webSocketFactory) { + group('payload transfer', () { + late Uri uri; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + late WebSocket webSocket; + + setUp(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + uri = Uri.parse('ws://localhost:${await httpServerQueue.next}'); + webSocket = await webSocketFactory(uri); + }); + tearDown(() async { + httpServerChannel.sink.add(null); + await webSocket.close(); + }); + + test('empty string request and response', () async { + webSocket.sendText(''); + expect(await webSocket.events.first, TextDataReceived('')); + }); + + test('empty binary request and response', () async { + webSocket.sendBytes(Uint8List(0)); + expect(await webSocket.events.first, BinaryDataReceived(Uint8List(0))); + }); + + test('string request and response', () async { + webSocket.sendText('Hello World!'); + expect(await webSocket.events.first, TextDataReceived('Hello World!')); + }); + + test('binary request and response', () async { + webSocket.sendBytes(Uint8List.fromList([1, 2, 3, 4, 5])); + expect(await webSocket.events.first, + BinaryDataReceived(Uint8List.fromList([1, 2, 3, 4, 5]))); + }); + + test('large string request and response', () async { + final data = 'Hello World!' * 10000; + + webSocket.sendText(data); + expect(await webSocket.events.first, TextDataReceived(data)); + }); + + test('large binary request and response', () async { + final data = Uint8List(1000000); + data + ..fillRange(0, data.length ~/ 10, 1) + ..fillRange(0, data.length ~/ 10, 2) + ..fillRange(0, data.length ~/ 10, 3) + ..fillRange(0, data.length ~/ 10, 4) + ..fillRange(0, data.length ~/ 10, 5) + ..fillRange(0, data.length ~/ 10, 6) + ..fillRange(0, data.length ~/ 10, 7) + ..fillRange(0, data.length ~/ 10, 8) + ..fillRange(0, data.length ~/ 10, 9) + ..fillRange(0, data.length ~/ 10, 10); + + webSocket.sendBytes(data); + expect(await webSocket.events.first, BinaryDataReceived(data)); + }); + + test('non-ascii string request and response', () async { + webSocket.sendText('🎨⛳🌈'); + expect(await webSocket.events.first, TextDataReceived('🎨⛳🌈')); + }); + + test('alternative string and binary request and response', () async { + webSocket + ..sendBytes(Uint8List.fromList([1])) + ..sendText('Hello!') + ..sendBytes(Uint8List.fromList([1, 2])) + ..sendText('Hello World!'); + + expect(await webSocket.events.take(4).toList(), [ + BinaryDataReceived(Uint8List.fromList([1])), + TextDataReceived('Hello!'), + BinaryDataReceived(Uint8List.fromList([1, 2])), + TextDataReceived('Hello World!') + ]); + }); + }); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server.dart b/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server.dart new file mode 100644 index 0000000000..8760bb9a38 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server.dart @@ -0,0 +1,37 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; +import 'package:crypto/crypto.dart'; +import 'package:stream_channel/stream_channel.dart'; + +const _webSocketGuid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; + +/// Starts an WebSocket server that sends invalid frames after completing the +/// WebSocket upgrade. +void hybridMain(StreamChannel channel) async { + late final HttpServer server; + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + var key = request.headers.value('Sec-WebSocket-Key'); + var digest = sha1.convert('$key$_webSocketGuid'.codeUnits); + var accept = base64.encode(digest.bytes); + request.response + ..statusCode = HttpStatus.switchingProtocols + ..headers.add(HttpHeaders.connectionHeader, 'Upgrade') + ..headers.add(HttpHeaders.upgradeHeader, 'websocket') + ..headers.add('Sec-WebSocket-Accept', accept); + request.response.contentLength = 0; + final socket = await request.response.detachSocket(); + socket.write('marry had a little lamb whose fleece was white as snow'); + }); + + channel.sink.add(server.port); + + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server_vm.dart b/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server_vm.dart new file mode 100644 index 0000000000..4996e3b6c2 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server_vm.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'peer_protocol_errors_server.dart'; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server_web.dart b/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server_web.dart new file mode 100644 index 0000000000..361b02c30f --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server_web.dart @@ -0,0 +1,9 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'web_socket_conformance_tests/src/peer_protocol_errors_server.dart')); diff --git a/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_tests.dart b/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_tests.dart new file mode 100644 index 0000000000..ba44f5122c --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_tests.dart @@ -0,0 +1,52 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; +import 'package:web_socket/web_socket.dart'; + +import 'peer_protocol_errors_server_vm.dart' + if (dart.library.html) 'peer_protocol_errors_server_web.dart'; + +/// Tests that the [WebSocket] can correctly handle incorrect WebSocket frames. +void testPeerProtocolErrors( + Future Function(Uri uri, {Iterable? protocols}) + channelFactory) { + group('peer protocol errors', () { + late final Uri uri; + late final StreamChannel httpServerChannel; + late final StreamQueue httpServerQueue; + + setUpAll(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + uri = Uri.parse('ws://localhost:${await httpServerQueue.next}'); + }); + tearDownAll(() => httpServerChannel.sink.add(null)); + + test('bad data after upgrade', () async { + final channel = await channelFactory(uri); + expect( + (await channel.events.single as CloseReceived).code, + anyOf([ + 1002, // protocol error + 1005, // closed no status + 1006, // closed abnormal + ])); + }); + + test('bad data after upgrade with write', () async { + final channel = await channelFactory(uri); + channel.sendText('test'); + expect( + (await channel.events.single as CloseReceived).code, + anyOf([ + 1002, // protocol error + 1005, // closed no status + 1006, // closed abnormal + ])); + }); + }); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/protocol_server.dart b/pkgs/web_socket_conformance_tests/lib/src/protocol_server.dart new file mode 100644 index 0000000000..c0df5b6ea4 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/protocol_server.dart @@ -0,0 +1,47 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:crypto/crypto.dart'; +import 'package:stream_channel/stream_channel.dart'; + +const _webSocketGuid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; + +/// Starts an WebSocket server that responds with a scripted subprotocol. +void hybridMain(StreamChannel channel) async { + late final HttpServer server; + server = (await HttpServer.bind('localhost', 0)) + ..listen((request) async { + final serverProtocol = request.requestedUri.queryParameters['protocol']; + var key = request.headers.value('Sec-WebSocket-Key'); + var digest = sha1.convert('$key$_webSocketGuid'.codeUnits); + var accept = base64.encode(digest.bytes); + channel.sink.add(request.headers['Sec-WebSocket-Protocol']); + request.response + ..statusCode = HttpStatus.switchingProtocols + ..headers.add(HttpHeaders.connectionHeader, 'Upgrade') + ..headers.add(HttpHeaders.upgradeHeader, 'websocket') + ..headers.add('Sec-WebSocket-Accept', accept); + if (serverProtocol != null) { + request.response.headers.add('Sec-WebSocket-Protocol', serverProtocol); + } + request.response.contentLength = 0; + final socket = await request.response.detachSocket(); + final webSocket = WebSocket.fromUpgradedSocket(socket, + protocol: serverProtocol, serverSide: true); + webSocket.listen((e) async { + webSocket.add(e); + await webSocket.close(); + }); + }); + + channel.sink.add(server.port); + + await channel + .stream.first; // Any writes indicates that the server should exit. + unawaited(server.close()); +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/protocol_server_vm.dart b/pkgs/web_socket_conformance_tests/lib/src/protocol_server_vm.dart new file mode 100644 index 0000000000..a31da9ec1e --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/protocol_server_vm.dart @@ -0,0 +1,12 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; + +import 'protocol_server.dart'; + +/// Starts the redirect test HTTP server in the same process. +Future> startServer() async { + final controller = StreamChannelController(sync: true); + hybridMain(controller.foreign); + return controller.local; +} diff --git a/pkgs/web_socket_conformance_tests/lib/src/protocol_server_web.dart b/pkgs/web_socket_conformance_tests/lib/src/protocol_server_web.dart new file mode 100644 index 0000000000..a752ed7ac2 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/protocol_server_web.dart @@ -0,0 +1,9 @@ +// Generated by generate_server_wrappers.dart. Do not edit. + +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; + +/// Starts the redirect test HTTP server out-of-process. +Future> startServer() async => spawnHybridUri(Uri( + scheme: 'package', + path: 'web_socket_conformance_tests/src/protocol_server.dart')); diff --git a/pkgs/web_socket_conformance_tests/lib/src/protocol_tests.dart b/pkgs/web_socket_conformance_tests/lib/src/protocol_tests.dart new file mode 100644 index 0000000000..2d35f1c4a4 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/src/protocol_tests.dart @@ -0,0 +1,70 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:async/async.dart'; +import 'package:stream_channel/stream_channel.dart'; +import 'package:test/test.dart'; +import 'package:web_socket/web_socket.dart'; + +import 'protocol_server_vm.dart' + if (dart.library.html) 'protocol_server_web.dart'; + +/// Tests that the [WebSocket] can correctly negotiate a subprotocol with the +/// peer. +/// +/// See +/// [RFC-6455 1.9](https://datatracker.ietf.org/doc/html/rfc6455#section-1.9). +void testProtocols( + Future Function(Uri uri, {Iterable? protocols}) + channelFactory) { + group('protocols', () { + late Uri uri; + late StreamChannel httpServerChannel; + late StreamQueue httpServerQueue; + + setUp(() async { + httpServerChannel = await startServer(); + httpServerQueue = StreamQueue(httpServerChannel.stream); + uri = Uri.parse('ws://localhost:${await httpServerQueue.next}'); + }); + tearDown(() => httpServerChannel.sink.add(null)); + + test('no protocol', () async { + final socket = await channelFactory(uri); + + expect(await httpServerQueue.next, null); + expect(socket.protocol, ''); + socket.sendText('Hello World!'); + }); + + test('single protocol', () async { + final socket = await channelFactory( + uri.replace(queryParameters: {'protocol': 'chat.example.com'}), + protocols: ['chat.example.com']); + + expect(await httpServerQueue.next, ['chat.example.com']); + expect(socket.protocol, 'chat.example.com'); + socket.sendText('Hello World!'); + }); + + test('multiple protocols', () async { + final socket = await channelFactory( + uri.replace(queryParameters: {'protocol': 'text.example.com'}), + protocols: ['chat.example.com', 'text.example.com']); + + expect( + await httpServerQueue.next, ['chat.example.com, text.example.com']); + expect(socket.protocol, 'text.example.com'); + socket.sendText('Hello World!'); + }); + + test('protocol mismatch', () async { + await expectLater( + () => channelFactory( + uri.replace(queryParameters: {'protocol': 'example.example.com'}), + protocols: ['chat.example.com']), + throwsA(isA())); + }); + }); +} diff --git a/pkgs/web_socket_conformance_tests/lib/web_socket_conformance_tests.dart b/pkgs/web_socket_conformance_tests/lib/web_socket_conformance_tests.dart new file mode 100644 index 0000000000..9e6e011628 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/lib/web_socket_conformance_tests.dart @@ -0,0 +1,27 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:web_socket/web_socket.dart'; +import 'src/close_local_tests.dart'; +import 'src/close_remote_tests.dart'; +import 'src/connect_uri_tests.dart'; +import 'src/disconnect_after_upgrade_tests.dart'; +import 'src/no_upgrade_tests.dart'; +import 'src/payload_transfer_tests.dart'; +import 'src/peer_protocol_errors_tests.dart'; +import 'src/protocol_tests.dart'; + +/// Runs the entire test suite against the given [WebSocket]. +void testAll( + Future Function(Uri uri, {Iterable? protocols}) + webSocketFactory) { + testCloseLocal(webSocketFactory); + testCloseRemote(webSocketFactory); + testConnectUri(webSocketFactory); + testDisconnectAfterUpgrade(webSocketFactory); + testNoUpgrade(webSocketFactory); + testPayloadTransfer(webSocketFactory); + testPeerProtocolErrors(webSocketFactory); + testProtocols(webSocketFactory); +} diff --git a/pkgs/web_socket_conformance_tests/mono_pkg.yaml b/pkgs/web_socket_conformance_tests/mono_pkg.yaml new file mode 100644 index 0000000000..16e4e7a5f3 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/mono_pkg.yaml @@ -0,0 +1,10 @@ +sdk: +- pubspec +- dev + +stages: +- analyze_and_format: + - analyze: --fatal-infos + - format: + sdk: + - dev diff --git a/pkgs/web_socket_conformance_tests/pubspec.yaml b/pkgs/web_socket_conformance_tests/pubspec.yaml new file mode 100644 index 0000000000..d7b64f2e36 --- /dev/null +++ b/pkgs/web_socket_conformance_tests/pubspec.yaml @@ -0,0 +1,21 @@ +name: web_socket_conformance_tests +description: >- + A library that tests whether implementations of `package:web_socket`'s + `WebSocket` class behave as expected. +repository: https://github.com/dart-lang/http/tree/master/pkgs/web_socket_conformance_tests + +publish_to: none + +environment: + sdk: ^3.4.0 + +dependencies: + async: ^2.11.0 + crypto: ^3.0.3 + dart_style: ^2.3.7 + stream_channel: ^2.1.2 + test: ^1.24.0 + web_socket: ^0.1.0 + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 diff --git a/tool/ci.sh b/tool/ci.sh new file mode 100755 index 0000000000..133b358da3 --- /dev/null +++ b/tool/ci.sh @@ -0,0 +1,143 @@ +#!/bin/bash +# Created with package:mono_repo v6.6.2 + +# Support built in commands on windows out of the box. + +# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") +# then "flutter pub" is called instead of "dart pub". +# This assumes that the Flutter SDK has been installed in a previous step. +function pub() { + if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then + command flutter pub "$@" + else + command dart pub "$@" + fi +} + +function format() { + command dart format "$@" +} + +# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") +# then "flutter analyze" is called instead of "dart analyze". +# This assumes that the Flutter SDK has been installed in a previous step. +function analyze() { + if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then + command flutter analyze "$@" + else + command dart analyze "$@" + fi +} + +if [[ -z ${PKGS} ]]; then + echo -e '\033[31mPKGS environment variable must be set! - TERMINATING JOB\033[0m' + exit 64 +fi + +if [[ "$#" == "0" ]]; then + echo -e '\033[31mAt least one task argument must be provided! - TERMINATING JOB\033[0m' + exit 64 +fi + +SUCCESS_COUNT=0 +declare -a FAILURES + +for PKG in ${PKGS}; do + echo -e "\033[1mPKG: ${PKG}\033[22m" + EXIT_CODE=0 + pushd "${PKG}" >/dev/null || EXIT_CODE=$? + + if [[ ${EXIT_CODE} -ne 0 ]]; then + echo -e "\033[31mPKG: '${PKG}' does not exist - TERMINATING JOB\033[0m" + exit 64 + fi + + dart pub upgrade || EXIT_CODE=$? + + if [[ ${EXIT_CODE} -ne 0 ]]; then + echo -e "\033[31mPKG: ${PKG}; 'dart pub upgrade' - FAILED (${EXIT_CODE})\033[0m" + FAILURES+=("${PKG}; 'dart pub upgrade'") + else + for TASK in "$@"; do + EXIT_CODE=0 + echo + echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m" + case ${TASK} in + analyze_0) + echo 'flutter analyze --fatal-infos' + flutter analyze --fatal-infos || EXIT_CODE=$? + ;; + analyze_1) + echo 'dart analyze --fatal-infos' + dart analyze --fatal-infos || EXIT_CODE=$? + ;; + command_0) + echo 'flutter test' + flutter test || EXIT_CODE=$? + ;; + command_1) + echo 'dart run --define=no_default_http_client=true test/no_default_http_client_test.dart' + dart run --define=no_default_http_client=true test/no_default_http_client_test.dart || EXIT_CODE=$? + ;; + format) + echo 'dart format --output=none --set-exit-if-changed .' + dart format --output=none --set-exit-if-changed . || EXIT_CODE=$? + ;; + test_1) + echo 'flutter test --platform chrome' + flutter test --platform chrome || EXIT_CODE=$? + ;; + test_2) + echo 'dart test --platform vm' + dart test --platform vm || EXIT_CODE=$? + ;; + test_3) + echo 'dart test --platform chrome' + dart test --platform chrome || EXIT_CODE=$? + ;; + test_4) + echo 'dart test --test-randomize-ordering-seed=random -p chrome -c dart2wasm' + dart test --test-randomize-ordering-seed=random -p chrome -c dart2wasm || EXIT_CODE=$? + ;; + test_5) + echo 'dart test --test-randomize-ordering-seed=random -p vm' + dart test --test-randomize-ordering-seed=random -p vm || EXIT_CODE=$? + ;; + test_6) + echo 'dart test --test-randomize-ordering-seed=random -p chrome -c dart2js' + dart test --test-randomize-ordering-seed=random -p chrome -c dart2js || EXIT_CODE=$? + ;; + *) + echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m" + exit 64 + ;; + esac + + if [[ ${EXIT_CODE} -ne 0 ]]; then + echo -e "\033[31mPKG: ${PKG}; TASK: ${TASK} - FAILED (${EXIT_CODE})\033[0m" + FAILURES+=("${PKG}; TASK: ${TASK}") + else + echo -e "\033[32mPKG: ${PKG}; TASK: ${TASK} - SUCCEEDED\033[0m" + SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) + fi + + done + fi + + echo + echo -e "\033[32mSUCCESS COUNT: ${SUCCESS_COUNT}\033[0m" + + if [ ${#FAILURES[@]} -ne 0 ]; then + echo -e "\033[31mFAILURES: ${#FAILURES[@]}\033[0m" + for i in "${FAILURES[@]}"; do + echo -e "\033[31m $i\033[0m" + done + fi + + popd >/dev/null || exit 70 + echo +done + +if [ ${#FAILURES[@]} -ne 0 ]; then + exit 1 +fi