PSocketProcess.ipdl (8621B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 include protocol PDNSRequest; 7 include protocol PSocketProcessBridge; 8 include protocol PProfiler; 9 include protocol PWebrtcTCPSocket; 10 include protocol PHttpTransaction; 11 include protocol PHttpConnectionMgr; 12 include protocol PInputChannelThrottleQueue; 13 include protocol PAltService; 14 include protocol PAltSvcTransaction; 15 include protocol PTRRService; 16 include protocol PProxyConfigLookup; 17 include protocol PNativeDNSResolverOverride; 18 include protocol PProxyAutoConfig; 19 include protocol PSocketProcessBackground; 20 21 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS) 22 include protocol PSandboxTesting; 23 #endif 24 25 include CrashReporterInitArgs; 26 include MemoryReportTypes; 27 include NeckoChannelParams; 28 include PrefsTypes; 29 30 include "mozilla/ipc/ByteBufUtils.h"; 31 32 using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h"; 33 using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h"; 34 using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h"; 35 using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h"; 36 using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h"; 37 using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h"; 38 using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h"; 39 using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h"; 40 using base::ProcessId from "base/process.h"; 41 using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h"; 42 using PRTime from "prtime.h"; 43 [RefCounted] using class nsIURI from "mozilla/ipc/URIUtils.h"; 44 using struct nsID from "nsID.h"; 45 using mozilla::net::SocketInfo from "mozilla/net/DashboardTypes.h"; 46 using mozilla::net::DNSCacheEntries from "mozilla/net/DashboardTypes.h"; 47 using mozilla::net::HttpRetParams from "mozilla/net/DashboardTypes.h"; 48 using mozilla::net::Http3ConnectionStatsParams from "mozilla/net/DashboardTypes.h"; 49 using mozilla::net::NetAddr from "mozilla/net/DNS.h"; 50 using nsIDNSService::DNSFlags from "nsIDNSService.h"; 51 52 #if defined(XP_WIN) 53 [MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h"; 54 [MoveOnly] using mozilla::ModulePaths from "mozilla/UntrustedModulesData.h"; 55 [MoveOnly] using mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h"; 56 #endif // defined(XP_WIN) 57 58 namespace mozilla { 59 namespace net { 60 61 struct HttpHandlerInitArgs { 62 nsCString mLegacyAppName; 63 nsCString mLegacyAppVersion; 64 nsCString mPlatform; 65 nsCString mOscpu; 66 nsCString mMisc; 67 nsCString mProduct; 68 nsCString mProductSub; 69 nsCString mAppName; 70 nsCString mAppVersion; 71 nsCString mCompatFirefox; 72 nsCString mCompatDevice; 73 nsCString mDeviceModelId; 74 }; 75 76 struct SocketDataArgs 77 { 78 uint64_t totalSent; 79 uint64_t totalRecv; 80 SocketInfo[] info; 81 }; 82 83 struct SocketPorcessInitAttributes { 84 bool mOffline; 85 bool mConnectivity; 86 bool mInitSandbox; 87 #if defined(XP_WIN) 88 bool mIsReadyForBackgroundProcessing; 89 #endif 90 FileDescriptor? mSandboxBroker; 91 }; 92 93 [NeedsOtherPid, ChildProc=Socket] 94 sync protocol PSocketProcess 95 { 96 manages PDNSRequest; 97 manages PWebrtcTCPSocket; 98 manages PHttpTransaction; 99 manages PHttpConnectionMgr; 100 manages PInputChannelThrottleQueue; 101 manages PAltService; 102 manages PAltSvcTransaction; 103 manages PTRRService; 104 manages PProxyConfigLookup; 105 manages PNativeDNSResolverOverride; 106 107 parent: 108 async InitCrashReporter(CrashReporterInitArgs aInitArgs); 109 async AddMemoryReport(MemoryReport aReport); 110 // Messages for sending telemetry to parent process. 111 async AccumulateChildHistograms(HistogramAccumulation[] accumulations); 112 async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations); 113 async UpdateChildScalars(ScalarAction[] actions); 114 async UpdateChildKeyedScalars(KeyedScalarAction[] actions); 115 async RecordChildEvents(ChildEventData[] events); 116 async RecordDiscardedData(DiscardedData data); 117 118 /* tabId is only required for web-proxy support, which isn't always needed */ 119 async PWebrtcTCPSocket(TabId? tabId); 120 async ObserveHttpActivity(HttpActivityArgs aActivityArgs, 121 uint32_t aActivityType, 122 uint32_t aActivitySubtype, 123 PRTime aTimestamp, 124 uint64_t aExtraSizeData, 125 nsCString aExtraStringData); 126 async InitSocketBackground(Endpoint<PSocketProcessBackgroundParent> aEndpoint); 127 async PAltService(); 128 async PProxyConfigLookup(nullable nsIURI aUri, uint32_t aFlags); 129 130 async ExcludeHttp2OrHttp3(HttpConnectionInfoCloneArgs aArgs); 131 132 async OnConsoleMessage(nsString aMessage); 133 134 // Sent from time-to-time to limit the amount of telemetry vulnerable to loss 135 // Buffer contains bincoded Rust structs. 136 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html 137 async FOGData(ByteBuf buf); 138 139 async GeckoTraceExport(ByteBuf aBuf); 140 141 #if defined(XP_WIN) 142 async GetModulesTrust(ModulePaths aModPaths, bool aRunAtNormalPriority) 143 returns (ModulesMapResult? modMapResult); 144 #endif // defined(XP_WIN) 145 146 child: 147 async Init(SocketPorcessInitAttributes aAttributes); 148 async PreferenceUpdate(Pref pref); 149 async RequestMemoryReport(uint32_t generation, 150 bool anonymize, 151 bool minimizeMemoryUsage, 152 FileDescriptor? DMDFile) 153 returns (uint32_t aGeneration); 154 async SetOffline(bool offline); 155 async SetConnectivity(bool connectivity); 156 async InitLinuxSandbox(FileDescriptor? sandboxBroker); 157 async InitSocketProcessBridgeParent(ProcessId processId, Endpoint<PSocketProcessBridgeParent> endpoint); 158 async InitProfiler(Endpoint<PProfilerChild> aEndpoint); 159 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS) 160 async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint); 161 #endif 162 // test-only 163 async SocketProcessTelemetryPing(); 164 165 async PHttpTransaction(); 166 async PHttpConnectionMgr(HttpHandlerInitArgs aArgs); 167 async UpdateDeviceModelId(nsCString aModelId); 168 169 async OnHttpActivityDistributorActivated(bool aIsActivated); 170 async OnHttpActivityDistributorObserveProxyResponse(bool aIsEnabled); 171 async OnHttpActivityDistributorObserveConnection(bool aIsEnabled); 172 async PInputChannelThrottleQueue(uint32_t meanBytesPerSecond, 173 uint32_t maxBytesPerSecond); 174 async PAltSvcTransaction(HttpConnectionInfoCloneArgs aConnInfo, 175 uint32_t aCaps); 176 async ClearSessionCache() returns (void_t ok); 177 async PTRRService(bool aCaptiveIsPassed, 178 bool aParentalControlEnabled, 179 nsCString[] aDNSSuffixList); 180 async PNativeDNSResolverOverride(); 181 async NotifyObserver(nsCString aTopic, nsString aData); 182 183 async GetSocketData() 184 returns (SocketDataArgs data); 185 async GetDNSCacheEntries() 186 returns (DNSCacheEntries[] entries); 187 async GetHttpConnectionData() 188 returns (HttpRetParams[] params); 189 async GetHttp3ConnectionStatsData() 190 returns (Http3ConnectionStatsParams[] params); 191 192 async InitProxyAutoConfigChild(Endpoint<PProxyAutoConfigChild> endpoint); 193 194 async RecheckIPConnectivity(); 195 async RecheckDNS(); 196 197 // Tells the Socket process to flush any pending telemetry. 198 // Used in tests and ping assembly. Buffer contains bincoded Rust structs. 199 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html 200 async FlushFOGData() returns (ByteBuf buf); 201 202 // Test-only method. 203 // Asks the Socket process to trigger test-only instrumentation. 204 // The unused returned value is to have a promise we can await. 205 async TestTriggerMetrics() returns (bool unused); 206 207 #if defined(XP_WIN) 208 async GetUntrustedModulesData() returns (UntrustedModulesData? data); 209 210 /** 211 * This method is used to notifty a child process to start 212 * processing module loading events in UntrustedModulesProcessor. 213 * This should be called when the parent process has gone idle. 214 */ 215 async UnblockUntrustedModulesThread(); 216 #endif // defined(XP_WIN) 217 218 async AddNetAddrOverride(NetAddr aFrom, NetAddr aTo); 219 async ClearNetAddrOverrides(); 220 221 both: 222 async PDNSRequest(nsCString hostName, nsCString trrServer, int32_t port, 223 uint16_t type, OriginAttributes originAttributes, 224 DNSFlags flags); 225 }; 226 227 } // namespace net 228 } // namespace mozilla