NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
url.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_EMAIL_URL_H
24 #define MUTT_EMAIL_URL_H
25 
26 #include <stddef.h>
27 #include "mutt/lib.h"
28 
33 {
46 };
47 
48 #define U_NO_FLAGS 0
49 #define U_PATH (1 << 1)
50 
56 struct UrlQuery
57 {
58  char *name;
59  char *value;
60  STAILQ_ENTRY(UrlQuery) entries;
61 };
62 STAILQ_HEAD(UrlQueryList, UrlQuery);
63 
67 struct Url
68 {
70  char *user;
71  char *pass;
72  char *host;
73  unsigned short port;
74  char *path;
75  struct UrlQueryList query_strings;
76  char *src;
77 };
78 
79 enum UrlScheme url_check_scheme(const char *s);
80 void url_free (struct Url **ptr);
81 struct Url *url_parse (const char *src);
82 int url_pct_decode (char *s);
83 void url_pct_encode (char *buf, size_t buflen, const char *src);
84 int url_tobuffer (struct Url *url, struct Buffer *dest, uint8_t flags);
85 int url_tostring (struct Url *url, char *buf, size_t buflen, uint8_t flags);
86 
87 #endif /* MUTT_EMAIL_URL_H */
Url::src
char * src
Raw URL string.
Definition: url.h:76
UrlQuery::name
char * name
Query name.
Definition: url.h:58
U_IMAP
@ U_IMAP
Url is imap://.
Definition: url.h:38
U_NNTPS
@ U_NNTPS
Url is nntps://.
Definition: url.h:41
U_MAILTO
@ U_MAILTO
Url is mailto://.
Definition: url.h:44
Buffer
String manipulation buffer.
Definition: buffer.h:33
UrlScheme
UrlScheme
All recognised Url types.
Definition: url.h:32
U_UNKNOWN
@ U_UNKNOWN
Url wasn't recognised.
Definition: url.h:34
Url::scheme
enum UrlScheme scheme
Scheme, e.g. U_SMTPS.
Definition: url.h:69
url_pct_encode
void url_pct_encode(char *buf, size_t buflen, const char *src)
Percent-encode a string.
Definition: url.c:151
Url::pass
char * pass
Password.
Definition: url.h:71
U_FILE
@ U_FILE
Url is file://.
Definition: url.h:35
url_parse
struct Url * url_parse(const char *src)
Fill in Url.
Definition: url.c:234
UrlQuery
Parsed Query String.
Definition: url.h:56
url_pct_decode
int url_pct_decode(char *s)
Decode a percent-encoded string.
Definition: url.c:189
url_tobuffer
int url_tobuffer(struct Url *url, struct Buffer *dest, uint8_t flags)
Output the URL string for a given Url object.
Definition: url.c:353
url_free
void url_free(struct Url **ptr)
Free the contents of a URL.
Definition: url.c:123
U_SMTPS
@ U_SMTPS
Url is smtps://.
Definition: url.h:43
Url::query_strings
struct UrlQueryList query_strings
List of query strings.
Definition: url.h:75
url_tostring
int url_tostring(struct Url *url, char *buf, size_t buflen, uint8_t flags)
Output the URL string for a given Url object.
Definition: url.c:418
lib.h
Url
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition: url.h:67
STAILQ_HEAD
STAILQ_HEAD(UrlQueryList, UrlQuery)
U_IMAPS
@ U_IMAPS
Url is imaps://.
Definition: url.h:39
U_SMTP
@ U_SMTP
Url is smtp://.
Definition: url.h:42
Url::port
unsigned short port
Port.
Definition: url.h:73
Url::user
char * user
Username.
Definition: url.h:70
UrlQuery::STAILQ_ENTRY
STAILQ_ENTRY(UrlQuery) entries
Linked list.
U_POP
@ U_POP
Url is pop://.
Definition: url.h:36
UrlQuery::value
char * value
Query value.
Definition: url.h:59
U_POPS
@ U_POPS
Url is pops://.
Definition: url.h:37
U_NNTP
@ U_NNTP
Url is nntp://.
Definition: url.h:40
Url::host
char * host
Host.
Definition: url.h:72
U_NOTMUCH
@ U_NOTMUCH
Url is notmuch://.
Definition: url.h:45
Url::path
char * path
Path.
Definition: url.h:74
url_check_scheme
enum UrlScheme url_check_scheme(const char *s)
Check the protocol of a URL.
Definition: url.c:221