2012-03-09 02:15:46 +00:00
|
|
|
#ifndef __url_h__
|
|
|
|
#define __url_h__
|
|
|
|
|
|
|
|
enum {
|
|
|
|
SCHEME_UNKNOWN = -1,
|
|
|
|
SCHEME_NONE = 0,
|
|
|
|
SCHEME_FILE,
|
|
|
|
SCHEME_FTP,
|
|
|
|
SCHEME_GOPHER,
|
|
|
|
SCHEME_HTTP,
|
|
|
|
SCHEME_HTTPS,
|
|
|
|
SCHEME_MAILTO,
|
|
|
|
SCHEME_NEWS,
|
|
|
|
SCHEME_NNTP,
|
|
|
|
SCHEME_TELNET
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct URLRange {
|
|
|
|
int location;
|
|
|
|
int length;
|
|
|
|
} URLRange;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
URLComponentScheme,
|
|
|
|
URLComponentUser,
|
|
|
|
URLComponentPassword,
|
|
|
|
URLComponentHost,
|
|
|
|
URLComponentPort,
|
|
|
|
URLComponentPath,
|
|
|
|
URLComponentParams,
|
|
|
|
URLComponentQuery,
|
|
|
|
URLComponentFragment,
|
|
|
|
URLComponentPathAndQuery
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct URLComponents {
|
|
|
|
|
|
|
|
int schemeType;
|
|
|
|
int portNumber;
|
|
|
|
|
|
|
|
URLRange scheme;
|
|
|
|
URLRange user;
|
|
|
|
URLRange password;
|
|
|
|
URLRange host;
|
|
|
|
URLRange port;
|
|
|
|
URLRange path;
|
|
|
|
URLRange params;
|
|
|
|
URLRange query;
|
|
|
|
URLRange fragment;
|
|
|
|
|
|
|
|
URLRange pathAndQuery;
|
|
|
|
|
|
|
|
} URLComponents;
|
|
|
|
|
2012-03-11 22:48:45 +00:00
|
|
|
int ParseURL(const char *url, int length, URLComponents *components);
|
2012-03-09 02:15:46 +00:00
|
|
|
|
2012-03-11 22:48:45 +00:00
|
|
|
int URLComponentGet(const char *url, URLComponents *, int, char *);
|
|
|
|
int URLComponentGetC(const char *url, URLComponents *, int, char *);
|
|
|
|
//int URLComponentGetGS(const char *url, URLComponents *, int, GSString255Ptr);
|
2012-03-09 02:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|