![]() |
librnr
1.14.5
RoadNarrows Robotics Common Library 1
|
Uniform Resource Identifier (URI) parsing utiliies. More...
#include <stdlib.h>#include <string.h>#include <stdio.h>#include "rnr/rnrconfig.h"#include "rnr/new.h"#include "rnr/uri.h"Go to the source code of this file.
Functions | |
| Uri_T * | UriParseNew (const char *sUri) |
| Parse a URI string. More... | |
| char * | UriParseHostNew (const char *sHost, char **pHostName, int *pPortNum) |
| Parse the host string. More... | |
| void | UriSetScheme (Uri_T *pUri, const char *sScheme) |
| Set the scheme. More... | |
| void | UriSetHostName (Uri_T *pUri, const char *sHostName) |
| Set the hostname. More... | |
| void | UriSetPortNum (Uri_T *pUri, int nPortNum) |
| Set the port number. More... | |
| void | UriSetPath (Uri_T *pUri, const char *sPath) |
| Set the file path. More... | |
| char * | UriStrNew (const Uri_T *pUri) |
| Construct a new URI string from the given URI components. More... | |
| void | UriDelete (Uri_T *pUri) |
| Delete the URI compenent structure. More... | |
Uniform Resource Identifier (URI) parsing utiliies.
Definition in file uri.c.
| void UriDelete | ( | Uri_T * | pUri | ) |
Delete the URI compenent structure.
| pUri | Pointer to allocated Uri_T. |
Definition at line 397 of file uri.c.
References uri_struct_t::m_sHostName, uri_struct_t::m_sPath, uri_struct_t::m_sQuery, uri_struct_t::m_sScheme, uri_struct_t::m_sUserInfo, and NULL.
Referenced by main().
| char* UriParseHostNew | ( | const char * | sHost, |
| char ** | pHostName, | ||
| int * | pPortNum | ||
| ) |
Parse the host string.
If no hostname is specified, NULL is set. If no port number is specified, URI_PORT_NONE is set.
| sHost | Host string. | |
| [out] | pHostName | Pointer to the allocated parsed host name string. |
| [out] | pPortNum | Pointer to the parsed port number. |
Definition at line 183 of file uri.c.
References new_strndup(), NULL, URI_PORT_NONE, URI_SEP_PATH, URI_SEP_PORT, and URI_SEP_QUERY.
Referenced by UriParseNew().
| Uri_T* UriParseNew | ( | const char * | sUri | ) |
Parse a URI string.
Any URI string components not found are set to NULL. If no port is specified, the port number is set to URI_PORT_NONE (0).
The Uri_T structure is allocated. The calling application owns the structure. See UriDelete().
| sUri | URI string. |
Definition at line 70 of file uri.c.
References uri_struct_t::m_nPortNum, uri_struct_t::m_sHostName, uri_struct_t::m_sPath, uri_struct_t::m_sQuery, uri_struct_t::m_sScheme, uri_struct_t::m_sUserInfo, NEW, new_strdup(), new_strndup(), NULL, URI_SEP_PATH, URI_SEP_PATH_LEN, URI_SEP_QUERY, URI_SEP_QUERY_LEN, URI_SEP_SCHEME, URI_SEP_SCHEME_LEN, URI_SEP_USER_INFO, URI_SEP_USER_INFO_LEN, and UriParseHostNew().
Referenced by main().
| void UriSetHostName | ( | Uri_T * | pUri, |
| const char * | sHostName | ||
| ) |
Set the hostname.
| pUri | URI scheme. |
| sHostName | New hostname. |
Definition at line 254 of file uri.c.
References uri_struct_t::m_sHostName, new_strdup(), and NULL.
| void UriSetPath | ( | Uri_T * | pUri, |
| const char * | sPath | ||
| ) |
Set the file path.
| pUri | URI scheme. |
| sPath | New scheme. |
Definition at line 295 of file uri.c.
References uri_struct_t::m_sPath, new_strdup(), and NULL.
| void UriSetPortNum | ( | Uri_T * | pUri, |
| int | nPortNum | ||
| ) |
Set the port number.
| pUri | URI scheme. |
| nPortNum | New scheme. |
Definition at line 279 of file uri.c.
References uri_struct_t::m_nPortNum, NULL, and URI_PORT_NONE.
| void UriSetScheme | ( | Uri_T * | pUri, |
| const char * | sScheme | ||
| ) |
Set the scheme.
| pUri | URI scheme. |
| sScheme | New scheme. |
Definition at line 229 of file uri.c.
References uri_struct_t::m_sScheme, new_strdup(), and NULL.
| char* UriStrNew | ( | const Uri_T * | pUri | ) |
Construct a new URI string from the given URI components.
| pUri | Pointer to URI structure. |
Definition at line 321 of file uri.c.
References uri_struct_t::m_nPortNum, uri_struct_t::m_sHostName, uri_struct_t::m_sPath, uri_struct_t::m_sQuery, uri_struct_t::m_sScheme, uri_struct_t::m_sUserInfo, NEWSTR, NULL, URI_PORT_MAX_LEN, URI_PORT_NONE, URI_SEP_PATH, URI_SEP_PATH_LEN, URI_SEP_PORT, URI_SEP_PORT_LEN, URI_SEP_QUERY, URI_SEP_QUERY_LEN, URI_SEP_SCHEME, URI_SEP_SCHEME_LEN, URI_SEP_USER_INFO, and URI_SEP_USER_INFO_LEN.
Referenced by main().