summaryrefslogtreecommitdiff
path: root/pjnath/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-10-12 12:14:27 +0000
committerBenny Prijono <bennylp@teluu.com>2007-10-12 12:14:27 +0000
commitb0f62471ea72f5767d859f18e41d4326f57b85c5 (patch)
tree5be22dd454663b8e8daee9e322ed794ccf54e8c4 /pjnath/include
parent9ca491d9d373e4f9114b429bcd61b72b1ff97048 (diff)
Ticket #399: Initial implementation of tool to perform NAT type detection/classification
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1495 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath/include')
-rw-r--r--pjnath/include/pjnath.h1
-rw-r--r--pjnath/include/pjnath/nat_detect.h95
2 files changed, 96 insertions, 0 deletions
diff --git a/pjnath/include/pjnath.h b/pjnath/include/pjnath.h
index 20fb28b4..6c925050 100644
--- a/pjnath/include/pjnath.h
+++ b/pjnath/include/pjnath.h
@@ -21,6 +21,7 @@
#include <pjnath/errno.h>
#include <pjnath/ice_session.h>
#include <pjnath/ice_strans.h>
+#include <pjnath/nat_detect.h>
#include <pjnath/stun_auth.h>
#include <pjnath/stun_config.h>
#include <pjnath/stun_msg.h>
diff --git a/pjnath/include/pjnath/nat_detect.h b/pjnath/include/pjnath/nat_detect.h
new file mode 100644
index 00000000..014a8911
--- /dev/null
+++ b/pjnath/include/pjnath/nat_detect.h
@@ -0,0 +1,95 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __PJNATH_NAT_DETECT_H__
+#define __PJNATH_NAT_DETECT_H__
+
+/**
+ * @file ice_session.h
+ * @brief ICE session management
+ */
+#include <pjnath/stun_session.h>
+
+
+PJ_BEGIN_DECL
+
+
+/**
+ * @defgroup PJNATH_NAT_DETECT NAT Classification/Detection Tool
+ * @brief NAT Classification/Detection Tool
+ * @ingroup PJNATH_ICE
+ * @{
+ * This module provides one function to perform NAT classification and
+ * detection.
+ */
+
+/**
+ * This enumeration describes the NAT types.
+ */
+typedef enum pj_stun_nat_type
+{
+ PJ_STUN_NAT_TYPE_UNKNOWN,
+ PJ_STUN_NAT_TYPE_OPEN,
+ PJ_STUN_NAT_TYPE_BLOCKED,
+ PJ_STUN_NAT_TYPE_SYMMETRIC_UDP,
+ PJ_STUN_NAT_TYPE_FULL_CONE,
+ PJ_STUN_NAT_TYPE_SYMMETRIC,
+ PJ_STUN_NAT_TYPE_RESTRICTED,
+ PJ_STUN_NAT_TYPE_PORT_RESTRICTED
+} pj_stun_nat_type;
+
+
+/**
+ * This structure contains the result of NAT classification function.
+ */
+typedef struct pj_stun_nat_detect_result
+{
+ pj_status_t status;
+ const char *status_text;
+ pj_stun_nat_type nat_type;
+ const char *nat_type_name;
+} pj_stun_nat_detect_result;
+
+
+/**
+ * Type of callback to be called when the NAT detection function has
+ * completed.
+ */
+typedef void pj_stun_nat_detect_cb(void *user_data,
+ const pj_stun_nat_detect_result *res);
+
+
+/**
+ * Perform NAT classification function.
+ */
+PJ_DECL(pj_status_t) pj_stun_detect_nat_type(const pj_sockaddr_in *server,
+ pj_stun_config *stun_cfg,
+ void *user_data,
+ pj_stun_nat_detect_cb *cb);
+
+
+/**
+ * @}
+ */
+
+
+PJ_END_DECL
+
+
+#endif /* __PJNATH_NAT_DETECT_H__ */
+