mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
parseaddr: add new call pa_is_ip_address()
This commit is contained in:
parent
d5f9057558
commit
9208b86b5e
2 changed files with 17 additions and 0 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include <pulse/xmalloc.h>
|
#include <pulse/xmalloc.h>
|
||||||
#include <pulse/util.h>
|
#include <pulse/util.h>
|
||||||
|
|
@ -131,3 +132,17 @@ int pa_parse_address(const char *name, pa_parsed_address *ret_p) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pa_bool_t pa_is_ip_address(const char *a) {
|
||||||
|
char buf[INET6_ADDRSTRLEN];
|
||||||
|
|
||||||
|
pa_assert(a);
|
||||||
|
|
||||||
|
if (inet_pton(AF_INET6, a, buf) >= 1)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (inet_pton(AF_INET, a, buf) >= 1)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,4 +39,6 @@ typedef struct pa_parsed_address {
|
||||||
|
|
||||||
int pa_parse_address(const char *a, pa_parsed_address *ret_p);
|
int pa_parse_address(const char *a, pa_parsed_address *ret_p);
|
||||||
|
|
||||||
|
pa_bool_t pa_is_ip_address(const char *a);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue