Udipe 1.0
Solving the riddle of high-throughput UDP
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations
connect.h File Reference

Connection-related definitions. More...

#include "time.h"
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

union  ip_address_u
 
struct  udipe_connect_options_s
 

Typedefs

typedef enum udipe_direction_e udipe_direction_t
 
typedef union ip_address_u ip_address_t
 
typedef enum udipe_bool_with_default_e udipe_bool_with_default_t
 
typedef struct udipe_connect_options_s udipe_connect_options_t
 
typedef int udipe_connect_result_t
 
typedef int udipe_disconnect_options_t
 
typedef int udipe_disconnect_result_t
 

Enumerations

enum  udipe_direction_e { UDIPE_IN = 0 , UDIPE_OUT , UDIPE_INOUT }
 
enum  udipe_bool_with_default_e { UDIPE_FALSE = 1 , UDIPE_TRUE = 2 , UDIPE_DEFAULT = 0 }
 

Detailed Description

Like all other udipe commands, the udipe_connect() and udipe_disconnect() commands are defined in command.h. But they come with a fairly large amount of related definitions, which have been extracted into this dedicated header the interest of code clarity.

Typedef Documentation

◆ ip_address_t

typedef union ip_address_u ip_address_t

IP address

As a UDP library, libudipe only supports IPv4 and IPv6 addresses, i.e. sockaddr_in and sockaddr_in6 in POSIX parlance. As a special extension, sa_family == 0 is interpreted as requesting some default address.

This union does not need to be accompanied by a tag because the sockaddr types features a sa_family internal tag that enables IPv4/IPv6/default disambiguation.

◆ udipe_bool_with_default_t

Boolean option with a nontrivial default value

This is needed in circumstances where the default value for an option is not false but e.g. "`true` if supported", "`true` if deemed worthwhile based on system configuration", etc.

◆ udipe_connect_options_t

udipe_connect() parameters

This struct controls the parameters that can be tuned when establishing a UDP connection. Like most configuration structs, it is designed such that zero-initializing results in sane defaults, except for sending traffic where you will need to set at least a remote_address.

◆ udipe_direction_t

Communication direction(s)

When you create a udipe_connection_t, you can specify whether you intend to receive datagrams, send datagrams, or both.

The more restricted configurations that only allow one direction of data exchange clarify intent and require fewer parameters to be set at configuration time. They should also enjoy slightly faster connection setup, though the performance of establishing connections should not matter in realistic use cases.

Enumeration Type Documentation

◆ udipe_bool_with_default_e

Boolean option with a nontrivial default value

This is needed in circumstances where the default value for an option is not false but e.g. "`true` if supported", "`true` if deemed worthwhile based on system configuration", etc.

Enumerator
UDIPE_FALSE 

Set to false

UDIPE_TRUE 

Set to true

UDIPE_DEFAULT 

Use default value (depends on context)

◆ udipe_direction_e

Communication direction(s)

When you create a udipe_connection_t, you can specify whether you intend to receive datagrams, send datagrams, or both.

The more restricted configurations that only allow one direction of data exchange clarify intent and require fewer parameters to be set at configuration time. They should also enjoy slightly faster connection setup, though the performance of establishing connections should not matter in realistic use cases.

Enumerator
UDIPE_IN 

Can receive datagrams from the remote peer.

UDIPE_OUT 

Can send datagrams to the remote peer.

UDIPE_INOUT 

Can exchange datagrams with the remote peer in either direction.