diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/network/interfaces | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/network/interfaces')
-rw-r--r-- | dom/network/interfaces/moz.build | 12 | ||||
-rw-r--r-- | dom/network/interfaces/nsITCPSocketCallback.idl | 58 | ||||
-rw-r--r-- | dom/network/interfaces/nsIUDPSocketChild.idl | 30 |
3 files changed, 100 insertions, 0 deletions
diff --git a/dom/network/interfaces/moz.build b/dom/network/interfaces/moz.build new file mode 100644 index 0000000000..362ad4c228 --- /dev/null +++ b/dom/network/interfaces/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + "nsITCPSocketCallback.idl", + "nsIUDPSocketChild.idl", +] + +XPIDL_MODULE = "dom_network" diff --git a/dom/network/interfaces/nsITCPSocketCallback.idl b/dom/network/interfaces/nsITCPSocketCallback.idl new file mode 100644 index 0000000000..4a2b7a9ef2 --- /dev/null +++ b/dom/network/interfaces/nsITCPSocketCallback.idl @@ -0,0 +1,58 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * MozTCPSocket exposes a TCP client and server sockets + * to highly privileged apps. It provides a buffered, non-blocking + * interface for sending. For receiving, it uses an asynchronous, + * event handler based interface. + */ + +#include "domstubs.idl" + +%{C++ +#include "nsTArrayForwardDeclare.h" +%} +[ref] native nsUint8TArrayRef(nsTArray<uint8_t>); +[ptr] native JSContextPtr(JSContext); + + +/* + * This interface is implemented in TCPSocket.cpp as an internal interface + * for use in cross-process socket implementation. + * Needed to account for multiple possible types that can be provided to + * the socket callbacks as arguments. + */ +[scriptable, uuid(ac2c4b69-cb79-4767-b1ce-bcf62945cd39)] +interface nsITCPSocketCallback : nsISupports { + // Limitation of TCPSocket's buffer size. + const unsigned long BUFFER_SIZE = 65536; + + // Dispatch an "error" event at this object with the given name and type. + void fireErrorEvent(in AString name, in AString type, in nsresult errorCode); + + // Dispatch a "data" event at this object with a string + void fireDataStringEvent(in AString type, in ACString data); + + // Dispatch a "data" event at this object with an Array + void fireDataArrayEvent(in AString type, [const] in nsUint8TArrayRef data); + + // Dispatch an event of the given type at this object. + void fireEvent(in AString type); + + // Update the DOM object's readyState. + // @param readyState + // new ready state + void updateReadyState(in unsigned long readystate); + + // Update the DOM object's bufferedAmount value with a tracking number to + // to allow tracking of which writes are "in-flight" + // @param bufferedAmount + // TCPSocket parent's bufferedAmount. + // @param trackingNumber + // A number to ensure the bufferedAmount is updated after data + // from child are sent to parent. + void updateBufferedAmount(in uint32_t bufferedAmount, + in uint32_t trackingNumber); +}; diff --git a/dom/network/interfaces/nsIUDPSocketChild.idl b/dom/network/interfaces/nsIUDPSocketChild.idl new file mode 100644 index 0000000000..38a8e43576 --- /dev/null +++ b/dom/network/interfaces/nsIUDPSocketChild.idl @@ -0,0 +1,30 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsINetAddr.idl" + +interface nsIUDPSocketInternal; +interface nsIInputStream; +interface nsIPrincipal; +interface nsIEventTarget; + +/* + * Internal interface for callback from chrome process + */ +[scriptable, builtinclass, uuid(613dd3ad-598b-4da9-ad63-bbda50c20098)] +interface nsIUDPSocketInternal : nsISupports +{ + // callback while socket is opened. localPort and localAddress is ready until this time. + void callListenerOpened(); + // callback while socket is connected. + void callListenerConnected(); + // callback while socket is closed. + void callListenerClosed(); + // callback while incoming packet is received. + void callListenerReceivedData(in AUTF8String host, in unsigned short port, + in Array<uint8_t> data); + // callback while any error happened. + void callListenerError(in AUTF8String message, in AUTF8String filename, in uint32_t lineNumber); +}; |