FFmpeg
ip.h
Go to the documentation of this file.
1 /*
2  * IP common code
3  *
4  * This file is part of FFmpeg.
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #ifndef AVFORMAT_IP_H
22 #define AVFORMAT_IP_H
23 
24 #include "network.h"
25 
26 /**
27  * Structure for storing IP (UDP) source filters or block lists.
28  */
29 typedef struct IPSourceFilters {
35 
36 /**
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
39  * can be dropped.
40  */
41 int ff_ip_check_source_lists(struct sockaddr_storage *source_addr_ptr, IPSourceFilters *s);
42 
43 /**
44  * Resolves hostname into an addrinfo structure.
45  * @return addrinfo structure which should be freed by the user, NULL in case
46  * of error.
47  */
48 struct addrinfo *ff_ip_resolve_host(void *log_ctx,
49  const char *hostname, int port,
50  int type, int family, int flags);
51 
52 /**
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.
56  */
57 int ff_ip_parse_sources(void *log_ctx, const char *buf, IPSourceFilters *filters);
58 
59 /**
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.
63  */
64 int ff_ip_parse_blocks(void *log_ctx, const char *buf, IPSourceFilters *filters);
65 
66 /**
67  * Resets the IP filter list and frees the internal fields of an
68  * IPSourceFilters structure.
69  */
71 
72 #endif /* AVFORMAT_IP_H */
ff_ip_reset_filters
void ff_ip_reset_filters(IPSourceFilters *filters)
Resets the IP filter list and frees the internal fields of an IPSourceFilters structure.
Definition: ip.c:153
ff_ip_parse_blocks
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...
Definition: ip.c:148
ff_ip_check_source_lists
int ff_ip_check_source_lists(struct sockaddr_storage *source_addr_ptr, IPSourceFilters *s)
Checks the source address against a given IP source filter.
Definition: ip.c:44
filters
static const struct PPFilter filters[]
Definition: postprocess.c:134
sockaddr_storage
Definition: network.h:111
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
ff_ip_parse_sources
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...
Definition: ip.c:143
s
#define s(width, name)
Definition: cbs_vp9.c:257
IPSourceFilters::nb_exclude_addrs
int nb_exclude_addrs
Definition: ip.h:31
IPSourceFilters::exclude_addrs
struct sockaddr_storage * exclude_addrs
Definition: ip.h:33
ff_ip_resolve_host
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.
Definition: ip.c:63
network.h
IPSourceFilters
Structure for storing IP (UDP) source filters or block lists.
Definition: ip.h:29
IPSourceFilters::nb_include_addrs
int nb_include_addrs
Definition: ip.h:30
IPSourceFilters::include_addrs
struct sockaddr_storage * include_addrs
Definition: ip.h:32
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
addrinfo
Definition: network.h:137