]> mj.ucw.cz Git - eval.git/blob - submit/submitd.h
7e0d4345378b656efc1cdbccb5f7c5d167b67b52
[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   pid_t pid;
30   uns id;
31   struct access_rule *rule;             // Rule matched by this connection
32   int sk;                               // Client socket
33   byte *cert_name;                      // Client name from the certificate (NULL if no TLS)
34
35   // Used by the child process
36   gnutls_session_t tls;                 // TLS session
37   struct fastbuf rx_fb, tx_fb;          // Fastbufs for communication with the client (either plain-text or TLS)
38   struct mempool *pool;
39   struct odes *request;
40   struct odes *reply;
41   byte *user;
42 };
43
44 extern uns max_request_size, max_attachment_size, trace_commands;
45
46 /* submitd.c */
47
48 void NONRET client_error(char *msg, ...);
49
50 /* commands.c */
51
52 int process_init(struct conn *c);
53 int process_command(struct conn *c);
54
55 #endif