2 This file is part of GNUnet.
\r
3 Copyright (C) 2009, 2015 Christian Grothoff (and other contributing authors)
\r
5 GNUnet is free software; you can redistribute it and/or modify
\r
6 it under the terms of the GNU General Public License as published
\r
7 by the Free Software Foundation; either version 3, or (at your
\r
8 option) any later version.
\r
10 GNUnet is distributed in the hope that it will be useful, but
\r
11 WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
13 General Public License for more details.
\r
15 You should have received a copy of the GNU General Public License
\r
16 along with GNUnet; see the file COPYING. If not, write to the
\r
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
\r
18 Boston, MA 02111-1307, USA.
\r
22 * Testcase for STUN server resolution
\r
24 * @file nat/test_stun.h
\r
25 * @brief Testcase for STUN library
\r
26 * @author Bruno Souza Cabral
\r
27 * @autor Mark Spencer (Original code borrowed from Asterisk)
\r
31 #define STUN_SERVER "stun.ekiga.net"
\r
32 #define STUN_PORT 3478
\r
33 #define STUN_IGNORE (0)
\r
34 #define STUN_ACCEPT (1)
\r
36 #define STUN_MAGIC_COOKIE 0x2112A442
\r
38 typedef struct { uint32_t id[3]; } GNUNET_PACKED stun_trans_id;
\r
40 struct stun_header {
\r
55 * The format normally used for addresses carried by STUN messages.
\r
66 /* STUN message classes */
\r
67 typedef enum StunClasses {
\r
69 STUN_REQUEST = 0x0000,
\r
70 STUN_INDICATION = 0x0001,
\r
71 STUN_RESPONSE = 0x0002,
\r
72 STUN_ERROR_RESPONSE = 0x0003
\r
75 typedef enum StunMethods {
\r
77 STUN_BINDING = 0x0001,
\r
78 STUN_SHARED_SECRET = 0x0002,
\r
79 STUN_ALLOCATE = 0x0003,
\r
80 STUN_REFRESH = 0x0004,
\r
83 STUN_CREATE_PERMISSION = 0x0008,
\r
84 STUN_CHANNEL_BIND = 0x0009
\r
87 /* Basic attribute types in stun messages.
\r
88 * Messages can also contain custom attributes (codes above 0x7fff)
\r
91 typedef enum StunAttributes {
\r
92 STUN_MAPPED_ADDRESS = 0x0001,
\r
93 STUN_RESPONSE_ADDRESS = 0x0002,
\r
94 STUN_CHANGE_ADDRESS = 0x0003,
\r
95 STUN_SOURCE_ADDRESS = 0x0004,
\r
96 STUN_CHANGED_ADDRESS = 0x0005,
\r
97 STUN_USERNAME = 0x0006,
\r
98 STUN_PASSWORD = 0x0007,
\r
99 STUN_MESSAGE_INTEGRITY = 0x0008,
\r
100 STUN_ERROR_CODE = 0x0009,
\r
101 STUN_UNKNOWN_ATTRIBUTES = 0x000a,
\r
102 STUN_REFLECTED_FROM = 0x000b,
\r
103 STUN_REALM = 0x0014,
\r
104 STUN_NONCE = 0x0015,
\r
105 STUN_XOR_MAPPED_ADDRESS = 0x0020,
\r
106 STUN_MS_VERSION = 0x8008,
\r
107 STUN_MS_XOR_MAPPED_ADDRESS = 0x8020,
\r
108 STUN_SOFTWARE = 0x8022,
\r
109 STUN_ALTERNATE_SERVER = 0x8023,
\r
110 STUN_FINGERPRINT = 0x8028
\r