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
6bf37456
Commit
6bf37456
authored
Feb 07, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net_Printf: automagic cast to VLC object
parent
9242bbe1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
28 deletions
+29
-28
include/vlc_network.h
include/vlc_network.h
+1
-0
modules/access/ftp.c
modules/access/ftp.c
+1
-2
modules/access/http.c
modules/access/http.c
+11
-11
modules/access/mms/mmsh.c
modules/access/mms/mmsh.c
+13
-13
modules/access/rtsp/access.c
modules/access/rtsp/access.c
+1
-1
modules/misc/audioscrobbler.c
modules/misc/audioscrobbler.c
+1
-1
src/network/io.c
src/network/io.c
+1
-0
No files found.
include/vlc_network.h
View file @
6bf37456
...
...
@@ -146,6 +146,7 @@ VLC_EXPORT( char *, net_Gets, ( vlc_object_t *p_this, int fd, const v_socket_t *
VLC_EXPORT
(
ssize_t
,
net_Printf
,
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
,
const
char
*
psz_fmt
,
...
)
LIBVLC_FORMAT
(
4
,
5
)
);
#define net_Printf(o,fd,vs,...) net_Printf(VLC_OBJECT(o),fd,vs, __VA_ARGS__)
VLC_EXPORT
(
ssize_t
,
net_vaPrintf
,
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
,
const
char
*
psz_fmt
,
va_list
args
)
);
#define net_vaPrintf(a,b,c,d,e) net_vaPrintf(VLC_OBJECT(a),b,c,d,e)
...
...
modules/access/ftp.c
View file @
6bf37456
...
...
@@ -629,8 +629,7 @@ static int ftp_SendCommand( vlc_object_t *p_access, access_sys_t *p_sys,
msg_Dbg
(
p_access
,
"ftp_SendCommand:
\"
%s
\"
"
,
psz_cmd
);
if
(
net_Printf
(
VLC_OBJECT
(
p_access
),
p_sys
->
fd_cmd
,
NULL
,
"%s
\r\n
"
,
psz_cmd
)
<
0
)
if
(
net_Printf
(
p_access
,
p_sys
->
fd_cmd
,
NULL
,
"%s
\r\n
"
,
psz_cmd
)
<
0
)
{
msg_Err
(
p_access
,
"failed to send command"
);
return
VLC_EGENERIC
;
...
...
modules/access/http.c
View file @
6bf37456
...
...
@@ -1164,7 +1164,7 @@ static int Connect( access_t *p_access, uint64_t i_tell )
return
-
1
;
}
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"CONNECT %s:%d HTTP/1.%d
\r\n
Host: %s:%d
\r\n\r\n
"
,
p_sys
->
url
.
psz_host
,
p_sys
->
url
.
i_port
,
p_sys
->
i_version
,
...
...
@@ -1240,14 +1240,14 @@ static int Request( access_t *p_access, uint64_t i_tell )
{
if
(
p_sys
->
url
.
psz_path
)
{
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"GET http://%s:%d%s HTTP/1.%d
\r\n
"
,
p_sys
->
url
.
psz_host
,
p_sys
->
url
.
i_port
,
p_sys
->
url
.
psz_path
,
p_sys
->
i_version
);
}
else
{
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"GET http://%s:%d/ HTTP/1.%d
\r\n
"
,
p_sys
->
url
.
psz_host
,
p_sys
->
url
.
i_port
,
p_sys
->
i_version
);
...
...
@@ -1262,26 +1262,26 @@ static int Request( access_t *p_access, uint64_t i_tell )
}
if
(
p_sys
->
url
.
i_port
!=
(
pvs
?
443
:
80
)
)
{
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
pvs
,
net_Printf
(
p_access
,
p_sys
->
fd
,
pvs
,
"GET %s HTTP/1.%d
\r\n
Host: %s:%d
\r\n
"
,
psz_path
,
p_sys
->
i_version
,
p_sys
->
url
.
psz_host
,
p_sys
->
url
.
i_port
);
}
else
{
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
pvs
,
net_Printf
(
p_access
,
p_sys
->
fd
,
pvs
,
"GET %s HTTP/1.%d
\r\n
Host: %s
\r\n
"
,
psz_path
,
p_sys
->
i_version
,
p_sys
->
url
.
psz_host
);
}
}
/* User Agent */
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
pvs
,
"User-Agent: %s
\r\n
"
,
net_Printf
(
p_access
,
p_sys
->
fd
,
pvs
,
"User-Agent: %s
\r\n
"
,
p_sys
->
psz_user_agent
);
/* Offset */
if
(
p_sys
->
i_version
==
1
&&
!
p_sys
->
b_continuous
)
{
p_sys
->
b_persist
=
true
;
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
pvs
,
net_Printf
(
p_access
,
p_sys
->
fd
,
pvs
,
"Range: bytes=%"
PRIu64
"-
\r\n
"
,
i_tell
);
}
...
...
@@ -1303,7 +1303,7 @@ static int Request( access_t *p_access, uint64_t i_tell )
if
(
is_in_right_domain
)
{
msg_Dbg
(
p_access
,
"Sending Cookie %s"
,
psz_cookie_content
);
if
(
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
pvs
,
"Cookie: %s
\r\n
"
,
psz_cookie_content
)
<
0
)
if
(
net_Printf
(
p_access
,
p_sys
->
fd
,
pvs
,
"Cookie: %s
\r\n
"
,
psz_cookie_content
)
<
0
)
msg_Err
(
p_access
,
"failed to send Cookie"
);
}
free
(
psz_cookie_content
);
...
...
@@ -1320,10 +1320,10 @@ static int Request( access_t *p_access, uint64_t i_tell )
AuthReply
(
p_access
,
"Proxy-"
,
&
p_sys
->
proxy
,
&
p_sys
->
proxy_auth
);
/* ICY meta data request */
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
pvs
,
"Icy-MetaData: 1
\r\n
"
);
net_Printf
(
p_access
,
p_sys
->
fd
,
pvs
,
"Icy-MetaData: 1
\r\n
"
);
if
(
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
pvs
,
"
\r\n
"
)
<
0
)
if
(
net_Printf
(
p_access
,
p_sys
->
fd
,
pvs
,
"
\r\n
"
)
<
0
)
{
msg_Err
(
p_access
,
"failed to send request"
);
Disconnect
(
p_access
);
...
...
@@ -1764,7 +1764,7 @@ static void AuthReply( access_t *p_access, const char *psz_prefix,
if
(
psz_value
==
NULL
)
return
;
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
p_sys
->
p_vs
,
net_Printf
(
p_access
,
p_sys
->
fd
,
p_sys
->
p_vs
,
"%sAuthorization: %s
\r\n
"
,
psz_prefix
,
psz_value
);
free
(
psz_value
);
}
...
...
modules/access/mms/mmsh.c
View file @
6bf37456
...
...
@@ -503,7 +503,7 @@ static int OpenConnection( access_t *p_access )
if
(
p_sys
->
b_proxy
)
{
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"GET http://%s:%d%s HTTP/1.0
\r\n
"
,
p_sys
->
url
.
psz_host
,
p_sys
->
url
.
i_port
,
(
(
p_sys
->
url
.
psz_path
==
NULL
)
||
...
...
@@ -523,14 +523,14 @@ static int OpenConnection( access_t *p_access )
b64
=
vlc_b64_encode
(
buf
);
free
(
buf
);
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"Proxy-Authorization: Basic %s
\r\n
"
,
b64
);
free
(
b64
);
}
}
else
{
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"GET %s HTTP/1.0
\r\n
"
"Host: %s:%d
\r\n
"
,
(
(
p_sys
->
url
.
psz_path
==
NULL
)
||
...
...
@@ -564,7 +564,7 @@ static int Describe( access_t *p_access, char **ppsz_location )
if
(
OpenConnection
(
p_access
)
)
return
VLC_EGENERIC
;
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"Accept: */*
\r\n
"
"User-Agent: "
MMSH_USER_AGENT
"
\r\n
"
"Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=0:0,request-context=%d,max-duration=0
\r\n
"
...
...
@@ -573,7 +573,7 @@ static int Describe( access_t *p_access, char **ppsz_location )
p_sys
->
i_request_context
++
,
GUID_PRINT
(
p_sys
->
guid
)
);
if
(
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
"
\r\n
"
)
<
0
)
if
(
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"
\r\n
"
)
<
0
)
{
msg_Err
(
p_access
,
"failed to send request"
);
goto
error
;
...
...
@@ -770,24 +770,24 @@ static int Start( access_t *p_access, uint64_t i_pos )
if
(
OpenConnection
(
p_access
)
)
return
VLC_EGENERIC
;
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"Accept: */*
\r\n
"
"User-Agent: "
MMSH_USER_AGENT
"
\r\n
"
);
if
(
p_sys
->
b_broadcast
)
{
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"Pragma: no-cache,rate=1.000000,request-context=%d
\r\n
"
,
p_sys
->
i_request_context
++
);
}
else
{
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=%u:%u,request-context=%d,max-duration=0
\r\n
"
,
(
uint32_t
)((
i_pos
>>
32
)
&
0xffffffff
),
(
uint32_t
)(
i_pos
&
0xffffffff
),
p_sys
->
i_request_context
++
);
}
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"Pragma: xPlayStrm=1
\r\n
"
"Pragma: xClientGUID={"
GUID_FMT
"}
\r\n
"
"Pragma: stream-switch-count=%d
\r\n
"
...
...
@@ -804,15 +804,15 @@ static int Start( access_t *p_access, uint64_t i_pos )
{
i_select
=
0
;
}
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"ffff:%d:%d "
,
i
,
i_select
);
}
}
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
"
\r\n
"
);
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"
\r\n
"
);
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"Connection: Close
\r\n
"
);
if
(
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
NULL
,
"
\r\n
"
)
<
0
)
if
(
net_Printf
(
p_access
,
p_sys
->
fd
,
NULL
,
"
\r\n
"
)
<
0
)
{
msg_Err
(
p_access
,
"failed to send request"
);
return
VLC_EGENERIC
;
...
...
modules/access/rtsp/access.c
View file @
6bf37456
...
...
@@ -142,7 +142,7 @@ static int RtspWrite( void *p_userdata, uint8_t *p_buffer, int i_buffer )
//fprintf(stderr, "Write: %s", p_buffer);
net_Printf
(
VLC_OBJECT
(
p_access
)
,
p_sys
->
fd
,
0
,
"%s"
,
p_buffer
);
net_Printf
(
p_access
,
p_sys
->
fd
,
0
,
"%s"
,
p_buffer
);
return
0
;
}
...
...
modules/misc/audioscrobbler.c
View file @
6bf37456
...
...
@@ -394,7 +394,7 @@ static void Run( intf_thread_t *p_intf )
/* we transmit the data */
i_net_ret
=
net_Printf
(
VLC_OBJECT
(
p_intf
)
,
i_post_socket
,
NULL
,
p_intf
,
i_post_socket
,
NULL
,
POST_REQUEST
,
p_sys
->
psz_submit_file
,
(
unsigned
)
strlen
(
psz_submit
),
p_sys
->
psz_submit_host
,
VERSION
,
psz_submit
...
...
src/network/io.c
View file @
6bf37456
...
...
@@ -532,6 +532,7 @@ char *net_Gets( vlc_object_t *p_this, int fd, const v_socket_t *p_vs )
return
psz_line
;
}
#undef net_Printf
ssize_t
net_Printf
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
p_vs
,
const
char
*
psz_fmt
,
...
)
{
...
...
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