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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /** |
michael@0 | 6 | * @section DNS APIS |
michael@0 | 7 | * This module contains method definitions to be implemented by the platform. |
michael@0 | 8 | * SIP Stack uses these methods to perform DNS queries |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | |
michael@0 | 12 | #ifndef _DNS_UTIL_H_ |
michael@0 | 13 | #define _DNS_UTIL_H_ |
michael@0 | 14 | |
michael@0 | 15 | #include "cc_constants.h" |
michael@0 | 16 | #include "cpr_types.h" |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * Defines the return values for DNS query. |
michael@0 | 20 | */ |
michael@0 | 21 | #define CC_DNS_OK 0 |
michael@0 | 22 | #define CC_DNS_ERR_NOBUF 1 |
michael@0 | 23 | #define CC_DNS_ERR_INUSE 2 |
michael@0 | 24 | #define CC_DNS_ERR_TIMEOUT 3 |
michael@0 | 25 | #define CC_DNS_ERR_NOHOST 4 |
michael@0 | 26 | #define CC_DNS_ERR_HOST_UNAVAIL 5 |
michael@0 | 27 | |
michael@0 | 28 | typedef void *srv_handle_t; |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Perform an DNS lookup of the name specified |
michael@0 | 32 | * |
michael@0 | 33 | * @param[in] hname host name |
michael@0 | 34 | * @param[out] ipaddr_ptr the ip address returned by DNS for host with name hname. |
michael@0 | 35 | * @param[in] timeout the timeout for the query |
michael@0 | 36 | * @param[in] retries the retry times for the query |
michael@0 | 37 | * |
michael@0 | 38 | * @return CC_DNS_OK or CC_DNS_ERR_NOHOST |
michael@0 | 39 | */ |
michael@0 | 40 | cc_int32_t dnsGetHostByName(const char *hname, |
michael@0 | 41 | cpr_ip_addr_t *ipaddr_ptr, |
michael@0 | 42 | cc_int32_t timeout, |
michael@0 | 43 | cc_int32_t retries); |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | * This function calls the dns api to perform a dns srv query. |
michael@0 | 47 | * |
michael@0 | 48 | * @param[in] service the service name, e.g. "sip" |
michael@0 | 49 | * @param[in] protocol the protocol name, e.g. "udp" |
michael@0 | 50 | * @param[in] domain the domain name |
michael@0 | 51 | * @param[out] ipaddr_ptr the returned ip address |
michael@0 | 52 | * @param[out] port the port |
michael@0 | 53 | * @param[in] timeout the timeout for the query |
michael@0 | 54 | * @param[in] retries the number of retries for the query |
michael@0 | 55 | * @param[in,out] psrv_handle the handle for this query |
michael@0 | 56 | * |
michael@0 | 57 | * @note if handle is NULL an new query needs to be made and the |
michael@0 | 58 | * first response needs to be returned along with a valid handle. |
michael@0 | 59 | * Subsequent calls should return the next result if a valid handle has been provided. |
michael@0 | 60 | * |
michael@0 | 61 | * @returns CC_DNS_OK for success or |
michael@0 | 62 | * CC_DNS_ERR_NOHOST, CC_DNS_ERR_HOST_UNAVAIL |
michael@0 | 63 | */ |
michael@0 | 64 | cc_int32_t dnsGetHostBySRV(cc_int8_t *service, |
michael@0 | 65 | cc_int8_t *protocol, |
michael@0 | 66 | cc_int8_t *domain, |
michael@0 | 67 | cpr_ip_addr_t *ipaddr_ptr, |
michael@0 | 68 | cc_uint16_t *port, |
michael@0 | 69 | cc_int32_t timeout, |
michael@0 | 70 | cc_int32_t retries, |
michael@0 | 71 | srv_handle_t *psrv_handle); |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Free the srvhandle allocated in dnsGetHostBySRV. |
michael@0 | 75 | * |
michael@0 | 76 | * @param[in] srv_handle handle to be freed. |
michael@0 | 77 | * |
michael@0 | 78 | */ |
michael@0 | 79 | |
michael@0 | 80 | void dnsFreeSrvHandle(srv_handle_t srv_handle); |
michael@0 | 81 | |
michael@0 | 82 | #endif /* _DNS_UTIL_H_ */ |