Esempio n. 1
0
int coap_split_path(const unsigned char *s, size_t length, unsigned char *buf, size_t *buflen)
{
	struct cnt_str tmp = { {*buflen, buf}, 0 };
	coap_parse_iterator_t pi;

	coap_parse_iterator_init((unsigned char *)s, length, '/', (unsigned char *)"?#", 2, &pi);
	coap_split_path_impl(&pi, write_option, &tmp);

	*buflen = *buflen - tmp.buf.length;
	return tmp.n;
}
int
coap_hash_path(const unsigned char *path, size_t len, coap_key_t key) {
  if (!path)
    return 0;

  memset(key, 0, sizeof(coap_key_t));

  coap_split_path_impl(path, len, hash_segment, key);

  return 1;
}
int
coap_split_path(const unsigned char *s, size_t length, 
		unsigned char *buf, size_t *buflen) {
  struct cnt_str tmp = { { *buflen, buf }, 0 };

  coap_split_path_impl(s, length, write_option, &tmp);

  *buflen = *buflen - tmp.buf.length;

  return tmp.n;
}
Esempio n. 4
0
int coap_hash_path(const unsigned char *path, size_t len, coap_key_t key)
{
    coap_parse_iterator_t pi;

    if (!path)
        return 0;

    memset(key, 0, sizeof(coap_key_t));

    coap_parse_iterator_init((unsigned char *) path, len, '/', (unsigned char *) "?#", 2, &pi);
    coap_split_path_impl(&pi, hash_segment, key);

    return 1;
}
Esempio n. 5
0
int coap_split_query(const unsigned char *s, size_t length, unsigned char *buf, size_t *buflen)
{
    struct cnt_str tmp =
    {
    { *buflen, buf }, 0 };
    coap_parse_iterator_t pi;

    coap_parse_iterator_init((unsigned char *) s, length, (unsigned char *)OC_QUERY_SEPARATOR,
                             (unsigned char *) "#", 1, &pi);

    coap_split_path_impl(&pi, write_option, &tmp);

    *buflen = tmp.buf.length;
    return tmp.n;
}