NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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
58{
59 char *name;
60 char *value;
62};
63STAILQ_HEAD(UrlQueryList, UrlQuery);
64
68struct Url
69{
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
80enum UrlScheme url_check_scheme(const char *s);
81void url_free (struct Url **ptr);
82struct Url *url_parse (const char *src);
83int url_pct_decode (char *s);
84void url_pct_encode (char *buf, size_t buflen, const char *src);
85int url_tobuffer (const struct Url *url, struct Buffer *dest, uint8_t flags);
86int url_tostring (const struct Url *url, char *buf, size_t buflen, uint8_t flags);
87
88#endif /* MUTT_EMAIL_URL_H */
Convenience wrapper for the library headers.
#define STAILQ_HEAD(name, type)
Definition: queue.h:312
String manipulation buffer.
Definition: buffer.h:36
Parsed Query String.
Definition: url.h:58
STAILQ_ENTRY(UrlQuery) entries
Linked list.
char * name
Query name.
Definition: url.h:59
char * value
Query value.
Definition: url.h:60
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition: url.h:69
char * user
Username.
Definition: url.h:71
unsigned short port
Port.
Definition: url.h:74
struct UrlQueryList query_strings
List of query strings.
Definition: url.h:76
char * host
Host.
Definition: url.h:73
char * src
Raw URL string.
Definition: url.h:77
char * pass
Password.
Definition: url.h:72
char * path
Path.
Definition: url.h:75
enum UrlScheme scheme
Scheme, e.g. U_SMTPS.
Definition: url.h:70
int url_pct_decode(char *s)
Decode a percent-encoded string.
Definition: url.c:190
UrlScheme
All recognised Url types.
Definition: url.h:34
@ U_NOTMUCH
Url is notmuch://.
Definition: url.h:46
@ U_UNKNOWN
Url wasn't recognised.
Definition: url.h:35
@ U_FILE
Url is file://.
Definition: url.h:36
@ U_NNTPS
Url is nntps://.
Definition: url.h:42
@ U_MAILTO
Url is mailto://.
Definition: url.h:45
@ U_SMTPS
Url is smtps://.
Definition: url.h:44
@ U_SMTP
Url is smtp://.
Definition: url.h:43
@ U_NNTP
Url is nntp://.
Definition: url.h:41
@ U_IMAP
Url is imap://.
Definition: url.h:39
@ U_POPS
Url is pops://.
Definition: url.h:38
@ U_IMAPS
Url is imaps://.
Definition: url.h:40
@ U_POP
Url is pop://.
Definition: url.h:37
struct Url * url_parse(const char *src)
Fill in Url.
Definition: url.c:239
enum UrlScheme url_check_scheme(const char *s)
Check the protocol of a URL.
Definition: url.c:226
void url_free(struct Url **ptr)
Free the contents of a URL.
Definition: url.c:124
int url_tostring(const struct Url *url, char *buf, size_t buflen, uint8_t flags)
Output the URL string for a given Url object.
Definition: url.c:423
void url_pct_encode(char *buf, size_t buflen, const char *src)
Percent-encode a string.
Definition: url.c:152
int url_tobuffer(const struct Url *url, struct Buffer *dest, uint8_t flags)
Output the URL string for a given Url object.
Definition: url.c:358