FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 */
struct sockaddr_storage * exclude_addrs
Definition: ip.h:33
int nb_include_addrs
Definition: ip.h:30
struct sockaddr_storage * include_addrs
Definition: ip.h:32
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
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
#define s(width, name)
Definition: cbs_vp9.c:257
void * buf
Definition: avisynth_c.h:690
GLint GLenum type
Definition: opengl_enc.c:105
#define flags(name, subs,...)
Definition: cbs_av1.c:596
int nb_exclude_addrs
Definition: ip.h:31
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
static const struct PPFilter filters[]
Definition: postprocess.c:134
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
Structure for storing IP (UDP) source filters or block lists.
Definition: ip.h:29
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