1 /*
2 Copyright (c) 2007, Adobe Systems, Incorporated
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8 
9 * Redistributions of source code must retain the above copyright
10   notice, this list of conditions and the following disclaimer.
11 
12 * Redistributions in binary form must reproduce the above copyright
13   notice, this list of conditions and the following disclaimer in the
14   documentation and/or other materials provided with the distribution.
15 
16 * Neither the name of Adobe Systems, Network Resonance nor the names of its
17   contributors may be used to endorse or promote products derived from
18   this software without specific prior written permission.
19 
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 
33 
34 
35 #ifndef _ice_h
36 #define _ice_h
37 #ifdef __cplusplus
38 using namespace std;
39 extern "C" {
40 #endif /* __cplusplus */
41 
42 typedef struct nr_ice_handler_vtbl_ {
43   /* The checks on this media stream are done. The handler needs to
44      select a single pair to proceed with (regular nomination).
45      Once this returns the check starts and the pair can be
46      written on. Use nr_ice_candidate_pair_select() to perform the
47      selection.
48      TODO: !ekr! is this right?
49   */
50   int (*select_pair)(void *obj,nr_ice_media_stream *stream,
51 int component_id, nr_ice_cand_pair **potentials,int potential_ct);
52 
53   /* This media stream is ready to read/write (aggressive nomination).
54      May be called again if the nominated pair changes due to
55      ICE instability. TODO: !ekr! think about this
56   */
57   int (*stream_ready)(void *obj, nr_ice_media_stream *stream);
58 
59   /* This media stream has failed */
60   int (*stream_failed)(void *obj, nr_ice_media_stream *stream);
61 
62   /* ICE is connected for this peer ctx */
63   int (*ice_connected)(void *obj, nr_ice_peer_ctx *pctx);
64 
65   /* A message was delivered to us */
66   int (*msg_recvd)(void *obj, nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream, int component_id, UCHAR *msg, int len);
67 
68   /* ICE has started checking. */
69   int (*ice_checking)(void *obj, nr_ice_peer_ctx *pctx);
70 
71   /* ICE detected a (temporary?) disconnect. */
72   int (*ice_disconnected)(void *obj, nr_ice_peer_ctx *pctx);
73 } nr_ice_handler_vtbl;
74 
75 typedef struct nr_ice_handler_ {
76   void *obj;
77   nr_ice_handler_vtbl *vtbl;
78 } nr_ice_handler;
79 
80 #ifdef __cplusplus
81 }
82 #endif /* __cplusplus */
83 #endif
84 
85