Lines Matching refs:uri

65                    coap_uri_t *uri,
72 if (!str_var || !uri || len == 0)
75 memset(uri, 0, sizeof(coap_uri_t));
76 uri->port = COAP_DEFAULT_PORT;
108 uri->scheme = coap_uri_scheme[i].scheme;
109 uri->port = coap_uri_scheme[i].port;
119 switch (uri->scheme) {
156 coap_log_warn("Unsupported URI type %d\n", uri->scheme);
179 COAP_SET_STR(&uri->host, q - p, p);
187 uri->port = 0;
200 COAP_SET_STR(&uri->host, q - p, p);
229 uri->port = (uint16_t)uri_port;
248 COAP_SET_STR(&uri->path, q - p, p);
257 COAP_SET_STR(&uri->query, len, p);
269 coap_split_uri(const uint8_t *str_var, size_t len, coap_uri_t *uri) {
270 return coap_split_uri_sub(str_var, len, uri, COAP_URI_CHECK_URI);
274 coap_split_proxy_uri(const uint8_t *str_var, size_t len, coap_uri_t *uri) {
275 return coap_split_uri_sub(str_var, len, uri, COAP_URI_CHECK_PROXY);
279 coap_uri_into_options(const coap_uri_t *uri, const coap_address_t *dst,
286 if (create_port_host_opt && !coap_host_is_unix_domain(&uri->host)) {
289 if (dst && uri->host.length) {
297 size_t uri_host_len = uri->host.length;
298 const uint8_t *cp = uri->host.s;
311 memcmp(addr, uri->host.s, uri_host_len) != 0)) {
315 uri->host.length,
316 uri->host.s));
320 switch ((int)uri->scheme) {
323 if (uri->port != 80)
328 if (uri->port != 443)
332 if (uri->port != (coap_uri_scheme_is_secure(uri) ? COAPS_DEFAULT_PORT :
341 (uri->port & 0xffff)),
345 if (uri->path.length) {
346 if (uri->path.length > buflen)
349 res = coap_split_path(uri->path.s, uri->path.length, buf, &buflen);
363 if (uri->query.length) {
366 if (uri->query.length > buflen)
369 res = coap_split_query(uri->query.s, uri->query.length, buf, &buflen);
638 coap_new_uri(const uint8_t *uri, unsigned int length) {
646 memcpy(URI_DATA(result), uri, length);
657 coap_clone_uri(const coap_uri_t *uri) {
661 if (!uri)
664 result = (coap_uri_t *)coap_malloc_type(COAP_STRING, uri->query.length + uri->host.length +
665 uri->path.length + sizeof(coap_uri_t) + 1);
672 result->port = uri->port;
674 if (uri->host.length) {
676 result->host.length = uri->host.length;
678 memcpy(p, uri->host.s, uri->host.length);
681 if (uri->path.length) {
682 result->path.s = p = URI_DATA(result) + uri->host.length;
683 result->path.length = uri->path.length;
685 memcpy(p, uri->path.s, uri->path.length);
688 if (uri->query.length) {
689 result->query.s = p = URI_DATA(result) + uri->host.length + uri->path.length;
690 result->query.length = uri->query.length;
692 memcpy(p, uri->query.s, uri->query.length);
699 coap_delete_uri(coap_uri_t *uri) {
700 coap_free_type(COAP_STRING, uri);
779 coap_uri_t uri;
782 coap_opt_length(q), &uri) < 0) {
785 uri_path = coap_new_string(uri.path.length);
787 memcpy(uri_path->s, uri.path.s, uri.path.length);