Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | Copyright (c) 2007, Adobe Systems, Incorporated |
michael@0 | 3 | All rights reserved. |
michael@0 | 4 | |
michael@0 | 5 | Redistribution and use in source and binary forms, with or without |
michael@0 | 6 | modification, are permitted provided that the following conditions are |
michael@0 | 7 | met: |
michael@0 | 8 | |
michael@0 | 9 | * Redistributions of source code must retain the above copyright |
michael@0 | 10 | notice, this list of conditions and the following disclaimer. |
michael@0 | 11 | |
michael@0 | 12 | * Redistributions in binary form must reproduce the above copyright |
michael@0 | 13 | notice, this list of conditions and the following disclaimer in the |
michael@0 | 14 | documentation and/or other materials provided with the distribution. |
michael@0 | 15 | |
michael@0 | 16 | * Neither the name of Adobe Systems, Network Resonance nor the names of its |
michael@0 | 17 | contributors may be used to endorse or promote products derived from |
michael@0 | 18 | 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 |
michael@0 | 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
michael@0 | 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
michael@0 | 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@0 | 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@0 | 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
michael@0 | 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
michael@0 | 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
michael@0 | 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
michael@0 | 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 31 | */ |
michael@0 | 32 | |
michael@0 | 33 | |
michael@0 | 34 | |
michael@0 | 35 | #ifndef _ice_component_h |
michael@0 | 36 | #define _ice_component_h |
michael@0 | 37 | #ifdef __cplusplus |
michael@0 | 38 | using namespace std; |
michael@0 | 39 | extern "C" { |
michael@0 | 40 | #endif /* __cplusplus */ |
michael@0 | 41 | |
michael@0 | 42 | typedef struct nr_ice_pre_answer_request_ { |
michael@0 | 43 | nr_stun_server_request req; |
michael@0 | 44 | char *username; |
michael@0 | 45 | nr_transport_addr local_addr; |
michael@0 | 46 | |
michael@0 | 47 | STAILQ_ENTRY(nr_ice_pre_answer_request_) entry; |
michael@0 | 48 | } nr_ice_pre_answer_request; |
michael@0 | 49 | |
michael@0 | 50 | typedef STAILQ_HEAD(nr_ice_pre_answer_request_head_, nr_ice_pre_answer_request_) nr_ice_pre_answer_request_head; |
michael@0 | 51 | |
michael@0 | 52 | struct nr_ice_component_ { |
michael@0 | 53 | int state; |
michael@0 | 54 | #define NR_ICE_COMPONENT_UNPAIRED 0 |
michael@0 | 55 | #define NR_ICE_COMPONENT_RUNNING 1 |
michael@0 | 56 | #define NR_ICE_COMPONENT_NOMINATED 2 |
michael@0 | 57 | #define NR_ICE_COMPONENT_FAILED 3 |
michael@0 | 58 | #define NR_ICE_COMPONENT_DISABLED 4 |
michael@0 | 59 | struct nr_ice_ctx_ *ctx; |
michael@0 | 60 | struct nr_ice_media_stream_ *stream; |
michael@0 | 61 | nr_ice_component *local_component; |
michael@0 | 62 | |
michael@0 | 63 | int component_id; |
michael@0 | 64 | nr_ice_socket_head sockets; |
michael@0 | 65 | nr_ice_candidate_head candidates; |
michael@0 | 66 | int candidate_ct; |
michael@0 | 67 | nr_ice_pre_answer_request_head pre_answer_reqs; |
michael@0 | 68 | |
michael@0 | 69 | int valid_pairs; |
michael@0 | 70 | struct nr_ice_cand_pair_ *nominated; /* Highest priority nomninated pair */ |
michael@0 | 71 | struct nr_ice_cand_pair_ *active; |
michael@0 | 72 | |
michael@0 | 73 | int keepalive_needed; |
michael@0 | 74 | void *keepalive_timer; |
michael@0 | 75 | nr_stun_client_ctx *keepalive_ctx; |
michael@0 | 76 | |
michael@0 | 77 | STAILQ_ENTRY(nr_ice_component_)entry; |
michael@0 | 78 | }; |
michael@0 | 79 | |
michael@0 | 80 | typedef STAILQ_HEAD(nr_ice_component_head_,nr_ice_component_) nr_ice_component_head; |
michael@0 | 81 | |
michael@0 | 82 | int nr_ice_component_create(struct nr_ice_media_stream_ *stream, int component_id, nr_ice_component **componentp); |
michael@0 | 83 | int nr_ice_component_destroy(nr_ice_component **componentp); |
michael@0 | 84 | int nr_ice_component_initialize(struct nr_ice_ctx_ *ctx,nr_ice_component *component); |
michael@0 | 85 | int nr_ice_component_maybe_prune_candidate(nr_ice_ctx *ctx, nr_ice_component *comp, nr_ice_candidate *c1, int *was_pruned); |
michael@0 | 86 | int nr_ice_component_pair_candidate(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, nr_ice_candidate *lcand, int pair_all_remote); |
michael@0 | 87 | int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lcomp, nr_ice_component *pcomp); |
michael@0 | 88 | int nr_ice_component_service_pre_answer_requests(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, char *username, int *serviced); |
michael@0 | 89 | int nr_ice_component_nominated_pair(nr_ice_component *comp, nr_ice_cand_pair *pair); |
michael@0 | 90 | int nr_ice_component_failed_pair(nr_ice_component *comp, nr_ice_cand_pair *pair); |
michael@0 | 91 | int nr_ice_component_select_pair(nr_ice_peer_ctx *pctx, nr_ice_component *comp); |
michael@0 | 92 | int nr_ice_component_set_failed(nr_ice_component *comp); |
michael@0 | 93 | int nr_ice_component_finalize(nr_ice_component *lcomp, nr_ice_component *rcomp); |
michael@0 | 94 | int nr_ice_component_insert_pair(nr_ice_component *pcomp, nr_ice_cand_pair *pair); |
michael@0 | 95 | |
michael@0 | 96 | #ifdef __cplusplus |
michael@0 | 97 | } |
michael@0 | 98 | #endif /* __cplusplus */ |
michael@0 | 99 | #endif |