Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /*
2 Copyright (c) 2007, Adobe Systems, Incorporated
3 All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 * Neither the name of Adobe Systems, Network Resonance nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
35 #ifndef _ice_socket_h
36 #define _ice_socket_h
37 #ifdef __cplusplus
38 using namespace std;
39 extern "C" {
40 #endif /* __cplusplus */
42 typedef struct nr_ice_stun_ctx_ {
43 int type;
44 #define NR_ICE_STUN_NONE 0 /* Deregistered */
45 #define NR_ICE_STUN_CLIENT 1
46 #define NR_ICE_STUN_SERVER 2
47 #define NR_ICE_TURN_CLIENT 3
49 union {
50 nr_stun_client_ctx *client;
51 nr_stun_server_ctx *server;
52 struct {
53 nr_turn_client_ctx *turn_client;
54 nr_socket *turn_sock; /* The nr_socket_turn wrapped around
55 turn_client */
56 } turn_client;
57 } u;
59 TAILQ_ENTRY(nr_ice_stun_ctx_) entry;
60 } nr_ice_stun_ctx;
64 typedef struct nr_ice_socket_ {
65 int type;
66 #define NR_ICE_SOCKET_TYPE_DGRAM 1
67 #define NR_ICE_SOCKET_TYPE_STREAM 2
69 nr_socket *sock;
70 nr_ice_ctx *ctx;
72 nr_ice_candidate_head candidates;
73 nr_ice_component *component;
75 TAILQ_HEAD(nr_ice_stun_ctx_head_,nr_ice_stun_ctx_) stun_ctxs;
77 nr_stun_server_ctx *stun_server;
78 void *stun_server_handle;
80 STAILQ_ENTRY(nr_ice_socket_) entry;
81 } nr_ice_socket;
83 typedef STAILQ_HEAD(nr_ice_socket_head_,nr_ice_socket_) nr_ice_socket_head;
85 int nr_ice_socket_create(struct nr_ice_ctx_ *ctx, struct nr_ice_component_ *comp, nr_socket *nsock, nr_ice_socket **sockp);
86 int nr_ice_socket_destroy(nr_ice_socket **isock);
87 int nr_ice_socket_close(nr_ice_socket *isock);
88 int nr_ice_socket_register_stun_client(nr_ice_socket *sock, nr_stun_client_ctx *srv,void **handle);
89 int nr_ice_socket_register_stun_server(nr_ice_socket *sock, nr_stun_server_ctx *srv,void **handle);
90 int nr_ice_socket_register_turn_client(nr_ice_socket *sock, nr_turn_client_ctx *srv,nr_socket *turn_socket, void **handle);
91 int nr_ice_socket_deregister(nr_ice_socket *sock, void *handle);
93 #ifdef __cplusplus
94 }
95 #endif /* __cplusplus */
96 #endif