other-licenses/android/ns_netint.c

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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.

michael@0 1 /* $NetBSD: ns_netint.c,v 1.2 2004/05/20 20:19:00 christos Exp $ */
michael@0 2
michael@0 3 /*
michael@0 4 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
michael@0 5 * Copyright (c) 1996,1999 by Internet Software Consortium.
michael@0 6 *
michael@0 7 * Permission to use, copy, modify, and distribute this software for any
michael@0 8 * purpose with or without fee is hereby granted, provided that the above
michael@0 9 * copyright notice and this permission notice appear in all copies.
michael@0 10 *
michael@0 11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
michael@0 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
michael@0 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
michael@0 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
michael@0 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
michael@0 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
michael@0 17 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
michael@0 18 */
michael@0 19
michael@0 20 /*
michael@0 21 * This version of this file is derived from Android 2.3 "Gingerbread",
michael@0 22 * which contains uncredited changes by Android/Google developers. It has
michael@0 23 * been modified in 2011 for use in the Android build of Mozilla Firefox by
michael@0 24 * Mozilla contributors (including Michael Edwards <m.k.edwards@gmail.com>,
michael@0 25 * and Steve Workman <sjhworkman@gmail.com>).
michael@0 26 * These changes are offered under the same license as the original NetBSD
michael@0 27 * file, whose copyright and license are unchanged above.
michael@0 28 */
michael@0 29
michael@0 30 #define ANDROID_CHANGES 1
michael@0 31 #define MOZILLA_NECKO_EXCLUDE_CODE 1
michael@0 32
michael@0 33 #include <sys/cdefs.h>
michael@0 34 #ifndef lint
michael@0 35 #ifdef notdef
michael@0 36 static const char rcsid[] = "Id: ns_netint.c,v 1.1.206.1 2004/03/09 08:33:44 marka Exp";
michael@0 37 #else
michael@0 38 __RCSID("$NetBSD: ns_netint.c,v 1.2 2004/05/20 20:19:00 christos Exp $");
michael@0 39 #endif
michael@0 40 #endif
michael@0 41
michael@0 42 /* Import. */
michael@0 43
michael@0 44 #include "arpa_nameser.h"
michael@0 45
michael@0 46 /* Public. */
michael@0 47
michael@0 48 u_int16_t
michael@0 49 ns_get16(const u_char *src) {
michael@0 50 u_int dst;
michael@0 51
michael@0 52 NS_GET16(dst, src);
michael@0 53 return (dst);
michael@0 54 }
michael@0 55
michael@0 56 u_int32_t
michael@0 57 ns_get32(const u_char *src) {
michael@0 58 u_long dst;
michael@0 59
michael@0 60 NS_GET32(dst, src);
michael@0 61 return (dst);
michael@0 62 }
michael@0 63
michael@0 64 void
michael@0 65 ns_put16(u_int16_t src, u_char *dst) {
michael@0 66 NS_PUT16(src, dst);
michael@0 67 }
michael@0 68
michael@0 69 void
michael@0 70 ns_put32(u_int32_t src, u_char *dst) {
michael@0 71 NS_PUT32(src, dst);
michael@0 72 }

mercurial