1 /*- 2 * Copyright 2021 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 17 18 #ifndef RSPAMD_RECEIVED_H 19 #define RSPAMD_RECEIVED_H 20 21 #include "config.h" 22 #include "libutil/addr.h" 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 /* 28 * C bindings for C++ received code 29 */ 30 31 struct rspamd_email_address; 32 struct rspamd_received_header_chain; 33 struct rspamd_mime_header; 34 35 /** 36 * Parse received header from an input header data 37 * @param task 38 * @param data 39 * @param sz 40 * @param hdr 41 * @return 42 */ 43 bool rspamd_received_header_parse(struct rspamd_task *task, 44 const char *data, size_t sz, struct rspamd_mime_header *hdr); 45 46 47 /** 48 * Process task data and the most top received and fix either part if needed 49 * @param task 50 * @return 51 */ 52 bool rspamd_received_maybe_fix_task(struct rspamd_task *task); 53 54 struct lua_State; 55 /** 56 * Push received headers chain to lua 57 * @param task 58 * @param L 59 * @return 60 */ 61 bool rspamd_received_export_to_lua(struct rspamd_task *task, struct lua_State *L); 62 63 #ifdef __cplusplus 64 } 65 #endif 66 67 68 #endif //RSPAMD_RECEIVED_H 69