4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpeg; if not, write to the Free Software * Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 * Structure for storing IP (UDP) source filters or block lists.
29 typedef struct IPSourceFilters {
32 struct sockaddr_storage *include_addrs;
33 struct sockaddr_storage *exclude_addrs;
37 * Checks the source address against a given IP source filter.
38 * @return 0 if packet should be processed based on the filter, 1 if the packet
41 int ff_ip_check_source_lists(struct sockaddr_storage *source_addr_ptr, IPSourceFilters *s);
44 * Resolves hostname into an addrinfo structure.
45 * @return addrinfo structure which should be freed by the user, NULL in case
48 struct addrinfo *ff_ip_resolve_host(void *log_ctx,
49 const char *hostname, int port,
50 int type, int family, int flags);
53 * Parses the address[,address] source list in buf and adds it to the filters
54 * in the IPSourceFilters structure.
55 * @return 0 on success, < 0 AVERROR code on error.
57 int ff_ip_parse_sources(void *log_ctx, const char *buf, IPSourceFilters *filters);
60 * Parses the address[,address] source block list in buf and adds it to the
61 * filters in the IPSourceFilters structure.
62 * @return 0 on success, < 0 AVERROR code on error.
64 int ff_ip_parse_blocks(void *log_ctx, const char *buf, IPSourceFilters *filters);
67 * Resets the IP filter list and frees the internal fields of an
68 * IPSourceFilters structure.
70 void ff_ip_reset_filters(IPSourceFilters *filters);
72 #endif /* AVFORMAT_IP_H */