Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /*- |
michael@0 | 2 | * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. |
michael@0 | 3 | * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. |
michael@0 | 4 | * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. |
michael@0 | 5 | * |
michael@0 | 6 | * Redistribution and use in source and binary forms, with or without |
michael@0 | 7 | * modification, are permitted provided that the following conditions are met: |
michael@0 | 8 | * |
michael@0 | 9 | * a) Redistributions of source code must retain the above copyright notice, |
michael@0 | 10 | * this list of conditions and the following disclaimer. |
michael@0 | 11 | * |
michael@0 | 12 | * b) Redistributions in binary form must reproduce the above copyright |
michael@0 | 13 | * notice, this list of conditions and the following disclaimer in |
michael@0 | 14 | * the documentation and/or other materials provided with the distribution. |
michael@0 | 15 | * |
michael@0 | 16 | * c) Neither the name of Cisco Systems, Inc. nor the names of its |
michael@0 | 17 | * contributors may be used to endorse or promote products derived |
michael@0 | 18 | * from this software without specific prior written permission. |
michael@0 | 19 | * |
michael@0 | 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
michael@0 | 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
michael@0 | 22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
michael@0 | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
michael@0 | 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
michael@0 | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
michael@0 | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
michael@0 | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
michael@0 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
michael@0 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
michael@0 | 30 | * THE POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 31 | */ |
michael@0 | 32 | |
michael@0 | 33 | #ifdef __FreeBSD__ |
michael@0 | 34 | #include <sys/cdefs.h> |
michael@0 | 35 | __FBSDID("$FreeBSD: head/sys/netinet/sctp_output.h 246595 2013-02-09 17:26:14Z tuexen $"); |
michael@0 | 36 | #endif |
michael@0 | 37 | |
michael@0 | 38 | #ifndef _NETINET_SCTP_OUTPUT_H_ |
michael@0 | 39 | #define _NETINET_SCTP_OUTPUT_H_ |
michael@0 | 40 | |
michael@0 | 41 | #include <netinet/sctp_header.h> |
michael@0 | 42 | |
michael@0 | 43 | #if defined(_KERNEL) || defined(__Userspace__) |
michael@0 | 44 | |
michael@0 | 45 | |
michael@0 | 46 | struct mbuf * |
michael@0 | 47 | sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp, |
michael@0 | 48 | struct sctp_tcb *stcb, |
michael@0 | 49 | struct sctp_scoping *scope, |
michael@0 | 50 | struct mbuf *m_at, |
michael@0 | 51 | int cnt_inits_to, |
michael@0 | 52 | uint16_t *padding_len, uint16_t *chunk_len); |
michael@0 | 53 | |
michael@0 | 54 | |
michael@0 | 55 | int sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *); |
michael@0 | 56 | |
michael@0 | 57 | |
michael@0 | 58 | int |
michael@0 | 59 | sctp_is_address_in_scope(struct sctp_ifa *ifa, |
michael@0 | 60 | struct sctp_scoping *scope, |
michael@0 | 61 | int do_update); |
michael@0 | 62 | |
michael@0 | 63 | int |
michael@0 | 64 | sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa); |
michael@0 | 65 | |
michael@0 | 66 | struct sctp_ifa * |
michael@0 | 67 | sctp_source_address_selection(struct sctp_inpcb *inp, |
michael@0 | 68 | struct sctp_tcb *stcb, |
michael@0 | 69 | sctp_route_t *ro, struct sctp_nets *net, |
michael@0 | 70 | int non_asoc_addr_ok, uint32_t vrf_id); |
michael@0 | 71 | |
michael@0 | 72 | #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Userspace__) |
michael@0 | 73 | int |
michael@0 | 74 | sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t *ro); |
michael@0 | 75 | int |
michael@0 | 76 | sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro); |
michael@0 | 77 | #endif |
michael@0 | 78 | |
michael@0 | 79 | void sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int |
michael@0 | 80 | #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) |
michael@0 | 81 | SCTP_UNUSED |
michael@0 | 82 | #endif |
michael@0 | 83 | ); |
michael@0 | 84 | |
michael@0 | 85 | void |
michael@0 | 86 | sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *, struct mbuf *, |
michael@0 | 87 | int, int, |
michael@0 | 88 | struct sockaddr *, struct sockaddr *, |
michael@0 | 89 | struct sctphdr *, struct sctp_init_chunk *, |
michael@0 | 90 | #if defined(__FreeBSD__) |
michael@0 | 91 | uint8_t, uint32_t, |
michael@0 | 92 | #endif |
michael@0 | 93 | uint32_t, uint16_t, int); |
michael@0 | 94 | |
michael@0 | 95 | struct mbuf * |
michael@0 | 96 | sctp_arethere_unrecognized_parameters(struct mbuf *, int, int *, |
michael@0 | 97 | struct sctp_chunkhdr *, int *); |
michael@0 | 98 | void sctp_queue_op_err(struct sctp_tcb *, struct mbuf *); |
michael@0 | 99 | |
michael@0 | 100 | int |
michael@0 | 101 | sctp_send_cookie_echo(struct mbuf *, int, struct sctp_tcb *, |
michael@0 | 102 | struct sctp_nets *); |
michael@0 | 103 | |
michael@0 | 104 | void sctp_send_cookie_ack(struct sctp_tcb *); |
michael@0 | 105 | |
michael@0 | 106 | void |
michael@0 | 107 | sctp_send_heartbeat_ack(struct sctp_tcb *, struct mbuf *, int, int, |
michael@0 | 108 | struct sctp_nets *); |
michael@0 | 109 | |
michael@0 | 110 | void |
michael@0 | 111 | sctp_remove_from_wheel(struct sctp_tcb *stcb, |
michael@0 | 112 | struct sctp_association *asoc, |
michael@0 | 113 | struct sctp_stream_out *strq, int holds_lock); |
michael@0 | 114 | |
michael@0 | 115 | |
michael@0 | 116 | void sctp_send_shutdown(struct sctp_tcb *, struct sctp_nets *); |
michael@0 | 117 | |
michael@0 | 118 | void sctp_send_shutdown_ack(struct sctp_tcb *, struct sctp_nets *); |
michael@0 | 119 | |
michael@0 | 120 | void sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *, int); |
michael@0 | 121 | |
michael@0 | 122 | void sctp_send_shutdown_complete2(struct sockaddr *, struct sockaddr *, |
michael@0 | 123 | struct sctphdr *, |
michael@0 | 124 | #if defined(__FreeBSD__) |
michael@0 | 125 | uint8_t, uint32_t, |
michael@0 | 126 | #endif |
michael@0 | 127 | uint32_t, uint16_t); |
michael@0 | 128 | |
michael@0 | 129 | void sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *, int addr_locked); |
michael@0 | 130 | |
michael@0 | 131 | void sctp_send_asconf_ack(struct sctp_tcb *); |
michael@0 | 132 | |
michael@0 | 133 | int sctp_get_frag_point(struct sctp_tcb *, struct sctp_association *); |
michael@0 | 134 | |
michael@0 | 135 | void sctp_toss_old_cookies(struct sctp_tcb *, struct sctp_association *); |
michael@0 | 136 | |
michael@0 | 137 | void sctp_toss_old_asconf(struct sctp_tcb *); |
michael@0 | 138 | |
michael@0 | 139 | void sctp_fix_ecn_echo(struct sctp_association *); |
michael@0 | 140 | |
michael@0 | 141 | void sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net); |
michael@0 | 142 | |
michael@0 | 143 | #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 |
michael@0 | 144 | int |
michael@0 | 145 | sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, |
michael@0 | 146 | struct mbuf *, struct thread *, int); |
michael@0 | 147 | #elif defined(__Windows__) |
michael@0 | 148 | sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, |
michael@0 | 149 | struct mbuf *, PKTHREAD, int); |
michael@0 | 150 | #else |
michael@0 | 151 | #if defined(__Userspace__) |
michael@0 | 152 | /* sctp_output is called bu sctp_sendm. Not using sctp_sendm for __Userspace__ */ |
michael@0 | 153 | #endif |
michael@0 | 154 | int |
michael@0 | 155 | sctp_output(struct sctp_inpcb *, |
michael@0 | 156 | #if defined(__Panda__) |
michael@0 | 157 | pakhandle_type, |
michael@0 | 158 | #else |
michael@0 | 159 | struct mbuf *, |
michael@0 | 160 | #endif |
michael@0 | 161 | struct sockaddr *, |
michael@0 | 162 | #if defined(__Panda__) |
michael@0 | 163 | pakhandle_type, |
michael@0 | 164 | #else |
michael@0 | 165 | struct mbuf *, |
michael@0 | 166 | #endif |
michael@0 | 167 | struct proc *, int); |
michael@0 | 168 | #endif |
michael@0 | 169 | |
michael@0 | 170 | void sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int |
michael@0 | 171 | #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) |
michael@0 | 172 | SCTP_UNUSED |
michael@0 | 173 | #endif |
michael@0 | 174 | ); |
michael@0 | 175 | void sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int |
michael@0 | 176 | #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) |
michael@0 | 177 | SCTP_UNUSED |
michael@0 | 178 | #endif |
michael@0 | 179 | ); |
michael@0 | 180 | |
michael@0 | 181 | void send_forward_tsn(struct sctp_tcb *, struct sctp_association *); |
michael@0 | 182 | |
michael@0 | 183 | void sctp_send_sack(struct sctp_tcb *, int); |
michael@0 | 184 | |
michael@0 | 185 | void sctp_send_hb(struct sctp_tcb *, struct sctp_nets *, int); |
michael@0 | 186 | |
michael@0 | 187 | void sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t); |
michael@0 | 188 | |
michael@0 | 189 | |
michael@0 | 190 | void |
michael@0 | 191 | sctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *, |
michael@0 | 192 | int, int, int); |
michael@0 | 193 | |
michael@0 | 194 | |
michael@0 | 195 | |
michael@0 | 196 | void sctp_send_cwr(struct sctp_tcb *, struct sctp_nets *, uint32_t, uint8_t); |
michael@0 | 197 | |
michael@0 | 198 | |
michael@0 | 199 | void |
michael@0 | 200 | sctp_add_stream_reset_out(struct sctp_tmit_chunk *, |
michael@0 | 201 | int, uint16_t *, uint32_t, uint32_t, uint32_t); |
michael@0 | 202 | |
michael@0 | 203 | void |
michael@0 | 204 | sctp_add_stream_reset_result(struct sctp_tmit_chunk *, uint32_t, uint32_t); |
michael@0 | 205 | |
michael@0 | 206 | void |
michael@0 | 207 | sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *, |
michael@0 | 208 | uint32_t, uint32_t, uint32_t, uint32_t); |
michael@0 | 209 | |
michael@0 | 210 | int |
michael@0 | 211 | sctp_send_str_reset_req(struct sctp_tcb *, int , uint16_t *, uint8_t, uint8_t, |
michael@0 | 212 | uint8_t, uint8_t, uint16_t, uint16_t, uint8_t); |
michael@0 | 213 | |
michael@0 | 214 | void |
michael@0 | 215 | sctp_send_abort(struct mbuf *, int, struct sockaddr *, struct sockaddr *, |
michael@0 | 216 | struct sctphdr *, uint32_t, struct mbuf *, |
michael@0 | 217 | #if defined(__FreeBSD__) |
michael@0 | 218 | uint8_t, uint32_t, |
michael@0 | 219 | #endif |
michael@0 | 220 | uint32_t, uint16_t); |
michael@0 | 221 | |
michael@0 | 222 | void sctp_send_operr_to(struct sockaddr *, struct sockaddr *, |
michael@0 | 223 | struct sctphdr *, uint32_t, struct mbuf *, |
michael@0 | 224 | #if defined(__FreeBSD__) |
michael@0 | 225 | uint8_t, uint32_t, |
michael@0 | 226 | #endif |
michael@0 | 227 | uint32_t, uint16_t); |
michael@0 | 228 | |
michael@0 | 229 | #endif /* _KERNEL || __Userspace__ */ |
michael@0 | 230 | |
michael@0 | 231 | #if defined(_KERNEL) || defined(__Userspace__) |
michael@0 | 232 | int |
michael@0 | 233 | sctp_sosend(struct socket *so, |
michael@0 | 234 | struct sockaddr *addr, |
michael@0 | 235 | struct uio *uio, |
michael@0 | 236 | #ifdef __Panda__ |
michael@0 | 237 | pakhandle_type top, |
michael@0 | 238 | pakhandle_type control, |
michael@0 | 239 | #else |
michael@0 | 240 | struct mbuf *top, |
michael@0 | 241 | struct mbuf *control, |
michael@0 | 242 | #endif |
michael@0 | 243 | #if defined(__APPLE__) || defined(__Panda__) |
michael@0 | 244 | int flags |
michael@0 | 245 | #else |
michael@0 | 246 | int flags, |
michael@0 | 247 | #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 |
michael@0 | 248 | struct thread *p |
michael@0 | 249 | #elif defined(__Windows__) |
michael@0 | 250 | PKTHREAD p |
michael@0 | 251 | #else |
michael@0 | 252 | #if defined(__Userspace__) |
michael@0 | 253 | /* proc is a dummy in __Userspace__ and will not be passed to sctp_lower_sosend */ |
michael@0 | 254 | #endif |
michael@0 | 255 | struct proc *p |
michael@0 | 256 | #endif |
michael@0 | 257 | #endif |
michael@0 | 258 | ); |
michael@0 | 259 | |
michael@0 | 260 | #endif |
michael@0 | 261 | #endif |
michael@0 | 262 |