You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

worker_private.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*-
  2. * Copyright 2016 Vsevolod Stakhov
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef RSPAMD_WORKER_PRIVATE_H
  17. #define RSPAMD_WORKER_PRIVATE_H
  18. #include "config.h"
  19. #include "libcryptobox/cryptobox.h"
  20. #include "libcryptobox/keypair.h"
  21. #include "libserver/task.h"
  22. #include "libserver/cfg_file.h"
  23. #include "libserver/rspamd_control.h"
  24. /*
  25. * Worker's context
  26. */
  27. struct rspamd_worker_log_pipe {
  28. gint fd;
  29. enum rspamd_log_pipe_type type;
  30. struct rspamd_worker_log_pipe *prev, *next;
  31. };
  32. static const guint64 rspamd_worker_magic = 0xb48abc69d601dc1dULL;
  33. struct rspamd_worker_ctx {
  34. guint64 magic;
  35. guint32 timeout;
  36. struct timeval io_tv;
  37. /* Detect whether this worker is mime worker */
  38. gboolean is_mime;
  39. /* HTTP worker */
  40. gboolean is_http;
  41. /* JSON output */
  42. gboolean is_json;
  43. /* Allow learning throught worker */
  44. gboolean allow_learn;
  45. /* DNS resolver */
  46. struct rspamd_dns_resolver *resolver;
  47. /* Limit of tasks */
  48. guint32 max_tasks;
  49. /* Maximum time for task processing */
  50. gdouble task_timeout;
  51. /* Events base */
  52. struct event_base *ev_base;
  53. /* Encryption key */
  54. struct rspamd_cryptobox_keypair *key;
  55. /* Keys cache */
  56. struct rspamd_keypair_cache *keys_cache;
  57. /* Configuration */
  58. struct rspamd_config *cfg;
  59. /* Log pipe */
  60. struct rspamd_worker_log_pipe *log_pipes;
  61. };
  62. #endif