Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
90ff5f51
Commit
90ff5f51
authored
Jan 21, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* net: added net_OpenUDP
* udp: cleaned to use net_*
parent
2900cf80
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
153 additions
and
195 deletions
+153
-195
include/network.h
include/network.h
+4
-1
modules/access/udp.c
modules/access/udp.c
+79
-193
src/misc/net.c
src/misc/net.c
+70
-1
No files found.
include/network.h
View file @
90ff5f51
...
...
@@ -2,7 +2,7 @@
* network.h: interface to communicate with network plug-ins
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: network.h,v 1.
9 2004/01/15 22:39:50
fenrir Exp $
* $Id: network.h,v 1.
10 2004/01/21 10:22:31
fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>
...
...
@@ -165,6 +165,9 @@ static inline void vlc_UrlClean( vlc_url_t *url )
#define net_OpenTCP(a, b, c) __net_OpenTCP(VLC_OBJECT(a), b, c)
VLC_EXPORT
(
int
,
__net_OpenTCP
,
(
vlc_object_t
*
p_this
,
char
*
psz_host
,
int
i_port
)
);
#define net_OpenUDP(a, b, c, d, e ) __net_OpenUDP(VLC_OBJECT(a), b, c, d, e)
VLC_EXPORT
(
int
,
__net_OpenUDP
,
(
vlc_object_t
*
p_this
,
char
*
psz_bind
,
int
i_bind
,
char
*
psz_server
,
int
i_server
)
);
VLC_EXPORT
(
void
,
net_Close
,
(
int
fd
)
);
#define net_Read(a,b,c,d,e) __net_Read(VLC_OBJECT(a),b,c,d,e)
...
...
modules/access/udp.c
View file @
90ff5f51
This diff is collapsed.
Click to expand it.
src/misc/net.c
View file @
90ff5f51
...
...
@@ -2,7 +2,7 @@
* net.c:
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: net.c,v 1.
5 2004/01/09 12:23:46 gbazin
Exp $
* $Id: net.c,v 1.
6 2004/01/21 10:22:31 fenrir
Exp $
*
* Authors: Laurent Aimar <fenrir@videolan.org>
*
...
...
@@ -110,6 +110,62 @@ int __net_OpenTCP( vlc_object_t *p_this, char *psz_host, int i_port )
return
sock
.
i_handle
;
}
/*****************************************************************************
* __net_OpenUDP:
*****************************************************************************
* Open a UDP connection and return a handle
*****************************************************************************/
int
__net_OpenUDP
(
vlc_object_t
*
p_this
,
char
*
psz_bind
,
int
i_bind
,
char
*
psz_server
,
int
i_server
)
{
vlc_value_t
val
;
void
*
private
;
char
*
psz_network
=
""
;
network_socket_t
sock
;
module_t
*
p_network
;
/* Check if we have force ipv4 or ipv6 */
var_Create
(
p_this
,
"ipv4"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_this
,
"ipv4"
,
&
val
);
if
(
val
.
b_bool
)
{
psz_network
=
"ipv4"
;
}
var_Create
(
p_this
,
"ipv6"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_this
,
"ipv6"
,
&
val
);
if
(
val
.
b_bool
)
{
psz_network
=
"ipv6"
;
}
if
(
psz_server
==
NULL
)
psz_server
=
""
;
if
(
psz_bind
==
NULL
)
psz_bind
=
""
;
/* Prepare the network_socket_t structure */
sock
.
i_type
=
NETWORK_UDP
;
sock
.
psz_bind_addr
=
psz_bind
;
sock
.
i_bind_port
=
i_bind
;
sock
.
psz_server_addr
=
psz_server
;
sock
.
i_server_port
=
i_server
;
sock
.
i_ttl
=
0
;
msg_Dbg
(
p_this
,
"net: connecting to '%s:%d@%s:%d'"
,
psz_server
,
i_server
,
psz_bind
,
i_bind
);
private
=
p_this
->
p_private
;
p_this
->
p_private
=
(
void
*
)
&
sock
;
if
(
(
p_network
=
module_Need
(
p_this
,
"network"
,
psz_network
)
)
==
NULL
)
{
msg_Dbg
(
p_this
,
"net: connection to '%s:%d@%s:%d' failed"
,
psz_server
,
i_server
,
psz_bind
,
i_bind
);
return
-
1
;
}
module_Unneed
(
p_this
,
p_network
);
p_this
->
p_private
=
private
;
return
sock
.
i_handle
;
}
/*****************************************************************************
* __net_Close:
*****************************************************************************
...
...
@@ -169,6 +225,19 @@ int __net_Read( vlc_object_t *p_this, int fd, uint8_t *p_data, int i_data, vlc_b
if
(
(
i_recv
=
recv
(
fd
,
p_data
,
i_data
,
0
)
)
<
0
)
{
#ifdef WIN32
/* For udp only */
/* On win32 recv() will fail if the datagram doesn't fit inside
* the passed buffer, even though the buffer will be filled with
* the first part of the datagram. */
if
(
WSAGetLastError
()
==
WSAEMSGSIZE
)
{
msg_Err
(
p_input
,
"recv() failed. "
"Increase the mtu size (--mtu option)"
);
i_recv
=
i_len
;
}
else
#endif
msg_Err
(
p_this
,
"recv failed (%s)"
,
strerror
(
errno
)
);
return
i_total
>
0
?
i_total
:
-
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