NeoMutt  2021-02-05-329-g9e03b7
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 <stdint.h>
28 #include "mutt/lib.h"
29 
34 {
47 };
48 
49 #define U_NO_FLAGS 0
50 #define U_PATH (1 << 1)
51 
57 struct UrlQuery
58 {
59  char *name;
60  char *value;
61  STAILQ_ENTRY(UrlQuery) entries;
62 };
63 STAILQ_HEAD(UrlQueryList, UrlQuery);
64 
68 struct Url
69 {
70  enum UrlScheme scheme;
71  char *user;
72  char *pass;
73  char *host;
74  unsigned short port;
75  char *path;
76  struct UrlQueryList query_strings;
77  char *src;
78 };
79 
80 enum UrlScheme url_check_scheme(const char *s);
81 void url_free (struct Url **ptr);
82 struct Url *url_parse (const char *src);
83 int url_pct_decode (char *s);
84 void url_pct_encode (char *buf, size_t buflen, const char *src);
85 int url_tobuffer (struct Url *url, struct Buffer *dest, uint8_t flags);
86 int url_tostring (struct Url *url, char *buf, size_t buflen, uint8_t flags);
87 
88 #endif /* MUTT_EMAIL_URL_H */
char * name
Query name.
Definition: url.h:59
Url is notmuch://.
Definition: url.h:46
char * pass
Password.
Definition: url.h:72
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition: url.h:68
Url is imaps://.
Definition: url.h:40
String manipulation buffer.
Definition: buffer.h:33
Parsed Query String.
Definition: url.h:57
Url wasn&#39;t recognised.
Definition: url.h:35
Url is imap://.
Definition: url.h:39
char * value
Query value.
Definition: url.h:60
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
STAILQ_ENTRY(UrlQuery) entries
Linked list.
UrlScheme
All recognised Url types.
Definition: url.h:33
Url is nntps://.
Definition: url.h:42
char * user
Username.
Definition: url.h:71
Url is smtps://.
Definition: url.h:44
enum UrlScheme url_check_scheme(const char *s)
Check the protocol of a URL.
Definition: url.c:221
char * host
Host.
Definition: url.h:73
char * path
Path.
Definition: url.h:75
struct Url * url_parse(const char *src)
Fill in Url.
Definition: url.c:234
Url is pop://.
Definition: url.h:37
unsigned short port
Port.
Definition: url.h:74
STAILQ_HEAD(UrlQueryList, UrlQuery)
Url is nntp://.
Definition: url.h:41
int url_pct_decode(char *s)
Decode a percent-encoded string.
Definition: url.c:189
Url is smtp://.
Definition: url.h:43
Url is mailto://.
Definition: url.h:45
void url_pct_encode(char *buf, size_t buflen, const char *src)
Percent-encode a string.
Definition: url.c:151
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
void url_free(struct Url **ptr)
Free the contents of a URL.
Definition: url.c:123
Convenience wrapper for the library headers.
char * src
Raw URL string.
Definition: url.h:77
Url is file://.
Definition: url.h:36
Url is pops://.
Definition: url.h:38