Source code

Revision control

Other Tools

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/. */
6
7
#include "nsISupports.idl"
8
#include "nsINetAddr.idl"
9
10
native NetAddr(mozilla::net::NetAddr);
11
[ptr] native NetAddrPtr(mozilla::net::NetAddr);
12
13
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.
18
*/
19
[uuid(afe2c40c-b9b9-4207-b898-e5cde18c6139)]
20
interface nsISocketFilter : nsISupports
21
{
22
const long SF_INCOMING = 0;
23
const long SF_OUTGOING = 1;
24
25
bool 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);
29
};
30
31
/**
32
* Factory of a specified filter.
33
*/
34
[uuid(81ee76c6-4753-4125-9c8c-290ed9ba62fb)]
35
interface nsISocketFilterHandler : nsISupports
36
{
37
nsISocketFilter newFilter();
38
};
39
40
%{C++
41
/**
42
* Filter handlers are registered with XPCOM under the following CONTRACTID prefix:
43
*/
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="
46
47
#define NS_NETWORK_SOCKET_FILTER_HANDLER_STUN_SUFFIX "stun"
48
49
#define NS_STUN_UDP_SOCKET_FILTER_HANDLER_CONTRACTID NS_NETWORK_UDP_SOCKET_FILTER_HANDLER_PREFIX NS_NETWORK_SOCKET_FILTER_HANDLER_STUN_SUFFIX
50
51
52
#define NS_STUN_TCP_SOCKET_FILTER_HANDLER_CONTRACTID NS_NETWORK_TCP_SOCKET_FILTER_HANDLER_PREFIX NS_NETWORK_SOCKET_FILTER_HANDLER_STUN_SUFFIX
53
%}