Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
269d8af1
Commit
269d8af1
authored
Nov 23, 2002
by
Sam Hocevar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ./modules/access/http.c, ./modules/misc/network/ipv4.c: http and ipv4
plugins compile for WinCE. Couldn't test yet though.
parent
f6cf9ef8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
31 deletions
+126
-31
modules/access/http.c
modules/access/http.c
+29
-20
modules/misc/network/ipv4.c
modules/misc/network/ipv4.c
+97
-11
No files found.
modules/access/http.c
View file @
269d8af1
...
...
@@ -2,7 +2,7 @@
* http.c: HTTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: http.c,v 1.1
0 2002/11/15 14:41:49 gbazin
Exp $
* $Id: http.c,v 1.1
1 2002/11/23 04:40:53 sam
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -25,22 +25,26 @@
* Preamble
*****************************************************************************/
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( _MSC_VER ) && defined( _WIN32 )
&& !defined( UNDER_CE )
# include <io.h>
#endif
#ifdef WIN32
#if defined( UNDER_CE )
# include <winsock.h>
#elif defined( WIN32 )
# include <winsock2.h>
# include <ws2tcpip.h>
# ifndef IN_MULTICAST
...
...
@@ -142,7 +146,11 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
if
(
send
(
p_access_data
->
_socket
.
i_handle
,
psz_buffer
,
strlen
(
psz_buffer
),
0
)
==
(
-
1
)
)
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"cannot send request (%s)"
,
strerror
(
errno
)
);
#else
msg_Err
(
p_input
,
"cannot send request"
);
#endif
Close
(
VLC_OBJECT
(
p_input
)
);
return
VLC_EGENERIC
;
}
...
...
@@ -549,9 +557,7 @@ static void Close( vlc_object_t *p_this )
msg_Info
(
p_input
,
"closing HTTP target `%s'"
,
p_input
->
psz_source
);
#ifdef UNDER_CE
CloseHandle
(
(
HANDLE
)
i_handle
);
#elif defined( WIN32 )
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
i_handle
);
#else
close
(
i_handle
);
...
...
@@ -575,9 +581,7 @@ static int SetProgram( input_thread_t * p_input,
static
void
Seek
(
input_thread_t
*
p_input
,
off_t
i_pos
)
{
_input_socket_t
*
p_access_data
=
(
_input_socket_t
*
)
p_input
->
p_access_data
;
#ifdef UNDER_CE
CloseHandle
(
(
HANDLE
)
p_access_data
->
_socket
.
i_handle
);
#elif defined( WIN32 )
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
p_access_data
->
_socket
.
i_handle
);
#else
close
(
p_access_data
->
_socket
.
i_handle
);
...
...
@@ -591,10 +595,6 @@ static void Seek( input_thread_t * p_input, off_t i_pos )
*****************************************************************************/
static
ssize_t
Read
(
input_thread_t
*
p_input
,
byte_t
*
p_buffer
,
size_t
i_len
)
{
#ifdef UNDER_CE
return
-
1
;
#else
input_socket_t
*
p_access_data
=
(
input_socket_t
*
)
p_input
->
p_access_data
;
struct
timeval
timeout
;
fd_set
fds
;
...
...
@@ -612,10 +612,17 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, size_t i_len )
i_ret
=
select
(
p_access_data
->
i_handle
+
1
,
&
fds
,
NULL
,
NULL
,
&
timeout
);
#ifdef HAVE_ERRNO_H
if
(
i_ret
==
-
1
&&
errno
!=
EINTR
)
{
msg_Err
(
p_input
,
"network select error (%s)"
,
strerror
(
errno
)
);
}
#else
if
(
i_ret
==
-
1
)
{
msg_Err
(
p_input
,
"network select error"
);
}
#endif
else
if
(
i_ret
>
0
)
{
ssize_t
i_recv
=
recv
(
p_access_data
->
i_handle
,
p_buffer
,
i_len
,
0
);
...
...
@@ -629,13 +636,15 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, size_t i_len )
if
(
i_recv
<
0
)
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"recv failed (%s)"
,
strerror
(
errno
)
);
#else
msg_Err
(
p_input
,
"recv failed"
);
#endif
}
return
i_recv
;
}
return
0
;
#endif
}
modules/misc/network/ipv4.c
View file @
269d8af1
...
...
@@ -2,7 +2,7 @@
* ipv4.c: IPv4 network abstraction layer
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: ipv4.c,v 1.
5 2002/11/14 22:38:48 massiot
Exp $
* $Id: ipv4.c,v 1.
6 2002/11/23 04:40:53 sam
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Mathias Kretschmer <mathias@research.att.com>
...
...
@@ -26,21 +26,31 @@
* Preamble
*****************************************************************************/
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <vlc/vlc.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( _MSC_VER ) && defined( _WIN32 )
&& !defined( UNDER_CE )
# include <io.h>
#endif
#ifdef WIN32
#if defined( UNDER_CE )
# include <winsock.h>
#elif defined( WIN32 )
# include <winsock2.h>
# include <ws2tcpip.h>
# ifndef IN_MULTICAST
...
...
@@ -80,7 +90,7 @@ static int BuildAddr( struct sockaddr_in * p_socket,
/* Reset struct */
memset
(
p_socket
,
0
,
sizeof
(
struct
sockaddr_in
)
);
p_socket
->
sin_family
=
AF_INET
;
/* family */
p_socket
->
sin_port
=
htons
(
i_port
);
p_socket
->
sin_port
=
htons
(
(
uint16_t
)
i_port
);
if
(
!*
psz_address
)
{
p_socket
->
sin_addr
.
s_addr
=
INADDR_ANY
;
...
...
@@ -130,7 +140,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
int
i_bind_port
=
p_socket
->
i_bind_port
;
char
*
psz_server_addr
=
p_socket
->
psz_server_addr
;
int
i_server_port
=
p_socket
->
i_server_port
;
#if
def WIN32
#if
defined( WIN32 ) && !defined( UNDER_CE )
char
*
psz_bind_win32
;
/* WIN32 multicast kludge */
#endif
...
...
@@ -147,7 +157,11 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
* protocol */
if
(
(
i_handle
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
))
==
-
1
)
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_this
,
"cannot create socket (%s)"
,
strerror
(
errno
)
);
#else
msg_Err
(
p_this
,
"cannot create socket"
);
#endif
return
(
-
1
);
}
...
...
@@ -156,9 +170,17 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if
(
setsockopt
(
i_handle
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
void
*
)
&
i_opt
,
sizeof
(
i_opt
)
)
==
-
1
)
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_this
,
"cannot configure socket (SO_REUSEADDR: %s)"
,
strerror
(
errno
));
#else
msg_Err
(
p_this
,
"cannot configure socket (SO_REUSEADDR)"
);
#endif
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
i_handle
);
#else
close
(
i_handle
);
#endif
return
(
-
1
);
}
...
...
@@ -168,8 +190,12 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if
(
setsockopt
(
i_handle
,
SOL_SOCKET
,
SO_RCVBUF
,
(
void
*
)
&
i_opt
,
sizeof
(
i_opt
)
)
==
-
1
)
{
#ifdef HAVE_ERRNO_H
msg_Warn
(
p_this
,
"cannot configure socket (SO_RCVBUF: %s)"
,
strerror
(
errno
));
#else
msg_Warn
(
p_this
,
"cannot configure socket (SO_RCVBUF)"
);
#endif
}
/* Check if we really got what we have asked for, because Linux, etc.
...
...
@@ -180,8 +206,12 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if
(
getsockopt
(
i_handle
,
SOL_SOCKET
,
SO_RCVBUF
,
(
void
*
)
&
i_opt
,
&
i_opt_size
)
==
-
1
)
{
#ifdef HAVE_ERRNO_H
msg_Warn
(
p_this
,
"cannot query socket (SO_RCVBUF: %s)"
,
strerror
(
errno
)
);
#else
msg_Warn
(
p_this
,
"cannot query socket (SO_RCVBUF)"
);
#endif
}
else
if
(
i_opt
<
0x80000
)
{
...
...
@@ -192,7 +222,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
/* Build the local socket */
#if
def WIN32
#if
defined( WIN32 ) && !defined( UNDER_CE )
/* Under Win32 and for the multicast, we bind on INADDR_ANY,
* so let's call BuildAddr with "" instead of psz_bind_addr */
psz_bind_win32
=
psz_bind_addr
;
...
...
@@ -207,15 +237,28 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if
(
BuildAddr
(
&
sock
,
psz_bind_addr
,
i_bind_port
)
==
-
1
)
#endif
{
msg_Dbg
(
p_this
,
"could not build local address"
);
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
i_handle
);
#else
close
(
i_handle
);
#endif
return
(
-
1
);
}
/* Bind it */
if
(
bind
(
i_handle
,
(
struct
sockaddr
*
)
&
sock
,
sizeof
(
sock
)
)
<
0
)
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_this
,
"cannot bind socket (%s)"
,
strerror
(
errno
)
);
#else
msg_Err
(
p_this
,
"cannot bind socket"
);
#endif
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
i_handle
);
#else
close
(
i_handle
);
#endif
return
(
-
1
);
}
...
...
@@ -226,11 +269,16 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if
(
setsockopt
(
i_handle
,
SOL_SOCKET
,
SO_BROADCAST
,
(
void
*
)
&
i_opt
,
sizeof
(
i_opt
)
)
==
-
1
)
{
#ifdef HAVE_ERRNO_H
msg_Warn
(
p_this
,
"cannot configure socket (SO_BROADCAST: %s)"
,
strerror
(
errno
)
);
#else
msg_Warn
(
p_this
,
"cannot configure socket (SO_BROADCAST)"
);
#endif
}
}
#ifndef UNDER_CE
/* Join the multicast group if the socket is a multicast address */
#ifndef IN_MULTICAST
# define IN_MULTICAST(a) IN_CLASSD(a)
...
...
@@ -263,12 +311,21 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if
(
setsockopt
(
i_handle
,
IPPROTO_IP
,
IP_ADD_MEMBERSHIP
,
(
char
*
)
&
imr
,
sizeof
(
struct
ip_mreq
)
)
==
-
1
)
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_this
,
"failed to join IP multicast group (%s)"
,
strerror
(
errno
)
);
#else
msg_Err
(
p_this
,
"failed to join IP multicast group"
);
#endif
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
i_handle
);
#else
close
(
i_handle
);
#endif
return
(
-
1
);
}
}
#endif
/* UNDER_CE */
if
(
*
psz_server_addr
)
{
...
...
@@ -276,7 +333,11 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if
(
BuildAddr
(
&
sock
,
psz_server_addr
,
i_server_port
)
==
-
1
)
{
msg_Err
(
p_this
,
"cannot build remote address"
);
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
i_handle
);
#else
close
(
i_handle
);
#endif
return
(
-
1
);
}
...
...
@@ -284,8 +345,16 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
if
(
connect
(
i_handle
,
(
struct
sockaddr
*
)
&
sock
,
sizeof
(
sock
)
)
==
(
-
1
)
)
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_this
,
"cannot connect socket (%s)"
,
strerror
(
errno
)
);
#else
msg_Err
(
p_this
,
"cannot connect socket"
);
#endif
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
i_handle
);
#else
close
(
i_handle
);
#endif
return
(
-
1
);
}
}
...
...
@@ -320,14 +389,23 @@ static int OpenTCP( vlc_object_t * p_this, network_socket_t * p_socket )
* protocol */
if
(
(
i_handle
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
-
1
)
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_this
,
"cannot create socket (%s)"
,
strerror
(
errno
)
);
#else
msg_Err
(
p_this
,
"cannot create socket"
);
#endif
return
(
-
1
);
}
/* Build remote address */
if
(
BuildAddr
(
&
sock
,
psz_server_addr
,
i_server_port
)
==
-
1
)
{
msg_Dbg
(
p_this
,
"could not build local address"
);
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
i_handle
);
#else
close
(
i_handle
);
#endif
return
(
-
1
);
}
...
...
@@ -335,8 +413,16 @@ static int OpenTCP( vlc_object_t * p_this, network_socket_t * p_socket )
if
(
connect
(
i_handle
,
(
struct
sockaddr
*
)
&
sock
,
sizeof
(
sock
)
)
==
(
-
1
)
)
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_this
,
"cannot connect socket (%s)"
,
strerror
(
errno
)
);
#else
msg_Err
(
p_this
,
"cannot connect socket"
);
#endif
#if defined( WIN32 ) || defined( UNDER_CE )
closesocket
(
i_handle
);
#else
close
(
i_handle
);
#endif
return
(
-
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