TwiceAsNice  2019-02-18
Classes | Macros | Functions | Variables
indiserver.c File Reference
#include "config.h"
#include "fq.h"
#include "indiapi.h"
#include "indidevapi.h"
#include "lilxml.h"
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/socket.h>
Include dependency graph for indiserver.c:

Classes

struct  Msg
 
struct  Property
 
struct  ClInfo
 
struct  DvrInfo
 

Macros

#define INDIPORT   7624 /* default TCP/IP port to listen */
 
#define REMOTEDVR   (-1234) /* invalid PID to flag remote drivers */
 
#define MAXSBUF   512
 
#define MAXRBUF   49152 /* max read buffering here */
 
#define MAXWSIZ   49152 /* max bytes/write */
 
#define DEFMAXQSIZ   128 /* default max q behind, MB */
 
#define DEFMAXSSIZ   5 /* default max stream behind, MB */
 
#define DEFMAXRESTART   10 /* default max restarts */
 

Functions

static void logStartup (int ac, char *av[])
 
static void usage (void)
 
static void reapZombies (void)
 
static void noSIGPIPE (void)
 
static void indiFIFO (void)
 
static void indiRun (void)
 
static void indiListen (void)
 
static void newFIFO (void)
 
static void newClient (void)
 
static int newClSocket (void)
 
static void shutdownClient (ClInfo *cp)
 
static int readFromClient (ClInfo *cp)
 
static void startDvr (DvrInfo *dp)
 
static void startLocalDvr (DvrInfo *dp)
 
static void startRemoteDvr (DvrInfo *dp)
 
static int openINDIServer (char host[], int indi_port)
 
static void shutdownDvr (DvrInfo *dp, int restart)
 
static int isDeviceInDriver (const char *dev, DvrInfo *dp)
 
static void q2RDrivers (const char *dev, Msg *mp, XMLEle *root)
 
static void q2SDrivers (DvrInfo *me, int isblob, const char *dev, const char *name, Msg *mp, XMLEle *root)
 
static int q2Clients (ClInfo *notme, int isblob, const char *dev, const char *name, Msg *mp, XMLEle *root)
 
static int q2Servers (DvrInfo *me, Msg *mp, XMLEle *root)
 
static void addSDevice (DvrInfo *dp, const char *dev, const char *name)
 
static PropertyfindSDevice (DvrInfo *dp, const char *dev, const char *name)
 
static void addClDevice (ClInfo *cp, const char *dev, const char *name, int isblob)
 
static int findClDevice (ClInfo *cp, const char *dev, const char *name)
 
static int readFromDriver (DvrInfo *dp)
 
static int stderrFromDriver (DvrInfo *dp)
 
static int msgQSize (FQ *q)
 
static void setMsgXMLEle (Msg *mp, XMLEle *root)
 
static void setMsgStr (Msg *mp, char *str)
 
static void freeMsg (Msg *mp)
 
static MsgnewMsg (void)
 
static int sendClientMsg (ClInfo *cp)
 
static int sendDriverMsg (DvrInfo *cp)
 
static void crackBLOB (const char *enableBLOB, BLOBHandling *bp)
 
static void crackBLOBHandling (const char *dev, const char *name, const char *enableBLOB, ClInfo *cp)
 
static void traceMsg (XMLEle *root)
 
static char * indi_tstamp (char *s)
 
static void logDMsg (XMLEle *root, const char *dev)
 
static void Bye (void)
 
int main (int ac, char *av[])
 
static void zombieRaised (int signum, siginfo_t *sig, void *data)
 
static DvrInfoallocDvr ()
 

Variables

struct {
   const char *   name
 
   int   fd
 
fifo
 
static ClInfoclinfo
 
static int nclinfo
 
static DvrInfodvrinfo
 
static int ndvrinfo
 
static char * me
 
static int port = INDIPORT
 
static int verbose
 
static int lsocket
 
static char * ldir
 
static int maxqsiz = (DEFMAXQSIZ * 1024 * 1024)
 
static int maxstreamsiz = (DEFMAXSSIZ * 1024 * 1024)
 
static int maxrestarts = DEFMAXRESTART
 
static int terminateddrv = 0
 

Macro Definition Documentation

◆ DEFMAXQSIZ

#define DEFMAXQSIZ   128 /* default max q behind, MB */

◆ DEFMAXRESTART

#define DEFMAXRESTART   10 /* default max restarts */

◆ DEFMAXSSIZ

#define DEFMAXSSIZ   5 /* default max stream behind, MB */

◆ INDIPORT

#define INDIPORT   7624 /* default TCP/IP port to listen */

◆ MAXRBUF

#define MAXRBUF   49152 /* max read buffering here */

◆ MAXSBUF

#define MAXSBUF   512

◆ MAXWSIZ

#define MAXWSIZ   49152 /* max bytes/write */

◆ REMOTEDVR

#define REMOTEDVR   (-1234) /* invalid PID to flag remote drivers */

Function Documentation

◆ addClDevice()

static void addClDevice ( ClInfo cp,
const char *  dev,
const char *  name,
int  isblob 
)
static

◆ addSDevice()

static void addSDevice ( DvrInfo dp,
const char *  dev,
const char *  name 
)
static

◆ allocDvr()

static DvrInfo* allocDvr ( )
static

◆ Bye()

static void Bye ( void  )
static

◆ crackBLOB()

static void crackBLOB ( const char *  enableBLOB,
BLOBHandling bp 
)
static

◆ crackBLOBHandling()

static void crackBLOBHandling ( const char *  dev,
const char *  name,
const char *  enableBLOB,
ClInfo cp 
)
static

◆ findClDevice()

static int findClDevice ( ClInfo cp,
const char *  dev,
const char *  name 
)
static

◆ findSDevice()

static Property * findSDevice ( DvrInfo dp,
const char *  dev,
const char *  name 
)
static

◆ freeMsg()

static void freeMsg ( Msg mp)
static

◆ indi_tstamp()

static char * indi_tstamp ( char *  s)
static

◆ indiFIFO()

static void indiFIFO ( void  )
static

◆ indiListen()

static void indiListen ( void  )
static

◆ indiRun()

static void indiRun ( void  )
static

◆ isDeviceInDriver()

int isDeviceInDriver ( const char *  dev,
DvrInfo dp 
)
static

◆ logDMsg()

static void logDMsg ( XMLEle root,
const char *  dev 
)
static

◆ logStartup()

static void logStartup ( int  ac,
char *  av[] 
)
static

◆ main()

int main ( int  ac,
char *  av[] 
)

◆ msgQSize()

static int msgQSize ( FQ q)
static

◆ newClient()

static void newClient ( void  )
static

◆ newClSocket()

static int newClSocket ( void  )
static

◆ newFIFO()

static void newFIFO ( void  )
static

◆ newMsg()

static Msg * newMsg ( void  )
static

◆ noSIGPIPE()

static void noSIGPIPE ( void  )
static

◆ openINDIServer()

static int openINDIServer ( char  host[],
int  indi_port 
)
static

◆ q2Clients()

static int q2Clients ( ClInfo notme,
int  isblob,
const char *  dev,
const char *  name,
Msg mp,
XMLEle root 
)
static

◆ q2RDrivers()

static void q2RDrivers ( const char *  dev,
Msg mp,
XMLEle root 
)
static

◆ q2SDrivers()

static void q2SDrivers ( DvrInfo me,
int  isblob,
const char *  dev,
const char *  name,
Msg mp,
XMLEle root 
)
static

◆ q2Servers()

static int q2Servers ( DvrInfo me,
Msg mp,
XMLEle root 
)
static

◆ readFromClient()

static int readFromClient ( ClInfo cp)
static

◆ readFromDriver()

static int readFromDriver ( DvrInfo dp)
static

◆ reapZombies()

static void reapZombies ( void  )
static

◆ sendClientMsg()

static int sendClientMsg ( ClInfo cp)
static

◆ sendDriverMsg()

static int sendDriverMsg ( DvrInfo cp)
static

◆ setMsgStr()

static void setMsgStr ( Msg mp,
char *  str 
)
static

◆ setMsgXMLEle()

static void setMsgXMLEle ( Msg mp,
XMLEle root 
)
static

◆ shutdownClient()

static void shutdownClient ( ClInfo cp)
static

◆ shutdownDvr()

static void shutdownDvr ( DvrInfo dp,
int  restart 
)
static

◆ startDvr()

static void startDvr ( DvrInfo dp)
static

◆ startLocalDvr()

static void startLocalDvr ( DvrInfo dp)
static

◆ startRemoteDvr()

static void startRemoteDvr ( DvrInfo dp)
static

◆ stderrFromDriver()

static int stderrFromDriver ( DvrInfo dp)
static

◆ traceMsg()

static void traceMsg ( XMLEle root)
static

◆ usage()

static void usage ( void  )
static

◆ zombieRaised()

static void zombieRaised ( int  signum,
siginfo_t *  sig,
void *  data 
)
static

Variable Documentation

◆ clinfo

ClInfo* clinfo
static

◆ dvrinfo

DvrInfo* dvrinfo
static

◆ fd

int fd

◆ fifo

struct { ... } fifo

◆ ldir

char* ldir
static

◆ lsocket

int lsocket
static

◆ maxqsiz

int maxqsiz = (DEFMAXQSIZ * 1024 * 1024)
static

◆ maxrestarts

int maxrestarts = DEFMAXRESTART
static

◆ maxstreamsiz

int maxstreamsiz = (DEFMAXSSIZ * 1024 * 1024)
static

◆ me

char* me
static

◆ name

const char* name

◆ nclinfo

int nclinfo
static

◆ ndvrinfo

int ndvrinfo
static

◆ port

int port = INDIPORT
static

◆ terminateddrv

int terminateddrv = 0
static

◆ verbose

int verbose
static