SDDSlib
|
Server program to log data to SDDS (Self Describing Data Sets) files. More...
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <signal.h>
#include <sys/stat.h>
#include <dirent.h>
#include "mdb.h"
#include "SDDS.h"
#include "scan.h"
Go to the source code of this file.
Macros | |
#define | BUFLEN 16384 |
#define | DISCONNECT 0 /* Disconnect from the server—forces server to terminate the forked process */ |
#define | ADD_VALUE 1 |
#define | MAKE_DIRECTORY 2 |
#define | CHANGE_DIRECTORY 3 |
#define | GET_TIME_SPAN 4 /* Get values between two times */ |
#define | GET_LAST_N 5 /* Get last N values */ |
#define | SDDSPLOT 6 /* Make an sddsplot and return its URL */ |
#define | ADD_CHANNEL 7 |
#define | DELETE_VALUE 8 |
#define | UPDATE_CHD 9 |
#define | LIST_DIRS 10 |
#define | LIST_CHANNELS 11 |
#define | N_COMMANDS 12 |
#define | CLI_PORT 0 |
#define | CLI_ROOT 1 |
#define | CLI_FORBID 2 |
#define | CLI_SDDSPLOT_PATH 3 |
#define | N_OPTIONS 4 |
Functions | |
int | dostuff (int) |
int | createChannel (char *spec) |
int | addValue (char *spec) |
int | runSddsplot (char *returnBuffer, char *options) |
void | updateChannelDescription (void) |
int | makeDirectoryList (int64_t *returnNumber, char ***returnBuffer) |
int | getChannelList (int64_t *returnNumber, char ***returnBuffer) |
void | error (const char *msg, char *progName) |
int | writeReply (int sock, const char *message, int code) |
int | writeReplyList (int sock, int64_t nItems, char **messageList) |
void | freeReplyList (int64_t nItems, char **item) |
int | chdirFromRoot (char *path) |
void | shutdownServer (int arg) |
int | main (int argc, char *argv[]) |
Variables | |
char * | rootDir |
char * | command [N_COMMANDS] |
short | forbid [N_COMMANDS] |
char * | option [N_OPTIONS] |
const char * | USAGE |
char * | sddsplotPath = NULL |
static int | sockfd = -1 |
Server program to log data to SDDS (Self Describing Data Sets) files.
This program listens on a specified port and handles multiple client connections to log data into SDDS files. It supports various commands such as adding values, creating channels, making directories, and generating SDDS plots.
Features:
Usage:
Options:
-port
Port number on which the server listens (required).-root
Path of the root directory (optional, defaults to current directory).-forbid
Comma-separated list of commands to forbid (optional).-sddsplotPath
Pathname for SDDS plot output files (optional).Definition in file sddslogserver.c.
#define ADD_CHANNEL 7 |
Definition at line 71 of file sddslogserver.c.
#define ADD_VALUE 1 |
Definition at line 65 of file sddslogserver.c.
#define BUFLEN 16384 |
Definition at line 52 of file sddslogserver.c.
#define CHANGE_DIRECTORY 3 |
Definition at line 67 of file sddslogserver.c.
#define CLI_FORBID 2 |
Definition at line 164 of file sddslogserver.c.
#define CLI_PORT 0 |
Definition at line 162 of file sddslogserver.c.
#define CLI_ROOT 1 |
Definition at line 163 of file sddslogserver.c.
#define CLI_SDDSPLOT_PATH 3 |
Definition at line 165 of file sddslogserver.c.
#define DELETE_VALUE 8 |
Definition at line 72 of file sddslogserver.c.
#define DISCONNECT 0 /* Disconnect from the server—forces server to terminate the forked process */ |
Definition at line 64 of file sddslogserver.c.
#define GET_LAST_N 5 /* Get last N values */ |
Definition at line 69 of file sddslogserver.c.
#define GET_TIME_SPAN 4 /* Get values between two times */ |
Definition at line 68 of file sddslogserver.c.
#define LIST_CHANNELS 11 |
Definition at line 75 of file sddslogserver.c.
#define LIST_DIRS 10 |
Definition at line 74 of file sddslogserver.c.
#define MAKE_DIRECTORY 2 |
Definition at line 66 of file sddslogserver.c.
#define N_COMMANDS 12 |
Definition at line 76 of file sddslogserver.c.
#define N_OPTIONS 4 |
Definition at line 166 of file sddslogserver.c.
#define SDDSPLOT 6 /* Make an sddsplot and return its URL */ |
Definition at line 70 of file sddslogserver.c.
#define UPDATE_CHD 9 |
Definition at line 73 of file sddslogserver.c.
int addValue | ( | char * | spec | ) |
Definition at line 512 of file sddslogserver.c.
int chdirFromRoot | ( | char * | path | ) |
Definition at line 155 of file sddslogserver.c.
int createChannel | ( | char * | spec | ) |
Definition at line 458 of file sddslogserver.c.
int dostuff | ( | int | sock | ) |
Definition at line 340 of file sddslogserver.c.
void error | ( | const char * | msg, |
char * | progName ) |
Definition at line 108 of file sddslogserver.c.
void freeReplyList | ( | int64_t | nItems, |
char ** | item ) |
Definition at line 145 of file sddslogserver.c.
int getChannelList | ( | int64_t * | returnNumber, |
char *** | returnBuffer ) |
Definition at line 729 of file sddslogserver.c.
int main | ( | int | argc, |
char * | argv[] ) |
Definition at line 198 of file sddslogserver.c.
int makeDirectoryList | ( | int64_t * | returnNumber, |
char *** | returnBuffer ) |
Definition at line 695 of file sddslogserver.c.
int runSddsplot | ( | char * | returnBuffer, |
char * | options ) |
Definition at line 629 of file sddslogserver.c.
void shutdownServer | ( | int | arg | ) |
Definition at line 190 of file sddslogserver.c.
void updateChannelDescription | ( | void | ) |
Definition at line 507 of file sddslogserver.c.
int writeReply | ( | int | sock, |
const char * | message, | ||
int | code ) |
Definition at line 115 of file sddslogserver.c.
int writeReplyList | ( | int | sock, |
int64_t | nItems, | ||
char ** | messageList ) |
Definition at line 126 of file sddslogserver.c.
char* command[N_COMMANDS] |
Definition at line 78 of file sddslogserver.c.
short forbid[N_COMMANDS] |
Definition at line 93 of file sddslogserver.c.
char* option[N_OPTIONS] |
Definition at line 168 of file sddslogserver.c.
char* rootDir |
Definition at line 62 of file sddslogserver.c.
char* sddsplotPath = NULL |
Definition at line 186 of file sddslogserver.c.
|
static |
Definition at line 188 of file sddslogserver.c.
const char* USAGE |
Definition at line 175 of file sddslogserver.c.