Main Page   Data Structures   File List   Data Fields   Globals  

nsds_util.h

Go to the documentation of this file.
00001 
00011 #if !defined(NSDS_UTIL_H_)
00012 
00014 #define NSDS_UTIL_H_
00015 
00016 
00017 #include <sys/types.h>
00018 #include <sys/socket.h>
00019 #include <netinet/in.h>
00020 #include <arpa/inet.h>
00021 #include <netdb.h>
00022 
00023 #include <stdlib.h>
00024 #include <stdio.h>
00025 #include <unistd.h>
00026 #include <stdint.h>
00027 #include <time.h>
00028 
00030 int pthread_setconcurrency(int new_level);
00031 
00032 // ---------------------------------------------------------------------
00034 typedef enum
00035 {
00036     SWAIT_SYS_ERR,
00037     SWAIT_TIMEOUT,
00038     SWAIT_GOT_DATA
00039 } socket_wait_ret;
00040 
00041 
00043 #if !defined(bool)
00044 typedef enum 
00045 {
00046     false, true
00047 } bool;
00048 #endif
00049 
00051 #define MAX_CMD_LEN 8192
00052 
00054 #define TSTAMP_LEN 32
00055 
00057 #define DATUM_LEN 32
00058 
00060 #define NUM_CHANNELS 128
00061 
00063 static const char BAD_PORT[] = "Invalid port request: bad or missing channel ID";
00064 
00066 static const char DATA_BUF_DELIM_CHARS[] = "\t\n\r";
00067 
00069 static const char CMD_BUF_DELIM_CHARS[] = " \n\r\t";
00070 
00071 /* Function prototypes*/
00072 int tcp_socket_make(const uint16_t SRV_PORT, const int QUEUE_LENGTH);
00073 int tcp_nl_write(const int socket, const char *buf);
00074 int tcp_nl_read(const uint16_t socket, char *buf, const time_t timeout);
00075 int tcp_connect(const char *server, const uint16_t port);
00076 socket_wait_ret tcp_socket_wait(const int socket, const time_t timeout);
00077 char * tcp_peername(const int socket);
00078 int tcp_connect_retry(const char *host, const uint16_t port,
00079               const time_t retry_delay, const time_t end_time,
00080               const char *description);
00081 void tcp_close(const int socket_fd);
00082 char *gen_timestamp(void);
00083 
00084 #endif

Generated on Fri Dec 6 14:33:16 2002 for NSDS Driver by doxygen1.2.18