stun.h
Go to the documentation of this file.
1
6 /* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */
26 #ifndef _PURPLE_STUN_H_
27 #define _PURPLE_STUN_H_
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /**************************************************************************/
35 /**************************************************************************/
38 typedef struct _PurpleStunNatDiscovery PurpleStunNatDiscovery;
39
40 typedef enum {
41 PURPLE_STUN_STATUS_UNDISCOVERED = -1,
42 PURPLE_STUN_STATUS_UNKNOWN, /* no STUN server reachable */
43 PURPLE_STUN_STATUS_DISCOVERING,
44 PURPLE_STUN_STATUS_DISCOVERED
45 } PurpleStunStatus;
46
47 typedef enum {
48 PURPLE_STUN_NAT_TYPE_PUBLIC_IP,
49 PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT,
50 PURPLE_STUN_NAT_TYPE_FULL_CONE,
51 PURPLE_STUN_NAT_TYPE_RESTRICTED_CONE,
52 PURPLE_STUN_NAT_TYPE_PORT_RESTRICTED_CONE,
53 PURPLE_STUN_NAT_TYPE_SYMMETRIC
54 } PurpleStunNatType;
55
56 struct _PurpleStunNatDiscovery {
57 PurpleStunStatus status;
58 PurpleStunNatType type;
59 char publicip[16];
60 char *servername;
61 time_t lookup_time;
62 };
63
64 typedef void (*StunCallback) (PurpleStunNatDiscovery *);
65
78 PurpleStunNatDiscovery *purple_stun_discover(StunCallback cb);
79
80 void purple_stun_init(void);
81
84 #ifdef __cplusplus
85 }
86 #endif
87
88 #endif /* _PURPLE_STUN_H_ */
_PurpleStunNatDiscovery
Definition: stun.h:56
purple_stun_discover
PurpleStunNatDiscovery * purple_stun_discover(StunCallback cb)
Starts a NAT discovery.