]> andersk Git - moira.git/blob - server/mr_scall.c
Initial revision
[moira.git] / server / mr_scall.c
1 /*
2  *      $Source$
3  *      $Author$
4  *      $Header$
5  *
6  *      Copyright (C) 1987 by the Massachusetts Institute of Technology
7  *
8  *      $Log$
9  *      Revision 1.1  1987-06-02 20:07:10  wesommer
10  *      Initial revision
11  *
12  */
13
14 #ifndef lint
15 static char *rcsid_sms_scall_c = "$Header$";
16 #endif lint
17
18 #include <krb.h>
19 #include "sms_private.h"
20 #include "sms_server.h"
21 extern char buf1[];
22 extern int nclients;
23 extern char *whoami;
24
25 extern void clist_delete(), do_auth(), do_shutdown();
26 void do_call();
27
28 /*
29  * Welcome to the (finite state) machine (highest level).
30  */
31 void
32 do_client(cp)
33         client *cp;
34 {
35         if (OP_STATUS(cp->pending_op) == OP_CANCELLED) {
36                 (void) sprintf(buf1, "Closed connection (now %d client%s)",
37                                nclients-1,
38                                nclients!=2?"s":"");
39                 com_err(whoami, 0, buf1);
40                 clist_delete(cp);
41                 return;
42         }
43         switch (cp->action) {
44         case CL_ACCEPT:
45         case CL_SEND:
46                 /* Start recieving next request */
47                 initialize_operation(cp->pending_op, sms_start_recv,
48                                      (char *)&cp->args, NULL);
49                 queue_operation(cp->con, CON_INPUT, cp->pending_op);
50                 cp->action = CL_RECEIVE;
51                 break;
52         case CL_RECEIVE:
53                 /* Data is here. Process it & start it heading back */
54                 do_call(cp); /* This may block for a while. */
55                 initialize_operation(cp->pending_op, sms_start_send,
56                                      (char *)&cp->reply, NULL);
57                 queue_operation(cp->con, CON_OUTPUT, cp->pending_op);
58                 cp->action = CL_SEND;
59                 break;
60         }
61 }               
62
63 #ifdef notdef
64 char *procnames[] = {
65          "noop",
66          "auth",
67          "shutdown",
68          "retrieve",
69          "append",
70          "delete",
71          "edit",
72          };
73 #endif notdef
74
75 void
76 do_call(cl)
77         client *cl;
78 {
79         int pn;
80         cl->reply.sms_argc = 0;
81         cl->reply.sms_status = 0;
82         if (((pn = cl->args->sms_procno) < 0) ||
83             (pn > SMS_MAX_PROC)) {
84                 com_err(whoami, 0, "procno out of range");
85                 cl->reply.sms_status = SMS_UNKNOWN_PROC;
86                 return;
87         }
88 #ifdef SMS_DBG
89         fprintf(stderr, "[#%d] %s(", cl->id, procnames[pn]);
90         for (i=0; i < cl->args->sms_argc; i++) {
91                 if (i) fputc(',', stderr);
92                 frequote(stderr,cl->args->sms_argv[i]);
93         }
94         fprintf(stderr, ")\n");
95 #endif SMS_DBG
96
97         switch(pn) {
98         case SMS_NOOP:
99                 cl->reply.sms_status = 0;
100                 com_err(whoami, 0, "noop");
101                 return;
102         case SMS_AUTH:
103                 do_auth(cl);
104                 return;
105 #ifdef notdef
106         case SMS_RETRIEVE:
107                 do_retr(cl);
108                 return;
109 #endif notdef
110
111         case SMS_SHUTDOWN:
112                 do_shutdown(cl);
113                 return;
114         }
115 }
116
117 #ifdef notdef
118 do_retr(cl)
119         client *cl;
120 {
121         
122 }
123 #endif notdef
This page took 0.049058 seconds and 5 git commands to generate.