3 * Part of the ministun package
5 * STUN support code borrowed from Asterisk -- An open source telephony toolkit.
6 * Copyright (C) 1999 - 2006, Digium, Inc.
7 * Mark Spencer <markster@digium.com>
8 * Standalone remake (c) 2009 Vladislav Grishenko <themiron@mail.ru>
10 * This software is licensed under the terms of the GNU General
11 * Public License (GPL). Please see the file COPYING for details.
15 #define PACKAGE "ministun"
18 #define STUN_SERVER "stun.xten.com"
19 #define STUN_PORT 3478
21 #define STUN_TIMEOUT 3
24 typedef struct { unsigned int id[4]; } __attribute__((packed)) stun_trans_id;
27 unsigned short msgtype;
28 unsigned short msglen;
30 } __attribute__((packed));
35 } __attribute__((packed));
38 * The format normally used for addresses carried by STUN messages.
46 } __attribute__((packed));
48 typedef struct { unsigned int id[4]; } stun_trans_id;
52 unsigned short msgtype;
53 unsigned short msglen;
66 * The format normally used for addresses carried by STUN messages.
78 #define STUN_IGNORE (0)
79 #define STUN_ACCEPT (1)
82 * 'BIND' refers to transactions used to determine the externally
83 * visible addresses. 'SEC' refers to transactions used to establish
84 * a session key for subsequent requests.
85 * 'SEC' functionality is not supported here.
88 #define STUN_BINDREQ 0x0001
89 #define STUN_BINDRESP 0x0101
90 #define STUN_BINDERR 0x0111
91 #define STUN_SECREQ 0x0002
92 #define STUN_SECRESP 0x0102
93 #define STUN_SECERR 0x0112
95 /* Basic attribute types in stun messages.
96 * Messages can also contain custom attributes (codes above 0x7fff)
98 #define STUN_MAPPED_ADDRESS 0x0001
99 #define STUN_RESPONSE_ADDRESS 0x0002
100 #define STUN_CHANGE_REQUEST 0x0003
101 #define STUN_SOURCE_ADDRESS 0x0004
102 #define STUN_CHANGED_ADDRESS 0x0005
103 #define STUN_USERNAME 0x0006
104 #define STUN_PASSWORD 0x0007
105 #define STUN_MESSAGE_INTEGRITY 0x0008
106 #define STUN_ERROR_CODE 0x0009
107 #define STUN_UNKNOWN_ATTRIBUTES 0x000a
108 #define STUN_REFLECTED_FROM 0x000b