COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
socketlib.h File Reference

Socket Support header file. More...

#include "support/configCosmos.h"
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
Include dependency graph for socketlib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  socket_channel
 
struct  SocketOptions
 
class  Udp
 

Macros

#define SOCKET_BLOCKING   true
 Blocking Agent. More...
 
#define SOCKET_NONBLOCKING   false
 Non-blocking Agent. More...
 
#define SOCKET_TALK   0
 Talk followed by optional listen (sendto address) More...
 
#define SOCKET_LISTEN   1
 Listen followed by optional talk (recvfrom INADDRANY) More...
 
#define SOCKET_COMMUNICATE   2
 Communicate socket (sendto followed by recvfrom) More...
 
#define SOCKET_JABBER   3
 Talk over multiple interfaces. More...
 
#define SOCKET_RCVTIMEO   100000
 Default SOCKET RCVTIMEO (100 msec) More...
 
#define SOCKET_IP_BYTE_VERSION   0
 IP Version Byte. More...
 
#define SOCKET_IP_BYTE_LEN_LOW   3
 
#define SOCKET_IP_BYTE_LEN_HIGH   2
 
#define SOCKET_IP_BYTE_PROTOCOL   9
 
#define SOCKET_IP_BYTE_SRC_ADDR   12
 
#define SOCKET_IP_BYTE_DEST_ADDR   16
 
#define SOCKET_IP_BYTE_UDP_LEN   24
 
#define SOCKET_IP_BYTE_UDP_CS   26
 
#define SOCKET_IP_PROTOCOL_UDP   17
 
#define SOCKET_BUFFER_LENGTH   512
 

Enumerations

enum  NetworkType : std::uint16_t {
  NetworkType::MULTICAST =0, NetworkType::BROADCAST =2, NetworkType::UDP =5, NetworkType::TCP =3,
  NetworkType::CSP =4
}
 

Functions

int32_t socket_open (socket_channel *channel, NetworkType ntype, const char *address, uint16_t port, uint16_t direction, bool blocking=true, uint32_t usectimeo=0, uint32_t rcvbuf=0, uint32_t sndbuf=0)
 Open UDP socket. More...
 
int32_t socket_open (socket_channel &channel, NetworkType ntype, const char *address, uint16_t port, uint16_t direction, bool blocking=true, uint32_t usectimeo=0, uint32_t rcvbuf=0, uint32_t sndbuf=0)
 
int32_t socket_accept (socket_channel server, socket_channel &client)
 
uint16_t socket_calc_udp_checksum (vector< uint8_t > packet)
 Calculate UDP Checksum. More...
 
int32_t socket_check_udp_checksum (vector< uint8_t > packet)
 Check UDP checksum. More...
 
int32_t socket_set_udp_checksum (vector< uint8_t > &packet)
 Set UDP checksum. More...
 
int32_t socket_blocking (socket_channel *channel, bool blocking)
 
int32_t socket_blocking (socket_channel &channel, bool blocking)
 
int32_t socket_close (socket_channel *channel)
 Close socket. More...
 
int32_t socket_close (socket_channel &channel)
 
int32_t socket_recvfrom (socket_channel &channel, vector< uint8_t > &buffer, size_t maxlen, int flags=0)
 
int32_t socket_recvfrom (socket_channel &channel, string &buffer, size_t maxlen, int flags=0)
 
int32_t socket_sendto (socket_channel &channel, const string buffer, int flags=0)
 
int32_t socket_sendto (socket_channel &channel, const vector< uint8_t > buffer, int flags=0)
 
vector< socket_channelsocket_find_addresses (NetworkType ntype)
 Discover interfaces. More...
 

Detailed Description

Socket Support header file.