IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7892


Ignore:
Timestamp:
Jul 13, 2006, 9:22:35 AM (20 years ago)
Author:
eugene
Message:

working on the client/server interactions for pantasks

Location:
trunk/Ohana/src/opihi
Files:
12 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/Makefile

    r7721 r7892  
    1212pclient:  lib.data lib.shell cmd.basic
    1313pcontrol: lib.data lib.shell cmd.basic
     14
     15pantasks_server: lib.data lib.shell cmd.basic cmd.data cmd.astro
     16pantasks_client: lib.data lib.shell cmd.basic cmd.data cmd.astro
    1417
    1518LIBS = lib.data lib.shell cmd.basic cmd.data cmd.astro
     
    4750#############################################################
    4851
     52pantasks_client pantasks_server:
     53        if [ -d pantasks ]; then (cd pantasks && make $@); fi
     54
     55pantasks_client.install pantasks_server.install:
     56        if [ -d pantasks ]; then (cd pantasks && make $@); fi
     57
    4958$(PROGRAM) $(LIBS) $(EXTRAS):
    5059        if [ -d "$@" ]; then (cd $@ && make); fi
  • trunk/Ohana/src/opihi/cmd.basic/init.c

    r4748 r7892  
    8989 
    9090}
     91
     92void InitBasic_PantasksClient () {
     93 
     94  int i;
     95
     96  InitCommands ();
     97  InitMacros ();
     98  InitBuffers ();
     99  InitVectors ();
     100  InitVariables ();
     101  InitLists ();
     102  InitOutfile ();
     103
     104  for (i = 0; i < sizeof (cmds) / sizeof (Command); i++) {
     105    if (!strcmp (cmds[i].name, "quit")) goto valid;
     106    if (!strcmp (cmds[i].name, "exit")) goto valid;
     107    if (!strcmp (cmds[i].name, "exec")) goto valid;
     108    if (!strcmp (cmds[i].name, "!")) goto valid;
     109    continue;
     110
     111  valid:
     112    AddCommand (&cmds[i]);
     113  }
     114}
  • trunk/Ohana/src/opihi/dvo/fitsed.c

    r7688 r7892  
    11# include "dvoshell.h"
    2 # define NMIN_PTS 100
    32
    43typedef struct {
  • trunk/Ohana/src/opihi/include/basic.h

    r4689 r7892  
    55void cleanup ();
    66void InitBasic ();
     7void InitBasic_PantasksClient ();
  • trunk/Ohana/src/opihi/include/pantasks.h

    r6687 r7892  
    11# include "data.h"
    22# include "basic.h"
     3
     4# include <sys/time.h>
     5# include <time.h>
     6# include <zlib.h>
     7# include <netinet/ip.h>
     8# include <netdb.h>
     9# include <arpa/inet.h>
     10# include <pthread.h>
     11
     12typedef struct sockaddr_in SockAddress;
    313
    414typedef enum {
     
    120130
    121131void InitPantasks ();
     132void InitPantasksClient ();
    122133void InitTasks ();
    123134Task *NextTask ();
     
    183194void gotsignal (int signum);
    184195
     196void InitClients ();
     197void AddNewClient (int client);
     198void *ListenClients (void *data);
     199
     200int InitServerSocket (SockAddress *Address);
     201int WaitServerSocket (int InitSocket, SockAddress *Address);
     202int GetClientSocket (char *hostname);
     203int InitServerSocket_Named (char *hostname, SockAddress *Address);
  • trunk/Ohana/src/opihi/include/shell.h

    r5919 r7892  
    4949int           multicommand              PROTO((char *line));
    5050int           command                   PROTO((char *, char **));
     51int           command_client            PROTO((char *, char **));
    5152char         *expand_vars               PROTO((char *line));
    5253char         *expand_vectors            PROTO((char *line));
     
    8788int           ConfigInit                PROTO((int *argc, char **argv));
    8889char         *VarConfig                 PROTO((char *keyword, char *mode, void *ptr));
     90char         *VarConfigEntry            PROTO((char *keyword, char *mode, int entry, void *ptr));
    8991FILE         *GetOutfile                PROTO((void));
    9092void          InitOutfile               PROTO((void));
  • trunk/Ohana/src/opihi/lib.shell/ConfigInit.c

    r4833 r7892  
    4242  return (ptr);
    4343}
     44
     45char *VarConfigEntry (char *keyword, char *mode, int entry, void *ptr) {
     46
     47  char *answer;
     48
     49  answer = get_variable (keyword);
     50  if (answer == (char *) NULL) {
     51    answer = ScanConfig (GlobalConfig, keyword, mode, entry, ptr);
     52    return (answer);
     53  }
     54
     55  if (!strcmp (mode, "%s"))  strcpy ((char *) ptr, answer);
     56  if (!strcmp (mode, "%d"))  *(int *) ptr       = atoi (answer);
     57  if (!strcmp (mode, "%u"))  *(unsigned *) ptr  = atoi (answer);
     58  if (!strcmp (mode, "%ld")) *(long *) ptr      = atoi (answer);
     59  if (!strcmp (mode, "%hd")) *(short *) ptr     = atoi (answer);
     60  if (!strcmp (mode, "%f"))  *(float *) ptr     = atof (answer);
     61  if (!strcmp (mode, "%lf")) *(double *) ptr    = atof (answer);
     62
     63  free (answer);
     64  return (ptr);
     65}
  • trunk/Ohana/src/opihi/lib.shell/opihi.c

    r5919 r7892  
    22
    33/******************/
    4 int main (int argc, char **argv) {
     4int opihi (int argc, char **argv) {
    55
    66  int Nbad, status;
  • trunk/Ohana/src/opihi/mana/mana.c

    r5935 r7892  
    4444  return;
    4545}
     46
     47/* call to opihi shell */
     48int main (int argc, char **argv) {
     49  int status;
     50  status = opihi (argc, argv);
     51  exit (status);
     52}
  • trunk/Ohana/src/opihi/pantasks/Makefile

    r6687 r7892  
    2525# sched user commands and support functions ########################
    2626
     27single = \
     28$(SDIR)/pantasks.$(ARCH).o
     29
    2730funcs = \
    28 $(SDIR)/pantasks.$(ARCH).o \
    2931$(SDIR)/init.$(ARCH).o \
    3032$(SDIR)/CheckJobs.$(ARCH).o \
     
    6365$(SDIR)/version.$(ARCH).o
    6466
     67client = \
     68$(SDIR)/pantasks_client.$(ARCH).o \
     69$(SDIR)/client_shell.$(ARCH).o \
     70$(SDIR)/invalid.$(ARCH).o \
     71$(SDIR)/init_client.$(ARCH).o \
     72$(SDIR)/SocketOps.$(ARCH).o
     73
     74server = \
     75$(SDIR)/pantasks_server.$(ARCH).o \
     76$(SDIR)/ListenClients.$(ARCH).o \
     77$(SDIR)/CheckPassword.$(ARCH).o \
     78$(SDIR)/SocketOps.$(ARCH).o
     79
    6580libs = \
    6681$(DESTLIB)/libshell.a \
     
    7186
    7287pantasks: $(BIN)/pantasks.$(ARCH)
     88$(BIN)/pantasks.$(ARCH) : $(single) $(funcs) $(cmds) $(libs)
    7389
    74 $(BIN)/pantasks.$(ARCH) : $(funcs) $(cmds) $(libs)
     90pantasks_client: $(BIN)/pantasks_client.$(ARCH)
     91$(BIN)/pantasks_client.$(ARCH) : $(client) $(libs)
    7592
    76 install: $(DESTBIN)/pantasks help
     93pantasks_server: $(BIN)/pantasks_server.$(ARCH)
     94$(BIN)/pantasks_server.$(ARCH) : $(server) $(funcs) $(cmds) $(libs)
     95        @if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
     96        $(CC) -o $@ $^ $(LFLAGS) -lpthread
     97
     98pantasks_client.install: $(DESTBIN)/pantasks_client
     99pantasks_server.install: $(DESTBIN)/pantasks_server
     100
     101install: $(DESTBIN)/pantasks $(DESTBIN)/pantasks_client $(DESTBIN)/pantasks_server help
    77102
    78103help: cmd.basic.help cmd.data.help cmd.astro.help pantasks.help
    79104
    80 .PHONY: pantasks
     105.PHONY: pantasks pantasks_client pantasks_server
    81106
    82107include ../Makefile.Common
  • trunk/Ohana/src/opihi/pantasks/init.c

    r6687 r7892  
    3434  {"kill",       kill_job,     "kill job"},
    3535  {"delete",     delete_job,   "delete job"},
    36   {"version",     version,      "show version information"},
     36  {"version",    version,      "show version information"},
    3737  {"verbose",    verbose,      "set/toggle verbose mode"},
    3838};
Note: See TracChangeset for help on using the changeset viewer.