Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
a809d42f
Commit
a809d42f
authored
Sep 12, 2017
by
Tomoyuki Sahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove whitespaces at the end of line.
parent
15f4bdb5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
33 deletions
+33
-33
README.md
README.md
+12
-12
mrbgem.rake
mrbgem.rake
+1
-1
mrblib/socket.rb
mrblib/socket.rb
+1
-1
src/socket.c
src/socket.c
+19
-19
No files found.
README.md
View file @
a809d42f
...
@@ -36,20 +36,20 @@ Date: Tue, 21 May 2013 04:31:30 GMT
...
@@ -36,20 +36,20 @@ Date: Tue, 21 May 2013 04:31:30 GMT
Copyright (c) 2013 Internet Initiative Japan Inc.
Copyright (c) 2013 Internet Initiative Japan Inc.
Permission is hereby granted, free of charge, to any person obtaining a
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
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:
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.
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
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
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
DEALINGS IN THE SOFTWARE.
mrbgem.rake
View file @
a809d42f
...
@@ -3,7 +3,7 @@ MRuby::Gem::Specification.new('mruby-socket') do |spec|
...
@@ -3,7 +3,7 @@ MRuby::Gem::Specification.new('mruby-socket') do |spec|
spec
.
authors
=
'Internet Initiative Japan'
spec
.
authors
=
'Internet Initiative Japan'
spec
.
cc
.
include_paths
<<
"
#{
build
.
root
}
/src"
spec
.
cc
.
include_paths
<<
"
#{
build
.
root
}
/src"
# If Windows, use winsock
# If Windows, use winsock
if
(
/mswin|mingw|win32/
=~
RUBY_PLATFORM
)
then
if
(
/mswin|mingw|win32/
=~
RUBY_PLATFORM
)
then
spec
.
linker
.
libraries
<<
"wsock32"
spec
.
linker
.
libraries
<<
"wsock32"
...
...
mrblib/socket.rb
View file @
a809d42f
...
@@ -154,7 +154,7 @@ class Addrinfo
...
@@ -154,7 +154,7 @@ class Addrinfo
[
s
,
port
.
to_i
,
addr
,
addr
]
[
s
,
port
.
to_i
,
addr
,
addr
]
end
end
def
to_sockaddr
def
to_sockaddr
@sockaddr
@sockaddr
end
end
...
...
src/socket.c
View file @
a809d42f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#ifdef _WIN32
#ifdef _WIN32
#define _WIN32_WINNT 0x0501
#define _WIN32_WINNT 0x0501
#include <winsock2.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <windows.h>
...
@@ -260,13 +260,13 @@ socket_family(int s)
...
@@ -260,13 +260,13 @@ socket_family(int s)
static
mrb_value
static
mrb_value
mrb_basicsocket_getpeereid
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_getpeereid
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
#ifdef HAVE_GETPEEREID
#ifdef HAVE_GETPEEREID
mrb_value
ary
;
mrb_value
ary
;
gid_t
egid
;
gid_t
egid
;
uid_t
euid
;
uid_t
euid
;
int
s
;
int
s
;
s
=
socket_fd
(
mrb
,
self
);
s
=
socket_fd
(
mrb
,
self
);
if
(
getpeereid
(
s
,
&
euid
,
&
egid
)
!=
0
)
if
(
getpeereid
(
s
,
&
euid
,
&
egid
)
!=
0
)
mrb_sys_fail
(
mrb
,
"getpeereid"
);
mrb_sys_fail
(
mrb
,
"getpeereid"
);
...
@@ -283,10 +283,10 @@ mrb_basicsocket_getpeereid(mrb_state *mrb, mrb_value self)
...
@@ -283,10 +283,10 @@ mrb_basicsocket_getpeereid(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_basicsocket_getpeername
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_getpeername
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
struct
sockaddr_storage
ss
;
struct
sockaddr_storage
ss
;
socklen_t
salen
;
socklen_t
salen
;
salen
=
sizeof
(
ss
);
salen
=
sizeof
(
ss
);
if
(
getpeername
(
socket_fd
(
mrb
,
self
),
(
struct
sockaddr
*
)
&
ss
,
&
salen
)
!=
0
)
if
(
getpeername
(
socket_fd
(
mrb
,
self
),
(
struct
sockaddr
*
)
&
ss
,
&
salen
)
!=
0
)
mrb_sys_fail
(
mrb
,
"getpeername"
);
mrb_sys_fail
(
mrb
,
"getpeername"
);
...
@@ -296,10 +296,10 @@ mrb_basicsocket_getpeername(mrb_state *mrb, mrb_value self)
...
@@ -296,10 +296,10 @@ mrb_basicsocket_getpeername(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_basicsocket_getsockname
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_getsockname
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
struct
sockaddr_storage
ss
;
struct
sockaddr_storage
ss
;
socklen_t
salen
;
socklen_t
salen
;
salen
=
sizeof
(
ss
);
salen
=
sizeof
(
ss
);
if
(
getsockname
(
socket_fd
(
mrb
,
self
),
(
struct
sockaddr
*
)
&
ss
,
&
salen
)
!=
0
)
if
(
getsockname
(
socket_fd
(
mrb
,
self
),
(
struct
sockaddr
*
)
&
ss
,
&
salen
)
!=
0
)
mrb_sys_fail
(
mrb
,
"getsockname"
);
mrb_sys_fail
(
mrb
,
"getsockname"
);
...
@@ -309,7 +309,7 @@ mrb_basicsocket_getsockname(mrb_state *mrb, mrb_value self)
...
@@ -309,7 +309,7 @@ mrb_basicsocket_getsockname(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_basicsocket_getsockopt
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_getsockopt
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
char
opt
[
8
];
char
opt
[
8
];
int
s
;
int
s
;
mrb_int
family
,
level
,
optname
;
mrb_int
family
,
level
,
optname
;
...
@@ -329,7 +329,7 @@ mrb_basicsocket_getsockopt(mrb_state *mrb, mrb_value self)
...
@@ -329,7 +329,7 @@ mrb_basicsocket_getsockopt(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_basicsocket_recv
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_recv
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
int
n
;
int
n
;
mrb_int
maxlen
,
flags
=
0
;
mrb_int
maxlen
,
flags
=
0
;
mrb_value
buf
;
mrb_value
buf
;
...
@@ -345,7 +345,7 @@ mrb_basicsocket_recv(mrb_state *mrb, mrb_value self)
...
@@ -345,7 +345,7 @@ mrb_basicsocket_recv(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_basicsocket_recvfrom
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_recvfrom
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
int
n
;
int
n
;
mrb_int
maxlen
,
flags
=
0
;
mrb_int
maxlen
,
flags
=
0
;
mrb_value
ary
,
buf
,
sa
;
mrb_value
ary
,
buf
,
sa
;
...
@@ -368,7 +368,7 @@ mrb_basicsocket_recvfrom(mrb_state *mrb, mrb_value self)
...
@@ -368,7 +368,7 @@ mrb_basicsocket_recvfrom(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_basicsocket_send
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_send
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
int
n
;
int
n
;
mrb_int
flags
;
mrb_int
flags
;
mrb_value
dest
,
mesg
;
mrb_value
dest
,
mesg
;
...
@@ -387,7 +387,7 @@ mrb_basicsocket_send(mrb_state *mrb, mrb_value self)
...
@@ -387,7 +387,7 @@ mrb_basicsocket_send(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_basicsocket_setnonblock
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_setnonblock
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
int
fd
,
flags
;
int
fd
,
flags
;
mrb_value
bool
;
mrb_value
bool
;
#ifdef _WIN32
#ifdef _WIN32
...
@@ -416,7 +416,7 @@ mrb_basicsocket_setnonblock(mrb_state *mrb, mrb_value self)
...
@@ -416,7 +416,7 @@ mrb_basicsocket_setnonblock(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_basicsocket_setsockopt
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_setsockopt
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
int
argc
,
s
;
int
argc
,
s
;
mrb_int
level
=
0
,
optname
;
mrb_int
level
=
0
,
optname
;
mrb_value
optval
,
so
;
mrb_value
optval
,
so
;
...
@@ -461,7 +461,7 @@ mrb_basicsocket_setsockopt(mrb_state *mrb, mrb_value self)
...
@@ -461,7 +461,7 @@ mrb_basicsocket_setsockopt(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_basicsocket_shutdown
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_basicsocket_shutdown
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
mrb_int
how
=
SHUT_RDWR
;
mrb_int
how
=
SHUT_RDWR
;
mrb_get_args
(
mrb
,
"|i"
,
&
how
);
mrb_get_args
(
mrb
,
"|i"
,
&
how
);
...
@@ -472,7 +472,7 @@ mrb_basicsocket_shutdown(mrb_state *mrb, mrb_value self)
...
@@ -472,7 +472,7 @@ mrb_basicsocket_shutdown(mrb_state *mrb, mrb_value self)
static
mrb_value
static
mrb_value
mrb_ipsocket_ntop
(
mrb_state
*
mrb
,
mrb_value
klass
)
mrb_ipsocket_ntop
(
mrb_state
*
mrb
,
mrb_value
klass
)
{
{
mrb_int
af
,
n
;
mrb_int
af
,
n
;
char
*
addr
,
buf
[
50
];
char
*
addr
,
buf
[
50
];
...
@@ -486,7 +486,7 @@ mrb_ipsocket_ntop(mrb_state *mrb, mrb_value klass)
...
@@ -486,7 +486,7 @@ mrb_ipsocket_ntop(mrb_state *mrb, mrb_value klass)
static
mrb_value
static
mrb_value
mrb_ipsocket_pton
(
mrb_state
*
mrb
,
mrb_value
klass
)
mrb_ipsocket_pton
(
mrb_state
*
mrb
,
mrb_value
klass
)
{
{
mrb_int
af
,
n
;
mrb_int
af
,
n
;
char
*
bp
,
buf
[
50
];
char
*
bp
,
buf
[
50
];
...
@@ -516,7 +516,7 @@ invalid:
...
@@ -516,7 +516,7 @@ invalid:
static
mrb_value
static
mrb_value
mrb_ipsocket_recvfrom
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_ipsocket_recvfrom
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
struct
sockaddr_storage
ss
;
struct
sockaddr_storage
ss
;
socklen_t
socklen
;
socklen_t
socklen
;
mrb_value
a
,
buf
,
pair
;
mrb_value
a
,
buf
,
pair
;
...
@@ -546,7 +546,7 @@ mrb_socket_gethostname(mrb_state *mrb, mrb_value cls)
...
@@ -546,7 +546,7 @@ mrb_socket_gethostname(mrb_state *mrb, mrb_value cls)
{
{
mrb_value
buf
;
mrb_value
buf
;
size_t
bufsize
;
size_t
bufsize
;
#ifdef HOST_NAME_MAX
#ifdef HOST_NAME_MAX
bufsize
=
HOST_NAME_MAX
+
1
;
bufsize
=
HOST_NAME_MAX
+
1
;
#else
#else
...
@@ -647,7 +647,7 @@ mrb_socket_sockaddr_un(mrb_state *mrb, mrb_value klass)
...
@@ -647,7 +647,7 @@ mrb_socket_sockaddr_un(mrb_state *mrb, mrb_value klass)
#else
#else
struct
sockaddr_un
*
sunp
;
struct
sockaddr_un
*
sunp
;
mrb_value
path
,
s
;
mrb_value
path
,
s
;
mrb_get_args
(
mrb
,
"S"
,
&
path
);
mrb_get_args
(
mrb
,
"S"
,
&
path
);
if
(
RSTRING_LEN
(
path
)
>
sizeof
(
sunp
->
sun_path
)
-
1
)
{
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
);
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"too long unix socket path (max: %ubytes)"
,
(
unsigned
int
)
sizeof
(
sunp
->
sun_path
)
-
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment