diff options
Diffstat (limited to 'src/libutil/map_private.h')
-rw-r--r-- | src/libutil/map_private.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/libutil/map_private.h b/src/libutil/map_private.h new file mode 100644 index 000000000..39a546de6 --- /dev/null +++ b/src/libutil/map_private.h @@ -0,0 +1,83 @@ +/*- + * Copyright 2016 Vsevolod Stakhov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef SRC_LIBUTIL_MAP_PRIVATE_H_ +#define SRC_LIBUTIL_MAP_PRIVATE_H_ + +#include "config.h" +#include "mem_pool.h" +#include "keypair.h" +#include "unix-std.h" + +enum fetch_proto { + MAP_PROTO_FILE, + MAP_PROTO_HTTP, +}; +struct rspamd_map { + rspamd_mempool_t *pool; + gboolean is_signed; + struct rspamd_cryptobox_pubkey *trusted_pubkey; + struct rspamd_config *cfg; + enum fetch_proto protocol; + map_cb_t read_callback; + map_fin_cb_t fin_callback; + void **user_data; + struct event ev; + struct timeval tv; + struct event_base *ev_base; + void *map_data; + gchar *uri; + gchar *description; + guint32 id; + guint32 checksum; + /* Shared lock for temporary disabling of map reading (e.g. when this map is written by UI) */ + gint *locked; +}; + +/** + * Data specific to file maps + */ +struct file_map_data { + const gchar *filename; + struct stat st; +}; + +/** + * Data specific to HTTP maps + */ +struct http_map_data { + struct addrinfo *addr; + guint16 port; + gchar *path; + gchar *host; + time_t last_checked; + gboolean request_sent; + struct rspamd_http_connection *conn; +}; + + +struct http_callback_data { + struct event_base *ev_base; + struct timeval tv; + struct rspamd_map *map; + struct http_map_data *data; + struct map_cb_data cbdata; + + GString *remain_buf; + + gint fd; +}; + +#endif /* SRC_LIBUTIL_MAP_PRIVATE_H_ */ |