1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,99 @@ 1.4 +/* 1.5 +Copyright (c) 2007, Adobe Systems, Incorporated 1.6 +All rights reserved. 1.7 + 1.8 +Redistribution and use in source and binary forms, with or without 1.9 +modification, are permitted provided that the following conditions are 1.10 +met: 1.11 + 1.12 +* Redistributions of source code must retain the above copyright 1.13 + notice, this list of conditions and the following disclaimer. 1.14 + 1.15 +* Redistributions in binary form must reproduce the above copyright 1.16 + notice, this list of conditions and the following disclaimer in the 1.17 + documentation and/or other materials provided with the distribution. 1.18 + 1.19 +* Neither the name of Adobe Systems, Network Resonance nor the names of its 1.20 + contributors may be used to endorse or promote products derived from 1.21 + this software without specific prior written permission. 1.22 + 1.23 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.24 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.25 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.26 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1.27 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.28 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.29 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1.30 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1.31 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.32 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1.33 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.34 +*/ 1.35 + 1.36 + 1.37 + 1.38 +#ifndef _ice_component_h 1.39 +#define _ice_component_h 1.40 +#ifdef __cplusplus 1.41 +using namespace std; 1.42 +extern "C" { 1.43 +#endif /* __cplusplus */ 1.44 + 1.45 +typedef struct nr_ice_pre_answer_request_ { 1.46 + nr_stun_server_request req; 1.47 + char *username; 1.48 + nr_transport_addr local_addr; 1.49 + 1.50 + STAILQ_ENTRY(nr_ice_pre_answer_request_) entry; 1.51 +} nr_ice_pre_answer_request; 1.52 + 1.53 +typedef STAILQ_HEAD(nr_ice_pre_answer_request_head_, nr_ice_pre_answer_request_) nr_ice_pre_answer_request_head; 1.54 + 1.55 +struct nr_ice_component_ { 1.56 + int state; 1.57 +#define NR_ICE_COMPONENT_UNPAIRED 0 1.58 +#define NR_ICE_COMPONENT_RUNNING 1 1.59 +#define NR_ICE_COMPONENT_NOMINATED 2 1.60 +#define NR_ICE_COMPONENT_FAILED 3 1.61 +#define NR_ICE_COMPONENT_DISABLED 4 1.62 + struct nr_ice_ctx_ *ctx; 1.63 + struct nr_ice_media_stream_ *stream; 1.64 + nr_ice_component *local_component; 1.65 + 1.66 + int component_id; 1.67 + nr_ice_socket_head sockets; 1.68 + nr_ice_candidate_head candidates; 1.69 + int candidate_ct; 1.70 + nr_ice_pre_answer_request_head pre_answer_reqs; 1.71 + 1.72 + int valid_pairs; 1.73 + struct nr_ice_cand_pair_ *nominated; /* Highest priority nomninated pair */ 1.74 + struct nr_ice_cand_pair_ *active; 1.75 + 1.76 + int keepalive_needed; 1.77 + void *keepalive_timer; 1.78 + nr_stun_client_ctx *keepalive_ctx; 1.79 + 1.80 + STAILQ_ENTRY(nr_ice_component_)entry; 1.81 +}; 1.82 + 1.83 +typedef STAILQ_HEAD(nr_ice_component_head_,nr_ice_component_) nr_ice_component_head; 1.84 + 1.85 +int nr_ice_component_create(struct nr_ice_media_stream_ *stream, int component_id, nr_ice_component **componentp); 1.86 +int nr_ice_component_destroy(nr_ice_component **componentp); 1.87 +int nr_ice_component_initialize(struct nr_ice_ctx_ *ctx,nr_ice_component *component); 1.88 +int nr_ice_component_maybe_prune_candidate(nr_ice_ctx *ctx, nr_ice_component *comp, nr_ice_candidate *c1, int *was_pruned); 1.89 +int nr_ice_component_pair_candidate(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, nr_ice_candidate *lcand, int pair_all_remote); 1.90 +int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lcomp, nr_ice_component *pcomp); 1.91 +int nr_ice_component_service_pre_answer_requests(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, char *username, int *serviced); 1.92 +int nr_ice_component_nominated_pair(nr_ice_component *comp, nr_ice_cand_pair *pair); 1.93 +int nr_ice_component_failed_pair(nr_ice_component *comp, nr_ice_cand_pair *pair); 1.94 +int nr_ice_component_select_pair(nr_ice_peer_ctx *pctx, nr_ice_component *comp); 1.95 +int nr_ice_component_set_failed(nr_ice_component *comp); 1.96 +int nr_ice_component_finalize(nr_ice_component *lcomp, nr_ice_component *rcomp); 1.97 +int nr_ice_component_insert_pair(nr_ice_component *pcomp, nr_ice_cand_pair *pair); 1.98 + 1.99 +#ifdef __cplusplus 1.100 +} 1.101 +#endif /* __cplusplus */ 1.102 +#endif