Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc-gpu
Commits
8c1e99ea
Commit
8c1e99ea
authored
Oct 19, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dirty up. Ahaha.
parent
c55bcff9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
40 deletions
+30
-40
src/network/io.c
src/network/io.c
+30
-40
No files found.
src/network/io.c
View file @
8c1e99ea
...
@@ -57,39 +57,31 @@
...
@@ -57,39 +57,31 @@
# define INADDR_NONE 0xFFFFFFFF
# define INADDR_NONE 0xFFFFFFFF
#endif
#endif
int
net_Socket
(
vlc_object_t
*
p_this
,
int
i_family
,
int
i_socktype
,
int
i_protocol
)
{
int
fd
,
i_val
;
fd
=
socket
(
i_family
,
i_socktype
,
i_protocol
);
if
(
fd
==
-
1
)
{
#if defined(WIN32) || defined(UNDER_CE)
#if defined(WIN32) || defined(UNDER_CE)
if
(
WSAGetLastError
(
)
!=
WSAEAFNOSUPPORT
)
# undef EAFNOSUPPORT
#else
# define EAFNOSUPPORT WSAEAFNOSUPPORT
if
(
errno
!=
EAFNOSUPPORT
)
#endif
#endif
msg_Warn
(
p_this
,
"cannot create socket: %s"
,
net_strerror
(
net_errno
)
);
return
-
1
;
}
#if defined( WIN32 ) || defined( UNDER_CE )
int
net_Socket
(
vlc_object_t
*
p_this
,
int
family
,
int
socktype
,
int
protocol
)
{
int
fd
=
socket
(
family
,
socktype
,
protocol
);
if
(
fd
==
-
1
)
{
{
unsigned
long
i_dummy
=
1
;
if
(
net_errno
!=
EAFNOSUPPORT
)
if
(
ioctlsocket
(
fd
,
FIONBIO
,
&
i_dummy
)
!=
0
)
msg_Err
(
p_this
,
"cannot create socket: %s"
,
msg_Err
(
p_this
,
"cannot set socket to non-blocking mode"
);
net_strerror
(
net_errno
));
return
-
1
;
}
}
#if defined (WIN32) || defined (UNDER_CE)
ioctlsocket
(
fd
,
FIONBIO
,
&
(
unsigned
long
){
1
});
#else
#else
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
i_val
=
fcntl
(
fd
,
F_GETFL
,
0
);
fcntl
(
fd
,
F_SETFL
,
fcntl
(
fd
,
F_GETFL
,
0
)
|
O_NONBLOCK
);
fcntl
(
fd
,
F_SETFL
,
((
i_val
!=
-
1
)
?
i_val
:
0
)
|
O_NONBLOCK
);
#endif
#endif
i_val
=
1
;
setsockopt
(
fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
(
int
){
1
},
sizeof
(
int
));
setsockopt
(
fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
void
*
)
&
i_val
,
sizeof
(
i_val
)
);
#ifdef IPV6_V6ONLY
#ifdef IPV6_V6ONLY
/*
/*
...
@@ -100,22 +92,20 @@ int net_Socket( vlc_object_t *p_this, int i_family, int i_socktype,
...
@@ -100,22 +92,20 @@ int net_Socket( vlc_object_t *p_this, int i_family, int i_socktype,
* it makes sure that IPv4 addresses will be printed as w.x.y.z rather
* it makes sure that IPv4 addresses will be printed as w.x.y.z rather
* than ::ffff:w.x.y.z
* than ::ffff:w.x.y.z
*/
*/
if
(
i_family
==
AF_INET6
)
if
(
family
==
AF_INET6
)
setsockopt
(
fd
,
IPPROTO_IPV6
,
IPV6_V6ONLY
,
(
void
*
)
&
i_val
,
setsockopt
(
fd
,
IPPROTO_IPV6
,
IPV6_V6ONLY
,
&
(
int
){
1
},
sizeof
(
int
));
sizeof
(
i_val
)
);
#endif
#endif
#if defined
( WIN32 ) || defined( UNDER_CE
)
#if defined
(WIN32) || defined (UNDER_CE
)
# ifndef IPV6_PROTECTION_LEVEL
# ifndef IPV6_PROTECTION_LEVEL
# define IPV6_PROTECTION_LEVEL 23
# define IPV6_PROTECTION_LEVEL 23
# define PROTECTION_LEVEL_UNRESTRICTED 30
# endif
# endif
if
(
i_family
==
AF_INET6
)
if
(
family
==
AF_INET6
)
{
setsockopt
(
fd
,
IPPROTO_IPV6
,
IPV6_PROTECTION_LEVEL
,
i_val
=
30
/*PROTECTION_LEVEL_UNRESTRICTED*/
;
&
(
int
){
PROTECTION_LEVEL_UNRESTRICTED
},
sizeof
(
int
));
setsockopt
(
fd
,
IPPROTO_IPV6
,
IPV6_PROTECTION_LEVEL
,
(
const
char
*
)
&
i_val
,
sizeof
(
i_val
)
);
}
#endif
#endif
return
fd
;
return
fd
;
}
}
...
@@ -125,14 +115,14 @@ int net_Socket( vlc_object_t *p_this, int i_family, int i_socktype,
...
@@ -125,14 +115,14 @@ int net_Socket( vlc_object_t *p_this, int i_family, int i_socktype,
*****************************************************************************
*****************************************************************************
* Close a network handle
* Close a network handle
*****************************************************************************/
*****************************************************************************/
void
net_Close
(
int
fd
)
void
net_Close
(
int
fd
)
{
{
#ifdef UNDER_CE
#ifdef UNDER_CE
CloseHandle
(
(
HANDLE
)
fd
);
CloseHandle
((
HANDLE
)
fd
);
#elif defined
( WIN32
)
#elif defined
(WIN32
)
closesocket
(
fd
);
closesocket
(
fd
);
#else
#else
close
(
fd
);
(
void
)
close
(
fd
);
#endif
#endif
}
}
...
...
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