summaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-20 19:35:07 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-20 19:35:07 +0400
commit5c9372c4a8678c6856360891180b02c2fdf688ee (patch)
treebc67f5cb057c4784c67e691f76aa8a8f80a40e51 /src/util.h
parent9bc06fea2eac12cc46028fcdd630d291a76b68ae (diff)
downloadrspamd-5c9372c4a8678c6856360891180b02c2fdf688ee.tar.gz
rspamd-5c9372c4a8678c6856360891180b02c2fdf688ee.zip
* Add start script for red hat compatible systems
Add descriptions for some rspamd API functions (no functional changes). --HG-- rename : linux/rspamd => linux/rspamd_debian.in
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h87
1 files changed, 75 insertions, 12 deletions
diff --git a/src/util.h b/src/util.h
index b1d4ad2e9..2fb083eba 100644
--- a/src/util.h
+++ b/src/util.h
@@ -29,38 +29,72 @@ enum process_type {
TYPE_MAX=255
};
-/* Create socket and bind or connect it to specified address and port */
+/*
+ * Create socket and bind or connect it to specified address and port
+ */
gint make_tcp_socket (struct in_addr *, u_short, gboolean is_server, gboolean async);
-/* Create socket and bind or connect it to specified address and port */
+/*
+ * Create socket and bind or connect it to specified address and port
+ */
gint make_udp_socket (struct in_addr *, u_short, gboolean is_server, gboolean async);
-/* Accept from socket */
+/*
+ * Accept from socket
+ */
gint accept_from_socket (gint listen_sock, struct sockaddr *addr, socklen_t *len);
-/* Create and bind or connect unix socket */
+/*
+ * Create and bind or connect unix socket
+ */
gint make_unix_socket (const gchar *, struct sockaddr_un *, gboolean is_server);
-/* Write pid to file */
+
+/*
+ * Write pid to file
+ */
gint write_pid (struct rspamd_main *);
-/* Make specified socket non-blocking */
+
+/*
+ * Make specified socket non-blocking
+ */
gint make_socket_nonblocking (gint);
+/*
+ * Make specified socket blocking
+ */
gint make_socket_blocking (gint);
-/* Poll sync socket for specified events */
+
+/*
+ * Poll a sync socket for specified events
+ */
gint poll_sync_socket (gint fd, gint timeout, short events);
-/* Init signals */
+
+/*
+ * Init signals
+ */
#ifdef HAVE_SA_SIGINFO
void init_signals (struct sigaction *sa, void (*sig_handler)(gint, siginfo_t *, void *));
#else
void init_signals (struct sigaction *sa, sighandler_t);
#endif
-/* Send specified signal to each worker */
+
+/*
+ * Send specified signal to each worker
+ */
void pass_signal_worker (GHashTable *, gint );
-/* Convert string to lowercase */
+/*
+ * Convert string to lowercase
+ */
void convert_to_lowercase (gchar *str, guint size);
#ifndef HAVE_SETPROCTITLE
+/*
+ * Process title utility functions
+ */
gint init_title(gint argc, gchar *argv[], gchar *envp[]);
gint setproctitle(const gchar *fmt, ...);
#endif
#ifndef HAVE_PIDFILE
+/*
+ * Pidfile functions from FreeBSD libutil code
+ */
struct pidfh {
gint pf_fd;
#ifdef HAVE_PATH_MAX
@@ -79,29 +113,56 @@ gint pidfile_close(struct pidfh *pfh);
gint pidfile_remove(struct pidfh *pfh);
#endif
-/* Replace %r with rcpt value and %f with from value, new string is allocated in pool */
+/*
+ * Replace %r with rcpt value and %f with from value, new string is allocated in pool
+ */
gchar* resolve_stat_filename (memory_pool_t *pool, gchar *pattern, gchar *rcpt, gchar *from);
#ifdef HAVE_CLOCK_GETTIME
+/*
+ * Calculate check time with specified resolution of timer
+ */
const gchar* calculate_check_time (struct timeval *tv, struct timespec *begin, gint resolution);
#else
const gchar* calculate_check_time (struct timeval *begin, gint resolution);
#endif
+/*
+ * Set counter for a symbol
+ */
double set_counter (const gchar *name, guint32 value);
+/*
+ * File locking functions
+ */
gboolean lock_file (gint fd, gboolean async);
gboolean unlock_file (gint fd, gboolean async);
+/*
+ * Hash table utility functions for case insensitive hashing
+ */
guint rspamd_strcase_hash (gconstpointer key);
gboolean rspamd_strcase_equal (gconstpointer v, gconstpointer v2);
+
+/*
+ * Hash table utility functions for hashing fixed strings
+ */
guint fstr_strcase_hash (gconstpointer key);
gboolean fstr_strcase_equal (gconstpointer v, gconstpointer v2);
+/*
+ * Google perf-tools initialization function
+ */
void gperf_profiler_init (struct config_file *cfg, const gchar *descr);
+/*
+ * Get a statfile by symbol
+ */
stat_file_t* get_statfile_by_symbol (statfile_pool_t *pool, struct classifier_config *ccf,
const gchar *symbol, struct statfile **st, gboolean try_create);
+/*
+ * Workaround for older versions of glib
+ */
#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 22))
void g_ptr_array_unref (GPtrArray *array);
#endif
@@ -158,7 +219,9 @@ void free_task (struct worker_task *task, gboolean is_soft);
void free_task_hard (gpointer ud);
void free_task_soft (gpointer ud);
-/* Find string find in string s ignoring case */
+/*
+ * Find string find in string s ignoring case
+ */
gchar* rspamd_strncasestr (const gchar *s, const gchar *find, gint len);
#endif