#include "nsds_util.h"
#include "flog.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
Go to the source code of this file.
Functions | |
char * | gen_timestamp (void) |
Generate an ISO 8601-compliant timestamp. | |
int | tcp_socket_make (const uint16_t SRV_PORT, const int QUEUE_LENGTH) |
Create server socket, ready for accept(). | |
int | tcp_nl_write (const int socket, const char *buf) |
Send a string, appending a newline character. | |
int | tcp_nl_read (const uint16_t socket, char *buf, const time_t timeout) |
Read until EOL or MAX_CMD_LEN bytes. | |
int | tcp_connect (const char *server, const uint16_t port) |
Routine, after Comer, for opening a TCP connection. | |
socket_wait_ret | tcp_socket_wait (const int socket, const time_t timeout) |
Function to wait on a socket, with or without timeout. | |
char * | tcp_peername (const int socket) |
Function to return a string w/name of connected peer. | |
int | tcp_connect_retry (const char *host, const uint16_t port, const time_t retry_delay, const time_t end_time, const char *description) |
Loop until can open client connection. | |
void | tcp_close (const int socket_fd) |
Shutdown and close TCP socket. | |
Variables | |
bool | control_break |
Global boolean set by signal handler to force exit. |
Definition in file nsds_util.c.
|
Generate an ISO 8601-compliant timestamp.
Definition at line 46 of file nsds_util.c. Referenced by daq_thread_main(). |
|
Shutdown and close TCP socket. Does shutdown (read/write) and then close if fd > 0
Definition at line 620 of file nsds_util.c. Referenced by daq_main_loop(), and main_loop(). |
|
Routine, after Comer, for opening a TCP connection. ---------------------------------------------------------------------
Definition at line 359 of file nsds_util.c. Referenced by tcp_connect_retry(). |
|
Loop until can open client connection.
Definition at line 562 of file nsds_util.c. References tcp_connect(). Referenced by main_loop(). |
|
Read until EOL or MAX_CMD_LEN bytes. --------------------------------------------------------------------- Read from TCP into static buffer until
Yeah, yeah, I know already. Needs dynamic buffers, or sizing, or code that Sucks Less.
Definition at line 246 of file nsds_util.c. References MAX_CMD_LEN, socket_wait_ret, and tcp_socket_wait(). Referenced by cmd_handler(), and daq_do_work(). |
|
Send a string, appending a newline character. ---------------------------------------------------------------------
Definition at line 194 of file nsds_util.c. Referenced by cmd_handler(), daq_do_work(), daq_thread_main(), and tcp_send_driverids(). |
|
Function to return a string w/name of connected peer.
Definition at line 510 of file nsds_util.c. Referenced by daq_main_loop(), and main_loop(). |
|
Create server socket, ready for accept(). ---------------------------------------------------------------------
Definition at line 100 of file nsds_util.c. References QUEUE_LENGTH, and SRV_PORT. Referenced by daq_main_loop(). |
|
Function to wait on a socket, with or without timeout. Blocking or non-blocking wait until a socket is ready for reading. Used in functions that cannot wait forever, as well as ones that can.
Definition at line 437 of file nsds_util.c. References socket_wait_ret. Referenced by tcp_nl_read(). |
|
Global boolean set by signal handler to force exit.
Definition at line 30 of file nsds_util.c. Referenced by daq_main_loop(), daq_thread_main(), main(), and sighandler(). |