]> mj.ucw.cz Git - eval.git/blob - submit/submitd.h
First parts of submit command.
[eval.git] / submit / submitd.h
1 /*
2  *  The Submit Daemon
3  *
4  *  (c) 2007 Martin Mares <mj@ucw.cz>
5  */
6
7 #ifndef _SUBMITD_H
8 #define _SUBMITD_H
9
10 #include "lib/clists.h"
11 #include "lib/ipaccess.h"
12 #include "lib/fastbuf.h"
13
14 #include <gnutls/gnutls.h>
15 #include <gnutls/x509.h>
16
17 struct access_rule {
18   cnode n;
19   struct ip_addrmask addrmask;
20   uns allow_admin;
21   uns plain_text;
22   uns max_conn;
23 };
24
25 struct conn {
26   // Set up by the master process
27   cnode n;
28   u32 ip;
29   byte *ip_string;                      // (xmalloced)
30   pid_t pid;
31   uns id;
32   struct access_rule *rule;             // Rule matched by this connection
33   int sk;                               // Client socket
34   byte *cert_name;                      // Client name from the certificate (NULL if no TLS) (xmalloced)
35
36   // Used by the child process
37   gnutls_session_t tls;                 // TLS session
38   struct fastbuf rx_fb, tx_fb;          // Fastbufs for communication with the client (either plain-text or TLS)
39   struct mempool *pool;
40   struct odes *request;
41   struct odes *reply;
42   byte *user;
43 };
44
45 extern uns max_request_size, max_attachment_size, trace_commands;
46
47 /* submitd.c */
48
49 void NONRET client_error(char *msg, ...);
50
51 /* commands.c */
52
53 int process_init(struct conn *c);
54 int process_command(struct conn *c);
55
56 /* tasks.c */
57
58 struct task {
59   cnode n;
60   byte *name;
61 };
62
63 extern clist task_list;
64 extern struct cf_section tasks_conf;
65
66 struct task *task_find(byte *name);
67 int user_exists_p(byte *user);
68
69 #endif