peachsim 0.1.1738 → 0.1.1744
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/cli/app-catalog.ts +47 -23
- package/cli/app-fonts.ts +19 -1
- package/cli/command-registry.ts +3 -0
- package/cli/commands/control.ts +67 -16
- package/cli/commands/device.ts +3 -1
- package/cli/commands/doctor.ts +1 -4
- package/cli/commands/inspect/settling.ts +6 -1
- package/cli/commands/inspect/wait-ready.ts +22 -2
- package/cli/commands/package.ts +22 -20
- package/cli/commands/push.ts +56 -0
- package/cli/commands/serve.ts +9 -0
- package/cli/commands/shell-url.ts +37 -9
- package/cli/commands/swift.ts +1 -1
- package/cli/current-sim.ts +27 -0
- package/cli/drivers/linux-browser-libs.lock.json +323 -1
- package/cli/drivers/linux-browser-libs.ts +8 -6
- package/cli/drivers/playwright.ts +5 -1
- package/cli/internal-child.ts +11 -1
- package/cli/main.ts +6 -0
- package/cli/native-input.ts +1 -7
- package/cli/outbound-endpoints.ts +9 -1
- package/cli/packaged-app-launcher.ts +3 -1
- package/cli/scene-video.ts +4 -0
- package/cli/ws-bridge.ts +3 -1
- package/detox/index.ts +9 -4
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +7372 -3675
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +22 -8
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +6340 -3064
- package/dist-lib/expo-swift-metadata.cjs +14 -2
- package/dist-lib/expo-swift-metadata.mjs +14 -2
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +6524 -2720
- package/dist-lib/host/fetch-proxy-handler.cjs +8 -7
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +6 -3
- package/dist-lib/index.cjs +97 -31
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +71 -29
- package/dist-lib/native-app-identity-project.cjs +53 -22
- package/dist-lib/native-app-identity-project.mjs +53 -22
- package/dist-lib/native-app-identity.cjs +10 -3
- package/dist-lib/native-app-identity.mjs +10 -3
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +25 -23
- package/dist-lib/public-origins-lib.json +111 -79
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +4 -1
- package/dist-lib/sdk.mjs +4 -1
- package/dist-lib/skills.cjs +40549 -37613
- package/dist-lib/swift-compile.cjs +2054 -388
- package/dist-lib/swift-compile.mjs +1976 -312
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +68 -8
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +5867 -2646
- package/dist-lib/vite.cjs +18 -8
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/cli-companion.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +0 -3
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +25 -3
- package/dist-types/packages/peach-engine/src/engine/scroll-platform.d.ts +1 -15
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +1 -3
- package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +23 -0
- package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/metro-identity-contract.d.ts +33 -0
- package/dist-types/packages/peach-engine/src/preview/bundle-layout.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-gpu.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +28 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +21 -1
- package/dist-types/packages/peach-engine/src/render-worker/prepared-boot-bundle.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +3 -3
- package/dist-types/packages/peach-engine/src/render-worker/webgpu-frame-transaction.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/webgpu-readback-scheduler.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +8 -1
- package/dist-types/packages/peach-engine/src/rolldown-production-fingerprint.d.ts +1 -4
- package/dist-types/packages/peach-engine/src/rolldown-production-module.d.ts +12 -0
- package/dist-types/packages/peach-engine/src/rolldown-production-roles.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +6 -1
- package/dist-types/packages/peach-engine/src/settings/duo-fold-bus.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/shell-events.d.ts +4 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +7 -0
- package/package.json +2 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +1 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkErrors.h +257 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFByteOrder.h +305 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGAffineTransform.h +204 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h +260 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColor.h +164 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorConversionInfo.h +101 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorSpace.h +510 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h +1132 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGConvertColorDataWithFormat.h +34 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataConsumer.h +83 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataProvider.h +197 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGEXRToneMappingGamma.h +36 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGError.h +38 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFont.h +312 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFunction.h +106 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGradient.h +123 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGITUToneMapping.h +31 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGImage.h +409 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGLayer.h +78 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h +120 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContentStream.h +55 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContext.h +535 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h +133 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h +252 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFMarkedContentItem.h +37 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFObject.h +67 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFOperatorTable.h +51 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h +101 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFScanner.h +123 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStream.h +44 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFString.h +52 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStructureElement.h +87 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h +441 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPattern.h +89 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGRenderingBufferProvider.h +49 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGShading.h +124 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGToneMapping.h +85 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +44 -252
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Modules/module.modulemap +1 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/CFNetworkErrors.h +257 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +0 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +356 -61
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/NSURLSession+Network.h +32 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/Network.h +51 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/advertise_descriptor.h +193 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_descriptor.h +163 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_result.h +207 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browser.h +285 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection.h +714 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_group.h +629 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_report.h +932 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/content_context.h +229 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/endpoint.h +390 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/error.h +135 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ethernet_channel.h +349 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/framer_options.h +1187 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/group_descriptor.h +184 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/interface.h +150 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ip_options.h +351 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/listener.h +438 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/nw_object.h +200 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/parameters.h +1205 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path.h +392 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path_monitor.h +216 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/privacy_context.h +188 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/protocol_options.h +126 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/proxy_config.h +357 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/quic_options.h +889 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/resolver_config.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tcp_options.h +459 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tls_options.h +115 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/txt_record.h +432 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/udp_options.h +112 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ws_options.h +743 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Modules/module.modulemap +9 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAAnimation.h +395 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h +132 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CADisplayLink.h +107 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterCell.h +153 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterLayer.h +151 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAFrameRateRange.h +40 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAGradientLayer.h +78 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h +1078 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h +97 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTimingFunction.h +67 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAReplicatorLayer.h +65 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAScrollLayer.h +64 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAShapeLayer.h +135 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATextLayer.h +99 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATiledLayer.h +67 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransaction.h +124 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransform3D.h +138 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransformLayer.h +40 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAValueFunction.h +78 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +19 -38
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecureTransport.h +1757 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSAttributedString.h +19 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSParagraphStyle.h +28 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityConstants.h +114 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +16 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBarAppearance.h +47 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDataDetectors.h +20 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDatePicker.h +13 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h +16 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h +84 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizer.h +119 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizerSubclass.h +66 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIHoverGestureRecognizer.h +45 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +161 -37
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h +76 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBar.h +8 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBarAppearance.h +78 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITextInputTraits.h +29 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITouch.h +104 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITraitCollection.h +19 -0
- package/sdk/ios/usr/include/dns_sd.h +3616 -0
- package/sdk/ios/usr/include/dnssd.modulemap +4 -0
- package/sdk/ios/usr/include/module.modulemap +1 -0
- package/sdk/ios/usr/include/sys/socketvar.h +191 -0
- package/sdk/ios/usr/include/sys/vsock.h +84 -0
- package/sdk/native-hashes.json +1 -1
- package/skills/contrast/SKILL.md +6 -5
- package/skills/peach-debug/SKILL.md +68 -264
- package/skills/peach-debug/references/accessibility.md +37 -73
- package/skills/peach-debug/references/commands.md +2 -2
- package/skills/peach-debug/references/events.md +74 -0
- package/skills/peach-perf/SKILL.md +64 -401
- package/skills/peach-perf/references/presentation.md +46 -0
- package/skills/peach-perf/references/profiling.md +93 -0
- package/skills/peach-perf/references/render-counters.md +57 -0
- package/skills/peach-setup/SKILL.md +66 -216
- package/skills/peach-setup/references/native-config.md +35 -0
- package/skills/peach-setup/references/reporting.md +28 -0
- package/skills/peach-test/SKILL.md +68 -284
- package/skills/peach-test/references/detox.md +69 -0
- package/skills/peach-test/references/maestro.md +95 -0
- package/skills/peach-visual/SKILL.md +53 -105
- package/src/appPackageContract.ts +12 -1
- package/src/assetCatalogContract.ts +8 -1
- package/src/bridge-contract.ts +6 -0
- package/src/bundle-channel.mjs +133 -59
- package/src/cli-runtime.ts +8 -9
- package/src/configured-bundle-producer.ts +10 -0
- package/src/device-catalog.ts +68 -4
- package/src/expo-discovery-cache.ts +3 -0
- package/src/expo-native-workspace.ts +81 -17
- package/src/expo-swift-host.ts +57 -104
- package/src/expo-widget-assets.ts +76 -0
- package/src/expoSwiftContract.ts +13 -1
- package/src/host/websocket-proxy.ts +7 -2
- package/src/native-prebuilt.ts +3 -3
- package/src/nitro-adapter.lock.json +263 -263
- package/src/nitro-adapter.ts +69 -7
- package/src/nitro-bundle.ts +52 -24
- package/src/nitro-compile.ts +6 -1
- package/src/nitro-source.ts +82 -4
- package/src/nitro-superset.lock.json +103 -0
- package/src/nitro-superset.ts +137 -0
- package/src/nitroContract.ts +5 -1
- package/src/react-bridge-importers.ts +1 -0
- package/src/settingsContract.ts +26 -1
- package/src/swift-compile.ts +267 -68
- package/src/swift-compiler-digest.ts +2 -0
- package/src/swift-coverage/xcode-packages.ts +61 -1
- package/src/swift-coverage/xcode.ts +10 -12
- package/src/swift-cxx-reachable.ts +1 -1
- package/src/swift-distribution.lock.json +15 -13
- package/src/swift-distribution.ts +57 -26
- package/src/swift-host.ts +48 -35
- package/src/swift-link-roots.ts +45 -18
- package/src/swift-objc-compile.ts +78 -2
- package/src/swift-objc-standin.ts +3 -0
- package/src/swift-shared-sdk.ts +85 -1
- package/src/swift-standins.ts +233 -11
- package/src/swift-submit.ts +13 -1
- package/src/swift-toolchain.ts +82 -7
- package/src/swift-wasm-prune.ts +1629 -0
- package/src/turbo-bundle.ts +11 -10
- package/src/turbo-runtime.lock.json +16 -16
- package/src/vite-plugin-one.ts +12 -1
- package/src/vite-plugin.ts +82 -23
- package/src/wasm-optimize.ts +34 -0
- package/src/worker-system-chunks.ts +3 -3
- package/src/xcode-project.ts +52 -0
- package/src/xcode-target-members.ts +12 -1
|
@@ -0,0 +1,1187 @@
|
|
|
1
|
+
//
|
|
2
|
+
// framer_options.h
|
|
3
|
+
// Network
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2018-2019 Apple Inc. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef __NW_FRAMER_OPTIONS_H__
|
|
9
|
+
#define __NW_FRAMER_OPTIONS_H__
|
|
10
|
+
|
|
11
|
+
#ifndef __NW_INDIRECT__
|
|
12
|
+
#error "Please include <Network/Network.h> instead of this file directly."
|
|
13
|
+
#endif // __NW_INDIRECT__
|
|
14
|
+
|
|
15
|
+
#include <Network/protocol_options.h>
|
|
16
|
+
#include <Network/endpoint.h>
|
|
17
|
+
#include <Network/parameters.h>
|
|
18
|
+
|
|
19
|
+
#include <dispatch/dispatch.h>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
__BEGIN_DECLS
|
|
23
|
+
|
|
24
|
+
/*!
|
|
25
|
+
* @typedef nw_framer_t
|
|
26
|
+
* @abstract
|
|
27
|
+
* A Network Framer is an instance of a protocol in a connection's protocol
|
|
28
|
+
* stack that parses and writes messages on top of a transport protocol, such
|
|
29
|
+
* as a TCP stream. A framer can add and parse headers or delimiters around
|
|
30
|
+
* application data to provide a message-oriented abstraction.
|
|
31
|
+
*
|
|
32
|
+
* In order to create a framer protocol, first define it using
|
|
33
|
+
* nw_framer_create_definition(). This can be used to create options with
|
|
34
|
+
* nw_framer_create_options(), which can be added to an nw_protocol_stack_t.
|
|
35
|
+
* The callbacks and actions for the framer's protocol instance can be
|
|
36
|
+
* set once an instance of the framer is delivered with the start_handler.
|
|
37
|
+
*
|
|
38
|
+
* In order to send and receive framer messages on an nw_connection_t, use
|
|
39
|
+
* nw_framer_message_t as part of a nw_content_context_t.
|
|
40
|
+
*
|
|
41
|
+
* This type supports ARC and the -[description] method. In non-ARC files, use
|
|
42
|
+
* nw_retain() and nw_release() to retain and release the object.
|
|
43
|
+
*/
|
|
44
|
+
#ifndef NW_FRAMER_IMPL
|
|
45
|
+
NW_OBJECT_DECL(nw_framer);
|
|
46
|
+
#endif // NW_FRAMER_IMPL
|
|
47
|
+
|
|
48
|
+
NW_ASSUME_NONNULL_BEGIN
|
|
49
|
+
|
|
50
|
+
#pragma mark - Messages
|
|
51
|
+
|
|
52
|
+
/*!
|
|
53
|
+
* @typedef nw_framer_message_t
|
|
54
|
+
* @abstract
|
|
55
|
+
* A framer message is an instance of protocol metadata associated
|
|
56
|
+
* with the definition of a framer, created by nw_framer_create_definition().
|
|
57
|
+
*/
|
|
58
|
+
typedef nw_protocol_metadata_t nw_framer_message_t;
|
|
59
|
+
|
|
60
|
+
/*!
|
|
61
|
+
* @function nw_framer_protocol_create_message
|
|
62
|
+
*
|
|
63
|
+
* @abstract
|
|
64
|
+
* Create an instance of a framer message on which per-
|
|
65
|
+
* message options can be configured when sending data
|
|
66
|
+
* on a connection. This is intended to be used by the
|
|
67
|
+
* application above the connection to send message data
|
|
68
|
+
* down to the framer protocol instance.
|
|
69
|
+
*
|
|
70
|
+
* @param definition
|
|
71
|
+
* The framer protocol definition, as retrieved from
|
|
72
|
+
* nw_protocol_options_copy_definition() on the framer options.
|
|
73
|
+
*
|
|
74
|
+
* @result
|
|
75
|
+
* Returns a retained protocol metadata object.
|
|
76
|
+
*/
|
|
77
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
78
|
+
NW_RETURNS_RETAINED nw_framer_message_t
|
|
79
|
+
nw_framer_protocol_create_message(nw_protocol_definition_t definition);
|
|
80
|
+
|
|
81
|
+
/*!
|
|
82
|
+
* @function nw_protocol_metadata_is_framer_message
|
|
83
|
+
*
|
|
84
|
+
* @abstract
|
|
85
|
+
* Checks if a protocol metadata object is a framer protocol
|
|
86
|
+
* message. This indicates whether or not it is compatible
|
|
87
|
+
* with the framer message setters and accessors.
|
|
88
|
+
*
|
|
89
|
+
* @param metadata
|
|
90
|
+
* The protocol metadata to check.
|
|
91
|
+
*
|
|
92
|
+
* @result
|
|
93
|
+
* Returns true if the metadata is associated with a framer
|
|
94
|
+
* protocol definition, false otherwise.
|
|
95
|
+
*/
|
|
96
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
97
|
+
bool
|
|
98
|
+
nw_protocol_metadata_is_framer_message(nw_protocol_metadata_t metadata);
|
|
99
|
+
|
|
100
|
+
/*!
|
|
101
|
+
* @function nw_framer_message_create
|
|
102
|
+
*
|
|
103
|
+
* @abstract
|
|
104
|
+
* Create a framer message, given a framer instance. This
|
|
105
|
+
* is intended to be used within the implementation of
|
|
106
|
+
* the framer protocol to create messages that are delivered
|
|
107
|
+
* as input to the application.
|
|
108
|
+
*
|
|
109
|
+
* @param framer
|
|
110
|
+
* The framer instance object.
|
|
111
|
+
*
|
|
112
|
+
* @result
|
|
113
|
+
* Returns a retained framer message object.
|
|
114
|
+
*/
|
|
115
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
116
|
+
NW_RETURNS_RETAINED nw_framer_message_t
|
|
117
|
+
nw_framer_message_create(nw_framer_t framer);
|
|
118
|
+
|
|
119
|
+
#ifdef __BLOCKS__
|
|
120
|
+
|
|
121
|
+
/*!
|
|
122
|
+
* @typedef nw_framer_message_dispose_value_t
|
|
123
|
+
*
|
|
124
|
+
* @abstract
|
|
125
|
+
* A block to be invoked when a value stored in a framer message is disposed.
|
|
126
|
+
* If the value was created using malloc(), for example, it should be freed here.
|
|
127
|
+
*
|
|
128
|
+
* @param value
|
|
129
|
+
* A pointer to the stored message value.
|
|
130
|
+
*/
|
|
131
|
+
typedef void (^nw_framer_message_dispose_value_t)(void *value);
|
|
132
|
+
|
|
133
|
+
/*!
|
|
134
|
+
* @function nw_framer_message_set_value
|
|
135
|
+
*
|
|
136
|
+
* @abstract
|
|
137
|
+
* Set a key-value pair on a framer message, with a custom
|
|
138
|
+
* dispose function for the value.
|
|
139
|
+
*
|
|
140
|
+
* @param message
|
|
141
|
+
* The framer message object.
|
|
142
|
+
*
|
|
143
|
+
* @param key
|
|
144
|
+
* The string key to identify the value.
|
|
145
|
+
*
|
|
146
|
+
* @param value
|
|
147
|
+
* A pointer to the value to store.
|
|
148
|
+
*
|
|
149
|
+
* @param dispose_value
|
|
150
|
+
* A block to invoke to dispose the stored value.
|
|
151
|
+
*/
|
|
152
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
153
|
+
void
|
|
154
|
+
nw_framer_message_set_value(nw_framer_message_t message,
|
|
155
|
+
const char *key,
|
|
156
|
+
void * _Nullable value,
|
|
157
|
+
_Nullable nw_framer_message_dispose_value_t dispose_value);
|
|
158
|
+
|
|
159
|
+
/*!
|
|
160
|
+
* @function nw_framer_message_access_value
|
|
161
|
+
*
|
|
162
|
+
* @abstract
|
|
163
|
+
* Access the value with a key on a framer message.
|
|
164
|
+
*
|
|
165
|
+
* @param message
|
|
166
|
+
* The framer message object.
|
|
167
|
+
*
|
|
168
|
+
* @param key
|
|
169
|
+
* The string key to identify the value.
|
|
170
|
+
*
|
|
171
|
+
* @param access_value
|
|
172
|
+
* A block to invoke inline with the pointer to the stored value.
|
|
173
|
+
* This pointer may be NULL if no value is stored for the key.
|
|
174
|
+
*
|
|
175
|
+
* @return
|
|
176
|
+
* Returns the boolean value returned by the access_value block,
|
|
177
|
+
* or else false if the parameters were invalid.
|
|
178
|
+
*/
|
|
179
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
180
|
+
bool
|
|
181
|
+
nw_framer_message_access_value(nw_framer_message_t message,
|
|
182
|
+
const char *key,
|
|
183
|
+
NW_NOESCAPE bool (^access_value)(const void * _Nullable value));
|
|
184
|
+
|
|
185
|
+
#endif // __BLOCKS__
|
|
186
|
+
|
|
187
|
+
#ifdef __OBJC__
|
|
188
|
+
|
|
189
|
+
/*!
|
|
190
|
+
* @function nw_framer_message_set_object_value
|
|
191
|
+
*
|
|
192
|
+
* @abstract
|
|
193
|
+
* Set a key-value pair on a framer message, where the
|
|
194
|
+
* value is a reference-counted object.
|
|
195
|
+
*
|
|
196
|
+
* @param message
|
|
197
|
+
* The framer message object.
|
|
198
|
+
*
|
|
199
|
+
* @param key
|
|
200
|
+
* The string key to identify the value.
|
|
201
|
+
*
|
|
202
|
+
* @param value
|
|
203
|
+
* A reference counted object to store.
|
|
204
|
+
*/
|
|
205
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
206
|
+
void
|
|
207
|
+
nw_framer_message_set_object_value(nw_framer_message_t message,
|
|
208
|
+
const char *key,
|
|
209
|
+
_Nullable id value);
|
|
210
|
+
|
|
211
|
+
/*!
|
|
212
|
+
* @function nw_framer_message_copy_object_value
|
|
213
|
+
*
|
|
214
|
+
* @abstract
|
|
215
|
+
* Copy the stored object value using a key on a framer message.
|
|
216
|
+
*
|
|
217
|
+
* @param message
|
|
218
|
+
* The framer message object.
|
|
219
|
+
*
|
|
220
|
+
* @param key
|
|
221
|
+
* The string key to identify the value.
|
|
222
|
+
*
|
|
223
|
+
* @return
|
|
224
|
+
* Returns a reference counted object with a +1 reference count,
|
|
225
|
+
* or NULL if no value was found for the specified key.
|
|
226
|
+
*/
|
|
227
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
228
|
+
NW_RETURNS_RETAINED _Nullable id
|
|
229
|
+
nw_framer_message_copy_object_value(nw_framer_message_t message,
|
|
230
|
+
const char *key);
|
|
231
|
+
|
|
232
|
+
#endif // __OBJC__
|
|
233
|
+
|
|
234
|
+
#pragma mark - Framer Options
|
|
235
|
+
|
|
236
|
+
#ifdef __BLOCKS__
|
|
237
|
+
|
|
238
|
+
typedef enum {
|
|
239
|
+
nw_framer_start_result_ready = 1,
|
|
240
|
+
nw_framer_start_result_will_mark_ready = 2,
|
|
241
|
+
} nw_framer_start_result_t;
|
|
242
|
+
|
|
243
|
+
/*!
|
|
244
|
+
* @typedef nw_framer_start_result_t
|
|
245
|
+
*
|
|
246
|
+
* @abstract
|
|
247
|
+
* A block to be invoked when starting a new instance of the framer
|
|
248
|
+
* protocol. This may occur more than once for a single nw_connection.
|
|
249
|
+
*
|
|
250
|
+
* @param framer
|
|
251
|
+
* A new instance of the framer protocol. This handle should be used
|
|
252
|
+
* to set callbacks, such as with nw_framer_set_input_handler()
|
|
253
|
+
* and nw_framer_set_output_handler(); and to perform actions, such
|
|
254
|
+
* as nw_framer_deliver_input() and nw_framer_write_output().
|
|
255
|
+
*
|
|
256
|
+
* @result
|
|
257
|
+
* Return whether or not the start should implicitly mark the protocol
|
|
258
|
+
* as "ready" using nw_framer_start_result_ready, or that the protocol
|
|
259
|
+
* will call nw_framer_mark_ready() later using
|
|
260
|
+
* nw_framer_start_result_will_mark_ready.
|
|
261
|
+
*/
|
|
262
|
+
typedef nw_framer_start_result_t (^nw_framer_start_handler_t)(nw_framer_t framer);
|
|
263
|
+
|
|
264
|
+
/*!
|
|
265
|
+
* @define NW_FRAMER_CREATE_FLAGS_DEFAULT
|
|
266
|
+
* @discussion Empty flags to define default options on a framer protocol.
|
|
267
|
+
*/
|
|
268
|
+
#define NW_FRAMER_CREATE_FLAGS_DEFAULT 0x00
|
|
269
|
+
|
|
270
|
+
/*!
|
|
271
|
+
* @function nw_framer_create_definition
|
|
272
|
+
*
|
|
273
|
+
* @abstract
|
|
274
|
+
* Create a protocol definition for a custom framer protocol.
|
|
275
|
+
*
|
|
276
|
+
* @param identifier
|
|
277
|
+
* A string identifier used to name this framer protocol. This does not
|
|
278
|
+
* define uniqueness, and is primarily used for logging and debugging.
|
|
279
|
+
*
|
|
280
|
+
* @param flags
|
|
281
|
+
* Flags to describe extended options on framer protocol behavior,
|
|
282
|
+
* all prefixed with "NW_FRAMER_CREATE_FLAGS_".
|
|
283
|
+
*
|
|
284
|
+
* @param start_handler
|
|
285
|
+
* A block to be invoked when starting a new instance of the framer
|
|
286
|
+
* protocol. This may occur more than once for a single nw_connection.
|
|
287
|
+
*
|
|
288
|
+
* @result
|
|
289
|
+
* Returns a retained protocol definition that can be used with protocol
|
|
290
|
+
* options and metadata.
|
|
291
|
+
*/
|
|
292
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
293
|
+
NW_RETURNS_RETAINED nw_protocol_definition_t
|
|
294
|
+
nw_framer_create_definition(const char *identifier,
|
|
295
|
+
uint32_t flags,
|
|
296
|
+
nw_framer_start_handler_t start_handler);
|
|
297
|
+
|
|
298
|
+
/*!
|
|
299
|
+
* @function nw_framer_create_options
|
|
300
|
+
*
|
|
301
|
+
* @abstract
|
|
302
|
+
* Create protocol options from a framer definition. This object can
|
|
303
|
+
* be added to an nw_protocol_stack_t to be used in an nw_connection_t
|
|
304
|
+
* or an nw_listener_t.
|
|
305
|
+
*
|
|
306
|
+
* @param framer_definition
|
|
307
|
+
* A protocol definition created with nw_framer_create_definition().
|
|
308
|
+
*
|
|
309
|
+
* @result
|
|
310
|
+
* Returns a retained protocol options object to add into a protocol
|
|
311
|
+
* stack.
|
|
312
|
+
*/
|
|
313
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
314
|
+
NW_RETURNS_RETAINED nw_protocol_options_t
|
|
315
|
+
nw_framer_create_options(nw_protocol_definition_t framer_definition);
|
|
316
|
+
|
|
317
|
+
#ifdef __OBJC__
|
|
318
|
+
|
|
319
|
+
/*!
|
|
320
|
+
* @function nw_framer_options_set_object_value
|
|
321
|
+
*
|
|
322
|
+
* @abstract
|
|
323
|
+
* Set a key-value pair on framer options, where the
|
|
324
|
+
* value is a reference-counted object.
|
|
325
|
+
*
|
|
326
|
+
* @param options
|
|
327
|
+
* The framer options object.
|
|
328
|
+
*
|
|
329
|
+
* @param key
|
|
330
|
+
* The string key to identify the value.
|
|
331
|
+
*
|
|
332
|
+
* @param value
|
|
333
|
+
* A reference counted object to store.
|
|
334
|
+
*/
|
|
335
|
+
API_AVAILABLE(macos(12.3), ios(15.4), watchos(8.4), tvos(15.4))
|
|
336
|
+
void
|
|
337
|
+
nw_framer_options_set_object_value(nw_protocol_options_t options,
|
|
338
|
+
const char *key,
|
|
339
|
+
_Nullable id value);
|
|
340
|
+
|
|
341
|
+
/*!
|
|
342
|
+
* @function nw_framer_options_copy_object_value
|
|
343
|
+
*
|
|
344
|
+
* @abstract
|
|
345
|
+
* Copy the stored object value using a key on framer options.
|
|
346
|
+
*
|
|
347
|
+
* @param options
|
|
348
|
+
* The framer options object.
|
|
349
|
+
*
|
|
350
|
+
* @param key
|
|
351
|
+
* The string key to identify the value.
|
|
352
|
+
*
|
|
353
|
+
* @return
|
|
354
|
+
* Returns a reference counted object with a +1 reference count,
|
|
355
|
+
* or NULL if no value was found for the specified key.
|
|
356
|
+
*/
|
|
357
|
+
API_AVAILABLE(macos(12.3), ios(15.4), watchos(8.4), tvos(15.4))
|
|
358
|
+
NW_RETURNS_RETAINED _Nullable id
|
|
359
|
+
nw_framer_options_copy_object_value(nw_protocol_options_t options,
|
|
360
|
+
const char *key);
|
|
361
|
+
|
|
362
|
+
#endif // __OBJC__
|
|
363
|
+
|
|
364
|
+
#pragma mark - Framer Implementation Callbacks
|
|
365
|
+
|
|
366
|
+
/*!
|
|
367
|
+
* @typedef nw_framer_input_handler_t
|
|
368
|
+
*
|
|
369
|
+
* @abstract
|
|
370
|
+
* A handler block to be invoked whenever new input
|
|
371
|
+
* data is available to be parsed. When this block is
|
|
372
|
+
* run, the implementation should call functions like
|
|
373
|
+
* nw_framer_parse_input() and nw_framer_deliver_input().
|
|
374
|
+
*
|
|
375
|
+
* Each invocation represents new data being available
|
|
376
|
+
* to read from the network. This data may be insufficient
|
|
377
|
+
* to complete a message, or may contain multiple messages.
|
|
378
|
+
* Implementations are expected to try to parse messages
|
|
379
|
+
* in a loop until parsing fails to read enough to continue.
|
|
380
|
+
*
|
|
381
|
+
* @param framer
|
|
382
|
+
* The instance of the framer protocol.
|
|
383
|
+
*
|
|
384
|
+
* @result
|
|
385
|
+
* Return a hint of the number of bytes that should be present
|
|
386
|
+
* before invoking this handler again. Returning 0 indicates
|
|
387
|
+
* that the handler should be invoked once any data is available.
|
|
388
|
+
*/
|
|
389
|
+
typedef size_t (^nw_framer_input_handler_t)(nw_framer_t framer);
|
|
390
|
+
|
|
391
|
+
/*!
|
|
392
|
+
* @function nw_framer_set_input_handler
|
|
393
|
+
*
|
|
394
|
+
* @abstract
|
|
395
|
+
* Set a handler block to be invoked whenever new input
|
|
396
|
+
* data is available to be parsed. When this block is
|
|
397
|
+
* run, the implementation should call functions like
|
|
398
|
+
* nw_framer_parse_input() and nw_framer_deliver_input().
|
|
399
|
+
*
|
|
400
|
+
* Input events are edge triggered. The input_handler block
|
|
401
|
+
* should continue to call nw_framer_parse_input()
|
|
402
|
+
* until nw_framer_parse_input() can no longer produce
|
|
403
|
+
* enough bytes to satisfy the request, or the protocol
|
|
404
|
+
* needs to wait for some other event to continue processing
|
|
405
|
+
* later.
|
|
406
|
+
*
|
|
407
|
+
* This setter is required, and must only be set from within
|
|
408
|
+
* the invocation of a nw_framer_start_handler_t.
|
|
409
|
+
*
|
|
410
|
+
* @param framer
|
|
411
|
+
* The framer instance object, passed via the
|
|
412
|
+
* nw_framer_start_handler_t block.
|
|
413
|
+
*
|
|
414
|
+
* @param input_handler
|
|
415
|
+
* The block to invoke whenever new input data is available.
|
|
416
|
+
*/
|
|
417
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
418
|
+
void
|
|
419
|
+
nw_framer_set_input_handler(nw_framer_t framer,
|
|
420
|
+
nw_framer_input_handler_t input_handler);
|
|
421
|
+
|
|
422
|
+
/*!
|
|
423
|
+
* @typedef nw_framer_output_handler_t
|
|
424
|
+
*
|
|
425
|
+
* @abstract
|
|
426
|
+
* A handler block to be invoked whenever an output
|
|
427
|
+
* message is ready to be sent. When this block is
|
|
428
|
+
* run, the implementation should call functions like
|
|
429
|
+
* nw_framer_parse_output() and nw_framer_write_output().
|
|
430
|
+
*
|
|
431
|
+
* Each invocation represents a single complete or partial
|
|
432
|
+
* message that is being sent. The implementation is
|
|
433
|
+
* expected to write this message or let it be dropped
|
|
434
|
+
* in this handler.
|
|
435
|
+
*
|
|
436
|
+
* @param framer
|
|
437
|
+
* The instance of the framer protocol.
|
|
438
|
+
*
|
|
439
|
+
* @param message
|
|
440
|
+
* The framer message being sent.
|
|
441
|
+
*
|
|
442
|
+
* @param message_length
|
|
443
|
+
* The length of the data associated with this message send.
|
|
444
|
+
* If the message is not complete, the length represents the
|
|
445
|
+
* partial message length being sent, which may be smaller
|
|
446
|
+
* than the complete message length.
|
|
447
|
+
*
|
|
448
|
+
* @param is_complete
|
|
449
|
+
* A boolean indicating whether or not the message is now complete.
|
|
450
|
+
*/
|
|
451
|
+
typedef void (^nw_framer_output_handler_t)(nw_framer_t framer,
|
|
452
|
+
nw_framer_message_t message,
|
|
453
|
+
size_t message_length,
|
|
454
|
+
bool is_complete);
|
|
455
|
+
|
|
456
|
+
/*!
|
|
457
|
+
* @function nw_framer_set_output_handler
|
|
458
|
+
*
|
|
459
|
+
* @abstract
|
|
460
|
+
* Set a handler block to be invoked whenever an output
|
|
461
|
+
* message is ready to be sent. When this block is
|
|
462
|
+
* run, the implementation should call functions like
|
|
463
|
+
* nw_framer_parse_output() and nw_framer_write_output().
|
|
464
|
+
*
|
|
465
|
+
* This setter is required, and must only be set from within
|
|
466
|
+
* the invocation of a nw_framer_start_handler_t.
|
|
467
|
+
*
|
|
468
|
+
* @param framer
|
|
469
|
+
* The framer instance object, passed via the
|
|
470
|
+
* nw_framer_start_handler_t block.
|
|
471
|
+
*
|
|
472
|
+
* @param output_handler
|
|
473
|
+
* The block to invoke whenever a new output message is ready
|
|
474
|
+
* to be sent.
|
|
475
|
+
*/
|
|
476
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
477
|
+
void
|
|
478
|
+
nw_framer_set_output_handler(nw_framer_t framer,
|
|
479
|
+
nw_framer_output_handler_t output_handler);
|
|
480
|
+
|
|
481
|
+
/*!
|
|
482
|
+
* @typedef nw_framer_wakeup_handler_t
|
|
483
|
+
*
|
|
484
|
+
* @abstract
|
|
485
|
+
* A handler block to be invoked whenever the wakeup timer
|
|
486
|
+
* set via nw_framer_schedule_wakeup() fires. This is intended to
|
|
487
|
+
* be used for sending keepalives or other control traffic.
|
|
488
|
+
*
|
|
489
|
+
* @param framer
|
|
490
|
+
* The instance of the framer protocol.
|
|
491
|
+
*/
|
|
492
|
+
typedef void (^nw_framer_wakeup_handler_t)(nw_framer_t framer);
|
|
493
|
+
|
|
494
|
+
/*!
|
|
495
|
+
* @function nw_framer_set_wakeup_handler
|
|
496
|
+
*
|
|
497
|
+
* @abstract
|
|
498
|
+
* Set a handler block to be invoked whenever the wakeup timer
|
|
499
|
+
* set via nw_framer_schedule_wakeup() fires. This is intended to
|
|
500
|
+
* be used for sending keepalives or other control traffic.
|
|
501
|
+
*
|
|
502
|
+
* This setter is optional, and must only be set from within
|
|
503
|
+
* the invocation of a nw_framer_start_handler_t.
|
|
504
|
+
*
|
|
505
|
+
* @param framer
|
|
506
|
+
* The framer instance object, passed via the
|
|
507
|
+
* nw_framer_start_handler_t block.
|
|
508
|
+
*
|
|
509
|
+
* @param wakeup_handler
|
|
510
|
+
* The block to invoke whenever the timeout set by
|
|
511
|
+
* nw_framer_schedule_wakeup() is reached.
|
|
512
|
+
*/
|
|
513
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
514
|
+
void
|
|
515
|
+
nw_framer_set_wakeup_handler(nw_framer_t framer,
|
|
516
|
+
nw_framer_wakeup_handler_t wakeup_handler);
|
|
517
|
+
|
|
518
|
+
/*!
|
|
519
|
+
* @typedef nw_framer_stop_handler_t
|
|
520
|
+
*
|
|
521
|
+
* @abstract
|
|
522
|
+
* A handler block to be invoked when the connection
|
|
523
|
+
* is being disconnected, to allow the framer implementation
|
|
524
|
+
* a chance to send any final data.
|
|
525
|
+
*
|
|
526
|
+
* @param framer
|
|
527
|
+
* The instance of the framer protocol.
|
|
528
|
+
*
|
|
529
|
+
* @result
|
|
530
|
+
* Return true if the framer is done and the connection
|
|
531
|
+
* can be fully disconnected, or false the stop should
|
|
532
|
+
* be delayed. If false, the implementation must later
|
|
533
|
+
* call nw_framer_mark_failed_with_error().
|
|
534
|
+
*/
|
|
535
|
+
typedef bool (^nw_framer_stop_handler_t)(nw_framer_t framer);
|
|
536
|
+
|
|
537
|
+
/*!
|
|
538
|
+
* @function nw_framer_set_stop_handler
|
|
539
|
+
*
|
|
540
|
+
* @abstract
|
|
541
|
+
* Set a handler block to be invoked when the connection
|
|
542
|
+
* is being disconnected, to allow the framer implementation
|
|
543
|
+
* a chance to send any final data.
|
|
544
|
+
*
|
|
545
|
+
* This setter is optional, and must only be set from within
|
|
546
|
+
* the invocation of a nw_framer_start_handler_t.
|
|
547
|
+
*
|
|
548
|
+
* @param framer
|
|
549
|
+
* The framer instance object, passed via the
|
|
550
|
+
* nw_framer_start_handler_t block.
|
|
551
|
+
*
|
|
552
|
+
* @param stop_handler
|
|
553
|
+
* The block to invoke when the connection is disconnected.
|
|
554
|
+
*/
|
|
555
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
556
|
+
void
|
|
557
|
+
nw_framer_set_stop_handler(nw_framer_t framer,
|
|
558
|
+
nw_framer_stop_handler_t stop_handler);
|
|
559
|
+
|
|
560
|
+
/*!
|
|
561
|
+
* @typedef nw_framer_cleanup_handler_t
|
|
562
|
+
*
|
|
563
|
+
* @abstract
|
|
564
|
+
* A handler block to be invoked when the protocol stack
|
|
565
|
+
* is being torn down and deallocated. This is the opportunity
|
|
566
|
+
* for the framer implementation to release any state it may
|
|
567
|
+
* have saved.
|
|
568
|
+
*
|
|
569
|
+
* @param framer
|
|
570
|
+
* The instance of the framer protocol.
|
|
571
|
+
*/
|
|
572
|
+
typedef void (^nw_framer_cleanup_handler_t)(nw_framer_t framer);
|
|
573
|
+
|
|
574
|
+
/*!
|
|
575
|
+
* @function nw_framer_set_cleanup_handler
|
|
576
|
+
*
|
|
577
|
+
* @abstract
|
|
578
|
+
* Set a handler block to be invoked when the protocol stack
|
|
579
|
+
* is being torn down and deallocated. This is the opportunity
|
|
580
|
+
* for the framer implementation to release any state it may
|
|
581
|
+
* have saved.
|
|
582
|
+
*
|
|
583
|
+
* This setter is optional, and must only be set from within
|
|
584
|
+
* the invocation of a nw_framer_start_handler_t.
|
|
585
|
+
*
|
|
586
|
+
* @param framer
|
|
587
|
+
* The framer instance object, passed via the
|
|
588
|
+
* nw_framer_start_handler_t block.
|
|
589
|
+
*
|
|
590
|
+
* @param cleanup_handler
|
|
591
|
+
* The block to invoke when the protocol stack is being deallocated.
|
|
592
|
+
*/
|
|
593
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
594
|
+
void
|
|
595
|
+
nw_framer_set_cleanup_handler(nw_framer_t framer,
|
|
596
|
+
nw_framer_cleanup_handler_t cleanup_handler);
|
|
597
|
+
|
|
598
|
+
#pragma mark - Framer Implementation Actions
|
|
599
|
+
|
|
600
|
+
/*!
|
|
601
|
+
* @function nw_framer_mark_ready
|
|
602
|
+
*
|
|
603
|
+
* @abstract
|
|
604
|
+
* Mark the connection associated with the framer instance
|
|
605
|
+
* as ready (see nw_connection_state_ready). This is intended
|
|
606
|
+
* to be used by protocols that require a handshake before being
|
|
607
|
+
* able to send application data. This should only be called
|
|
608
|
+
* if the return value to the nw_framer_start_handler_t block
|
|
609
|
+
* was nw_framer_start_result_will_call_ready.
|
|
610
|
+
*
|
|
611
|
+
* To ensure thread safety, this function can only be called
|
|
612
|
+
* in one of the callback blocks invoked on the framer, or
|
|
613
|
+
* in a block passed to nw_framer_async().
|
|
614
|
+
*
|
|
615
|
+
* @param framer
|
|
616
|
+
* The framer instance object.
|
|
617
|
+
*/
|
|
618
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
619
|
+
void
|
|
620
|
+
nw_framer_mark_ready(nw_framer_t framer);
|
|
621
|
+
|
|
622
|
+
/*!
|
|
623
|
+
* @function nw_framer_prepend_application_protocol
|
|
624
|
+
*
|
|
625
|
+
* @abstract
|
|
626
|
+
* Dynamically add a protocol to a connection establishment
|
|
627
|
+
* attempt "above" the framer protocol. This means that the
|
|
628
|
+
* protocol above will start running once the framer becomes
|
|
629
|
+
* ready by calling nw_framer_mark_ready(). This can only
|
|
630
|
+
* be used with framers that return a value of
|
|
631
|
+
* nw_framer_start_result_will_call_ready to their start
|
|
632
|
+
* handlers. An example of using this functionality is
|
|
633
|
+
* adding a security protocol, like TLS, above a framer
|
|
634
|
+
* once that framer completes its initial handshake.
|
|
635
|
+
*
|
|
636
|
+
* To ensure thread safety, this function can only be called
|
|
637
|
+
* in one of the callback blocks invoked on the framer, or
|
|
638
|
+
* in a block passed to nw_framer_async().
|
|
639
|
+
*
|
|
640
|
+
* @param framer
|
|
641
|
+
* The framer instance object.
|
|
642
|
+
*
|
|
643
|
+
* @param protocol_options
|
|
644
|
+
* Protocol options for an application protocol to dynamically
|
|
645
|
+
* add "above" the framer.
|
|
646
|
+
*
|
|
647
|
+
* @result Returns true if the protocol was successfully added,
|
|
648
|
+
* or false it it could not be added. This will fail if
|
|
649
|
+
* the framer is already marked ready.
|
|
650
|
+
*/
|
|
651
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
652
|
+
bool
|
|
653
|
+
nw_framer_prepend_application_protocol(nw_framer_t framer,
|
|
654
|
+
nw_protocol_options_t protocol_options);
|
|
655
|
+
|
|
656
|
+
/*!
|
|
657
|
+
* @function nw_framer_mark_failed_with_error
|
|
658
|
+
*
|
|
659
|
+
* @abstract
|
|
660
|
+
* Mark the connection associated with the framer instance
|
|
661
|
+
* as failed (see nw_connection_state_failed).
|
|
662
|
+
*
|
|
663
|
+
* To ensure thread safety, this function can only be called
|
|
664
|
+
* in one of the callback blocks invoked on the framer, or
|
|
665
|
+
* in a block passed to nw_framer_async().
|
|
666
|
+
*
|
|
667
|
+
* @param framer
|
|
668
|
+
* The framer instance object.
|
|
669
|
+
*
|
|
670
|
+
* @param error_code
|
|
671
|
+
* An error code to describe why the connection failed.
|
|
672
|
+
*/
|
|
673
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
674
|
+
void
|
|
675
|
+
nw_framer_mark_failed_with_error(nw_framer_t framer, int error_code);
|
|
676
|
+
|
|
677
|
+
/*!
|
|
678
|
+
* @typedef nw_framer_parse_completion_t
|
|
679
|
+
*
|
|
680
|
+
* @abstract
|
|
681
|
+
* A completion block that is invoked inline to parse available
|
|
682
|
+
* bytes, either input or output. This is the way a framer can
|
|
683
|
+
* access the underlying buffer for data being sent or received.
|
|
684
|
+
* The block has a side effect of advancing the parsing cursor
|
|
685
|
+
* by the number of bytes specified in the return value.
|
|
686
|
+
*
|
|
687
|
+
* @param buffer
|
|
688
|
+
* The buffer of bytes being sent or received.
|
|
689
|
+
*
|
|
690
|
+
* @param buffer_length
|
|
691
|
+
* The number of valid bytes in buffer.
|
|
692
|
+
*
|
|
693
|
+
* @param is_complete
|
|
694
|
+
* The boolean indicating if this section of the buffer indicates
|
|
695
|
+
* the end of a message or stream.
|
|
696
|
+
*
|
|
697
|
+
* @result
|
|
698
|
+
* Return the number of bytes by which to advance the input or
|
|
699
|
+
* output cursor. For example, if nw_framer_parse_input() is called
|
|
700
|
+
* and the completion returns 0, calling nw_framer_parse_input() again
|
|
701
|
+
* will allow the implementation to start parsing again at the same
|
|
702
|
+
* start location. However, if the completion returns 10, the next
|
|
703
|
+
* call to nw_framer_parse_input() will return bytes starting from 10
|
|
704
|
+
* bytes beyond the previous call.
|
|
705
|
+
*
|
|
706
|
+
* The cursors also define the offsets at which data being delivered
|
|
707
|
+
* or written using nw_framer_deliver_input_no_copy() and
|
|
708
|
+
* nw_framer_write_output_no_copy() will start.
|
|
709
|
+
*
|
|
710
|
+
* The returned value for incrementing the cursor may be larger than
|
|
711
|
+
* the length of the buffer just parsed. This allows an implementation
|
|
712
|
+
* to "skip" ahead by a number of bytes if it knows it does not
|
|
713
|
+
* need to parse more.
|
|
714
|
+
*/
|
|
715
|
+
typedef size_t (^nw_framer_parse_completion_t)(uint8_t * _Nullable buffer,
|
|
716
|
+
size_t buffer_length,
|
|
717
|
+
bool is_complete);
|
|
718
|
+
|
|
719
|
+
/*!
|
|
720
|
+
* @function nw_framer_parse_input
|
|
721
|
+
*
|
|
722
|
+
* @abstract
|
|
723
|
+
* Parse currently available input from the location of the input
|
|
724
|
+
* cursor in the stream or message being parsed.
|
|
725
|
+
*
|
|
726
|
+
* The parse completion block will always be invoked inline exactly once.
|
|
727
|
+
*
|
|
728
|
+
* To ensure thread safety, this function can only be called
|
|
729
|
+
* in one of the callback blocks invoked on the framer, or
|
|
730
|
+
* in a block passed to nw_framer_async().
|
|
731
|
+
*
|
|
732
|
+
* @param framer
|
|
733
|
+
* The framer instance object.
|
|
734
|
+
*
|
|
735
|
+
* @param minimum_incomplete_length
|
|
736
|
+
* The minimum number of bytes to parse. If this amount is
|
|
737
|
+
* not available, the parse completion block will be invoked
|
|
738
|
+
* with 0 bytes.
|
|
739
|
+
*
|
|
740
|
+
* @param maximum_length
|
|
741
|
+
* The maximum number of bytes to parse as a contiguous buffer.
|
|
742
|
+
* If temp_buffer is not NULL, then this represents the length
|
|
743
|
+
* of valid bytes in temp_buffer.
|
|
744
|
+
*
|
|
745
|
+
* @param temp_buffer
|
|
746
|
+
* A buffer provided by the caller to copy parse bytes into.
|
|
747
|
+
* If it is not NULL, it must have at least maximum_length bytes
|
|
748
|
+
* available, and any parsed bytes will be copied into the buffer.
|
|
749
|
+
* Any data stored in temp_buffer will be overwritten.
|
|
750
|
+
* If it is NULL, the buffer provided in the completion will not
|
|
751
|
+
* copy unless a copy is required to provide the minimum bytes
|
|
752
|
+
* as a contiguous buffer. The temp_buffer allows the caller to
|
|
753
|
+
* guarantee alignment properties of the buffer it parses.
|
|
754
|
+
*
|
|
755
|
+
* @param parse
|
|
756
|
+
* The completion that provides the bytes to parse, which will
|
|
757
|
+
* be called exactly once.
|
|
758
|
+
*
|
|
759
|
+
* @result
|
|
760
|
+
* Returns true if the parse succeeded, or false if not enough
|
|
761
|
+
* bytes were available.
|
|
762
|
+
*/
|
|
763
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
764
|
+
bool
|
|
765
|
+
nw_framer_parse_input(nw_framer_t framer,
|
|
766
|
+
size_t minimum_incomplete_length,
|
|
767
|
+
size_t maximum_length,
|
|
768
|
+
uint8_t * _Nullable temp_buffer,
|
|
769
|
+
NW_NOESCAPE nw_framer_parse_completion_t parse);
|
|
770
|
+
|
|
771
|
+
/*!
|
|
772
|
+
* @function nw_framer_deliver_input
|
|
773
|
+
*
|
|
774
|
+
* @abstract
|
|
775
|
+
* Deliver arbitrary data to the application. This is intended to
|
|
776
|
+
* deliver any data that is generated or transformed by the
|
|
777
|
+
* protocol instance. It will incur a copy of bytes.
|
|
778
|
+
*
|
|
779
|
+
* To ensure thread safety, this function can only be called
|
|
780
|
+
* in one of the callback blocks invoked on the framer, or
|
|
781
|
+
* in a block passed to nw_framer_async().
|
|
782
|
+
*
|
|
783
|
+
* @param framer
|
|
784
|
+
* The framer instance object.
|
|
785
|
+
*
|
|
786
|
+
* @param input_buffer
|
|
787
|
+
* The bytes to deliver to the application. This must be non-NULL.
|
|
788
|
+
* If an empty message needs to be delivered, use
|
|
789
|
+
* nw_framer_deliver_input_no_copy().
|
|
790
|
+
*
|
|
791
|
+
* @param input_length
|
|
792
|
+
* The length of input_buffer. This must be non-zero.
|
|
793
|
+
*
|
|
794
|
+
* @param message
|
|
795
|
+
* The message to associate with the received data.
|
|
796
|
+
*
|
|
797
|
+
* @param is_complete
|
|
798
|
+
* A boolean indicating whether or not this data represents
|
|
799
|
+
* the end of the message.
|
|
800
|
+
*/
|
|
801
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
802
|
+
void
|
|
803
|
+
nw_framer_deliver_input(nw_framer_t framer,
|
|
804
|
+
const uint8_t *input_buffer,
|
|
805
|
+
size_t input_length,
|
|
806
|
+
nw_framer_message_t message,
|
|
807
|
+
bool is_complete);
|
|
808
|
+
|
|
809
|
+
/*!
|
|
810
|
+
* @function nw_framer_deliver_input_no_copy
|
|
811
|
+
*
|
|
812
|
+
* @abstract
|
|
813
|
+
* Deliver bytes directly to the application without any
|
|
814
|
+
* transformation or copy. The bytes will start at the current
|
|
815
|
+
* input cursor used for parsing, and will implicitly advance
|
|
816
|
+
* the cursor by the length being delivered.
|
|
817
|
+
*
|
|
818
|
+
* To ensure thread safety, this function can only be called
|
|
819
|
+
* in one of the callback blocks invoked on the framer, or
|
|
820
|
+
* in a block passed to nw_framer_async().
|
|
821
|
+
*
|
|
822
|
+
* @param framer
|
|
823
|
+
* The framer instance object.
|
|
824
|
+
*
|
|
825
|
+
* @param input_length
|
|
826
|
+
* The number of input bytes to deliver. This will advance
|
|
827
|
+
* the parsing cursor by the specified number of bytes.
|
|
828
|
+
*
|
|
829
|
+
* The length may be 0, which can be used to indicate the
|
|
830
|
+
* end of the message if is_complete is set.
|
|
831
|
+
*
|
|
832
|
+
* @param message
|
|
833
|
+
* The message to associate with the received data.
|
|
834
|
+
*
|
|
835
|
+
* @param is_complete
|
|
836
|
+
* A boolean indicating whether or not this data represents
|
|
837
|
+
* the end of the message.
|
|
838
|
+
*
|
|
839
|
+
* @result
|
|
840
|
+
* Returns true if the input was delivered immediately, or
|
|
841
|
+
* false if it will be delivered once more bytes become available.
|
|
842
|
+
*/
|
|
843
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
844
|
+
bool
|
|
845
|
+
nw_framer_deliver_input_no_copy(nw_framer_t framer,
|
|
846
|
+
size_t input_length,
|
|
847
|
+
nw_framer_message_t message,
|
|
848
|
+
bool is_complete);
|
|
849
|
+
|
|
850
|
+
/*!
|
|
851
|
+
* @function nw_framer_pass_through_input
|
|
852
|
+
*
|
|
853
|
+
* @abstract
|
|
854
|
+
* Mark the input side of the framer as a pass-through, which
|
|
855
|
+
* means the framer will not be notified of any further input
|
|
856
|
+
* data.
|
|
857
|
+
*
|
|
858
|
+
* To ensure thread safety, this function can only be called
|
|
859
|
+
* in one of the callback blocks invoked on the framer, or
|
|
860
|
+
* in a block passed to nw_framer_async().
|
|
861
|
+
*
|
|
862
|
+
* @param framer
|
|
863
|
+
* The framer instance object.
|
|
864
|
+
*/
|
|
865
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
866
|
+
void
|
|
867
|
+
nw_framer_pass_through_input(nw_framer_t framer);
|
|
868
|
+
|
|
869
|
+
/*!
|
|
870
|
+
* @function nw_framer_parse_output
|
|
871
|
+
*
|
|
872
|
+
* @abstract
|
|
873
|
+
* Parse currently available output from a message from the location
|
|
874
|
+
* of the output cursor in the message being parsed.
|
|
875
|
+
*
|
|
876
|
+
* The parse completion block will always be invoked inline exactly once.
|
|
877
|
+
*
|
|
878
|
+
* This function must only be called from within the output handler
|
|
879
|
+
* set with nw_framer_set_output_handler().
|
|
880
|
+
*
|
|
881
|
+
* @param framer
|
|
882
|
+
* The framer instance object.
|
|
883
|
+
*
|
|
884
|
+
* @param minimum_incomplete_length
|
|
885
|
+
* The minimum number of bytes to parse. If this amount is
|
|
886
|
+
* not available, the parse completion block will be invoked
|
|
887
|
+
* with 0 bytes.
|
|
888
|
+
*
|
|
889
|
+
* @param maximum_length
|
|
890
|
+
* The maximum number of bytes to parse as a contiguous buffer.
|
|
891
|
+
* If temp_buffer is not NULL, then this represents the length
|
|
892
|
+
* of valid bytes in temp_buffer.
|
|
893
|
+
*
|
|
894
|
+
* @param temp_buffer
|
|
895
|
+
* A buffer provided by the caller to copy parse bytes into.
|
|
896
|
+
* If it is not NULL, it must have at least maximum_length bytes
|
|
897
|
+
* available, and any parsed bytes will be copied into the buffer.
|
|
898
|
+
* Any data stored in temp_buffer will be overwritten.
|
|
899
|
+
* If it is NULL, the buffer provided in the completion will not
|
|
900
|
+
* copy unless a copy is required to provide the minimum bytes
|
|
901
|
+
* as a contiguous buffer. The temp_buffer allows the caller to
|
|
902
|
+
* guarantee alignment properties of the buffer it parses.
|
|
903
|
+
*
|
|
904
|
+
* @param parse
|
|
905
|
+
* The completion that provides the bytes to parse, which will
|
|
906
|
+
* be called exactly once.
|
|
907
|
+
*
|
|
908
|
+
* @result
|
|
909
|
+
* Returns true if the parse succeeded, or false if not enough
|
|
910
|
+
* bytes were available.
|
|
911
|
+
*/
|
|
912
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
913
|
+
bool
|
|
914
|
+
nw_framer_parse_output(nw_framer_t framer,
|
|
915
|
+
size_t minimum_incomplete_length,
|
|
916
|
+
size_t maximum_length,
|
|
917
|
+
uint8_t * _Nullable temp_buffer,
|
|
918
|
+
NW_NOESCAPE nw_framer_parse_completion_t parse);
|
|
919
|
+
|
|
920
|
+
/*!
|
|
921
|
+
* @function nw_framer_write_output
|
|
922
|
+
*
|
|
923
|
+
* @abstract
|
|
924
|
+
* Write arbitrary bytes as part of an outbound message. This
|
|
925
|
+
* is intended to be used for adding headers around application
|
|
926
|
+
* data, or writing any other data that is generated or transformed
|
|
927
|
+
* by the protocol instance. It does not pass along data directly
|
|
928
|
+
* from the application.
|
|
929
|
+
*
|
|
930
|
+
* This variant will copy bytes.
|
|
931
|
+
*
|
|
932
|
+
* This function may be called as part of any framer callback,
|
|
933
|
+
* not just the output handler.
|
|
934
|
+
*
|
|
935
|
+
* To ensure thread safety, this function can only be called
|
|
936
|
+
* in one of the callback blocks invoked on the framer, or
|
|
937
|
+
* in a block passed to nw_framer_async().
|
|
938
|
+
*
|
|
939
|
+
* @param framer
|
|
940
|
+
* The framer instance object.
|
|
941
|
+
*
|
|
942
|
+
* @param output_buffer
|
|
943
|
+
* The bytes to write.
|
|
944
|
+
*
|
|
945
|
+
* @param output_length
|
|
946
|
+
* The length of output_buffer.
|
|
947
|
+
*/
|
|
948
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
949
|
+
void
|
|
950
|
+
nw_framer_write_output(nw_framer_t framer,
|
|
951
|
+
const uint8_t *output_buffer,
|
|
952
|
+
size_t output_length);
|
|
953
|
+
|
|
954
|
+
/*!
|
|
955
|
+
* @function nw_framer_write_output_data
|
|
956
|
+
*
|
|
957
|
+
* @abstract
|
|
958
|
+
* Write arbitrary bytes as part of an outbound message. This
|
|
959
|
+
* is intended to be used for adding headers around application
|
|
960
|
+
* data, or writing any other data that is generated or transformed
|
|
961
|
+
* by the protocol instance. It does not pass along data directly
|
|
962
|
+
* from the application.
|
|
963
|
+
*
|
|
964
|
+
* This variant is the same as nw_framer_write_output(), but allows
|
|
965
|
+
* the implementation to pass its buffer as a dispatch_data_t to
|
|
966
|
+
* avoid a copy.
|
|
967
|
+
*
|
|
968
|
+
* This function may be called as part of any framer callback,
|
|
969
|
+
* not just the output handler.
|
|
970
|
+
*
|
|
971
|
+
* To ensure thread safety, this function can only be called
|
|
972
|
+
* in one of the callback blocks invoked on the framer, or
|
|
973
|
+
* in a block passed to nw_framer_async().
|
|
974
|
+
*
|
|
975
|
+
* @param framer
|
|
976
|
+
* The framer instance object.
|
|
977
|
+
*
|
|
978
|
+
* @param output_data
|
|
979
|
+
* A dispatch_data_t to write.
|
|
980
|
+
*/
|
|
981
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
982
|
+
void
|
|
983
|
+
nw_framer_write_output_data(nw_framer_t framer,
|
|
984
|
+
dispatch_data_t output_data);
|
|
985
|
+
|
|
986
|
+
/*!
|
|
987
|
+
* @function nw_framer_write_output_no_copy
|
|
988
|
+
*
|
|
989
|
+
* @abstract
|
|
990
|
+
* Write bytes directly from the application without any
|
|
991
|
+
* transformation or copy. The bytes will start at the current
|
|
992
|
+
* output cursor used for parsing, and will implicitly advance
|
|
993
|
+
* the cursor by the length being written.
|
|
994
|
+
*
|
|
995
|
+
* This function must only be called from within the output handler
|
|
996
|
+
* set with nw_framer_set_output_handler().
|
|
997
|
+
*
|
|
998
|
+
* To ensure thread safety, this function can only be called
|
|
999
|
+
* in one of the callback blocks invoked on the framer, or
|
|
1000
|
+
* in a block passed to nw_framer_async().
|
|
1001
|
+
*
|
|
1002
|
+
* @param framer
|
|
1003
|
+
* The framer instance object.
|
|
1004
|
+
*
|
|
1005
|
+
* @param output_length
|
|
1006
|
+
* The number of application bytes to write. This will advance
|
|
1007
|
+
* the parsing cursor by the specified number of bytes.
|
|
1008
|
+
*
|
|
1009
|
+
* @return
|
|
1010
|
+
* Returns true if the write could be completed, otherwise
|
|
1011
|
+
* false if the call was made from an invalid context
|
|
1012
|
+
* or with an invalid number of bytes.
|
|
1013
|
+
*/
|
|
1014
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
1015
|
+
bool
|
|
1016
|
+
nw_framer_write_output_no_copy(nw_framer_t framer,
|
|
1017
|
+
size_t output_length);
|
|
1018
|
+
|
|
1019
|
+
/*!
|
|
1020
|
+
* @function nw_framer_pass_through_output
|
|
1021
|
+
*
|
|
1022
|
+
* @abstract
|
|
1023
|
+
* Mark the output side of the framer as a pass-through, which
|
|
1024
|
+
* means the framer will not be notified of any further output
|
|
1025
|
+
* data.
|
|
1026
|
+
*
|
|
1027
|
+
* To ensure thread safety, this function can only be called
|
|
1028
|
+
* in one of the callback blocks invoked on the framer, or
|
|
1029
|
+
* in a block passed to nw_framer_async().
|
|
1030
|
+
*
|
|
1031
|
+
* @param framer
|
|
1032
|
+
* The framer instance object.
|
|
1033
|
+
*/
|
|
1034
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
1035
|
+
void
|
|
1036
|
+
nw_framer_pass_through_output(nw_framer_t framer);
|
|
1037
|
+
|
|
1038
|
+
#define NW_FRAMER_WAKEUP_TIME_FOREVER (~0ull)
|
|
1039
|
+
|
|
1040
|
+
/*!
|
|
1041
|
+
* @function nw_framer_schedule_wakeup
|
|
1042
|
+
*
|
|
1043
|
+
* @abstract
|
|
1044
|
+
* Schedule a wakeup on the framer instance for a number of
|
|
1045
|
+
* milliseconds into the future. If this is called multiple
|
|
1046
|
+
* times before the timeout is reached, the new value replaces
|
|
1047
|
+
* the previous value.
|
|
1048
|
+
*
|
|
1049
|
+
* To ensure thread safety, this function can only be called
|
|
1050
|
+
* in one of the callback blocks invoked on the framer, or
|
|
1051
|
+
* in a block passed to nw_framer_async().
|
|
1052
|
+
*
|
|
1053
|
+
* @param framer
|
|
1054
|
+
* The framer instance object.
|
|
1055
|
+
*
|
|
1056
|
+
* @param milliseconds
|
|
1057
|
+
* The number of milliseconds into the future at which to
|
|
1058
|
+
* invoke the wakeup handler. Pass the reserved value
|
|
1059
|
+
* NW_FRAMER_WAKEUP_TIME_FOREVER to push the wakeup timer
|
|
1060
|
+
* out to "forever", effectively unscheduling the timer.
|
|
1061
|
+
*/
|
|
1062
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
1063
|
+
void
|
|
1064
|
+
nw_framer_schedule_wakeup(nw_framer_t framer,
|
|
1065
|
+
uint64_t milliseconds);
|
|
1066
|
+
|
|
1067
|
+
/*!
|
|
1068
|
+
* @typedef nw_framer_block_t
|
|
1069
|
+
*
|
|
1070
|
+
* @abstract
|
|
1071
|
+
* A block to perform actions on a framer's scheduling context.
|
|
1072
|
+
*/
|
|
1073
|
+
typedef void (^nw_framer_block_t)(void);
|
|
1074
|
+
|
|
1075
|
+
/*!
|
|
1076
|
+
* @function nw_framer_async
|
|
1077
|
+
*
|
|
1078
|
+
* @abstract
|
|
1079
|
+
* Schedule a block asynchronously on the framer instance. This
|
|
1080
|
+
* must be used anytime the caller wants to perform any other
|
|
1081
|
+
* action on the framer instance while not directly in the call stack
|
|
1082
|
+
* of a callback from the framer.
|
|
1083
|
+
*
|
|
1084
|
+
* @param framer
|
|
1085
|
+
* The framer instance object.
|
|
1086
|
+
*
|
|
1087
|
+
* @param async_block
|
|
1088
|
+
* A block to execute on the correct scheduling context for the
|
|
1089
|
+
* framer instance.
|
|
1090
|
+
*/
|
|
1091
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
1092
|
+
void
|
|
1093
|
+
nw_framer_async(nw_framer_t framer,
|
|
1094
|
+
nw_framer_block_t async_block);
|
|
1095
|
+
|
|
1096
|
+
#endif // __BLOCKS__
|
|
1097
|
+
|
|
1098
|
+
#pragma mark - Framer Implementation Accessors
|
|
1099
|
+
|
|
1100
|
+
/*!
|
|
1101
|
+
* @function nw_framer_copy_remote_endpoint
|
|
1102
|
+
*
|
|
1103
|
+
* @abstract
|
|
1104
|
+
* Access the remote endpoint being used for a given
|
|
1105
|
+
* instance of a framer.
|
|
1106
|
+
*
|
|
1107
|
+
* To ensure thread safety, this function can only be called
|
|
1108
|
+
* in one of the callback blocks invoked on the framer, or
|
|
1109
|
+
* in a block passed to nw_framer_async().
|
|
1110
|
+
*
|
|
1111
|
+
* @param framer
|
|
1112
|
+
* The framer instance.
|
|
1113
|
+
*
|
|
1114
|
+
* @return
|
|
1115
|
+
* Returns a retained endpoint object representing
|
|
1116
|
+
* the remote side of a connection.
|
|
1117
|
+
*/
|
|
1118
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
1119
|
+
NW_RETURNS_RETAINED nw_endpoint_t
|
|
1120
|
+
nw_framer_copy_remote_endpoint(nw_framer_t framer);
|
|
1121
|
+
|
|
1122
|
+
/*!
|
|
1123
|
+
* @function nw_framer_copy_local_endpoint
|
|
1124
|
+
*
|
|
1125
|
+
* @abstract
|
|
1126
|
+
* Access the local endpoint being used for a given
|
|
1127
|
+
* instance of a framer.
|
|
1128
|
+
*
|
|
1129
|
+
* To ensure thread safety, this function can only be called
|
|
1130
|
+
* in one of the callback blocks invoked on the framer, or
|
|
1131
|
+
* in a block passed to nw_framer_async().
|
|
1132
|
+
*
|
|
1133
|
+
* @param framer
|
|
1134
|
+
* The framer instance.
|
|
1135
|
+
*
|
|
1136
|
+
* @return
|
|
1137
|
+
* Returns a retained endpoint object representing
|
|
1138
|
+
* the local side of a connection.
|
|
1139
|
+
*/
|
|
1140
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
1141
|
+
NW_RETURNS_RETAINED nw_endpoint_t
|
|
1142
|
+
nw_framer_copy_local_endpoint(nw_framer_t framer);
|
|
1143
|
+
|
|
1144
|
+
/*!
|
|
1145
|
+
* @function nw_framer_copy_parameters
|
|
1146
|
+
*
|
|
1147
|
+
* @abstract
|
|
1148
|
+
* Access the parameters being used for a given
|
|
1149
|
+
* instance of a framer.
|
|
1150
|
+
*
|
|
1151
|
+
* To ensure thread safety, this function can only be called
|
|
1152
|
+
* in one of the callback blocks invoked on the framer, or
|
|
1153
|
+
* in a block passed to nw_framer_async().
|
|
1154
|
+
*
|
|
1155
|
+
* @param framer
|
|
1156
|
+
* The framer instance.
|
|
1157
|
+
*
|
|
1158
|
+
* @return
|
|
1159
|
+
* Returns a retained parameters object.
|
|
1160
|
+
*/
|
|
1161
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
1162
|
+
NW_RETURNS_RETAINED nw_parameters_t
|
|
1163
|
+
nw_framer_copy_parameters(nw_framer_t framer);
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
/*!
|
|
1167
|
+
* @function nw_framer_copy_options
|
|
1168
|
+
*
|
|
1169
|
+
* @abstract
|
|
1170
|
+
* Access the protocol options being used for a given
|
|
1171
|
+
* instance of a framer.
|
|
1172
|
+
*
|
|
1173
|
+
* @param framer
|
|
1174
|
+
* The framer instance.
|
|
1175
|
+
*
|
|
1176
|
+
* @return
|
|
1177
|
+
* Returns a retained protocol options object.
|
|
1178
|
+
*/
|
|
1179
|
+
API_AVAILABLE(macos(12.3), ios(15.4), watchos(8.4), tvos(15.4))
|
|
1180
|
+
NW_RETURNS_RETAINED nw_protocol_options_t
|
|
1181
|
+
nw_framer_copy_options(nw_framer_t framer);
|
|
1182
|
+
|
|
1183
|
+
NW_ASSUME_NONNULL_END
|
|
1184
|
+
|
|
1185
|
+
__END_DECLS
|
|
1186
|
+
|
|
1187
|
+
#endif // __NW_FRAMER_OPTIONS_H__
|