Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / netwerk / base / nsISocketFilter.idl
blob40d58d086aad17bbecf6d8aa77d413b00f006f4a
1 /* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
8 #include "nsINetAddr.idl"
10 native NetAddr(mozilla::net::NetAddr);
11 [ptr] native NetAddrPtr(mozilla::net::NetAddr);
14 /**
15 * Filters are created and run on the parent, and filter all packets, both
16 * ingoing and outgoing. The child must specify the name of a recognized filter
17 * in order to create a socket.
19 [uuid(afe2c40c-b9b9-4207-b898-e5cde18c6139)]
20 interface nsISocketFilter : nsISupports
22 const long SF_INCOMING = 0;
23 const long SF_OUTGOING = 1;
25 boolean filterPacket([const]in NetAddrPtr remote_addr,
26 [const, array, size_is(len)]in uint8_t data,
27 in unsigned long len,
28 in long direction);
31 /**
32 * Factory of a specified filter.
34 [uuid(81ee76c6-4753-4125-9c8c-290ed9ba62fb)]
35 interface nsISocketFilterHandler : nsISupports
37 nsISocketFilter newFilter();
40 %{C++
41 /**
42 * Filter handlers are registered with XPCOM under the following CONTRACTID prefix:
44 #define NS_NETWORK_UDP_SOCKET_FILTER_HANDLER_PREFIX "@mozilla.org/network/udp-filter-handler;1?name="
45 #define NS_NETWORK_TCP_SOCKET_FILTER_HANDLER_PREFIX "@mozilla.org/network/tcp-filter-handler;1?name="
47 #define NS_NETWORK_SOCKET_FILTER_HANDLER_STUN_SUFFIX "stun"
49 #define NS_STUN_UDP_SOCKET_FILTER_HANDLER_CONTRACTID NS_NETWORK_UDP_SOCKET_FILTER_HANDLER_PREFIX NS_NETWORK_SOCKET_FILTER_HANDLER_STUN_SUFFIX
52 #define NS_STUN_TCP_SOCKET_FILTER_HANDLER_CONTRACTID NS_NETWORK_TCP_SOCKET_FILTER_HANDLER_PREFIX NS_NETWORK_SOCKET_FILTER_HANDLER_STUN_SUFFIX