| 1 |
#ifndef PROTON_URL_H |
| 2 |
#define PROTON_URL_H 1 |
| 3 |
|
| 4 |
/* |
| 5 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 6 |
* or more contributor license agreements. See the NOTICE file |
| 7 |
* distributed with this work for additional information |
| 8 |
* regarding copyright ownership. The ASF licenses this file |
| 9 |
* to you under the Apache License, Version 2.0 (the |
| 10 |
* "License"); you may not use this file except in compliance |
| 11 |
* with the License. You may obtain a copy of the License at |
| 12 |
* |
| 13 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 14 |
* |
| 15 |
* Unless required by applicable law or agreed to in writing, |
| 16 |
* software distributed under the License is distributed on an |
| 17 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 18 |
* KIND, either express or implied. See the License for the |
| 19 |
* specific language governing permissions and limitations |
| 20 |
* under the License. |
| 21 |
*/ |
| 22 |
|
| 23 |
#include <proton/import_export.h> |
| 24 |
|
| 25 |
#ifdef __cplusplus |
| 26 |
extern "C" { |
| 27 |
#endif |
| 28 |
|
| 29 |
/** |
| 30 |
* @file |
| 31 |
* |
| 32 |
* @copybrief url |
| 33 |
* |
| 34 |
* @addtogroup url |
| 35 |
* @{ |
| 36 |
*/ |
| 37 |
|
| 38 |
/** |
| 39 |
* A parsed URL |
| 40 |
*/ |
| 41 |
typedef struct pn_url_t pn_url_t; |
| 42 |
|
| 43 |
/** |
| 44 |
* Create an empty URL |
| 45 |
*/ |
| 46 |
PN_DEPRECATED("Use a third-party URL library") |
| 47 |
PNX_EXTERN pn_url_t *pn_url(void); |
| 48 |
|
| 49 |
/** |
| 50 |
* Parse a string URL as a pn_url_t. |
| 51 |
* |
| 52 |
* URL syntax: |
| 53 |
* |
| 54 |
* [ <scheme> :// ] [ <user> [ : <password> ] @ ] <host> [ : <port> ] [ / <path> ] |
| 55 |
* |
| 56 |
* `scheme`, `user`, `password`, `port` cannot contain any of '@', ':', '/' |
| 57 |
* |
| 58 |
* If the first character of `host` is '[' then it can contain any character up |
| 59 |
* to ']' (this is to allow IPv6 literal syntax). Otherwise it also cannot |
| 60 |
* contain '@', ':', '/' |
| 61 |
* |
| 62 |
* `path` can contain any character |
| 63 |
* |
| 64 |
* @param[in] url A URL string. |
| 65 |
* @return The parsed pn_url_t or NULL if url is not a valid URL string. |
| 66 |
*/ |
| 67 |
PN_DEPRECATED("Use a third-party URL library") |
| 68 |
PNX_EXTERN pn_url_t *pn_url_parse(const char *url); |
| 69 |
|
| 70 |
/** |
| 71 |
* Free a URL |
| 72 |
*/ |
| 73 |
PN_DEPRECATED("Use a third-party URL library") |
| 74 |
PNX_EXTERN void pn_url_free(pn_url_t *url); |
| 75 |
|
| 76 |
/** |
| 77 |
* Clear the contents of the URL. |
| 78 |
*/ |
| 79 |
PN_DEPRECATED("Use a third-party URL library") |
| 80 |
PNX_EXTERN void pn_url_clear(pn_url_t *url); |
| 81 |
|
| 82 |
/** |
| 83 |
* Return the string form of a URL. |
| 84 |
* |
| 85 |
* The returned string is owned by the pn_url_t and will become |
| 86 |
* invalid if it is modified. |
| 87 |
*/ |
| 88 |
PN_DEPRECATED("Use a third-party URL library") |
| 89 |
PNX_EXTERN const char *pn_url_str(pn_url_t *url); |
| 90 |
|
| 91 |
/** |
| 92 |
* @name Getters for parts of the URL. |
| 93 |
* |
| 94 |
* Values belong to the URL. May return NULL if the value is not set. |
| 95 |
* |
| 96 |
* @{ |
| 97 |
*/ |
| 98 |
PN_DEPRECATED("Use a third-party URL library") |
| 99 |
PNX_EXTERN const char *pn_url_get_scheme(pn_url_t *url); |
| 100 |
PN_DEPRECATED("Use a third-party URL library") |
| 101 |
PNX_EXTERN const char *pn_url_get_username(pn_url_t *url); |
| 102 |
PN_DEPRECATED("Use a third-party URL library") |
| 103 |
PNX_EXTERN const char *pn_url_get_password(pn_url_t *url); |
| 104 |
PN_DEPRECATED("Use a third-party URL library") |
| 105 |
PNX_EXTERN const char *pn_url_get_host(pn_url_t *url); |
| 106 |
PN_DEPRECATED("Use a third-party URL library") |
| 107 |
PNX_EXTERN const char *pn_url_get_port(pn_url_t *url); |
| 108 |
PN_DEPRECATED("Use a third-party URL library") |
| 109 |
PNX_EXTERN const char *pn_url_get_path(pn_url_t *url); |
| 110 |
/** |
| 111 |
* @} |
| 112 |
*/ |
| 113 |
|
| 114 |
/** |
| 115 |
* @name Setters for parts of the URL. |
| 116 |
* |
| 117 |
* Values are copied. Value can be NULL to indicate the part is not |
| 118 |
* set. |
| 119 |
* |
| 120 |
* @{ |
| 121 |
*/ |
| 122 |
PN_DEPRECATED("Use a third-party URL library") |
| 123 |
PNX_EXTERN void pn_url_set_scheme(pn_url_t *url, const char *scheme); |
| 124 |
PN_DEPRECATED("Use a third-party URL library") |
| 125 |
PNX_EXTERN void pn_url_set_username(pn_url_t *url, const char *username); |
| 126 |
PN_DEPRECATED("Use a third-party URL library") |
| 127 |
PNX_EXTERN void pn_url_set_password(pn_url_t *url, const char *password); |
| 128 |
PN_DEPRECATED("Use a third-party URL library") |
| 129 |
PNX_EXTERN void pn_url_set_host(pn_url_t *url, const char *host); |
| 130 |
PN_DEPRECATED("Use a third-party URL library") |
| 131 |
PNX_EXTERN void pn_url_set_port(pn_url_t *url, const char *port); |
| 132 |
PN_DEPRECATED("Use a third-party URL library") |
| 133 |
PNX_EXTERN void pn_url_set_path(pn_url_t *url, const char *path); |
| 134 |
/** |
| 135 |
* @} |
| 136 |
*/ |
| 137 |
|
| 138 |
/** |
| 139 |
* @} |
| 140 |
*/ |
| 141 |
|
| 142 |
#ifdef __cplusplus |
| 143 |
} |
| 144 |
#endif |
| 145 |
|
| 146 |
#endif /* url.h */ |