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

« back to all changes in this revision

Viewing changes to stun/usages/timer.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: Rémi Denis-Courmont
 
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
 *   Rémi Denis-Courmont, 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 STUN_TIMER_H
 
37
# define STUN_TIMER_H 1
 
38
 
 
39
/**
 
40
 * @file timer.h
 
41
 * @brief STUN retransmission timer
 
42
 */
 
43
 
 
44
#ifdef _WIN32
 
45
#include <winsock2.h>
 
46
#else
 
47
# include <sys/types.h>
 
48
# include <time.h>
 
49
#endif
 
50
 
 
51
typedef struct stun_timer_s
 
52
{
 
53
  struct timeval deadline;
 
54
  unsigned delay;
 
55
} stun_timer_t;
 
56
 
 
57
 
 
58
# ifdef __cplusplus
 
59
extern "C" {
 
60
# endif
 
61
 
 
62
/**
 
63
 * Starts a STUN transaction retransmission timer.
 
64
 * @param timer structure for internal timer state
 
65
 */
 
66
void stun_timer_start (stun_timer_t *timer);
 
67
void stun_timer_start_reliable (stun_timer_t *timer);
 
68
 
 
69
/**
 
70
 * Updates a STUN transaction retransmission timer.
 
71
 * @param timer internal timer state
 
72
 * @return -1 if the transaction timed out,
 
73
 * 0 if the transaction should be retransmitted,
 
74
 * otherwise milliseconds left until next time out or retransmit.
 
75
 */
 
76
int stun_timer_refresh (stun_timer_t *timer);
 
77
unsigned stun_timer_remainder (const stun_timer_t *timer);
 
78
 
 
79
# ifdef __cplusplus
 
80
}
 
81
# endif
 
82
 
 
83
#endif /* !STUN_TIMER_H */