ouster_clib v1.0
C library for Ouster LiDAR
Loading...
Searching...
No Matches
Network and sockets

Provides network functionality. More...

Classes

struct  ouster_net_sock_desc_t
 
struct  ouster_net_addr_t
 

Macros

#define OUSTER_NET_ADDRSTRLEN   46
 
#define OUSTER_NET_UDP_MAX_SIZE   65535
 
#define OUSTER_NET_FLAGS_NONBLOCK   0x0001
 
#define OUSTER_NET_FLAGS_REUSE   0x0002
 
#define OUSTER_NET_FLAGS_IPV6ONLY   0x0004
 
#define OUSTER_NET_FLAGS_IPV4   0x0008
 
#define OUSTER_NET_FLAGS_IPV6   0x0010
 
#define OUSTER_NET_FLAGS_UDP   0x0020
 
#define OUSTER_NET_FLAGS_TCP   0x0040
 
#define OUSTER_NET_FLAGS_BIND   0x0100
 
#define OUSTER_NET_FLAGS_CONNECT   0x0200
 

Functions

void ouster_net_addr_set_ip4 (ouster_net_addr_t *addr, char const *ip)
 Set a IPv4 address. More...
 
void ouster_net_addr_set_port (ouster_net_addr_t *addr, int port)
 Set a port. More...
 
int ouster_net_sendto (int sock, char *buf, int size, int flags, ouster_net_addr_t *addr)
 Send data from a socket to a network address. More...
 
int ouster_net_create (ouster_net_sock_desc_t *desc)
 
int64_t ouster_net_read (int sock, char *buf, int len)
 
uint64_t ouster_net_select (int socks[], int n, const int timeout_sec, const int timeout_usec)
 
int32_t ouster_net_get_port (int sock)
 

Detailed Description

Provides network functionality.

Macro Definition Documentation

◆ OUSTER_NET_ADDRSTRLEN

#define OUSTER_NET_ADDRSTRLEN   46

Definition at line 15 of file ouster_net.h.

◆ OUSTER_NET_FLAGS_BIND

#define OUSTER_NET_FLAGS_BIND   0x0100

Definition at line 24 of file ouster_net.h.

◆ OUSTER_NET_FLAGS_CONNECT

#define OUSTER_NET_FLAGS_CONNECT   0x0200

Definition at line 25 of file ouster_net.h.

◆ OUSTER_NET_FLAGS_IPV4

#define OUSTER_NET_FLAGS_IPV4   0x0008

Definition at line 20 of file ouster_net.h.

◆ OUSTER_NET_FLAGS_IPV6

#define OUSTER_NET_FLAGS_IPV6   0x0010

Definition at line 21 of file ouster_net.h.

◆ OUSTER_NET_FLAGS_IPV6ONLY

#define OUSTER_NET_FLAGS_IPV6ONLY   0x0004

Definition at line 19 of file ouster_net.h.

◆ OUSTER_NET_FLAGS_NONBLOCK

#define OUSTER_NET_FLAGS_NONBLOCK   0x0001

Definition at line 17 of file ouster_net.h.

◆ OUSTER_NET_FLAGS_REUSE

#define OUSTER_NET_FLAGS_REUSE   0x0002

Definition at line 18 of file ouster_net.h.

◆ OUSTER_NET_FLAGS_TCP

#define OUSTER_NET_FLAGS_TCP   0x0040

Definition at line 23 of file ouster_net.h.

◆ OUSTER_NET_FLAGS_UDP

#define OUSTER_NET_FLAGS_UDP   0x0020

Definition at line 22 of file ouster_net.h.

◆ OUSTER_NET_UDP_MAX_SIZE

#define OUSTER_NET_UDP_MAX_SIZE   65535

Definition at line 16 of file ouster_net.h.

Function Documentation

◆ ouster_net_addr_set_ip4()

void ouster_net_addr_set_ip4 ( ouster_net_addr_t addr,
char const *  ip 
)

Set a IPv4 address.

Parameters
addrThe address
ipThe IPv4 address

◆ ouster_net_addr_set_port()

void ouster_net_addr_set_port ( ouster_net_addr_t addr,
int  port 
)

Set a port.

Parameters
addrThe address
ipThe port

◆ ouster_net_sendto()

int ouster_net_sendto ( int  sock,
char *  buf,
int  size,
int  flags,
ouster_net_addr_t addr 
)

Send data from a socket to a network address.

Parameters
sockThe source socket filedescriptor
bufData to send
sizeData size to send
flags
addrDestinationnetwork address
Returns
Returns the number sent, or -1 for errors.