media/webrtc/signaling/src/sipcc/include/sll_lite.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

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 #ifndef _SLL_LITE_H
michael@0 6 #define _SLL_LITE_H
michael@0 7
michael@0 8 #include "cpr_types.h"
michael@0 9 /*
michael@0 10 * List node structure
michael@0 11 */
michael@0 12 typedef struct sll_lite_node_t_ {
michael@0 13 struct sll_lite_node_t_ *next_p; /* pointer to the next node */
michael@0 14 } sll_lite_node_t;
michael@0 15
michael@0 16 /*
michael@0 17 * List control structure
michael@0 18 */
michael@0 19 typedef struct sll_lite_list_t_ {
michael@0 20 uint16_t count; /* number of elements on the list */
michael@0 21 sll_lite_node_t *head_p; /* pointer to the head or first node */
michael@0 22 sll_lite_node_t *tail_p; /* pointer to the tail or last node */
michael@0 23 } sll_lite_list_t;
michael@0 24
michael@0 25 typedef enum {
michael@0 26 SLL_LITE_RET_SUCCESS,
michael@0 27 SLL_LITE_RET_INVALID_ARGS,
michael@0 28 SLL_LITE_RET_NODE_NOT_FOUND,
michael@0 29 SLL_LITE_RET_OTHER_FAILURE
michael@0 30 } sll_lite_return_e;
michael@0 31
michael@0 32 /*
michael@0 33 * Convenient macros
michael@0 34 */
michael@0 35 #define SLL_LITE_LINK_HEAD(link) \
michael@0 36 (((sll_lite_list_t *)link)->head_p)
michael@0 37
michael@0 38 #define SLL_LITE_LINK_TAIL(link) \
michael@0 39 (((sll_lite_list_t *)link)->tail_p)
michael@0 40
michael@0 41 #define SLL_LITE_LINK_NEXT_NODE(node) \
michael@0 42 (((sll_lite_node_t *)node)->next_p)
michael@0 43
michael@0 44 #define SLL_LITE_NODE_COUNT(link) \
michael@0 45 (((sll_lite_list_t *)link)->count)
michael@0 46
michael@0 47 /**
michael@0 48 * sll_lite_init initializes list control structure given by the
michael@0 49 * caller.
michael@0 50 *
michael@0 51 * @param[in] list - pointer to the list control structure
michael@0 52 * sll_lite_list_t
michael@0 53 *
michael@0 54 * @return - SLL_LITE_RET_SUCCESS for success
michael@0 55 * - SLL_LITE_RET_INVALID_ARGS when arguments are
michael@0 56 * invalid.
michael@0 57 */
michael@0 58 extern sll_lite_return_e
michael@0 59 sll_lite_init(sll_lite_list_t *list);
michael@0 60
michael@0 61 /**
michael@0 62 * sll_lite_link_head puts node to the head of the list.
michael@0 63 *
michael@0 64 * @param[in] list - pointer to the list control structure
michael@0 65 * sll_lite_list_t. The list must be
michael@0 66 * initialized prior.
michael@0 67 * @param[in] node - pointer to the list node structure.
michael@0 68 *
michael@0 69 * @return - SLL_LITE_RET_SUCCESS for success
michael@0 70 * - SLL_LITE_RET_INVALID_ARGS when arguments are
michael@0 71 * invalid.
michael@0 72 */
michael@0 73 extern sll_lite_return_e
michael@0 74 sll_lite_link_head(sll_lite_list_t *list, sll_lite_node_t *node);
michael@0 75
michael@0 76 /**
michael@0 77 * sll_lite_link_tail puts node to the tail of the list.
michael@0 78 *
michael@0 79 * @param[in] list - pointer to the list control structure
michael@0 80 * sll_lite_list_t. The list must be
michael@0 81 * initialized prior.
michael@0 82 * @param[in] node - pointer to the list node structure.
michael@0 83 *
michael@0 84 * @return - SLL_LITE_RET_SUCCESS for success
michael@0 85 * - SLL_LITE_RET_INVALID_ARGS when arguments are
michael@0 86 * invalid.
michael@0 87 */
michael@0 88 sll_lite_return_e
michael@0 89 sll_lite_link_tail(sll_lite_list_t *list, sll_lite_node_t *node);
michael@0 90
michael@0 91 /**
michael@0 92 * sll_lite_unlink_head removes head node from the head of the list and
michael@0 93 * returns it to the caller.
michael@0 94 *
michael@0 95 * @param[in] list - pointer to the list control structure
michael@0 96 * sll_lite_list_t. The list must be
michael@0 97 * initialized prior.
michael@0 98 *
michael@0 99 * @return Pointer to the head node if one exists otherwise
michael@0 100 * return NULL.
michael@0 101 */
michael@0 102 extern sll_lite_node_t *
michael@0 103 sll_lite_unlink_head(sll_lite_list_t *list);
michael@0 104
michael@0 105 /**
michael@0 106 * sll_lite_unlink_tail removes tail node from the list and
michael@0 107 * returns it to the caller.
michael@0 108 *
michael@0 109 * @param[in] list - pointer to the list control structure
michael@0 110 * sll_lite_list_t. The list must be
michael@0 111 * initialized prior.
michael@0 112 *
michael@0 113 * @return Pointer to the tail node if one exists otherwise
michael@0 114 * return NULL.
michael@0 115 */
michael@0 116 sll_lite_node_t *
michael@0 117 sll_lite_unlink_tail(sll_lite_list_t *list);
michael@0 118
michael@0 119 /**
michael@0 120 * sll_lite_remove removes the given node from the list.
michael@0 121 *
michael@0 122 * @param[in] list - pointer to the list control structure
michael@0 123 * sll_lite_list_t. The list must be
michael@0 124 * initialized prior.
michael@0 125 * @param[in] node - pointer to the list node structure to be
michael@0 126 * removed.
michael@0 127 *
michael@0 128 * @return - SLL_LITE_RET_SUCCESS for success
michael@0 129 * - SLL_LITE_RET_INVALID_ARGS when arguments are
michael@0 130 * invalid.
michael@0 131 * - SLL_LITE_RET_NODE_NOT_FOUND when the node
michael@0 132 * to remove is not found.
michael@0 133 */
michael@0 134 extern sll_lite_return_e
michael@0 135 sll_lite_remove(sll_lite_list_t *list, sll_lite_node_t *node);
michael@0 136
michael@0 137 #endif

mercurial