diff options
author | unknown <diego.nehab@gmail.com> | 2013-05-30 16:50:28 +0800 |
---|---|---|
committer | unknown <diego.nehab@gmail.com> | 2013-05-30 16:50:28 +0800 |
commit | 5eefc73b572e591bd127b8c2873f0fa9522dc0b9 (patch) | |
tree | 5dbd3040b73a40d13174335fcb6b91d497ce36b4 /src/options.c | |
parent | a233e27865d96566a6cb13960d08605ce34d9f0d (diff) | |
download | luasocket-5eefc73b572e591bd127b8c2873f0fa9522dc0b9.tar.gz luasocket-5eefc73b572e591bd127b8c2873f0fa9522dc0b9.tar.bz2 luasocket-5eefc73b572e591bd127b8c2873f0fa9522dc0b9.zip |
Remove warnings. Move windows specific code.
Diffstat (limited to 'src/options.c')
-rw-r--r-- | src/options.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/options.c b/src/options.c index 8737d9c..55b65a7 100644 --- a/src/options.c +++ b/src/options.c | |||
@@ -3,9 +3,6 @@ | |||
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <sys/types.h> | ||
7 | #include <sys/socket.h> | ||
8 | #include <net/if.h> | ||
9 | 6 | ||
10 | #include "lauxlib.h" | 7 | #include "lauxlib.h" |
11 | 8 | ||
@@ -13,20 +10,6 @@ | |||
13 | #include "options.h" | 10 | #include "options.h" |
14 | #include "inet.h" | 11 | #include "inet.h" |
15 | 12 | ||
16 | /* Some platforms use IPV6_JOIN_GROUP instead if | ||
17 | * IPV6_ADD_MEMBERSHIP. The semantics are same, though. */ | ||
18 | #ifndef IPV6_ADD_MEMBERSHIP | ||
19 | #ifdef IPV6_JOIN_GROUP | ||
20 | #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP | ||
21 | #endif /* IPV6_JOIN_GROUP */ | ||
22 | #endif /* !IPV6_ADD_MEMBERSHIP */ | ||
23 | |||
24 | /* Same with IPV6_DROP_MEMBERSHIP / IPV6_LEAVE_GROUP. */ | ||
25 | #ifndef IPV6_DROP_MEMBERSHIP | ||
26 | #ifdef IPV6_LEAVE_GROUP | ||
27 | #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP | ||
28 | #endif /* IPV6_LEAVE_GROUP */ | ||
29 | #endif /* !IPV6_DROP_MEMBERSHIP */ | ||
30 | 13 | ||
31 | /*=========================================================================*\ | 14 | /*=========================================================================*\ |
32 | * Internal functions prototypes | 15 | * Internal functions prototypes |
@@ -296,19 +279,22 @@ static int opt_ip6_setmembership(lua_State *L, p_socket ps, int level, int name) | |||
296 | lua_pushstring(L, "interface"); | 279 | lua_pushstring(L, "interface"); |
297 | lua_gettable(L, 3); | 280 | lua_gettable(L, 3); |
298 | /* By default we listen to interface on default route | 281 | /* By default we listen to interface on default route |
299 | * (sigh). However, interface= can override it. We support either | 282 | * (sigh). However, interface= can override it. We should |
300 | * number, or name for it. */ | 283 | * support either number, or name for it. Waiting for |
284 | * windows port of if_nametoindex */ | ||
301 | if (!lua_isnil(L, -1)) { | 285 | if (!lua_isnil(L, -1)) { |
302 | if (lua_isnumber(L, -1)) { | 286 | if (lua_isnumber(L, -1)) { |
303 | val.ipv6mr_interface = lua_tonumber(L, -1); | 287 | val.ipv6mr_interface = (unsigned int) lua_tonumber(L, -1); |
288 | #if 0 | ||
304 | } else if (lua_isstring(L, -1)) { | 289 | } else if (lua_isstring(L, -1)) { |
305 | if (!(val.ipv6mr_interface = if_nametoindex(lua_tostring(L, -1)))) { | 290 | if (!(val.ipv6mr_interface = if_nametoindex(lua_tostring(L, -1)))) { |
306 | lua_pushnil(L); | 291 | lua_pushnil(L); |
307 | lua_pushstring(L, "nonexistent interface"); | 292 | lua_pushstring(L, "nonexistent interface"); |
308 | return 2; | 293 | return 2; |
309 | } | 294 | } |
295 | #endif | ||
310 | } else | 296 | } else |
311 | luaL_argerror(L, -1, "number/string 'interface' field expected"); | 297 | luaL_argerror(L, -1, "number 'interface' field expected"); |
312 | } | 298 | } |
313 | return opt_set(L, ps, level, name, (char *) &val, sizeof(val)); | 299 | return opt_set(L, ps, level, name, (char *) &val, sizeof(val)); |
314 | } | 300 | } |