libgpac
Documentation of the core library of GPAC
network.h File Reference

Networking. More...

#include <gpac/setup.h>
#include <gpac/tools.h>
+ Include dependency graph for network.h:
+ This graph shows which files directly or indirectly include this file:

Macros

#define GF_NTP_SEC_1900_TO_1970
 NTP seconds from 1900 to 1970. More...
 
#define GF_MAX_IP_NAME_LEN   1025
 
#define GF_SOCK_TYPE_TCP   0x01
 
#define GF_SOCK_TYPE_UDP   0x02
 

Typedefs

typedef Bool(* gf_net_ifce_enum) (void *cbk, const char *name, const char *IP, u32 flags)
 
typedef struct __tag_socket GF_Socket
 abstracted socket object More...
 
typedef struct __tag_sock_group GF_SockGroup
 abstracted socket group object More...
 

Enumerations

enum  {
  GF_NETIF_ACTIVE = 1 , GF_NETIF_NO_MCAST = 1<<1 , GF_NETIF_RECV_ONLY = 1<<2 , GF_NETIF_LOOPBACK = 1<<3 ,
  GF_NETIF_IPV6 = 1<<4
}
 
enum  { GF_SOCK_REUSE_PORT = 1 , GF_SOCK_FORCE_IPV6 = 1<<1 , GF_SOCK_IS_SENDER = 1<<2 }
 
enum  GF_SockSelectMode { GF_SK_SELECT_BOTH =0 , GF_SK_SELECT_READ , GF_SK_SELECT_WRITE }
 

Functions

Bool gf_url_is_local (const char *url)
 URL local test. More...
 
char * gf_url_get_absolute_path (const char *pathName, const char *parentPath)
 gets absolute file path More...
 
char * gf_url_concatenate (const char *parentName, const char *pathName)
 URL concatenation. More...
 
char * gf_url_concatenate_parent (const char *parentName, const char *pathName)
 URL concatenation. More...
 
char * gf_url_percent_encode (const char *path)
 URL encoding. More...
 
char * gf_url_percent_decode (const char *path)
 URL decoding. More...
 
void gf_url_to_fs_path (char *url)
 URL to file system. More...
 
Bool gf_url_is_relative (const char *url)
 check relative URL More...
 
char * gf_url_colon_suffix (const char *URL, char assign_sep)
 get first after a filename/path More...
 
const char * gf_url_get_resource_name (const char *url)
 Extract resource name from URL. More...
 
const char * gf_url_get_path (const char *url)
 Gets resource path from URL. More...
 
u32 gf_net_has_ipv6 ()
 gets ipv6 support More...
 
Bool gf_net_is_ipv6 (const char *address)
 checks address type More...
 
Bool gf_net_enum_interfaces (gf_net_ifce_enum do_enum, void *enum_cbk)
 enumerate network interfaces More...
 
u32 gf_htonl (u32 val)
 
u32 gf_ntohl (u32 val)
 
u16 gf_htons (u16 val)
 
u16 gf_ntohs (u16 val)
 
void gf_utc_time_since_1970 (u32 *sec, u32 *msec)
 gets UTC time More...
 
void gf_net_get_ntp (u32 *sec, u32 *frac)
 gets NTP time More...
 
u64 gf_net_get_ntp_ms ()
 gets NTP time in milliseconds More...
 
void gf_net_set_ntp_shift (s32 sec)
 offsets NTP time by a given amount of seconds More...
 
u64 gf_net_get_ntp_ts ()
 gets NTP time More...
 
s32 gf_net_get_ntp_diff_ms (u64 ntp)
 
s32 gf_net_ntp_diff_ms (u64 ntp_a, u64 ntp_b)
 
const char * gf_errno_str (int errnoval)
 error code description More...
 
GF_Socketgf_sk_new (u32 SocketType)
 socket constructor More...
 
GF_Socketgf_sk_new_ex (u32 SocketType, const char *netcap_id)
 socket constructor More...
 
void gf_sk_del (GF_Socket *sock)
 socket destructor More...
 
void gf_sk_reset (GF_Socket *sock)
 reset internal buffer More...
 
GF_Err gf_sk_set_buffer_size (GF_Socket *sock, Bool send_buffer, u32 new_size)
 socket buffer size control More...
 
GF_Err gf_sk_set_block_mode (GF_Socket *sock, Bool NonBlockingOn)
 blocking mode control More...
 
GF_Err gf_sk_bind (GF_Socket *sock, const char *local_ip, u16 port, const char *peer_name, u16 peer_port, u32 options)
 socket binding More...
 
GF_Err gf_sk_connect (GF_Socket *sock, const char *peer_name, u16 port, const char *local_ip)
 connects a socket More...
 
GF_Err gf_sk_send (GF_Socket *sock, const u8 *buffer, u32 length)
 data emission More...
 
GF_Err gf_sk_send_ex (GF_Socket *sock, const u8 *buffer, u32 length, u32 *written)
 data emission More...
 
GF_Err gf_sk_receive (GF_Socket *sock, u8 *buffer, u32 length, u32 *read)
 data reception More...
 
GF_Err gf_sk_listen (GF_Socket *sock, u32 max_conn)
 socket listening More...
 
GF_Err gf_sk_accept (GF_Socket *sock, GF_Socket **new_conn)
 socket accept More...
 
GF_Err gf_sk_server_mode (GF_Socket *sock, Bool server_on)
 server socket mode More...
 
GF_Err gf_sk_get_host_name (char *buffer)
 get local host name More...
 
GF_Err gf_sk_get_local_ip (GF_Socket *sock, char *buffer)
 get local IP More...
 
GF_Err gf_sk_get_local_info (GF_Socket *sock, u16 *port, u32 *sock_type)
 get local info More...
 
GF_Err gf_sk_get_remote_address (GF_Socket *sock, char *buffer)
 get remote address More...
 
GF_Err gf_sk_set_remote (GF_Socket *sock, char *address, u16 port)
 set remote address More...
 
GF_Err gf_sk_setup_multicast (GF_Socket *sock, const char *multi_ip_add, u16 multi_port, u32 TTL, Bool no_bind, const char *ifce_ip_or_name)
 multicast setup More...
 
GF_Err gf_sk_setup_multicast_ex (GF_Socket *sock, const char *multi_ip_add, u16 multi_port, u32 TTL, Bool no_bind, const char *ifce_ip_or_name, const char **src_ip_inc, u32 nb_src_ip_inc, const char **src_ip_exc, u32 nb_src_ip_exc)
 source-specific multicast setup More...
 
u32 gf_sk_is_multicast_address (const char *multi_ip_add)
 multicast address test More...
 
s32 gf_sk_get_handle (GF_Socket *sock)
 gets socket handle More...
 
void gf_sk_set_usec_wait (GF_Socket *sock, u32 usec_wait)
 
GF_Err gf_sk_receive_no_select (GF_Socket *sock, u8 *buffer, u32 length, u32 *read)
 
GF_Err gf_sk_probe (GF_Socket *sock)
 
char * gf_net_bump_ip_address (const char *in_ip, u32 increment)
 
Bool gf_net_get_adapter_ip (const char *ip_or_name, char **ipv4, char **ipv6)
 
GF_Err gf_sk_select (GF_Socket *sock, GF_SockSelectMode mode)
 
GF_SockGroupgf_sk_group_new ()
 
void gf_sk_group_del (GF_SockGroup *sg)
 
void gf_sk_group_register (GF_SockGroup *sg, GF_Socket *sk)
 
void gf_sk_group_unregister (GF_SockGroup *sg, GF_Socket *sk)
 
GF_Err gf_sk_group_select (GF_SockGroup *sg, u32 wait_usec, GF_SockSelectMode mode)
 
Bool gf_sk_group_sock_is_set (GF_SockGroup *sg, GF_Socket *sk, GF_SockSelectMode mode)
 

Detailed Description

>