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/. */
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;
21 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
22 include protocol PSandboxTesting;
25 include MemoryReportTypes;
26 include NeckoChannelParams;
29 include "mozilla/ipc/ByteBufUtils.h";
31 using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
32 using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
33 using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
34 using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
35 using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
36 using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
37 using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
38 using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
39 using base::ProcessId from "base/process.h";
40 using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
41 using PRTime from "prtime.h";
42 [RefCounted] using class nsIURI from "mozilla/ipc/URIUtils.h";
43 using struct nsID from "nsID.h";
44 using mozilla::net::SocketInfo from "mozilla/net/DashboardTypes.h";
45 using mozilla::net::DNSCacheEntries from "mozilla/net/DashboardTypes.h";
46 using mozilla::net::HttpRetParams from "mozilla/net/DashboardTypes.h";
47 using nsIDNSService::DNSFlags from "nsIDNSService.h";
50 [MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
51 [MoveOnly] using mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
52 [MoveOnly] using mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
53 #endif // defined(XP_WIN)
58 struct HttpHandlerInitArgs {
59 nsCString mLegacyAppName;
60 nsCString mLegacyAppVersion;
65 nsCString mProductSub;
67 nsCString mAppVersion;
68 nsCString mCompatFirefox;
69 nsCString mCompatDevice;
70 nsCString mDeviceModelId;
80 struct SocketPorcessInitAttributes {
85 bool mIsReadyForBackgroundProcessing;
87 FileDescriptor? mSandboxBroker;
90 [NeedsOtherPid, ChildProc=Socket]
91 sync protocol PSocketProcess
94 manages PWebrtcTCPSocket;
95 manages PHttpTransaction;
96 manages PHttpConnectionMgr;
97 manages PInputChannelThrottleQueue;
99 manages PAltSvcTransaction;
101 manages PProxyConfigLookup;
102 manages PNativeDNSResolverOverride;
105 async InitCrashReporter(NativeThreadId threadId);
106 async AddMemoryReport(MemoryReport aReport);
107 // Messages for sending telemetry to parent process.
108 async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
109 async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
110 async UpdateChildScalars(ScalarAction[] actions);
111 async UpdateChildKeyedScalars(KeyedScalarAction[] actions);
112 async RecordChildEvents(ChildEventData[] events);
113 async RecordDiscardedData(DiscardedData data);
115 /* tabId is only required for web-proxy support, which isn't always needed */
116 async PWebrtcTCPSocket(TabId? tabId);
117 async ObserveHttpActivity(HttpActivityArgs aActivityArgs,
118 uint32_t aActivityType,
119 uint32_t aActivitySubtype,
121 uint64_t aExtraSizeData,
122 nsCString aExtraStringData);
123 async InitSocketBackground(Endpoint<PSocketProcessBackgroundParent> aEndpoint);
125 async PProxyConfigLookup(nullable nsIURI aUri, uint32_t aFlags);
126 async CachePushCheck(nullable nsIURI aPushedURL,
127 OriginAttributes aOriginAttributes,
128 nsCString aRequestString)
129 returns (bool aAccepted);
131 async ExcludeHttp2OrHttp3(HttpConnectionInfoCloneArgs aArgs);
133 async OnConsoleMessage(nsString aMessage);
135 // Sent from time-to-time to limit the amount of telemetry vulnerable to loss
136 // Buffer contains bincoded Rust structs.
137 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
138 async FOGData(ByteBuf buf);
141 async GetModulesTrust(ModulePaths aModPaths, bool aRunAtNormalPriority)
142 returns (ModulesMapResult? modMapResult);
143 #endif // defined(XP_WIN)
146 async Init(SocketPorcessInitAttributes aAttributes);
147 async PreferenceUpdate(Pref pref);
148 async RequestMemoryReport(uint32_t generation,
150 bool minimizeMemoryUsage,
151 FileDescriptor? DMDFile)
152 returns (uint32_t aGeneration);
153 async SetOffline(bool offline);
154 async SetConnectivity(bool connectivity);
155 async InitLinuxSandbox(FileDescriptor? sandboxBroker);
156 async InitSocketProcessBridgeParent(ProcessId processId, Endpoint<PSocketProcessBridgeParent> endpoint);
157 async InitProfiler(Endpoint<PProfilerChild> aEndpoint);
158 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
159 async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint);
162 async SocketProcessTelemetryPing();
164 async PHttpTransaction();
165 async PHttpConnectionMgr(HttpHandlerInitArgs aArgs);
166 async UpdateDeviceModelId(nsCString aModelId);
168 async OnHttpActivityDistributorActivated(bool aIsActivated);
169 async OnHttpActivityDistributorObserveProxyResponse(bool aIsEnabled);
170 async OnHttpActivityDistributorObserveConnection(bool aIsEnabled);
171 async PInputChannelThrottleQueue(uint32_t meanBytesPerSecond,
172 uint32_t maxBytesPerSecond);
173 async PAltSvcTransaction(HttpConnectionInfoCloneArgs aConnInfo,
175 async ClearSessionCache() returns (void_t ok);
176 async PTRRService(bool aCaptiveIsPassed,
177 bool aParentalControlEnabled,
178 nsCString[] aDNSSuffixList);
179 async PNativeDNSResolverOverride();
180 async NotifyObserver(nsCString aTopic, nsString aData);
182 async GetSocketData()
183 returns (SocketDataArgs data);
184 async GetDNSCacheEntries()
185 returns (DNSCacheEntries[] entries);
186 async GetHttpConnectionData()
187 returns (HttpRetParams[] params);
189 async InitProxyAutoConfigChild(Endpoint<PProxyAutoConfigChild> endpoint);
191 async RecheckIPConnectivity();
194 // Tells the Socket process to flush any pending telemetry.
195 // Used in tests and ping assembly. Buffer contains bincoded Rust structs.
196 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
197 async FlushFOGData() returns (ByteBuf buf);
200 // Asks the Socket process to trigger test-only instrumentation.
201 // The unused returned value is to have a promise we can await.
202 async TestTriggerMetrics() returns (bool unused);
205 async GetUntrustedModulesData() returns (UntrustedModulesData? data);
208 * This method is used to notifty a child process to start
209 * processing module loading events in UntrustedModulesProcessor.
210 * This should be called when the parent process has gone idle.
212 async UnblockUntrustedModulesThread();
213 #endif // defined(XP_WIN)
216 async PDNSRequest(nsCString hostName, nsCString trrServer, int32_t port,
217 uint16_t type, OriginAttributes originAttributes,
222 } // namespace mozilla