aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-12-23 22:37:31 +0100
committerChristian Grothoff <christian@grothoff.org>2016-12-23 22:37:31 +0100
commit96b233995e41e0b6be65734ec5f29108ee017d31 (patch)
treede685563e1b6c77e6afec697bb537779736002b1 /src
parentb671c7b7d192d7b87d5553ad6f32ac8ac6791780 (diff)
downloadgnunet-96b233995e41e0b6be65734ec5f29108ee017d31.tar.gz
gnunet-96b233995e41e0b6be65734ec5f29108ee017d31.zip
improve types, eliminate compiler warning for unused function
Diffstat (limited to 'src')
-rw-r--r--src/nat/nat_api_stun.c4
-rw-r--r--src/nat/nat_stun.h21
2 files changed, 13 insertions, 12 deletions
diff --git a/src/nat/nat_api_stun.c b/src/nat/nat_api_stun.c
index 8f5a5f8f6..7f2ef4eaf 100644
--- a/src/nat/nat_api_stun.c
+++ b/src/nat/nat_api_stun.c
@@ -199,9 +199,7 @@ stun_dns_callback (void *cls,
199 199
200/** 200/**
201 * Make Generic STUN request. Sends a generic stun request to the 201 * Make Generic STUN request. Sends a generic stun request to the
202 * server specified using the specified socket, possibly waiting for 202 * server specified using the specified socket.
203 * a reply and filling the 'reply' field with the externally visible
204 * address.
205 * 203 *
206 * @param server the address of the stun server 204 * @param server the address of the stun server
207 * @param port port of the stun server, in host byte order 205 * @param port port of the stun server, in host byte order
diff --git a/src/nat/nat_stun.h b/src/nat/nat_stun.h
index 4c6c178fb..3e4228875 100644
--- a/src/nat/nat_stun.h
+++ b/src/nat/nat_stun.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009, 2015 GNUnet e.V. 3 Copyright (C) 2009, 2015, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -135,23 +135,24 @@ enum StunAttributes {
135 * @param msg the received message 135 * @param msg the received message
136 * @return the converted StunClass 136 * @return the converted StunClass
137 */ 137 */
138static int 138static enum StunClasses
139decode_class(int msg) 139decode_class (int msg)
140{ 140{
141 /* Sorry for the magic, but this maps the class according to rfc5245 */ 141 /* Sorry for the magic, but this maps the class according to rfc5245 */
142 return ((msg & 0x0010) >> 4) | ((msg & 0x0100) >> 7); 142 return (enum StunClasses) ((msg & 0x0010) >> 4) | ((msg & 0x0100) >> 7);
143} 143}
144 144
145
145/** 146/**
146 * Convert a message to a StunMethod 147 * Convert a message to a StunMethod
147 * 148 *
148 * @param msg the received message 149 * @param msg the received message
149 * @return the converted StunMethod 150 * @return the converted StunMethod
150 */ 151 */
151static int 152static enum StunMethods
152decode_method(int msg) 153decode_method (int msg)
153{ 154{
154 return (msg & 0x000f) | ((msg & 0x00e0) >> 1) | ((msg & 0x3e00) >> 2); 155 return (enum StunMethods) (msg & 0x000f) | ((msg & 0x00e0) >> 1) | ((msg & 0x3e00) >> 2);
155} 156}
156 157
157 158
@@ -161,6 +162,7 @@ decode_method(int msg)
161 * @param msg 162 * @param msg
162 * @return string with the message class and method 163 * @return string with the message class and method
163 */ 164 */
165GNUNET_UNUSED
164static const char * 166static const char *
165stun_msg2str (int msg) 167stun_msg2str (int msg)
166{ 168{
@@ -172,14 +174,14 @@ stun_msg2str (int msg)
172 { STUN_INDICATION, "Indication" }, 174 { STUN_INDICATION, "Indication" },
173 { STUN_RESPONSE, "Response" }, 175 { STUN_RESPONSE, "Response" },
174 { STUN_ERROR_RESPONSE, "Error Response" }, 176 { STUN_ERROR_RESPONSE, "Error Response" },
175 { 0, NULL } 177 { INVALID_CLASS, NULL }
176 }; 178 };
177 static const struct { 179 static const struct {
178 enum StunMethods value; 180 enum StunMethods value;
179 const char *name; 181 const char *name;
180 } methods[] = { 182 } methods[] = {
181 { STUN_BINDING, "Binding" }, 183 { STUN_BINDING, "Binding" },
182 { 0, NULL } 184 { INVALID_METHOD, NULL }
183 }; 185 };
184 static char result[64]; 186 static char result[64];
185 const char *msg_class = NULL; 187 const char *msg_class = NULL;
@@ -215,6 +217,7 @@ stun_msg2str (int msg)
215 * @param msg with a attribute type 217 * @param msg with a attribute type
216 * @return string with the attribute name 218 * @return string with the attribute name
217 */ 219 */
220GNUNET_UNUSED
218static const char * 221static const char *
219stun_attr2str (enum StunAttributes msg) 222stun_attr2str (enum StunAttributes msg)
220{ 223{