diff options
| -rw-r--r-- | README.md | 24 | ||||
| -rw-r--r-- | mrbgem.rake | 2 | ||||
| -rw-r--r-- | mrblib/socket.rb | 2 | ||||
| -rw-r--r-- | src/socket.c | 38 |
4 files changed, 33 insertions, 33 deletions
@@ -36,20 +36,20 @@ Date: Tue, 21 May 2013 04:31:30 GMT Copyright (c) 2013 Internet Initiative Japan Inc. -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/mrbgem.rake b/mrbgem.rake index ef91bdfcb..7ae914925 100644 --- a/mrbgem.rake +++ b/mrbgem.rake @@ -3,7 +3,7 @@ MRuby::Gem::Specification.new('mruby-socket') do |spec| spec.authors = 'Internet Initiative Japan' spec.cc.include_paths << "#{build.root}/src" - + # If Windows, use winsock if ( /mswin|mingw|win32/ =~ RUBY_PLATFORM ) then spec.linker.libraries << "wsock32" diff --git a/mrblib/socket.rb b/mrblib/socket.rb index f7d4ce3a8..53c20e3cc 100644 --- a/mrblib/socket.rb +++ b/mrblib/socket.rb @@ -154,7 +154,7 @@ class Addrinfo [ s, port.to_i, addr, addr ] end - def to_sockaddr + def to_sockaddr @sockaddr end diff --git a/src/socket.c b/src/socket.c index 19cfc509c..3f4ef8a4c 100644 --- a/src/socket.c +++ b/src/socket.c @@ -6,7 +6,7 @@ #ifdef _WIN32 #define _WIN32_WINNT 0x0501 - + #include <winsock2.h> #include <ws2tcpip.h> #include <windows.h> @@ -260,13 +260,13 @@ socket_family(int s) static mrb_value mrb_basicsocket_getpeereid(mrb_state *mrb, mrb_value self) -{ +{ #ifdef HAVE_GETPEEREID mrb_value ary; gid_t egid; uid_t euid; int s; - + s = socket_fd(mrb, self); if (getpeereid(s, &euid, &egid) != 0) mrb_sys_fail(mrb, "getpeereid"); @@ -283,10 +283,10 @@ mrb_basicsocket_getpeereid(mrb_state *mrb, mrb_value self) static mrb_value mrb_basicsocket_getpeername(mrb_state *mrb, mrb_value self) -{ +{ struct sockaddr_storage ss; socklen_t salen; - + salen = sizeof(ss); if (getpeername(socket_fd(mrb, self), (struct sockaddr *)&ss, &salen) != 0) mrb_sys_fail(mrb, "getpeername"); @@ -296,10 +296,10 @@ mrb_basicsocket_getpeername(mrb_state *mrb, mrb_value self) static mrb_value mrb_basicsocket_getsockname(mrb_state *mrb, mrb_value self) -{ +{ struct sockaddr_storage ss; socklen_t salen; - + salen = sizeof(ss); if (getsockname(socket_fd(mrb, self), (struct sockaddr *)&ss, &salen) != 0) mrb_sys_fail(mrb, "getsockname"); @@ -309,7 +309,7 @@ mrb_basicsocket_getsockname(mrb_state *mrb, mrb_value self) static mrb_value mrb_basicsocket_getsockopt(mrb_state *mrb, mrb_value self) -{ +{ char opt[8]; int s; mrb_int family, level, optname; @@ -329,7 +329,7 @@ mrb_basicsocket_getsockopt(mrb_state *mrb, mrb_value self) static mrb_value mrb_basicsocket_recv(mrb_state *mrb, mrb_value self) -{ +{ int n; mrb_int maxlen, flags = 0; mrb_value buf; @@ -345,7 +345,7 @@ mrb_basicsocket_recv(mrb_state *mrb, mrb_value self) static mrb_value mrb_basicsocket_recvfrom(mrb_state *mrb, mrb_value self) -{ +{ int n; mrb_int maxlen, flags = 0; mrb_value ary, buf, sa; @@ -368,7 +368,7 @@ mrb_basicsocket_recvfrom(mrb_state *mrb, mrb_value self) static mrb_value mrb_basicsocket_send(mrb_state *mrb, mrb_value self) -{ +{ int n; mrb_int flags; mrb_value dest, mesg; @@ -387,7 +387,7 @@ mrb_basicsocket_send(mrb_state *mrb, mrb_value self) static mrb_value mrb_basicsocket_setnonblock(mrb_state *mrb, mrb_value self) -{ +{ int fd, flags; mrb_value bool; #ifdef _WIN32 @@ -416,7 +416,7 @@ mrb_basicsocket_setnonblock(mrb_state *mrb, mrb_value self) static mrb_value mrb_basicsocket_setsockopt(mrb_state *mrb, mrb_value self) -{ +{ int argc, s; mrb_int level = 0, optname; mrb_value optval, so; @@ -461,7 +461,7 @@ mrb_basicsocket_setsockopt(mrb_state *mrb, mrb_value self) static mrb_value mrb_basicsocket_shutdown(mrb_state *mrb, mrb_value self) -{ +{ mrb_int how = SHUT_RDWR; mrb_get_args(mrb, "|i", &how); @@ -472,7 +472,7 @@ mrb_basicsocket_shutdown(mrb_state *mrb, mrb_value self) static mrb_value mrb_ipsocket_ntop(mrb_state *mrb, mrb_value klass) -{ +{ mrb_int af, n; char *addr, buf[50]; @@ -486,7 +486,7 @@ mrb_ipsocket_ntop(mrb_state *mrb, mrb_value klass) static mrb_value mrb_ipsocket_pton(mrb_state *mrb, mrb_value klass) -{ +{ mrb_int af, n; char *bp, buf[50]; @@ -516,7 +516,7 @@ invalid: static mrb_value mrb_ipsocket_recvfrom(mrb_state *mrb, mrb_value self) -{ +{ struct sockaddr_storage ss; socklen_t socklen; mrb_value a, buf, pair; @@ -546,7 +546,7 @@ mrb_socket_gethostname(mrb_state *mrb, mrb_value cls) { mrb_value buf; size_t bufsize; - + #ifdef HOST_NAME_MAX bufsize = HOST_NAME_MAX + 1; #else @@ -647,7 +647,7 @@ mrb_socket_sockaddr_un(mrb_state *mrb, mrb_value klass) #else struct sockaddr_un *sunp; mrb_value path, s; - + mrb_get_args(mrb, "S", &path); if (RSTRING_LEN(path) > sizeof(sunp->sun_path) - 1) { mrb_raisef(mrb, E_ARGUMENT_ERROR, "too long unix socket path (max: %ubytes)", (unsigned int)sizeof(sunp->sun_path) - 1); |
