Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright 2005 James Bursa <bursa@users.sourceforge.net>
  3.  * Copyright 2005 John M Bell <jmb202@ecs.soton.ac.uk>
  4.  *
  5.  * This file is part of NetSurf, http://www.netsurf-browser.org/
  6.  *
  7.  * NetSurf is free software; you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as published by
  9.  * the Free Software Foundation; version 2 of the License.
  10.  *
  11.  * NetSurf is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  */
  19.  
  20. /**
  21.  * \file utils/url.h
  22.  * \brief URL parsing and joining (interface).
  23.  */
  24.  
  25. #ifndef _NETSURF_UTILS_URL_H_
  26. #define _NETSURF_UTILS_URL_H_
  27.  
  28. /** File url prefix */
  29. #define FILE_SCHEME_PREFIX "file:///"
  30. /** File url prefix length */
  31. #define FILE_SCHEME_PREFIX_LEN 8
  32.  
  33. /** URL utility function return codes */
  34. typedef enum {
  35.         URL_FUNC_OK,     /**< No error */
  36.         URL_FUNC_NOMEM,  /**< Insufficient memory */
  37.         URL_FUNC_FAILED  /**< Non fatal error (eg failed to match regex) */
  38. } url_func_result;
  39.  
  40. struct url_components {
  41.         const char *buffer;
  42.         const char *scheme;
  43.         const char *authority;
  44.         const char *path;
  45.         const char *query;
  46.         const char *fragment;
  47. };
  48.  
  49. void url_init(void);
  50. bool url_host_is_ip_address(const char *host);
  51. url_func_result url_join(const char *rel, const char *base, char **result);
  52. url_func_result url_host(const char *url, char **result);
  53. url_func_result url_scheme(const char *url, char **result);
  54. url_func_result url_nice(const char *url, char **result,
  55.                 bool remove_extensions);
  56. url_func_result url_escape(const char *unescaped, size_t toskip,
  57.                 bool sptoplus, const char *escexceptions, char **result);
  58. url_func_result url_unescape(const char *str, char **result);
  59. url_func_result url_path(const char *url, char **result);
  60.  
  61. char *path_to_url(const char *path);
  62. char *url_to_path(const char *url);
  63.  
  64. #endif
  65.