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
a2aa6d7b
Commit
a2aa6d7b
authored
Jul 13, 2005
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New useful API to combine get(sock|peer)name() and vlc_getnameinfo()
parent
c6a7622b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
0 deletions
+36
-0
include/network.h
include/network.h
+4
-0
include/vlc_symbols.h
include/vlc_symbols.h
+3
-0
src/misc/net.c
src/misc/net.c
+29
-0
No files found.
include/network.h
View file @
a2aa6d7b
...
...
@@ -352,6 +352,10 @@ VLC_EXPORT( int, net_Printf, ( vlc_object_t *p_this, int fd, v_socket_t *, const
#define net_vaPrintf(a,b,c,d,e) __net_vaPrintf(VLC_OBJECT(a),b,c,d,e)
VLC_EXPORT
(
int
,
__net_vaPrintf
,
(
vlc_object_t
*
p_this
,
int
fd
,
v_socket_t
*
,
const
char
*
psz_fmt
,
va_list
args
)
);
#define net_GetSockAddress(a,b,c,d) __net_GetAddress(VLC_OBJECT(a),VLC_FALSE,b,c,d)
#define net_GetPeerAddress(a,b,c,d) __net_GetAddress(VLC_OBJECT(a),VLC_TRUE,b,c,d)
VLC_EXPORT
(
int
,
__net_GetAddress
,
(
vlc_object_t
*
p_this
,
vlc_bool_t
peer
,
int
fd
,
char
*
address
,
int
*
port
)
);
/*****************************************************************************
* net_StopRecv/Send
*****************************************************************************
...
...
include/vlc_symbols.h
View file @
a2aa6d7b
...
...
@@ -382,6 +382,7 @@ struct module_symbols_t
int
(
*
ACL_LoadFile_inner
)
(
vlc_acl_t
*
p_acl
,
const
char
*
path
);
int
(
*
ACL_AddNet_inner
)
(
vlc_acl_t
*
p_acl
,
const
char
*
psz_ip
,
int
i_len
,
vlc_bool_t
b_allow
);
void
(
*
ACL_Destroy_inner
)
(
vlc_acl_t
*
p_acl
);
int
(
*
__net_GetAddress_inner
)
(
vlc_object_t
*
p_this
,
vlc_bool_t
peer
,
int
fd
,
char
*
address
,
int
*
port
);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...
...
@@ -749,6 +750,7 @@ struct module_symbols_t
# define ACL_LoadFile (p_symbols)->ACL_LoadFile_inner
# define ACL_AddNet (p_symbols)->ACL_AddNet_inner
# define ACL_Destroy (p_symbols)->ACL_Destroy_inner
# define __net_GetAddress (p_symbols)->__net_GetAddress_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...
...
@@ -1119,6 +1121,7 @@ struct module_symbols_t
((p_symbols)->ACL_LoadFile_inner) = ACL_LoadFile; \
((p_symbols)->ACL_AddNet_inner) = ACL_AddNet; \
((p_symbols)->ACL_Destroy_inner) = ACL_Destroy; \
((p_symbols)->__net_GetAddress_inner) = __net_GetAddress; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
# endif
/* __PLUGIN__ */
...
...
src/misc/net.c
View file @
a2aa6d7b
...
...
@@ -1156,3 +1156,32 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
return
VLC_SUCCESS
;
}
int
__net_GetAddress
(
vlc_object_t
*
p_this
,
vlc_bool_t
peer
,
int
fd
,
char
*
address
,
int
*
port
)
{
struct
sockaddr_storage
addr
;
socklen_t
addrlen
=
sizeof
(
addr
);
int
val
;
val
=
peer
?
getpeername
(
fd
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
)
:
getsockname
(
fd
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
if
(
val
)
{
#if defined(WIN32) || defined (UNDER_CE)
msg_Err
(
p_this
,
"socket address error : %d"
,
WSAGetLastError
(
)
);
#else
msg_Err
(
p_this
,
"socket address error : %s"
,
strerror
(
errno
)
);
#endif
return
val
;
}
val
=
vlc_getnameinfo
(
(
struct
sockaddr
*
)
&
addr
,
addrlen
,
address
,
NI_MAXNUMERICHOST
,
port
,
NI_NUMERICHOST
);
if
(
val
)
{
msg_Err
(
p_this
,
"socket address error : %s"
,
vlc_gai_strerror
(
val
)
);
}
return
0
;
}
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