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.

html_url.hxx 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifndef RSPAMD_HTML_URL_HXX
  17. #define RSPAMD_HTML_URL_HXX
  18. #pragma once
  19. #include "libutil/mem_pool.h"
  20. #include <string_view>
  21. #include <optional>
  22. struct rspamd_url; /* Forward declaration */
  23. namespace rspamd::html {
  24. /**
  25. * Checks if an html url is likely phished by some displayed url
  26. * @param pool
  27. * @param href_url
  28. * @param text_data
  29. * @return
  30. */
  31. auto html_url_is_phished(rspamd_mempool_t *pool,
  32. struct rspamd_url *href_url,
  33. std::string_view text_data) -> std::optional<rspamd_url *>;
  34. /**
  35. * Check displayed part of the url at specified offset
  36. * @param pool
  37. * @param exceptions
  38. * @param url_set
  39. * @param visible_part
  40. * @param href_offset
  41. * @param url
  42. */
  43. auto html_check_displayed_url(rspamd_mempool_t *pool,
  44. GList **exceptions,
  45. void *url_set,
  46. std::string_view visible_part,
  47. goffset href_offset,
  48. struct rspamd_url *url) -> void;
  49. /**
  50. * Process HTML url (e.g. for href component)
  51. * @param pool
  52. * @param input may be modified during the process
  53. * @return
  54. */
  55. auto html_process_url(rspamd_mempool_t *pool, std::string_view &input)
  56. -> std::optional<struct rspamd_url *>;
  57. }// namespace rspamd::html
  58. #endif//RSPAMD_HTML_URL_HXX