aboutsummaryrefslogtreecommitdiff
path: root/src/nat/nat_stun.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-10-07 09:51:33 +0000
committerChristian Grothoff <christian@grothoff.org>2015-10-07 09:51:33 +0000
commit117a6b2f87eab48523f3ecd0d72d28ad9903c849 (patch)
treedc47d59f75047a2dfab458f116f4f80fa84ad57c /src/nat/nat_stun.h
parent886d8cda082a8005c1a73a6d6603b9791121a7ae (diff)
downloadgnunet-117a6b2f87eab48523f3ecd0d72d28ad9903c849.tar.gz
gnunet-117a6b2f87eab48523f3ecd0d72d28ad9903c849.zip
stylistic fixes
Diffstat (limited to 'src/nat/nat_stun.h')
-rw-r--r--src/nat/nat_stun.h103
1 files changed, 51 insertions, 52 deletions
diff --git a/src/nat/nat_stun.h b/src/nat/nat_stun.h
index 1dbb2a6ac..d79fd9ad2 100644
--- a/src/nat/nat_stun.h
+++ b/src/nat/nat_stun.h
@@ -36,76 +36,75 @@
36 36
37typedef struct { uint32_t id[3]; } GNUNET_PACKED stun_trans_id; 37typedef struct { uint32_t id[3]; } GNUNET_PACKED stun_trans_id;
38 38
39struct stun_header { 39struct stun_header
40 uint16_t msgtype; 40{
41 uint16_t msglen; 41 uint16_t msgtype;
42 uint32_t magic; 42 uint16_t msglen;
43 stun_trans_id id; 43 uint32_t magic;
44 44 stun_trans_id id;
45} GNUNET_PACKED; 45} GNUNET_PACKED;
46 46
47struct stun_attr { 47struct stun_attr
48 uint16_t attr; 48{
49 uint16_t len; 49 uint16_t attr;
50 50 uint16_t len;
51} GNUNET_PACKED; 51} GNUNET_PACKED;
52 52
53/* 53/*
54 * The format normally used for addresses carried by STUN messages. 54 * The format normally used for addresses carried by STUN messages.
55 */ 55 */
56struct stun_addr { 56struct stun_addr
57 uint8_t unused; 57{
58 uint8_t family; 58 uint8_t unused;
59 uint16_t port; 59 uint8_t family;
60 uint32_t addr; 60 uint16_t port;
61 uint32_t addr;
61} GNUNET_PACKED; 62} GNUNET_PACKED;
62 63
63 64
64 65
65/* STUN message classes */ 66/* STUN message classes */
66typedef enum StunClasses { 67enum StunClasses {
67 INVALID_CLASS = 0, 68 INVALID_CLASS = 0,
68 STUN_REQUEST = 0x0000, 69 STUN_REQUEST = 0x0000,
69 STUN_INDICATION = 0x0001, 70 STUN_INDICATION = 0x0001,
70 STUN_RESPONSE = 0x0002, 71 STUN_RESPONSE = 0x0002,
71 STUN_ERROR_RESPONSE = 0x0003 72 STUN_ERROR_RESPONSE = 0x0003
72} StunClasses; 73};
73 74
74typedef enum StunMethods { 75enum StunMethods {
75 INVALID_METHOD = 0, 76 INVALID_METHOD = 0,
76 STUN_BINDING = 0x0001, 77 STUN_BINDING = 0x0001,
77 STUN_SHARED_SECRET = 0x0002, 78 STUN_SHARED_SECRET = 0x0002,
78 STUN_ALLOCATE = 0x0003, 79 STUN_ALLOCATE = 0x0003,
79 STUN_REFRESH = 0x0004, 80 STUN_REFRESH = 0x0004,
80 STUN_SEND = 0x0006, 81 STUN_SEND = 0x0006,
81 STUN_DATA = 0x0007, 82 STUN_DATA = 0x0007,
82 STUN_CREATE_PERMISSION = 0x0008, 83 STUN_CREATE_PERMISSION = 0x0008,
83 STUN_CHANNEL_BIND = 0x0009 84 STUN_CHANNEL_BIND = 0x0009
84} StunMethods; 85};
85 86
86/* Basic attribute types in stun messages. 87/* Basic attribute types in stun messages.
87 * Messages can also contain custom attributes (codes above 0x7fff) 88 * Messages can also contain custom attributes (codes above 0x7fff)
88 */ 89 */
89 90enum StunAttributes {
90typedef enum StunAttributes { 91 STUN_MAPPED_ADDRESS = 0x0001,
91 STUN_MAPPED_ADDRESS = 0x0001, 92 STUN_RESPONSE_ADDRESS = 0x0002,
92 STUN_RESPONSE_ADDRESS = 0x0002, 93 STUN_CHANGE_ADDRESS = 0x0003,
93 STUN_CHANGE_ADDRESS = 0x0003, 94 STUN_SOURCE_ADDRESS = 0x0004,
94 STUN_SOURCE_ADDRESS = 0x0004, 95 STUN_CHANGED_ADDRESS = 0x0005,
95 STUN_CHANGED_ADDRESS = 0x0005, 96 STUN_USERNAME = 0x0006,
96 STUN_USERNAME = 0x0006, 97 STUN_PASSWORD = 0x0007,
97 STUN_PASSWORD = 0x0007, 98 STUN_MESSAGE_INTEGRITY = 0x0008,
98 STUN_MESSAGE_INTEGRITY = 0x0008, 99 STUN_ERROR_CODE = 0x0009,
99 STUN_ERROR_CODE = 0x0009, 100 STUN_UNKNOWN_ATTRIBUTES = 0x000a,
100 STUN_UNKNOWN_ATTRIBUTES = 0x000a, 101 STUN_REFLECTED_FROM = 0x000b,
101 STUN_REFLECTED_FROM = 0x000b, 102 STUN_REALM = 0x0014,
102 STUN_REALM = 0x0014, 103 STUN_NONCE = 0x0015,
103 STUN_NONCE = 0x0015, 104 STUN_XOR_MAPPED_ADDRESS = 0x0020,
104 STUN_XOR_MAPPED_ADDRESS = 0x0020, 105 STUN_MS_VERSION = 0x8008,
105 STUN_MS_VERSION = 0x8008, 106 STUN_MS_XOR_MAPPED_ADDRESS = 0x8020,
106 STUN_MS_XOR_MAPPED_ADDRESS = 0x8020, 107 STUN_SOFTWARE = 0x8022,
107 STUN_SOFTWARE = 0x8022, 108 STUN_ALTERNATE_SERVER = 0x8023,
108 STUN_ALTERNATE_SERVER = 0x8023, 109 STUN_FINGERPRINT = 0x8028
109 STUN_FINGERPRINT = 0x8028 110};
110} StunAttributes;
111