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