File: re_uri.h

package info (click to toggle)
libre 2.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,556 kB
  • sloc: ansic: 41,621; makefile: 143; sh: 1
file content (45 lines) | stat: -rw-r--r-- 1,948 bytes parent folder | download | duplicates (2)
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
35
36
37
38
39
40
41
42
43
44
45
/**
 * @file re_uri.h  Interface to URI module
 *
 * Copyright (C) 2010 Creytiv.com
 */


/** Defines a URI - Uniform Resource Identifier */
struct uri {
	struct pl scheme;    /**< URI scheme e.g. "sip:" "sips:"    */
	struct pl user;      /**< Username                          */
	struct pl password;  /**< Optional password                 */
	struct pl host;      /**< Hostname or IP-address            */
	int af;              /**< Address family of host IP-address */
	uint16_t port;       /**< Port number                       */
	struct pl path;      /**< Optional URI-path                 */
	struct pl params;    /**< Optional URI-parameters           */
	struct pl headers;   /**< Optional URI-headers              */
};

typedef int (uri_apply_h)(const struct pl *name, const struct pl *val,
			  void *arg);

struct re_printf;
int  uri_encode(struct re_printf *pf, const struct uri *uri);
int  uri_decode(struct uri *uri, const struct pl *pl);
int  uri_decode_hostport(const struct pl *hostport, struct pl *host,
			 struct pl *port);
int  uri_param_get(const struct pl *pl, const struct pl *pname,
		   struct pl *pvalue);
int  uri_params_apply(const struct pl *pl, uri_apply_h *ah, void *arg);
int  uri_header_get(const struct pl *pl, const struct pl *hname,
		    struct pl *hvalue);
int  uri_headers_apply(const struct pl *pl, uri_apply_h *ah, void *arg);


/* Special URI escaping/unescaping */
int uri_user_escape(struct re_printf *pf, const struct pl *pl);
int uri_user_unescape(struct re_printf *pf, const struct pl *pl);
int uri_password_escape(struct re_printf *pf, const struct pl *pl);
int uri_password_unescape(struct re_printf *pf, const struct pl *pl);
int uri_param_escape(struct re_printf *pf, const struct pl *pl);
int uri_param_unescape(struct re_printf *pf, const struct pl *pl);
int uri_header_escape(struct re_printf *pf, const struct pl *pl);
int uri_header_unescape(struct re_printf *pf, const struct pl *pl);