summaryrefslogtreecommitdiff
path: root/core/fs/pxe/url.h
blob: 934620048ffe6fdfe68013bbd281dfeacd73f0f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * url.h
 */

#ifndef CORE_PXE_URL_H
#define CORE_PXE_URL_H

#include <stddef.h>
#include <stdint.h>

enum url_type {
    URL_NORMAL,			/* It is a full URL */
    URL_OLD_TFTP,		/* It's a ::-style TFTP path */
    URL_SUFFIX			/* Prepend the pathname prefix */
};

struct url_info {
    char *scheme;
    char *user;
    char *passwd;
    char *host;
    uint32_t ip;		/* Not set by parse_url(), use url_set_ip() */
    unsigned int port;
    char *path;			/* Includes query */
    enum url_type type;
};

enum url_type url_type(const char *url);
void parse_url(struct url_info *ui, char *url);
size_t url_escape_unsafe(char *output, const char *input, size_t bufsize);
char *url_unescape(char *buffer, char terminator);
int url_set_ip(struct url_info *ui);

#endif /* CORE_PXE_URL_H */