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 mozilla::net::NetAddr from "mozilla/net/DNS.h";
48 using nsIDNSService::DNSFlags from "nsIDNSService.h";
51 [MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
52 [MoveOnly] using mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
53 [MoveOnly] using mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
54 #endif // defined(XP_WIN)
59 struct HttpHandlerInitArgs {
60 nsCString mLegacyAppName;
61 nsCString mLegacyAppVersion;
66 nsCString mProductSub;
68 nsCString mAppVersion;
69 nsCString mCompatFirefox;
70 nsCString mCompatDevice;
71 nsCString mDeviceModelId;
81 struct SocketPorcessInitAttributes {
86 bool mIsReadyForBackgroundProcessing;
88 FileDescriptor? mSandboxBroker;
91 [NeedsOtherPid, ChildProc=Socket]
92 sync protocol PSocketProcess
95 manages PWebrtcTCPSocket;
96 manages PHttpTransaction;
97 manages PHttpConnectionMgr;
98 manages PInputChannelThrottleQueue;
100 manages PAltSvcTransaction;
102 manages PProxyConfigLookup;
103 manages PNativeDNSResolverOverride;
106 async InitCrashReporter(NativeThreadId threadId);
107 async AddMemoryReport(MemoryReport aReport);
108 // Messages for sending telemetry to parent process.
109 async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
110 async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
111 async UpdateChildScalars(ScalarAction[] actions);
112 async UpdateChildKeyedScalars(KeyedScalarAction[] actions);
113 async RecordChildEvents(ChildEventData[] events);
114 async RecordDiscardedData(DiscardedData data);
116 /* tabId is only required for web-proxy support, which isn't always needed */
117 async PWebrtcTCPSocket(TabId? tabId);
118 async ObserveHttpActivity(HttpActivityArgs aActivityArgs,
119 uint32_t aActivityType,
120 uint32_t aActivitySubtype,
122 uint64_t aExtraSizeData,
123 nsCString aExtraStringData);
124 async InitSocketBackground(Endpoint<PSocketProcessBackgroundParent> aEndpoint);
126 async PProxyConfigLookup(nullable nsIURI aUri, uint32_t aFlags);
127 async CachePushCheck(nullable nsIURI aPushedURL,
128 OriginAttributes aOriginAttributes,
129 nsCString aRequestString)
130 returns (bool aAccepted);
132 async ExcludeHttp2OrHttp3(HttpConnectionInfoCloneArgs aArgs);
134 async OnConsoleMessage(nsString aMessage);
136 // Sent from time-to-time to limit the amount of telemetry vulnerable to loss
137 // Buffer contains bincoded Rust structs.
138 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
139 async FOGData(ByteBuf buf);
142 async GetModulesTrust(ModulePaths aModPaths, bool aRunAtNormalPriority)
143 returns (ModulesMapResult? modMapResult);
144 #endif // defined(XP_WIN)
147 async Init(SocketPorcessInitAttributes aAttributes);
148 async PreferenceUpdate(Pref pref);
149 async RequestMemoryReport(uint32_t generation,
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);
163 async SocketProcessTelemetryPing();
165 async PHttpTransaction();
166 async PHttpConnectionMgr(HttpHandlerInitArgs aArgs);
167 async UpdateDeviceModelId(nsCString aModelId);
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,
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);
183 async GetSocketData()
184 returns (SocketDataArgs data);
185 async GetDNSCacheEntries()
186 returns (DNSCacheEntries[] entries);
187 async GetHttpConnectionData()
188 returns (HttpRetParams[] params);
190 async InitProxyAutoConfigChild(Endpoint<PProxyAutoConfigChild> endpoint);
192 async RecheckIPConnectivity();
195 // Tells the Socket process to flush any pending telemetry.
196 // Used in tests and ping assembly. Buffer contains bincoded Rust structs.
197 // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
198 async FlushFOGData() returns (ByteBuf buf);
201 // Asks the Socket process to trigger test-only instrumentation.
202 // The unused returned value is to have a promise we can await.
203 async TestTriggerMetrics() returns (bool unused);
206 async GetUntrustedModulesData() returns (UntrustedModulesData? data);
209 * This method is used to notifty a child process to start
210 * processing module loading events in UntrustedModulesProcessor.
211 * This should be called when the parent process has gone idle.
213 async UnblockUntrustedModulesThread();
214 #endif // defined(XP_WIN)
216 async AddNetAddrOverride(NetAddr aFrom, NetAddr aTo);
217 async ClearNetAddrOverrides();
220 async PDNSRequest(nsCString hostName, nsCString trrServer, int32_t port,
221 uint16_t type, OriginAttributes originAttributes,
226 } // namespace mozilla