30 return (((
const struct sockaddr_in *)a)->sin_addr.s_addr !=
31 ((
const struct sockaddr_in *)b)->sin_addr.s_addr);
34 #if HAVE_STRUCT_SOCKADDR_IN6 36 const uint8_t *s6_addr_a = ((
const struct sockaddr_in6 *)a)->sin6_addr.s6_addr;
37 const uint8_t *s6_addr_b = ((
const struct sockaddr_in6 *)b)->sin6_addr.s6_addr;
38 return memcmp(s6_addr_a, s6_addr_b, 16);
64 const char *hostname,
int port,
67 struct addrinfo hints = { 0 }, *res = 0;
70 const char *node = 0, *service =
"0";
73 snprintf(sport,
sizeof(sport),
"%d", port);
76 if ((hostname) && (hostname[0] !=
'\0') && (hostname[0] !=
'?')) {
82 if ((error =
getaddrinfo(node, service, &hints, &res))) {
85 node ? node :
"unknown",
96 int *address_list_size_ptr)
102 while (buf && buf[0]) {
114 av_dynarray2_add((
void **)address_list_ptr, address_list_size_ptr,
sizeof(source_addr), (
uint8_t *)&source_addr);
115 if (!*address_list_ptr)
131 if (parse_include_list)
137 av_log(log_ctx,
AV_LOG_ERROR,
"Simultaneously including and excluding sources is not supported.\n");
static int compare_addr(const struct sockaddr_storage *a, const struct sockaddr_storage *b)
int ff_ip_parse_blocks(void *log_ctx, const char *buf, IPSourceFilters *filters)
Parses the address[,address] source block list in buf and adds it to the filters in the IPSourceFilte...
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
struct sockaddr_storage * exclude_addrs
static void error(const char *err)
int ff_ip_parse_sources(void *log_ctx, const char *buf, IPSourceFilters *filters)
Parses the address[,address] source list in buf and adds it to the filters in the IPSourceFilters str...
struct sockaddr_storage * include_addrs
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void ff_ip_reset_filters(IPSourceFilters *filters)
Resets the IP filter list and frees the internal fields of an IPSourceFilters structure.
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
static int ip_parse_addr_list(void *log_ctx, const char *buf, struct sockaddr_storage **address_list_ptr, int *address_list_size_ptr)
void * av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, const uint8_t *elem_data)
Add an element of size elem_size to a dynamic array.
int ff_ip_check_source_lists(struct sockaddr_storage *source_addr_ptr, IPSourceFilters *s)
Checks the source address against a given IP source filter.
#define flags(name, subs,...)
static int ip_parse_sources_and_blocks(void *log_ctx, const char *buf, IPSourceFilters *filters, int parse_include_list)
static const struct PPFilter filters[]
struct addrinfo * ff_ip_resolve_host(void *log_ctx, const char *hostname, int port, int type, int family, int flags)
Resolves hostname into an addrinfo structure.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
struct sockaddr * ai_addr
Structure for storing IP (UDP) source filters or block lists.