~ubuntu-branches/debian/squeeze/libnice/squeeze

« back to all changes in this revision

Viewing changes to agent/discovery.h

  • Committer: Bazaar Package Importer
  • Author(s): Laurent Bigonville
  • Date: 2009-01-04 17:45:34 UTC
  • Revision ID: james.westby@ubuntu.com-20090104174534-dh5u1pfonumqa99c
Tags: upstream-0.0.4
ImportĀ upstreamĀ versionĀ 0.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the Nice GLib ICE library.
 
3
 *
 
4
 * (C) 2007 Nokia Corporation. All rights reserved.
 
5
 *  Contact: Kai Vehmanen
 
6
 *
 
7
 * The contents of this file are subject to the Mozilla Public License Version
 
8
 * 1.1 (the "License"); you may not use this file except in compliance with
 
9
 * the License. You may obtain a copy of the License at
 
10
 * http://www.mozilla.org/MPL/
 
11
 *
 
12
 * Software distributed under the License is distributed on an "AS IS" basis,
 
13
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
14
 * for the specific language governing rights and limitations under the
 
15
 * License.
 
16
 *
 
17
 * The Original Code is the Nice GLib ICE library.
 
18
 *
 
19
 * The Initial Developers of the Original Code are Collabora Ltd and Nokia
 
20
 * Corporation. All Rights Reserved.
 
21
 *
 
22
 * Contributors:
 
23
 *   Kai Vehmanen, Nokia
 
24
 *
 
25
 * Alternatively, the contents of this file may be used under the terms of the
 
26
 * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
 
27
 * case the provisions of LGPL are applicable instead of those above. If you
 
28
 * wish to allow use of your version of this file only under the terms of the
 
29
 * LGPL and not to allow others to use your version of this file under the
 
30
 * MPL, indicate your decision by deleting the provisions above and replace
 
31
 * them with the notice and other provisions required by the LGPL. If you do
 
32
 * not delete the provisions above, a recipient may use your version of this
 
33
 * file under either the MPL or the LGPL.
 
34
 */
 
35
 
 
36
#ifndef _NICE_DISCOVERY_H
 
37
#define _NICE_DISCOVERY_H
 
38
 
 
39
/* note: this is a private header to libnice */
 
40
 
 
41
#include "stream.h"
 
42
#include "agent.h"
 
43
 
 
44
typedef struct
 
45
{
 
46
  NiceAgent *agent;         /**< back pointer to owner */
 
47
  NiceCandidateType type;   /**< candidate type STUN or TURN */
 
48
  NiceSocket *nicesock;  /**< XXX: should be taken from local cand: existing socket to use */
 
49
  NiceAddress server;       /**< STUN/TURN server address */
 
50
  GTimeVal next_tick;       /**< next tick timestamp */
 
51
  gboolean pending;         /**< is discovery in progress? */
 
52
  gboolean done;            /**< is discovery complete? */
 
53
  Stream *stream;
 
54
  Component *component;
 
55
  TurnServer *turn;
 
56
  StunAgent stun_agent;
 
57
  uint8_t *msn_turn_username;
 
58
  uint8_t *msn_turn_password;
 
59
  stun_timer_t timer;
 
60
  uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE];
 
61
  StunMessage stun_message;
 
62
  uint8_t stun_resp_buffer[STUN_MAX_MESSAGE_SIZE];
 
63
  StunMessage stun_resp_msg;
 
64
} CandidateDiscovery;
 
65
 
 
66
typedef struct
 
67
{
 
68
  NiceAgent *agent;         /**< back pointer to owner */
 
69
  NiceSocket *nicesock;     /**< existing socket to use */
 
70
  NiceSocket *relay_socket; /**< relay socket from which we receive */
 
71
  NiceAddress server;       /**< STUN/TURN server address */
 
72
  Stream *stream;
 
73
  Component *component;
 
74
  TurnServer *turn;
 
75
  StunAgent stun_agent;
 
76
  GSource *timer_source;
 
77
  GSource *tick_source;
 
78
  uint8_t *msn_turn_username;
 
79
  uint8_t *msn_turn_password;
 
80
  stun_timer_t timer;
 
81
  uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE];
 
82
  StunMessage stun_message;
 
83
  uint8_t stun_resp_buffer[STUN_MAX_MESSAGE_SIZE];
 
84
  StunMessage stun_resp_msg;
 
85
} CandidateRefresh;
 
86
 
 
87
void refresh_free_item (gpointer data, gpointer user_data);
 
88
void refresh_free (NiceAgent *agent);
 
89
void refresh_prune_stream (NiceAgent *agent, guint stream_id);
 
90
void refresh_cancel (CandidateRefresh *refresh);
 
91
 
 
92
 
 
93
void discovery_free_item (gpointer data, gpointer user_data);
 
94
void discovery_free (NiceAgent *agent);
 
95
void discovery_prune_stream (NiceAgent *agent, guint stream_id);
 
96
void discovery_schedule (NiceAgent *agent);
 
97
 
 
98
NiceCandidate *
 
99
discovery_add_local_host_candidate (
 
100
  NiceAgent *agent,
 
101
  guint stream_id,
 
102
  guint component_id,
 
103
  NiceAddress *address);
 
104
 
 
105
NiceCandidate*
 
106
discovery_add_relay_candidate (
 
107
  NiceAgent *agent,
 
108
  guint stream_id,
 
109
  guint component_id,
 
110
  NiceAddress *address,
 
111
  NiceSocket *base_socket,
 
112
  TurnServer *turn);
 
113
 
 
114
NiceCandidate* 
 
115
discovery_add_server_reflexive_candidate (
 
116
  NiceAgent *agent,
 
117
  guint stream_id,
 
118
  guint component_id,
 
119
  NiceAddress *address,
 
120
  NiceSocket *base_socket);
 
121
 
 
122
NiceCandidate* 
 
123
discovery_add_peer_reflexive_candidate (
 
124
  NiceAgent *agent,
 
125
  guint stream_id,
 
126
  guint component_id,
 
127
  NiceAddress *address,
 
128
  NiceSocket *base_socket,
 
129
  NiceCandidate *local,
 
130
  NiceCandidate *remote);
 
131
 
 
132
NiceCandidate *
 
133
discovery_learn_remote_peer_reflexive_candidate (
 
134
  NiceAgent *agent,
 
135
  Stream *stream,
 
136
  Component *component,
 
137
  guint32 priority, 
 
138
  const NiceAddress *remote_address,
 
139
  NiceSocket *udp_socket,
 
140
  NiceCandidate *local,
 
141
  NiceCandidate *remote);
 
142
 
 
143
#endif /*_NICE_CONNCHECK_H */