FFmpeg
Functions
ip.c File Reference
#include "ip.h"
#include "libavutil/avstring.h"

Go to the source code of this file.

Functions

static int compare_addr (const struct sockaddr_storage *a, const struct sockaddr_storage *b)
 
int ff_ip_check_source_lists (struct sockaddr_storage *source_addr_ptr, IPSourceFilters *s)
 Checks the source address against a given IP source filter. More...
 
struct addrinfoff_ip_resolve_host (void *log_ctx, const char *hostname, int port, int type, int family, int flags)
 Resolves hostname into an addrinfo structure. More...
 
static int ip_parse_addr_list (void *log_ctx, const char *buf, struct sockaddr_storage **address_list_ptr, int *address_list_size_ptr)
 
static int ip_parse_sources_and_blocks (void *log_ctx, const char *buf, IPSourceFilters *filters, int parse_include_list)
 
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 structure. More...
 
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 IPSourceFilters structure. More...
 
void ff_ip_reset_filters (IPSourceFilters *filters)
 Resets the IP filter list and frees the internal fields of an IPSourceFilters structure. More...
 

Function Documentation

◆ compare_addr()

static int compare_addr ( const struct sockaddr_storage a,
const struct sockaddr_storage b 
)
static

Definition at line 24 of file ip.c.

Referenced by ff_ip_check_source_lists().

◆ 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.

Returns
0 if packet should be processed based on the filter, 1 if the packet can be dropped.

Definition at line 44 of file ip.c.

Referenced by rtp_read(), and udp_read().

◆ 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.

Returns
addrinfo structure which should be freed by the user, NULL in case of error.

Definition at line 63 of file ip.c.

Referenced by ip_parse_addr_list(), udp_set_url(), and udp_socket_create().

◆ ip_parse_addr_list()

static int ip_parse_addr_list ( void *  log_ctx,
const char *  buf,
struct sockaddr_storage **  address_list_ptr,
int address_list_size_ptr 
)
static

Definition at line 94 of file ip.c.

Referenced by ip_parse_sources_and_blocks().

◆ ip_parse_sources_and_blocks()

static int ip_parse_sources_and_blocks ( void *  log_ctx,
const char *  buf,
IPSourceFilters filters,
int  parse_include_list 
)
static

Definition at line 128 of file ip.c.

Referenced by ff_ip_parse_blocks(), and ff_ip_parse_sources().

◆ 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 structure.

Returns
0 on success, < 0 AVERROR code on error.

Definition at line 143 of file ip.c.

Referenced by rtp_open(), and udp_open().

◆ 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 IPSourceFilters structure.

Returns
0 on success, < 0 AVERROR code on error.

Definition at line 148 of file ip.c.

Referenced by rtp_open(), and udp_open().

◆ 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 at line 153 of file ip.c.

Referenced by rtp_close(), udp_close(), and udp_open().