UCommon
socket.h File Reference

Common socket class and address manipulation. More...

#include <ucommon/timers.h>
#include <ucommon/linked.h>
#include <ucommon/string.h>
#include <ucommon/typeref.h>
#include <unistd.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <stdio.h>
Include dependency graph for socket.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hostaddr_internet
 An object that holds ipv4 or ipv6 binary encoded host addresses. More...
 
struct  sockaddr_internet
 An object that can hold a ipv4 or ipv6 socket address. More...
 
class  ucommon::cidr
 A class to hold internet segment routing rules. More...
 
class  ucommon::linked_pointer< sockaddr_struct >
 Linked pointer for address lists. More...
 
class  ucommon::linked_sockaddr_operations
 Helper class for linked_pointer template. More...
 
class  ucommon::ListenSocket
 A bound socket used to listen for inbound socket connections. More...
 
class  ucommon::Socket
 A generic socket base class. More...
 
class  ucommon::Socket::address
 A generic socket address class. More...
 
class  ucommon::TCPServer
 A generic tcp server class. More...
 

Namespaces

namespace  ucommon
 Common namespace for all ucommon objects.
 

Macros

#define DCCP_SOCKOPT_AVAILABLE_CCIDS   12
 
#define DCCP_SOCKOPT_CCID   13
 
#define DCCP_SOCKOPT_RX_CCID   15
 
#define DCCP_SOCKOPT_TX_CCID   14
 
#define DEFAULT_FAMILY   AF_UNSPEC
 
#define IPTOS_LOWDELAY   0x10
 
#define IPTOS_MINCOST   0x02
 
#define IPTOS_RELIABILITY   0x04
 
#define IPTOS_THROUGHPUT   0x08
 

Typedefs

typedef struct sockaddr sockaddr_struct
 
typedef struct sockaddr * sockaddr_t
 
typedef TCPServer ucommon::tcpserv_t
 

Functions

const struct sockaddr * ucommon::addr (Socket::address &address)
 A convenience function to convert a socket address list into a socket address.
 
struct addrinfo * ucommon::addrinfo (Socket::address &address)
 A convenience function to convert a socket address list into an addrinfo.
 
bool ucommon::eq (const struct sockaddr *s1, const struct sockaddr *s2)
 Compare two socket addresses to see if equal.
 
bool ucommon::eq (const struct sockaddr_storage *s1, const struct sockaddr_storage *s2)
 Compare two stored socket addresses to see if equal.
 
bool ucommon::eq_host (const struct sockaddr *s1, const struct sockaddr *s2)
 Compare two host addresses to see if equal.
 
bool ucommon::eq_subnet (const struct sockaddr *s1, const struct sockaddr *s2)
 
String ucommon::str (Socket &so, size_t size)
 

Detailed Description

Common socket class and address manipulation.

This offers a common socket base class that exposes socket functionality based on what the target platform supports. Support for multicast, IPV6 addressing, and manipulation of cidr policies are all supported here.

Definition in file socket.h.

Macro Definition Documentation

◆ DCCP_SOCKOPT_AVAILABLE_CCIDS

#define DCCP_SOCKOPT_AVAILABLE_CCIDS   12

Definition at line 151 of file socket.h.

◆ DCCP_SOCKOPT_CCID

#define DCCP_SOCKOPT_CCID   13

Definition at line 152 of file socket.h.

◆ DCCP_SOCKOPT_RX_CCID

#define DCCP_SOCKOPT_RX_CCID   15

Definition at line 154 of file socket.h.

◆ DCCP_SOCKOPT_TX_CCID

#define DCCP_SOCKOPT_TX_CCID   14

Definition at line 153 of file socket.h.

◆ DEFAULT_FAMILY

#define DEFAULT_FAMILY   AF_UNSPEC

Definition at line 79 of file socket.h.

◆ IPTOS_LOWDELAY

#define IPTOS_LOWDELAY   0x10

Definition at line 72 of file socket.h.

◆ IPTOS_MINCOST

#define IPTOS_MINCOST   0x02

Definition at line 75 of file socket.h.

◆ IPTOS_RELIABILITY

#define IPTOS_RELIABILITY   0x04

Definition at line 74 of file socket.h.

◆ IPTOS_THROUGHPUT

#define IPTOS_THROUGHPUT   0x08

Definition at line 73 of file socket.h.

Typedef Documentation

◆ sockaddr_struct

typedef struct sockaddr sockaddr_struct

Definition at line 86 of file socket.h.

◆ sockaddr_t

typedef struct sockaddr* sockaddr_t

Definition at line 84 of file socket.h.