Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef RSPAMD_UTIL_H
  2. #define RSPAMD_UTIL_H
  3. #include "config.h"
  4. #include "mem_pool.h"
  5. #include "radix.h"
  6. #include "statfile.h"
  7. struct config_file;
  8. struct rspamd_main;
  9. struct workq;
  10. struct statfile;
  11. struct classifier_config;
  12. /* Create socket and bind or connect it to specified address and port */
  13. int make_tcp_socket (struct in_addr *, u_short, gboolean is_server, gboolean async);
  14. /* Create socket and bind or connect it to specified address and port */
  15. int make_udp_socket (struct in_addr *, u_short, gboolean is_server, gboolean async);
  16. /* Accept from socket */
  17. int accept_from_socket (int listen_sock, struct sockaddr *addr, socklen_t *len);
  18. /* Create and bind or connect unix socket */
  19. int make_unix_socket (const char *, struct sockaddr_un *, gboolean is_server);
  20. /* Write pid to file */
  21. int write_pid (struct rspamd_main *);
  22. /* Make specified socket non-blocking */
  23. int make_socket_nonblocking (int);
  24. int make_socket_blocking (int);
  25. /* Poll sync socket for specified events */
  26. int poll_sync_socket (int fd, int timeout, short events);
  27. /* Init signals */
  28. #ifdef HAVE_SA_SIGINFO
  29. void init_signals (struct sigaction *sa, void (*sig_handler)(int, siginfo_t *, void *));
  30. #else
  31. void init_signals (struct sigaction *sa, sighandler_t);
  32. #endif
  33. /* Send specified signal to each worker */
  34. void pass_signal_worker (GHashTable *, int );
  35. /* Convert string to lowercase */
  36. void convert_to_lowercase (char *str, unsigned int size);
  37. #ifndef HAVE_SETPROCTITLE
  38. int init_title(int argc, char *argv[], char *envp[]);
  39. int setproctitle(const char *fmt, ...);
  40. #endif
  41. #ifndef HAVE_PIDFILE
  42. struct pidfh {
  43. int pf_fd;
  44. #ifdef HAVE_PATH_MAX
  45. char pf_path[PATH_MAX + 1];
  46. #elif defined(HAVE_MAXPATHLEN)
  47. char pf_path[MAXPATHLEN + 1];
  48. #else
  49. char pf_path[1024 + 1];
  50. #endif
  51. __dev_t pf_dev;
  52. ino_t pf_ino;
  53. };
  54. struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
  55. int pidfile_write(struct pidfh *pfh);
  56. int pidfile_close(struct pidfh *pfh);
  57. int pidfile_remove(struct pidfh *pfh);
  58. #endif
  59. /* Replace %r with rcpt value and %f with from value, new string is allocated in pool */
  60. char* resolve_stat_filename (memory_pool_t *pool, char *pattern, char *rcpt, char *from);
  61. #ifdef HAVE_CLOCK_GETTIME
  62. const char* calculate_check_time (struct timespec *begin, int resolution);
  63. #else
  64. const char* calculate_check_time (struct timeval *begin, int resolution);
  65. #endif
  66. double set_counter (const char *name, long int value);
  67. gboolean lock_file (int fd, gboolean async);
  68. gboolean unlock_file (int fd, gboolean async);
  69. guint rspamd_strcase_hash (gconstpointer key);
  70. gboolean rspamd_strcase_equal (gconstpointer v, gconstpointer v2);
  71. guint fstr_strcase_hash (gconstpointer key);
  72. gboolean fstr_strcase_equal (gconstpointer v, gconstpointer v2);
  73. void gperf_profiler_init (struct config_file *cfg, const char *descr);
  74. #ifdef RSPAMD_MAIN
  75. stat_file_t* get_statfile_by_symbol (statfile_pool_t *pool, struct classifier_config *ccf,
  76. const char *symbol, struct statfile **st, gboolean try_create);
  77. #endif
  78. int rspamd_sprintf (u_char *buf, const char *fmt, ...);
  79. int rspamd_snprintf (u_char *buf, size_t max, const char *fmt, ...);
  80. u_char *rspamd_vsnprintf (u_char *buf, size_t max, const char *fmt, va_list args);
  81. #endif