54 #include <sys/socket.h> 55 #include <sys/ioctl.h> 78 #define SOCKET_BLOCKING true 79 #define SOCKET_NONBLOCKING false 83 #define SOCKET_LISTEN 1 85 #define SOCKET_COMMUNICATE 2 87 #define SOCKET_JABBER 3 91 #define SOCKET_RCVTIMEO 100000 94 #define SOCKET_IP_BYTE_VERSION 0 95 #define SOCKET_IP_BYTE_LEN_LOW 3 96 #define SOCKET_IP_BYTE_LEN_HIGH 2 97 #define SOCKET_IP_BYTE_PROTOCOL 9 98 #define SOCKET_IP_BYTE_SRC_ADDR 12 99 #define SOCKET_IP_BYTE_DEST_ADDR 16 100 #define SOCKET_IP_BYTE_UDP_LEN 24 101 #define SOCKET_IP_BYTE_UDP_CS 26 103 #define SOCKET_IP_PROTOCOL_UDP 17 105 #define SOCKET_BUFFER_LENGTH 512 //Max length of buffer 122 struct sockaddr_in caddr;
124 struct sockaddr_in baddr;
126 struct sockaddr_in6 caddr6;
175 struct sockaddr_in server;
176 struct sockaddr_in s_other;
178 bool connect =
false;
186 int addrlen =
sizeof(server);
224 int32_t openServer();
225 int32_t errorStatus(
string functionName);
234 int32_t socketOpen();
236 int32_t setupClient();
237 int32_t setupClient(
string a, uint16_t
p);
239 int32_t setupClientSimGen(
string a, uint16_t
p);
240 int32_t setupClientAcstb(
string a, uint16_t
p);
244 int32_t setupServer(uint16_t
port,
float timeout_sec);
247 int32_t send(
string package2send);
248 int32_t receiveLoop();
249 int32_t receiveOnce();
259 #endif // SOCKETLIB_H static string port
Definition: add_radio.cpp:16
vector< socket_channel > socket_find_addresses(NetworkType ntype)
Discover interfaces.
Definition: socketlib.cpp:547
Agent socket using Unicast UDP.
int32_t socket_set_udp_checksum(vector< uint8_t > &packet)
Set UDP checksum.
Definition: socketlib.cpp:428
Agent socket using Unicast TCP.
int32_t socket_close(socket_channel *channel)
Close socket.
Definition: socketlib.cpp:509
#define COSMOS_MAX_NAME
Largest JSON name.
Definition: cosmos-defs.h:55
SocketOptions()
Definition: socketlib.h:196
int iretn
Definition: rw_test.cpp:37
int32_t socket_sendto(socket_channel &channel, const string buffer, int flags=0)
Definition: socketlib.cpp:737
int32_t socket_accept(socket_channel server, socket_channel &client)
Definition: socketlib.cpp:311
int32_t socket_recvfrom(socket_channel &channel, vector< uint8_t > &buffer, size_t maxlen, int flags=0)
Definition: socketlib.cpp:720
#define SOCKET_TALK
Talk followed by optional listen (sendto address)
Definition: socketlib.h:82
static double * p
Definition: gauss_jackson_test.cpp:42
uint16_t cport
Definition: socketlib.h:130
char address[]
Definition: netperf_listen.cpp:69
Agent socket using Broadcast CSP.
#define SOCKET_RCVTIMEO
Default SOCKET RCVTIMEO (100 msec)
Definition: socketlib.h:91
static char buffer[255]
Definition: propagator_simple.cpp:60
NetworkType type
Definition: socketlib.h:118
Definition: socketlib.h:115
int32_t socket_check_udp_checksum(vector< uint8_t > packet)
Check UDP checksum.
Definition: socketlib.cpp:407
Headers and definitions common to all COSMOS.
string name
Definition: cubesat2obj.cpp:6
NetworkType
Definition: socketlib.h:63
#define SOCKET_BLOCKING
Blocking Agent.
Definition: socketlib.h:78
gige_handle * handle
Definition: kpc9612p_recv.cpp:33
int addrlen
Definition: socketlib.h:128
Definition: eci2kep_test.cpp:33
Agent socket using Broadcast UDP.
uint16_t msgsize
Definition: socketlib.h:132
NetworkType ntype
Definition: agent_node.cpp:50
Agent socket using Multicast UDP.
uint16_t socket_calc_udp_checksum(vector< uint8_t > packet)
Calculate UDP Checksum.
Definition: socketlib.cpp:335
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.
Definition: socketlib.cpp:51
int32_t socket_blocking(socket_channel *channel, bool blocking)
Definition: socketlib.cpp:448
Definition: socketlib.h:212
Definition: socketlib.h:167
SocketOptions sok
Definition: socketlib.h:218
string receivedData
Definition: socketlib.h:253