#ifndef URL_H
#define URL_H

#define DEFAULT_FTP_DATA_PORT    20
#define DEFAULT_FTP_PORT         21
#define DEFAULT_TELNET_PORT      23
#define DEFAULT_SMTP_PORT        25
#define DEFAULT_TIME_PORT        37
#define DEFAULT_DNS_PORT         42
#define DEFAULT_WHOIS_PORT       43
#define DEFAULT_TFTP_PORT        69
#define DEFAULT_GOPHER_PORT      70
#define DEFAULT_FINGER_PORT      79
#define DEFAULT_HTTP_PORT        80
#define DEFAULT_POP3_PORT       110
#define DEFAULT_NNTP_PORT       119
#define	DEFAULT_WAIS_PORT	      210
#define DEFAULT_HTTPS_PORT	    443
#define	DEFAULT_SNEWS_PORT    	563
#define	DEFAULT_PROSPERO_PORT	 1525


typedef struct {
  char *scheme;
  char *user;
  char *pass;
  char *host;
  unsigned short port;
  char *path;
  char *query;
  char *fragment;
} URL;

extern  void      free_url(URL *url);
extern  URL      *parse_url(const char *urlString);
extern  unsigned  url_decode(char *str, unsigned len);
extern  char     *url_encode(char *s, unsigned len);

#endif