gopher/url.h

70 lines
1.4 KiB
C
Raw Normal View History

2012-03-09 02:15:46 +00:00
#ifndef __url_h__
#define __url_h__
enum {
2012-09-10 23:23:02 +00:00
SCHEME_UNKNOWN = 0xffff,
2012-03-09 02:15:46 +00:00
SCHEME_NONE = 0,
SCHEME_FILE = 0xfffe,
2012-09-10 23:23:02 +00:00
SCHEME_AFP = 548,
SCHEME_DICT = 2628,
SCHEME_FTP = 21,
SCHEME_GOPHER = 70,
SCHEME_HTTP = 80,
SCHEME_HTTPS = 443,
2012-09-10 23:23:02 +00:00
SCHEME_NFS = 2049,
SCHEME_NNTP = 119,
SCHEME_SFTP = 115,
2013-08-11 03:53:38 +00:00
SCHEME_SMB = 445,
2012-09-10 23:23:02 +00:00
SCHEME_SSH = 22,
SCHEME_TELNET = 23
2012-03-09 02:15:46 +00:00
};
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-04-25 03:55:18 +00:00
char *URLComponentGetCMalloc(const char *url, URLComponents *, int);
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