sitemap.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2018 Markus Hennecke <markus-hennecke@markus-hennecke.de>
  3. *
  4. * Permission to use, copy, modify, and distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef __SITEMAP_H__
  17. #define __SITEMAP_H__
  18. #include <sys/queue.h>
  19. struct url_entry {
  20. TAILQ_ENTRY(url_entry) entries;
  21. struct dir_list *dir;
  22. char *url;
  23. time_t mtime;
  24. };
  25. struct lang_entry {
  26. TAILQ_ENTRY(lang_entry) entries;
  27. TAILQ_HEAD(, url_entry) pages;
  28. struct dir_list *dir;
  29. char *lang;
  30. };
  31. struct sitemap {
  32. TAILQ_HEAD(, lang_entry) languages;
  33. struct dir_list *dir;
  34. char *hostname;
  35. };
  36. struct lang_entry *lang_entry_new(const char *);
  37. struct url_entry *url_entry_new(char *, time_t);
  38. void lang_entry_free(struct lang_entry *);
  39. void url_entry_free(struct url_entry *);
  40. struct sitemap *sitemap_new(const char *, const char *);
  41. void sitemap_free(struct sitemap *);
  42. char *sitemap_toxml(struct sitemap *);
  43. char *sitemap_toxmlgz(struct sitemap *, size_t *,
  44. const char *, uint32_t);
  45. uint32_t sitemap_newest(struct sitemap *, const char *);
  46. #endif //__SITEMAP_H__