Modify and parse URIs. More...
Include dependency graph for uri.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | URL_list |
| Represents a list of URLs as in the "callback" header of SUBSCRIBE message in GENA. More... | |
Functions | |
| int | create_url_list (memptr *a_url_list, URL_list *a_out) |
| Function to parse the Callback header value in subscription requests. | |
| int | copy_URL_list (URL_list *in, URL_list *out) |
| Copies one URL_list into another. | |
| void | free_URL_list (URL_list *list) |
| Frees the memory associated with a URL_list. | |
| void | print_uri (uri_type *in) |
| Function useful in debugging for printing a parsed uri. | |
| void | print_token (token *in) |
| Function useful in debugging for printing a token. | |
| int | token_string_casecmp (token *in1, const char *in2) |
| Compares buffer in the token object with the buffer in in2 case insensitive. | |
| int | token_cmp (token *in1, token *in2) |
| Compares two tokens. | |
| char * | resolve_rel_url (char *a_base_url, char *a_rel_url) |
| Resolves a relative url with a base url. | |
| int | parse_token (char *in, token *out, int max_size) |
Modify and parse URIs.
Definition in file uri.hpp.
| struct URL_list |
Represents a list of URLs as in the "callback" header of SUBSCRIBE message in GENA.
Collaboration diagram for URL_list:| Class Members | ||
|---|---|---|
| size_t | size | Number of urls (not characters). |
| char * | URLs |
Dynamic memory for all urls. They are serialized, each surounded by '<' and '>'. The whole string is expected to be terminated with '\0' ("<url><url>\0"). |
| uri_type * | parsedURLs |
parsed URLs, splittet into its components scheme, hostport, pathquery, fragment, and metadata. |
Function to parse the Callback header value in subscription requests.
Takes in a buffer containing serialized URLs delimited by '<' and '>'. The entire buffer is copied into dynamic memory and stored in the URL_list. Pointers to the individual urls within this buffer are allocated and stored in the URL_list. Only URLs with network addresses are considered (i.e. host:port or domain name). Because the function expects a serialized list with delimiters, even one url must be surrounded by '<' and '>'.
| [in] | a_url_list | Pointer to a buffer containing serialized URLs delimited by '<' and '>' ("<url><url>"). It is not necessary to terminate the string with zero ('\0') but can. |
| [out] | a_out | Pointer to the new URL list. |
Definition at line 89 of file uri.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:Copies one URL_list into another.
This includes dynamically allocating the out->URLs field (the full string), and the structures used to hold the parsedURLs. This memory MUST be freed by the caller through: free_URL_list(&out).
| [in] | in | Source URL list. |
| [out] | out | Destination URL list. |
Definition at line 180 of file uri.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void free_URL_list | ( | URL_list * | list | ) |
| void print_uri | ( | uri_type * | in | ) |
| void print_token | ( | token * | in | ) |
| int token_string_casecmp | ( | token * | in1, |
| const char * | in2 | ||
| ) |
Compares buffer in the token object with the buffer in in2 case insensitive.
| [in] | in1 | Token object whose buffer is to be compared. |
| [in] | in2 | String of characters to compare with. |
Definition at line 251 of file uri.cpp.
Here is the caller graph for this function:Compares two tokens.
| [in] | in1 | First token object whose buffer is to be compared. |
| [in] | in2 | Second token object used for the comparison. |
Definition at line 265 of file uri.cpp.
Here is the caller graph for this function:| char * resolve_rel_url | ( | char * | a_base_url, |
| char * | a_rel_url | ||
| ) |
Resolves a relative url with a base url.
The resolution of '..' is NOT implemented, but '.' is resolved.
| [in] | a_base_url | Base URL. |
| [in] | a_rel_url | Relative URL. |
Definition at line 275 of file uri.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int parse_token | ( | char * | in, |
| token * | out, | ||
| int | max_size | ||
| ) |
| [in] | in | . |
| [out] | out | . |
| [in] | max_size | . |