Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
c6d7c7f5
Commit
c6d7c7f5
authored
Nov 07, 2004
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement net_* virtualization with TLS module
parent
5f2fabb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
include/vlc_tls.h
include/vlc_tls.h
+6
-4
modules/misc/gnutls.c
modules/misc/gnutls.c
+12
-10
No files found.
include/vlc_tls.h
View file @
c6d7c7f5
...
...
@@ -24,6 +24,8 @@
#ifndef _VLC_TLS_H
# define _VLC_TLS_H
# include "network.h"
struct
tls_t
{
VLC_COMMON_MEMBERS
...
...
@@ -56,10 +58,9 @@ struct tls_session_t
void
*
p_sys
;
struct
virtual_socket_t
sock
;
tls_session_t
*
(
*
pf_handshake
)
(
tls_session_t
*
,
int
);
void
(
*
pf_close
)
(
tls_session_t
*
);
int
(
*
pf_send
)
(
tls_session_t
*
,
const
char
*
,
int
);
int
(
*
pf_recv
)
(
tls_session_t
*
,
char
*
,
int
);
};
...
...
@@ -105,8 +106,9 @@ VLC_EXPORT( void, tls_ClientDelete, ( tls_session_t * ) );
# define tls_SessionClose( a ) (((tls_session_t *)a)->pf_close (a))
# define __tls_ClientDelete( a ) tls_SessionClose( a )
# define tls_Send( a, b, c ) (((tls_session_t *)a)->pf_send (a, b, c ))
/* NOTE: It is assumed that a->sock.p_sys = a */
# define tls_Send( a, b, c ) (((tls_session_t *)a)->sock.pf_send (a, b, c ))
# define tls_Recv( a, b, c ) (((tls_session_t *)a)->pf_recv (a, b, c ))
# define tls_Recv( a, b, c ) (((tls_session_t *)a)->
sock.
pf_recv (a, b, c ))
#endif
modules/misc/gnutls.c
View file @
c6d7c7f5
...
...
@@ -88,12 +88,12 @@ typedef struct tls_client_sys_t
* Sends data through a TLS session.
*****************************************************************************/
static
int
gnutls_Send
(
tls_session_t
*
p_session
,
const
char
*
buf
,
int
i_length
)
gnutls_Send
(
void
*
p_session
,
const
void
*
buf
,
int
i_length
)
{
int
val
;
val
=
gnutls_record_send
(
*
(
gnutls_session
*
)(
p_session
->
p_sys
),
buf
,
i_length
);
val
=
gnutls_record_send
(
*
(
gnutls_session
*
)(
((
tls_session_t
*
)
p_session
)
->
p_sys
),
buf
,
i_length
);
return
val
<
0
?
-
1
:
val
;
}
...
...
@@ -104,12 +104,12 @@ gnutls_Send( tls_session_t *p_session, const char *buf, int i_length )
* Receives data through a TLS session.
*****************************************************************************/
static
int
gnutls_Recv
(
tls_session_t
*
p_session
,
char
*
buf
,
int
i_length
)
gnutls_Recv
(
void
*
p_session
,
void
*
buf
,
int
i_length
)
{
int
val
;
val
=
gnutls_record_recv
(
*
(
gnutls_session
*
)(
p_session
->
p_sys
),
buf
,
i_length
);
val
=
gnutls_record_recv
(
*
(
gnutls_session
*
)(
((
tls_session_t
*
)
p_session
)
->
p_sys
),
buf
,
i_length
);
return
val
<
0
?
-
1
:
val
;
}
...
...
@@ -269,10 +269,11 @@ gnutls_ClientCreate( tls_t *p_tls, const char *psz_ca_path )
p_session
->
p_tls
=
p_tls
;
p_session
->
p_server
=
NULL
;
p_session
->
p_sys
=
p_sys
;
p_session
->
sock
.
p_sys
=
p_session
;
p_session
->
sock
.
pf_send
=
gnutls_Send
;
p_session
->
sock
.
pf_recv
=
gnutls_Recv
;
p_session
->
pf_handshake
=
gnutls_SessionHandshake
;
p_session
->
pf_close
=
gnutls_SessionClose
;
p_session
->
pf_send
=
gnutls_Send
;
p_session
->
pf_recv
=
gnutls_Recv
;
return
p_session
;
}
...
...
@@ -350,10 +351,11 @@ gnutls_ServerSessionPrepare( tls_server_t *p_server )
p_session
->
p_tls
=
p_server
->
p_tls
;
p_session
->
p_server
=
p_server
;
p_session
->
p_sys
=
p_sys
;
p_session
->
sock
.
p_sys
=
p_session
;
p_session
->
sock
.
pf_send
=
gnutls_Send
;
p_session
->
sock
.
pf_recv
=
gnutls_Recv
;
p_session
->
pf_handshake
=
gnutls_SessionHandshake
;
p_session
->
pf_close
=
gnutls_SessionClose
;
p_session
->
pf_send
=
gnutls_Send
;
p_session
->
pf_recv
=
gnutls_Recv
;
return
p_session
;
}
...
...
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