tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PUDPSocket.ipdl (1936B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
      3 
      4 /* This Source Code Form is subject to the terms of the Mozilla Public
      5  * License, v. 2.0. If a copy of the MPL was not distributed with this
      6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      7 
      8 include protocol PNecko;
      9 include protocol PBackground;
     10 
     11 include IPCStream;
     12 
     13 include "mozilla/net/NeckoMessageUtils.h";
     14 include "mozilla/net/DNS.h";
     15 include "prio.h";
     16 include "mozilla/dom/network/UDPSocketParent.h";
     17 include "mozilla/dom/network/UDPSocketChild.h";
     18 
     19 using mozilla::net::NetAddr from "mozilla/net/DNS.h";
     20 using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
     21 
     22 struct UDPAddressInfo {
     23   nsCString addr;
     24   uint16_t port;
     25 };
     26 
     27 union UDPSocketAddr {
     28   UDPAddressInfo;
     29   NetAddr;
     30 };
     31 
     32 union UDPData {
     33   uint8_t[];
     34   IPCStream;
     35 };
     36 
     37 namespace mozilla {
     38 namespace net {
     39 
     40 //-------------------------------------------------------------------
     41 [ManualDealloc, ChildImpl="mozilla::dom::UDPSocketChild", ParentImpl="mozilla::dom::UDPSocketParent"]
     42 protocol PUDPSocket
     43 {
     44   manager PNecko or PBackground;
     45 
     46 parent:
     47   async Bind(UDPAddressInfo addressInfo, bool addressReuse, bool loopback,
     48              uint32_t recvBufferSize, uint32_t sendBufferSize);
     49   async Connect(UDPAddressInfo addressInfo);
     50 
     51   async OutgoingData(UDPData data, UDPSocketAddr addr);
     52 
     53   async JoinMulticast(nsCString multicastAddress, nsCString iface);
     54   async LeaveMulticast(nsCString multicastAddress, nsCString iface);
     55 
     56   async Close();
     57 
     58   async RequestDelete();
     59 
     60 child:
     61   async CallbackOpened(UDPAddressInfo addressInfo);
     62   async CallbackConnected(UDPAddressInfo addressInfo);
     63   async CallbackClosed();
     64   async CallbackReceivedData(UDPAddressInfo addressInfo, uint8_t[] data);
     65   async CallbackError(nsCString message, nsCString filename, uint32_t lineNumber);
     66   async __delete__();
     67 };
     68 
     69 
     70 } // namespace net
     71 } // namespace mozilla
     72