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;
31 } __attribute__((packed));
36 unsigned char value[0];
37 } __attribute__((packed));
40 * The format normally used for addresses carried by STUN messages.
48 } __attribute__((packed));
50 typedef struct { unsigned int id[4]; } stun_trans_id;
54 unsigned short msgtype;
55 unsigned short msglen;
65 unsigned char value[0];
70 * The format normally used for addresses carried by STUN messages.
82 #define STUN_IGNORE (0)
83 #define STUN_ACCEPT (1)
86 * 'BIND' refers to transactions used to determine the externally
87 * visible addresses. 'SEC' refers to transactions used to establish
88 * a session key for subsequent requests.
89 * 'SEC' functionality is not supported here.
92 #define STUN_BINDREQ 0x0001
93 #define STUN_BINDRESP 0x0101
94 #define STUN_BINDERR 0x0111
95 #define STUN_SECREQ 0x0002
96 #define STUN_SECRESP 0x0102
97 #define STUN_SECERR 0x0112
99 /* Basic attribute types in stun messages.
100 * Messages can also contain custom attributes (codes above 0x7fff)
102 #define STUN_MAPPED_ADDRESS 0x0001
103 #define STUN_RESPONSE_ADDRESS 0x0002
104 #define STUN_CHANGE_REQUEST 0x0003
105 #define STUN_SOURCE_ADDRESS 0x0004
106 #define STUN_CHANGED_ADDRESS 0x0005
107 #define STUN_USERNAME 0x0006
108 #define STUN_PASSWORD 0x0007
109 #define STUN_MESSAGE_INTEGRITY 0x0008
110 #define STUN_ERROR_CODE 0x0009
111 #define STUN_UNKNOWN_ATTRIBUTES 0x000a
112 #define STUN_REFLECTED_FROM 0x000b