2011-11-14 15:57:52 +01:00
|
|
|
/*
|
|
|
|
* piler.h, SJ
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PILER_H
|
|
|
|
#define _PILER_H
|
|
|
|
|
|
|
|
#include <misc.h>
|
|
|
|
#include <parser.h>
|
|
|
|
#include <errmsg.h>
|
|
|
|
#include <smtpcodes.h>
|
|
|
|
#include <decoder.h>
|
2013-08-14 14:24:30 +02:00
|
|
|
#include <hash.h>
|
2011-11-19 21:25:44 +01:00
|
|
|
#include <rules.h>
|
2011-11-14 15:57:52 +01:00
|
|
|
#include <defs.h>
|
2011-11-19 21:25:44 +01:00
|
|
|
#include <tai.h>
|
2011-11-14 15:57:52 +01:00
|
|
|
#include <sig.h>
|
|
|
|
#include <av.h>
|
2011-11-19 21:25:44 +01:00
|
|
|
#include <rules.h>
|
2013-05-05 11:57:14 +02:00
|
|
|
#include <sql.h>
|
2016-03-03 11:04:32 +01:00
|
|
|
#include <import.h>
|
2016-10-23 22:04:55 +02:00
|
|
|
#include <smtp.h>
|
2011-11-14 15:57:52 +01:00
|
|
|
#include <config.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_MEMCACHED
|
|
|
|
#include "memc.h"
|
|
|
|
#endif
|
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
int read_key(struct config *cfg);
|
2013-01-31 22:20:23 +01:00
|
|
|
void insert_offset(struct session_data *sdata, int server_id);
|
2011-11-22 12:31:54 +01:00
|
|
|
|
2016-10-23 22:04:55 +02:00
|
|
|
void tear_down_client(int n);
|
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
int do_av_check(char *filename, struct config *cfg);
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
int make_digests(struct session_data *sdata, struct config *cfg);
|
2011-11-19 21:25:44 +01:00
|
|
|
void digest_file(char *filename, char *digest);
|
2012-01-09 23:15:39 +01:00
|
|
|
void digest_string(char *s, char *digest);
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2015-11-21 23:06:47 +01:00
|
|
|
void remove_stripped_attachments(struct parser_state *state);
|
2017-08-08 15:34:45 +02:00
|
|
|
int process_message(struct session_data *sdata, struct parser_state *state, struct data *data, struct config *cfg);
|
|
|
|
int reimport_message(struct session_data *sdata, struct parser_state *state, struct data *data, struct config *cfg);
|
|
|
|
int store_file(struct session_data *sdata, char *filename, int len, struct config *cfg);
|
|
|
|
int remove_stored_message_files(struct session_data *sdata, struct parser_state *state, struct config *cfg);
|
|
|
|
int store_attachments(struct session_data *sdata, struct parser_state *state, struct data *data, struct config *cfg);
|
|
|
|
int query_attachments(struct session_data *sdata, struct data *data, struct ptr_array *ptr_arr);
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
struct config read_config(char *configfile);
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
void check_and_create_directories(struct config *cfg, uid_t uid, gid_t gid);
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
void update_counters(struct session_data *sdata, struct data *data, struct counters *counters, struct config *cfg);
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
int retrieve_email_from_archive(struct session_data *sdata, struct data *data, FILE *dest, struct config *cfg);
|
|
|
|
int file_from_archive_to_network(char *filename, int sd, int tls_enable, struct data *data, struct config *cfg);
|
2012-01-07 16:40:06 +01:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
int get_folder_id(struct session_data *sdata, struct data *data, char *foldername, int parent_id);
|
|
|
|
int add_new_folder(struct session_data *sdata, struct data *data, char *foldername, int parent_id);
|
2012-01-07 16:40:06 +01:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
int store_index_data(struct session_data *sdata, struct parser_state *state, struct data *data, uint64 id, struct config *cfg);
|
2012-06-01 14:25:49 +02:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
void extract_attachment_content(struct session_data *sdata, struct parser_state *state, char *filename, char *type, int *rec, struct config *cfg);
|
2012-09-11 14:11:17 +02:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *dest, struct config *cfg);
|
2012-10-03 23:32:44 +02:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
void load_mydomains(struct session_data *sdata, struct data *data, struct config *cfg);
|
|
|
|
int is_email_address_on_my_domains(char *email, struct data *data);
|
2013-07-12 22:54:45 +02:00
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
int start_new_session(struct smtp_session **sessions, int socket, int *num_connections, struct config *cfg);
|
2016-11-12 10:48:08 +01:00
|
|
|
void tear_down_session(struct smtp_session **sessions, int slot, int *num_connections);
|
|
|
|
struct smtp_session *get_session_by_socket(struct smtp_session **sessions, int max_connections, int socket);
|
|
|
|
void handle_data(struct smtp_session *session, char *readbuf, int readlen);
|
|
|
|
void free_smtp_session(struct smtp_session *session);
|
|
|
|
|
2016-10-28 19:32:59 +02:00
|
|
|
void child_sighup_handler(int sig);
|
|
|
|
void child_main(struct child *ptr);
|
|
|
|
pid_t child_make(struct child *ptr);
|
|
|
|
int search_slot_by_pid(pid_t pid);
|
|
|
|
void kill_children(int sig);
|
|
|
|
void p_clean_exit();
|
|
|
|
void fatal(char *s);
|
|
|
|
void initialise_configuration();
|
2016-08-21 21:15:48 +02:00
|
|
|
|
2011-11-14 15:57:52 +01:00
|
|
|
#endif /* _PILER_H */
|