stun.h

Go to the documentation of this file.
00001 
00006 /* purple
00007  *
00008  * Purple is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 #ifndef _PURPLE_STUN_H_
00027 #define _PURPLE_STUN_H_
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 /**************************************************************************/
00035 /**************************************************************************/
00038 typedef struct _PurpleStunNatDiscovery PurpleStunNatDiscovery;
00039 
00040 typedef enum {
00041     PURPLE_STUN_STATUS_UNDISCOVERED = -1,
00042     PURPLE_STUN_STATUS_UNKNOWN, /* no STUN server reachable */
00043     PURPLE_STUN_STATUS_DISCOVERING,
00044     PURPLE_STUN_STATUS_DISCOVERED
00045 } PurpleStunStatus;
00046 
00047 typedef enum {
00048     PURPLE_STUN_NAT_TYPE_PUBLIC_IP,
00049     PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT,
00050     PURPLE_STUN_NAT_TYPE_FULL_CONE,
00051     PURPLE_STUN_NAT_TYPE_RESTRICTED_CONE,
00052     PURPLE_STUN_NAT_TYPE_PORT_RESTRICTED_CONE,
00053     PURPLE_STUN_NAT_TYPE_SYMMETRIC
00054 } PurpleStunNatType;
00055 
00056 struct _PurpleStunNatDiscovery {
00057     PurpleStunStatus status;
00058     PurpleStunNatType type;
00059     char publicip[16];
00060     char *servername;
00061     time_t lookup_time;
00062 };
00063 
00064 typedef void (*StunCallback) (PurpleStunNatDiscovery *);
00065 
00078 PurpleStunNatDiscovery *purple_stun_discover(StunCallback cb);
00079 
00080 void purple_stun_init(void);
00081 
00084 #ifdef __cplusplus
00085 }
00086 #endif
00087 
00088 #endif /* _PURPLE_STUN_H_ */