Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
e70e3356
Commit
e70e3356
authored
Feb 25, 2017
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tls: introduce vlc_tls_SocketPair()
This creates a pair of mutually connected stream vlc_tls_t.
parent
72f0a2e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
include/vlc_tls.h
include/vlc_tls.h
+5
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/network/tls.c
src/network/tls.c
+26
-0
No files found.
include/vlc_tls.h
View file @
e70e3356
...
...
@@ -232,6 +232,11 @@ VLC_API void vlc_tls_Delete (vlc_tls_creds_t *);
*/
VLC_API
vlc_tls_t
*
vlc_tls_SocketOpen
(
int
fd
);
/**
* Creates a connected pair of transport-layer sockets.
*/
VLC_API
int
vlc_tls_SocketPair
(
int
family
,
int
protocol
,
vlc_tls_t
*
[
2
]);
struct
addrinfo
;
/**
...
...
src/libvlccore.sym
View file @
e70e3356
...
...
@@ -445,6 +445,7 @@ vlc_tls_GetLine
vlc_tls_SocketOpen
vlc_tls_SocketOpenTCP
vlc_tls_SocketOpenTLS
vlc_tls_SocketPair
ToCharset
update_Check
update_Delete
...
...
src/network/tls.c
View file @
e70e3356
...
...
@@ -404,6 +404,32 @@ vlc_tls_t *vlc_tls_SocketOpen(int fd)
return
vlc_tls_SocketAlloc
(
fd
,
NULL
,
0
);
}
int
vlc_tls_SocketPair
(
int
family
,
int
protocol
,
vlc_tls_t
*
pair
[
2
])
{
int
fds
[
2
];
if
(
vlc_socketpair
(
family
,
SOCK_STREAM
,
protocol
,
fds
,
true
))
return
-
1
;
for
(
size_t
i
=
0
;
i
<
2
;
i
++
)
{
setsockopt
(
fds
[
i
],
SOL_SOCKET
,
SO_REUSEADDR
,
&
(
int
){
1
},
sizeof
(
int
));
pair
[
i
]
=
vlc_tls_SocketAlloc
(
fds
[
i
],
NULL
,
0
);
if
(
unlikely
(
pair
[
i
]
==
NULL
))
{
net_Close
(
fds
[
i
]);
if
(
i
)
vlc_tls_SessionDelete
(
pair
[
0
]);
else
net_Close
(
fds
[
1
]);
return
-
1
;
}
}
return
0
;
}
/**
* Allocates an unconnected transport layer socket.
*/
...
...
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