]> andersk Git - moira.git/blobdiff - server/mr_server.h
Changes from dtanner.
[moira.git] / server / mr_server.h
index 80306cb3cf5819d17d98b20d2609503795178d36..33921e71af6c51eecd2106c4846db99ec616c27d 100644 (file)
@@ -6,8 +6,9 @@
  */
 
 #include <moira.h>
-#include <mr_proto.h>
+#include <mr_private.h>
 #include <moira_site.h>
+#include <moira_schema.h>
 
 #include <netinet/in.h>
 
 
 #include <krb.h>
 
-typedef struct returned_tuples {
-  struct returned_tuples *next;
-  OPERATION op;
-  mr_params *retval;
-} returned_tuples;
-
-/*
- * This should be in the kerberos header file.
- */
-
-struct krbname {
-  char name[ANAME_SZ];
-  char inst[INST_SZ];
-  char realm[REALM_SZ];
-};
+enum clstate { CL_ACCEPTING, CL_ACTIVE, CL_CLOSING };
 
 /*
  * This structure holds all per-client information; one of these is
@@ -37,53 +24,27 @@ struct krbname {
  */
 
 typedef struct _client {
-  OPERATION pending_op;                /* Primary pending operation */
-  CONNECTION con;              /* Connection to the client */
-  int action;                  /* what action is pending? */
-  mr_params *args, reply;
+  int con;                     /* Connection to the client */
   int id;                      /* Unique id of client */
   struct sockaddr_in haddr;    /* IP address of client */
+  enum clstate state;          /* State of the connection */
   char clname[MAX_K_NAME_SZ];  /* Name client authenticated to */
-  struct krbname kname;        /* Parsed version of the above */
+  char entity[USERS_MODWITH_SIZE]; /* client program being used */
   int users_id;                        /* Moira-internal ID of authenticated user */
-  int client_id;               /* Moira-internal ID of client for modby field */
-  returned_tuples *first, *last;
+  int client_id;               /* Moira-internal ID of client */
+  int proxy_id;                        /* client_id of orig user, if proxied */
+  int version;                 /* Max query version known by client */
   time_t last_time_used;       /* Last time connection used */
-  char entity[9];              /* entity on other end of the connection */
+  mr_params req;               /* Current request */
+  mr_params *tuples;           /* Tuples waiting to send back to client */
+  int ntuples;                 /* Number of tuples waiting */
+  int tuplessize;              /* Current size of tuple array */
+  int nexttuple;               /* Next tuple to return */
+  char *hsbuf;                 /* Buffer for initial connection handshaking */
+  int hslen;                   /* Length of data in hsbuf */
 } client;
 
-/*
- * States
- */
-
-#define CL_DEAD 0
-#define CL_STARTING 1
-
-/*
- * Actions.
- */
-
-#define CL_ACCEPT 0
-#define CL_RECEIVE 1
-#define CL_SEND 2
-
-extern char *krb_realm;
-
-/*
- * Debugging options.
- */
-
-extern int log_flags;
-
-#define LOG_CONNECT            0x0001
-#define LOG_REQUESTS           0x0002
-#define LOG_ARGS               0x0004
-#define LOG_RESP               0x0008
-#define LOG_RES                        0x0010
-#define LOG_VALID              0x0020
-#define LOG_SQL                        0x0040
-#define LOG_GDSS               0x0080
-
+extern char krb_realm[REALM_SZ];
 
 /* max length of query argument allowed */
 #define ARGLEN 257
@@ -91,10 +52,10 @@ extern int log_flags;
 #define QMAXARGS       22
 
 /* statistics on number of queries by version number */
-extern int newqueries, oldqueries;
+extern int newqueries;
 
-/* Maximum and minimum values that will ever be chosen for IDs */
-#define MAX_ID_VALUE   31999
+/* Maximum and minimum values that will be used for uids and gids */
+#define MAX_ID_VALUE   65535
 #define MIN_ID_VALUE   100
 
 /* Sleepy states for the server! */
@@ -117,19 +78,6 @@ struct query;
 struct validate;
 struct valobj;
 
-/* prototypes from gdb */
-int gdb_init(void);
-int gdb_debug(int flag);
-void start_accepting_client(CONNECTION, OPERATION, CONNECTION *,
-                            char *, int *, TUPLE *);
-int initialize_operation(OPERATION, int (*init_function)(OPERATION, HALF_CONNECTION, void *),
-                        char *, int (*cancel_function)(HALF_CONNECTION, void *));
-int reset_operation(OPERATION);
-int delete_operation(OPERATION);
-int start_replying_to_client(OPERATION, CONNECTION, int, char *, char *);
-int op_select(LIST_OF_OPERATIONS, int, fd_set *, fd_set *, fd_set *,
-             struct timeval *);
-
 /* prototypes from increment.dc */
 void incremental_init(void);
 void next_incremental(void);
@@ -149,7 +97,7 @@ int set_krb_mapping(char *name, char *login, int ok, int *kid, int *uid);
 int find_member(char *list_type, int list_id, client *cl);
 int do_for_all_rows(char *query, int count,
                    int (*action)(int, char *[], void *), void *actarg);
-void build_qual(char *fmt, int argc, char *argv[], char *qual);
+char *build_qual(char *fmt, int argc, char *argv[]);
 
 
 /* prototyoes from qsupport.dc */
@@ -165,25 +113,33 @@ void clist_delete(client *cp);
 
 /* prototypes from mr_sauth.c */
 void do_auth(client *cl);
+void do_proxy(client *cl);
 
 /* prototypes from mr_scall.c */
-void do_client(client *cp);
-int trigger_dcm(struct query *q, char *argv[], client *cl);
+void do_client(client *cl);
+void client_reply(client *cl, long status);
+void client_return_tuple(client *cl, int argc, char **argv);
+void client_read(client *cl);
+void client_write(client *cl);
 
 /* prototypes from mr_shutdown.c */
 void sigshut(int);
 void do_shutdown(client *cl);
 
 /* prototypes from mr_util.c */
-char *requote(char *buf, char *cp, int len);
+char *requote(char *buf);
 void log_args(char *tag, int version, int argc, char **argv);
 void mr_com_err(const char *whoami, long code, const char *fmt, va_list pvar);
 int mr_trim_args(int argc, char **argv);
 char **mr_copy_args(char **argv, int argc);
+void *xmalloc(size_t);
+void *xrealloc(void *, size_t);
+char *xstrdup(char *);
 
 /* prototypes from qaccess.pc */
 int access_user(struct query *q, char *argv[], client *cl);
 int access_login(struct query *q, char *argv[], client *cl);
+int access_spob(struct query *q, char *argv[], client *cl);
 int access_list(struct query *q, char *argv[], client *cl);
 int access_visible_list(struct query *q, char *argv[], client *cl);
 int access_vis_list_by_name(struct query *q, char *argv[], client *cl);
@@ -194,6 +150,9 @@ int access_filesys(struct query *q, char *argv[], client *cl);
 int access_host(struct query *q, char *argv[], client *cl);
 int access_ahal(struct query *q, char *argv[], client *cl);
 int access_snt(struct query *q, char *argv[], client *cl);
+int access_printer(struct query *q, char *argv[], client *cl);
+int access_zephyr(struct query *q, char *argv[], client *cl);
+int access_container(struct query *q, char *argv[], client *cl);
 
 /* prototypes from qfollow.pc */
 int followup_fix_modby(struct query *q, struct save_queue *sq,
@@ -205,6 +164,9 @@ int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
 int followup_glin(struct query *q, struct save_queue *sq, struct validate *v,
                  int (*action)(int, char **, void *), void *actarg,
                  client *cl);
+int followup_gsin(struct query *q, struct save_queue *sq, struct validate *v,
+                 int (*action)(int, char **, void *), void *actarg,
+                 client *cl);
 int followup_gzcl(struct query *q, struct save_queue *sq, struct validate *v,
                  int (*action)(int, char **, void *), void *actarg,
                  client *cl);
@@ -214,9 +176,6 @@ int followup_gsha(struct query *q, struct save_queue *sq, struct validate *v,
 int followup_gqot(struct query *q, struct save_queue *sq, struct validate *v,
                  int (*action)(int, char **, void *), void *actarg,
                  client *cl);
-int followup_gpce(struct query *q, struct save_queue *sq, struct validate *v,
-                 int (*action)(int, char **, void *), void *actarg,
-                 client *cl);
 int followup_guax(struct query *q, struct save_queue *sq, struct validate *v,
                  int (*action)(int, char **, void *), void *actarg,
                  client *cl);
@@ -226,11 +185,16 @@ int followup_gsnt(struct query *q, struct save_queue *sq, struct validate *v,
 int followup_ghst(struct query *q, struct save_queue *sq, struct validate *v,
                  int (*action)(int, char **, void *), void *actarg,
                  client *cl);
+int followup_gpsv(struct query *q, struct save_queue *sq, struct validate *v,
+                 int (*action)(int, char **, void *), void *actarg,
+                 client *cl);
+int followup_gcon(struct query *q, struct save_queue *sq, struct validate *v,
+                 int (*action)(int, char **, void *), void *actarg,
+                 client *cl);
 
 int followup_ausr(struct query *q, char *argv[], client *cl);
 int followup_aqot(struct query *q, char *argv[], client *cl);
 int followup_dqot(struct query *q, char *argv[], client *cl);
-int followup_uuac(struct query *q, char *argv[], client *cl);
 
 int set_modtime(struct query *q, char *argv[], client *cl);
 int set_modtime_by_id(struct query *q, char *argv[], client *cl);
@@ -243,14 +207,15 @@ int set_serverhost_modtime(struct query *q, char *argv[], client *cl);
 int set_nfsphys_modtime(struct query *q, char *argv[], client *cl);
 int set_filesys_modtime(struct query *q, char *argv[], client *cl);
 int set_zephyr_modtime(struct query *q, char *argv[], client *cl);
+int set_service_modtime(struct query *q, char *argv[], client *cl);
 int _sdl_followup(struct query *q, char *argv[], client *cl);
+int trigger_dcm(struct query *q, char *argv[], client *cl);
 
 /* prototypes from qsetup.pc */
 int prefetch_value(struct query *q, char *argv[], client *cl);
 int prefetch_filesys(struct query *q, char *argv[], client *cl);
 int setup_ausr(struct query *q, char *argv[], client *cl);
 int setup_dusr(struct query *q, char *argv[], client *cl);
-int setup_spop(struct query *q, char *argv[], client *cl);
 int setup_dpob(struct query *q, char *argv[], client *cl);
 int setup_dmac(struct query *q, char *argv[], client *cl);
 int setup_dclu(struct query *q, char *argv[], client *cl);
@@ -264,28 +229,32 @@ int setup_dfil(struct query *q, char *argv[], client *cl);
 int setup_aftg(struct query *q, char *argv[], client *cl);
 int setup_dnfp(struct query *q, char *argv[], client *cl);
 int setup_dqot(struct query *q, char *argv[], client *cl);
-int setup_akum(struct query *q, char *argv[], client *cl);
 int setup_dsnt(struct query *q, char *argv[], client *cl);
 int setup_ahst(struct query *q, char *argv[], client *cl);
 int setup_ahal(struct query *q, char *argv[], client *cl);
+int setup_uhha(struct query *q, char *argv[], client *cl);
+int setup_aprn(struct query *q, char *argv[], client *cl);
+int setup_dpsv(struct query *q, char *argv[], client *cl);
+int setup_dcon(struct query *q, char *argv[], client *cl);
 
 /* prototypes from qsupport.pc */
 int set_pobox(struct query *q, char *argv[], client *cl);
+int set_pobox_pop(struct query *q, char *argv[], client *cl);
 int add_member_to_list(struct query *q, char *argv[], client *cl);
 int delete_member_from_list(struct query *q, char *argv[], client *cl);
+int tag_member_of_list(struct query *q, char *argv[], client *cl);
 int register_user(struct query *q, char *argv[], client *cl);
+int do_user_reservation(struct query *q, char *argv[], client *cl);
+int update_container(struct query *q, char *argv[], client *cl);
 
-int get_list_info(struct query *q, char **argv, client *cl,
-                 int (*action)(int, char *[], void *), void *actarg);
 int get_ace_use(struct query *q, char **argv, client *cl,
                int (*action)(int, char *[], void *), void *actarg);
+int get_host_by_owner(struct query *q, char **argv, client *cl,
+               int (*action)(int, char *[], void *), void *actarg);
 int qualified_get_lists(struct query *q, char **argv, client *cl,
                        int (*action)(int, char *[], void *), void *actarg);
 int get_members_of_list(struct query *q, char **argv, client *cl,
                        int (*action)(int, char *[], void *), void *actarg);
-int get_end_members_of_list(struct query *q, char **argv, client *cl,
-                           int (*action)(int, char *[], void *),
-                           void *actarg);
 int qualified_get_server(struct query *q, char **argv, client *cl,
                         int (*action)(int, char *[], void *), void *actarg);
 int qualified_get_serverhost(struct query *q, char **argv, client *cl,
@@ -295,8 +264,19 @@ int count_members_of_list(struct query *q, char **argv, client *cl,
                          int (*action)(int, char *[], void *), void *actarg);
 int get_lists_of_member(struct query *q, char **argv, client *cl,
                        int (*action)(int, char *[], void *), void *actarg);
+int get_user_reservations(struct query *q, char **argv, client *cl,
+                         int (*action)(int, char *[], void *), void *actarg);
+int get_user_by_reservation(struct query *q, char **argv, client *cl,
+                           int (*action)(int, char *[], void *),
+                           void *actarg);
+int get_machines_of_container(struct query *q, char **argv, client *cl,
+                           int (*action)(int, char *[], void *),
+                           void *actarg);
+int get_subcontainers_of_container(struct query *q, char **argv, client *cl,
+                           int (*action)(int, char *[], void *),
+                           void *actarg);
+
 
 /* prototypes from qvalidate.pc */
-/* from qvalidate.dc */
 int validate_fields(struct query *q, char *argv[], struct valobj *vo, int n);
 int validate_row(struct query *q, char *argv[], struct validate *v);
This page took 0.08476 seconds and 4 git commands to generate.