KNX IoT
KNX IoT Point API stack implementation
|
generic helpers More...
#include "util/oc_list.h"
#include "util/oc_mmem.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | _ECHO |
#define | _MAKE_NULL(...) NULL |
#define | oc_alloc_string(ocstring, size) _oc_alloc_string((ocstring), (size)) |
allocate oc_string More... | |
#define | oc_bool_array(ocboolarray) (oc_cast(ocboolarray, bool)) |
#define | oc_bool_array_create_const(f, n, ...) oc_mmem_create_const(n, f((const bool[n]){ __VA_ARGS__ })) |
#define | oc_bool_array_size(ocboolarray) ((ocboolarray).size) |
#define | oc_byte_string_array_add_item(ocstringarray, str, str_len) (_oc_byte_string_array_add_item(&(ocstringarray), str, str_len)) |
#define | oc_byte_string_array_get_allocated_size(ocstringarray) ((ocstringarray).size / STRING_ARRAY_ITEM_MAX_LEN) |
#define | oc_byte_string_array_get_item(ocstringarray, index) (oc_string(ocstringarray) + (index)*STRING_ARRAY_ITEM_MAX_LEN + 1) |
#define | oc_byte_string_array_get_item_size(ocstringarray, index) (*(oc_string(ocstringarray) + (index)*STRING_ARRAY_ITEM_MAX_LEN)) |
#define | oc_byte_string_array_set_item(ocstringarray, str, str_len, index) (_oc_copy_byte_string_to_array(&(ocstringarray), str, str_len, index)) |
#define | oc_byte_string_len(ocstring) ((ocstring).size) |
#define | oc_cast(block, type) ((type *)(OC_MMEM_PTR(&(block)))) |
#define | oc_double_array(ocdoublearray) (oc_cast(ocdoublearray, double)) |
#define | oc_double_array_create_const(f, n, ...) oc_mmem_create_const(n, f((const double[n]){ __VA_ARGS__ })) |
#define | oc_double_array_size(ocdoublearray) ((ocdoublearray).size) |
#define | oc_float_array(ocfloatarray) (oc_cast(ocfloatarray, float)) |
#define | oc_float_array_create_const(f, n, ...) oc_mmem_create_const(n, f((const float[n]){ __VA_ARGS__ })) |
#define | oc_float_array_size(ocfloatarray) ((ocfloatarray).size) |
#define | oc_free_bool_array(ocarray) (_oc_free_array(ocarray, BYTE_POOL)) |
free array of booleans More... | |
#define | oc_free_byte_string_array(ocstringarray) (_oc_free_string(ocstringarray)) |
#define | oc_free_double_array(ocarray) (_oc_free_array(ocarray, DOUBLE_POOL)) |
free array of doubles More... | |
#define | oc_free_float_array(ocarray) (_oc_free_array(ocarray, FLOAT_POOL)) |
free array of floats More... | |
#define | oc_free_int_array(ocarray) (_oc_free_array(ocarray, INT_POOL)) |
free array of integers More... | |
#define | oc_free_string(ocstring) _oc_free_string(ocstring) |
free ocstring More... | |
#define | oc_free_string_array(ocstringarray) (_oc_free_string(ocstringarray)) |
free oc string array More... | |
#define | oc_int_array(ocintarray) (oc_cast(ocintarray, int64_t)) |
#define | oc_int_array_create_const(f, n, ...) oc_mmem_create_const(n, f((const int64_t[n]){ __VA_ARGS__ })) |
#define | oc_int_array_size(ocintarray) ((ocintarray).size) |
#define | oc_mmem_create_const(count, ptr) |
Helper macros to create const versions of oc types These are special and need some help to understand things correctly. More... | |
#define | oc_new_bool_array(ocarray, size) (_oc_new_array(ocarray, size, BYTE_POOL)) |
new boolean array More... | |
#define | oc_new_byte_string(ocstring, str, str_len) _oc_new_byte_string(ocstring, str, str_len) |
create new (byte) string from string (not null terminated) More... | |
#define | oc_new_byte_string_array(ocstringarray, size) (_oc_alloc_string_array(ocstringarray, size)) |
#define | oc_new_double_array(ocarray, size) (_oc_new_array(ocarray, size, DOUBLE_POOL)) |
new double array More... | |
#define | oc_new_float_array(ocarray, size) (_oc_new_array(ocarray, size, FLOAT_POOL)) |
new float array More... | |
#define | oc_new_int_array(ocarray, size) (_oc_new_array(ocarray, size, INT_POOL)) |
new integer array More... | |
#define | oc_new_string(ocstring, str, str_len) _oc_new_string(ocstring, str, str_len) |
create new string from string (null terminated) More... | |
#define | oc_new_string_array(ocstringarray, size) (_oc_alloc_string_array(ocstringarray, size)) |
new oc string array More... | |
#define | OC_SIZE_MANY(x) _ECHO, x |
#define | OC_SIZE_ZERO() _MAKE_NULL, 0 |
#define | oc_string(ocstring) (oc_cast(ocstring, char)) |
cast oc_string to string More... | |
#define | oc_string_array(ocstringarray) ((char(*)[STRING_ARRAY_ITEM_MAX_LEN])(OC_MMEM_PTR(&(ocstringarray)))) |
#define | oc_string_array_add_item(ocstringarray, str) (_oc_string_array_add_item(&(ocstringarray), str)) |
#define | oc_string_array_create_const(f, n, ...) |
#define | oc_string_array_get_allocated_size(ocstringarray) ((ocstringarray).size / STRING_ARRAY_ITEM_MAX_LEN) |
#define | oc_string_array_get_item(ocstringarray, index) (oc_string(ocstringarray) + (index)*STRING_ARRAY_ITEM_MAX_LEN) |
#define | oc_string_array_get_item_size(ocstringarray, index) (strlen((const char *)oc_string_array_get_item(ocstringarray, index))) |
#define | oc_string_array_set_item(ocstringarray, str, index) (_oc_copy_string_to_array(&(ocstringarray), str, index)) |
#define | oc_string_array_size(ocstringarray) ((ocstringarray).size / STRING_ARRAY_ITEM_MAX_LEN) |
#define | oc_string_checked(ocstring) (oc_cast(ocstring, char) ? oc_cast(ocstring, char) : "NULL") |
cast oc_string to string, replace null pointer results with a pointer to "NULL" More... | |
#define | oc_string_create_const(s) oc_mmem_create_const(sizeof(s), s) |
#define | oc_string_len(ocstring) ((ocstring).size ? (ocstring).size - 1 : 0) |
#define | STRING_ARRAY_ITEM_MAX_LEN 32 |
Typedefs | |
typedef struct oc_mmem | oc_array_t |
typedef struct oc_mmem | oc_byte_string_array_t |
typedef struct oc_mmem | oc_handle_t |
typedef struct oc_mmem | oc_string_array_t |
typedef struct oc_mmem | oc_string_t |
Enumerations | |
enum | StringRepresentation { DEC_REPRESENTATION = 0 , HEX_REPRESENTATION } |
Functions | |
void | _oc_alloc_string (oc_string_t *ocstring, size_t size) |
allocate oc_string More... | |
void | _oc_alloc_string_array (oc_string_array_t *ocstringarray, size_t size) |
allocate string array More... | |
bool | _oc_byte_string_array_add_item (oc_string_array_t *ocstringarray, const char str[], size_t str_len) |
bool | _oc_copy_byte_string_to_array (oc_string_array_t *ocstringarray, const char str[], size_t str_len, size_t index) |
bool | _oc_copy_string_to_array (oc_string_array_t *ocstringarray, const char str[], size_t index) |
void | _oc_free_array (oc_array_t *ocarray, pool type) |
free array More... | |
void | _oc_free_string (oc_string_t *ocstring) |
free oc string More... | |
void | _oc_new_array (oc_array_t *ocarray, size_t size, pool type) |
new array More... | |
void | _oc_new_byte_string (oc_string_t *ocstring, const char *str, size_t str_len) |
new oc_string byte from string More... | |
void | _oc_new_string (oc_string_t *ocstring, const char *str, size_t str_len) |
new oc_string from string More... | |
bool | _oc_string_array_add_item (oc_string_array_t *ocstringarray, const char str[]) |
int | oc_byte_string_cmp (oc_string_t string1, oc_string_t string2) |
oc_string compare for byte strings (no null terminator) More... | |
int | oc_byte_string_copy (oc_string_t *string1, oc_string_t string2) |
copy oc_string used as a byte string More... | |
int | oc_byte_string_copy_from_char_with_size (oc_string_t *string1, const char *string2, size_t string2_len) |
copy byte string from char* More... | |
int | oc_char_convert_to_lower (char *string) |
converts the input string to lower case More... | |
int | oc_char_print_hex (const char *str, int str_len) |
prints the string as hex More... | |
int | oc_char_println_hex (const char *str, int str_len) |
prints the input as hex string with newline ( ) at the end. More... | |
void | oc_concat_strings (oc_string_t *concat, const char *str1, const char *str2) |
int | oc_conv_byte_array_to_hex_string (const uint8_t *array, size_t array_len, char *hex_str, size_t *hex_str_len) |
Conversions between hex encoded strings and byte arrays. More... | |
int | oc_conv_hex_string_to_byte_array (const char *hex_str, size_t hex_str_len, uint8_t *array, size_t *array_len) |
convert hex string to byte array More... | |
int | oc_conv_hex_string_to_oc_string (const char *hex_str, size_t hex_str_len, oc_string_t *out) |
convert hex string to oc_string More... | |
int | oc_conv_uint64_to_dec_string (char *str, uint64_t number) |
Converts a uint64_t to a decimal string representation. More... | |
int | oc_conv_uint64_to_hex_string (char *str, uint64_t number) |
Converts a uint64_t to a hex string representation. More... | |
int | oc_get_sn_from_ep (const char *param, int param_len, char *sn, int sn_len, uint32_t *ia) |
retrieves the serial number and individual address from the ep parameter More... | |
int | oc_get_sn_ia_iid_from_ep (const char *param, int param_len, char *sn, int sn_len, uint32_t *ia, uint64_t *iid) |
retrieves the serial number and individual address from the ep parameter More... | |
void | oc_join_string_array (oc_string_array_t *ocstringarray, oc_string_t *ocstring) |
int | oc_print_uint64_t (uint64_t number, enum StringRepresentation rep) |
print a uint64_t, in either decimal or hex representation More... | |
int | oc_string_cmp (oc_string_t string1, oc_string_t string2) |
oc_string compare More... | |
int | oc_string_copy (oc_string_t *string1, oc_string_t string2) |
copy oc_string More... | |
int | oc_string_copy_from_char (oc_string_t *string1, const char *string2) |
copy string from char* More... | |
int | oc_string_copy_from_char_with_size (oc_string_t *string1, const char *string2, size_t string2_len) |
copy string from char* More... | |
int | oc_string_is_hex_array (oc_string_t hex_string) |
checks if the input is an array containing hex values e.g. More... | |
int | oc_string_print_hex (oc_string_t hex_string) |
prints the input as hex string More... | |
int | oc_string_println_hex (oc_string_t hex_string) |
prints the input as hex string with newline ( ) at the end. More... | |
char * | oc_strnchr (const char *string, char p, int size) |
search a string (non null terminated) for a character More... | |
bool | oc_uri_contains_wildcard (const char *uri) |
checks if the uri contains a wildcard (e.g. More... | |
bool | oc_uri_contains_wildcard_value_underscore (const char *uri_resource, size_t uri_len, const char *uri_invoked, size_t invoked_len) |
function to check if in the wild card section is a "_" (underscore) underscores can be used in functional block uri to have more than 1 instance e.g. More... | |
int | oc_uri_get_wildcard_value_as_int (const char *uri_resource, size_t uri_len, const char *uri_invoked, size_t invoked_len) |
retrieve the wild card value as integer The invoked URI is checked against the URI of a resource that might contain a wild card, if the resource URI contains a wild card then the invoked URI is compared against this URI and e.g. More... | |
int | oc_uri_get_wildcard_value_as_int_after_underscore (const char *uri_resource, size_t uri_len, const char *uri_invoked, size_t invoked_len) |
retrieve the integer after the "_" (underscore) e.g. More... | |
int | oc_uri_get_wildcard_value_as_string (const char *uri_resource, size_t uri_len, const char *uri_invoked, size_t invoked_len, const char **value) |
retrieve the wild card value as string The invoked URI is checked against the URI of a resource that might contain a wild card, if the resource URI contains a wild card then the invoked URI is compared against this URI and e.g. More... | |
int | oc_url_cmp (oc_string_t string1, oc_string_t string2) |
url compare same as string compare but ignores the leading / of the urls More... | |
generic helpers
Definition in file oc_helpers.h.
#define oc_alloc_string | ( | ocstring, | |
size | |||
) | _oc_alloc_string((ocstring), (size)) |
allocate oc_string
Definition at line 101 of file oc_helpers.h.
#define oc_free_bool_array | ( | ocarray | ) | (_oc_free_array(ocarray, BYTE_POOL)) |
free array of booleans
Definition at line 133 of file oc_helpers.h.
#define oc_free_double_array | ( | ocarray | ) | (_oc_free_array(ocarray, DOUBLE_POOL)) |
free array of doubles
Definition at line 145 of file oc_helpers.h.
#define oc_free_float_array | ( | ocarray | ) | (_oc_free_array(ocarray, FLOAT_POOL)) |
free array of floats
Definition at line 139 of file oc_helpers.h.
#define oc_free_int_array | ( | ocarray | ) | (_oc_free_array(ocarray, INT_POOL)) |
free array of integers
Definition at line 127 of file oc_helpers.h.
#define oc_free_string | ( | ocstring | ) | _oc_free_string(ocstring) |
free ocstring
Definition at line 121 of file oc_helpers.h.
#define oc_free_string_array | ( | ocstringarray | ) | (_oc_free_string(ocstringarray)) |
free oc string array
Definition at line 185 of file oc_helpers.h.
#define oc_mmem_create_const | ( | count, | |
ptr | |||
) |
Helper macros to create const versions of oc types These are special and need some help to understand things correctly.
creates a const oc_mmem struct unlikely to be used outside of the library
count | number of elements |
ptr | pointer to const data |
Definition at line 208 of file oc_helpers.h.
#define oc_new_bool_array | ( | ocarray, | |
size | |||
) | (_oc_new_array(ocarray, size, BYTE_POOL)) |
new boolean array
Definition at line 157 of file oc_helpers.h.
#define oc_new_byte_string | ( | ocstring, | |
str, | |||
str_len | |||
) | _oc_new_byte_string(ocstring, str, str_len) |
create new (byte) string from string (not null terminated)
Definition at line 114 of file oc_helpers.h.
#define oc_new_double_array | ( | ocarray, | |
size | |||
) | (_oc_new_array(ocarray, size, DOUBLE_POOL)) |
new double array
Definition at line 171 of file oc_helpers.h.
#define oc_new_float_array | ( | ocarray, | |
size | |||
) | (_oc_new_array(ocarray, size, FLOAT_POOL)) |
new float array
Definition at line 164 of file oc_helpers.h.
#define oc_new_int_array | ( | ocarray, | |
size | |||
) | (_oc_new_array(ocarray, size, INT_POOL)) |
new integer array
Definition at line 151 of file oc_helpers.h.
#define oc_new_string | ( | ocstring, | |
str, | |||
str_len | |||
) | _oc_new_string(ocstring, str, str_len) |
create new string from string (null terminated)
Definition at line 107 of file oc_helpers.h.
#define oc_new_string_array | ( | ocstringarray, | |
size | |||
) | (_oc_alloc_string_array(ocstringarray, size)) |
new oc string array
Definition at line 178 of file oc_helpers.h.
#define oc_string | ( | ocstring | ) | (oc_cast(ocstring, char)) |
cast oc_string to string
Definition at line 49 of file oc_helpers.h.
#define oc_string_array_create_const | ( | f, | |
n, | |||
... | |||
) |
Definition at line 213 of file oc_helpers.h.
#define oc_string_checked | ( | ocstring | ) | (oc_cast(ocstring, char) ? oc_cast(ocstring, char) : "NULL") |
cast oc_string to string, replace null pointer results with a pointer to "NULL"
Definition at line 56 of file oc_helpers.h.
void _oc_alloc_string | ( | oc_string_t * | ocstring, |
size_t | size | ||
) |
allocate oc_string
ocstring | the ocstring to be allocated |
size | size to be allocated |
void _oc_alloc_string_array | ( | oc_string_array_t * | ocstringarray, |
size_t | size | ||
) |
allocate string array
ocstringarray | array to be allocated |
size | the size of the string array |
void _oc_free_array | ( | oc_array_t * | ocarray, |
pool | type | ||
) |
free array
ocarray | the ocarray to be freed |
type | pool type |
void _oc_free_string | ( | oc_string_t * | ocstring | ) |
free oc string
ocstring | the ocstring to be freed |
void _oc_new_array | ( | oc_array_t * | ocarray, |
size_t | size, | ||
pool | type | ||
) |
new array
ocarray | the ocarray to be freed |
size | the size to be allocated |
type | pool type |
void _oc_new_byte_string | ( | oc_string_t * | ocstring, |
const char * | str, | ||
size_t | str_len | ||
) |
new oc_string byte from string
ocstring | the ocstring to be allocated |
str | not terminated string |
str_len | size of the string to be copied |
void _oc_new_string | ( | oc_string_t * | ocstring, |
const char * | str, | ||
size_t | str_len | ||
) |
new oc_string from string
ocstring | the ocstring to be allocated |
str | terminated string |
str_len | size of the string to be copied |
int oc_byte_string_cmp | ( | oc_string_t | string1, |
oc_string_t | string2 | ||
) |
oc_string compare for byte strings (no null terminator)
string1 | byte string 1 to be compared |
string2 | byte string 2 to be compared |
int oc_byte_string_copy | ( | oc_string_t * | string1, |
oc_string_t | string2 | ||
) |
copy oc_string used as a byte string
string1 | the oc_string to copy to |
string2 | the oc_string to copy from |
int oc_byte_string_copy_from_char_with_size | ( | oc_string_t * | string1, |
const char * | string2, | ||
size_t | string2_len | ||
) |
copy byte string from char*
Note: does NOT add a null terminator
string1 | the oc_string to copy to |
string2 | the char* to copy from |
string2_len | the length of string2 |
int oc_char_convert_to_lower | ( | char * | string | ) |
converts the input string to lower case
[in] | string | the input string that gets converted |
int oc_char_print_hex | ( | const char * | str, |
int | str_len | ||
) |
prints the string as hex
[in] | str | the input string to be printed |
[in] | str_len | the length of the input string |
int oc_char_println_hex | ( | const char * | str, |
int | str_len | ||
) |
prints the input as hex string with newline (
) at the end.
[in] | str | the input string to be printed |
[in] | str_len | the length of the input string |
int oc_conv_byte_array_to_hex_string | ( | const uint8_t * | array, |
size_t | array_len, | ||
char * | hex_str, | ||
size_t * | hex_str_len | ||
) |
Conversions between hex encoded strings and byte arrays.
convert array to hex
Note: hex_str is pre allocated with hex_str_len
[in] | array | the array of bytes |
[in] | array_len | length of the array |
hex_str | data as hex | |
hex_str_len | length of the hex string |
int oc_conv_hex_string_to_byte_array | ( | const char * | hex_str, |
size_t | hex_str_len, | ||
uint8_t * | array, | ||
size_t * | array_len | ||
) |
convert hex string to byte array
[in] | hex_str | hex string input |
[in] | hex_str_len | size of the hex string |
array | the array of bytes | |
array_len | length of the byte array |
int oc_conv_hex_string_to_oc_string | ( | const char * | hex_str, |
size_t | hex_str_len, | ||
oc_string_t * | out | ||
) |
convert hex string to oc_string
[in] | hex_str | hex string input |
[in] | hex_str_len | size of the hex string |
out | the allocated oc_string |
int oc_conv_uint64_to_dec_string | ( | char * | str, |
uint64_t | number | ||
) |
Converts a uint64_t to a decimal string representation.
[in] | number | number to be converted to string |
[out] | str | Resulting string after conversion. IMPORTANT: Should have a size of at least 22 bytes (21 + null terminator) |
int oc_conv_uint64_to_hex_string | ( | char * | str, |
uint64_t | number | ||
) |
Converts a uint64_t to a hex string representation.
[in] | number | number to be converted to hexadecimal string |
[out] | str | Resulting string after conversion. IMPORTANT: Should have a size of at least 17 bytes (16 + null terminator) |
int oc_get_sn_from_ep | ( | const char * | param, |
int | param_len, | ||
char * | sn, | ||
int | sn_len, | ||
uint32_t * | ia | ||
) |
retrieves the serial number and individual address from the ep parameter
deprecated!!
param | the string to be searched |
param_len | the length of the parameter |
sn | the sn for storage |
sn_len | the length of the sn for storage |
ia | the individual address |
int oc_get_sn_ia_iid_from_ep | ( | const char * | param, |
int | param_len, | ||
char * | sn, | ||
int | sn_len, | ||
uint32_t * | ia, | ||
uint64_t * | iid | ||
) |
retrieves the serial number and individual address from the ep parameter
param | the string to be searched |
param_len | the length of the parameter |
sn | the serial number |
sn_len | the length of the serial number |
ia | the individual address |
iid | the installation id |
int oc_print_uint64_t | ( | uint64_t | number, |
enum StringRepresentation | rep | ||
) |
print a uint64_t, in either decimal or hex representation
number | |
rep | - string representation chosen (decimal or hex) |
int oc_string_cmp | ( | oc_string_t | string1, |
oc_string_t | string2 | ||
) |
oc_string compare
string1 | string 1 to be compared |
string2 | string 2 to be compared |
int oc_string_copy | ( | oc_string_t * | string1, |
oc_string_t | string2 | ||
) |
copy oc_string
string1 | the oc_string to copy to |
string2 | the oc_string to copy from |
int oc_string_copy_from_char | ( | oc_string_t * | string1, |
const char * | string2 | ||
) |
copy string from char*
string1 | the oc_string to copy to |
string2 | the char* to copy from |
int oc_string_copy_from_char_with_size | ( | oc_string_t * | string1, |
const char * | string2, | ||
size_t | string2_len | ||
) |
copy string from char*
Note: adds a null terminator
string1 | the oc_string to copy to |
string2 | the char* to copy from |
string2_len | the length of string2 |
int oc_string_is_hex_array | ( | oc_string_t | hex_string | ) |
checks if the input is an array containing hex values e.g.
[0-9,A-F,a-f]
[in] | hex_string | the input string to be checked |
int oc_string_print_hex | ( | oc_string_t | hex_string | ) |
prints the input as hex string
[in] | hex_string | the input string to be printed |
int oc_string_println_hex | ( | oc_string_t | hex_string | ) |
prints the input as hex string with newline (
) at the end.
[in] | hex_string | the input string to be printed |
char* oc_strnchr | ( | const char * | string, |
char | p, | ||
int | size | ||
) |
search a string (non null terminated) for a character
string | the string to be searched |
p | the character to be found |
size | the size of the string |
bool oc_uri_contains_wildcard | ( | const char * | uri | ) |
checks if the uri contains a wildcard (e.g.
"*")
uri | The URI to be checked. |
bool oc_uri_contains_wildcard_value_underscore | ( | const char * | uri_resource, |
size_t | uri_len, | ||
const char * | uri_invoked, | ||
size_t | invoked_len | ||
) |
function to check if in the wild card section is a "_" (underscore) underscores can be used in functional block uri to have more than 1 instance e.g.
fb* as wild card and fb333_1 as url
uri_resource | The URI with wild card |
uri_len | The length of the URI with wild card |
uri_invoked | The URI that should match a wild card |
invoked_len | The URI length of the invoked URI |
int oc_uri_get_wildcard_value_as_int | ( | const char * | uri_resource, |
size_t | uri_len, | ||
const char * | uri_invoked, | ||
size_t | invoked_len | ||
) |
retrieve the wild card value as integer The invoked URI is checked against the URI of a resource that might contain a wild card, if the resource URI contains a wild card then the invoked URI is compared against this URI and e.g.
resource URI: / abc / * invoked URI: / abc / 1 return will be 1.
NOTE: the wild card part of the URL should only contain a number, e.g. no prefix to the number
uri_resource | The URI with wild card |
uri_len | The length of the URI with wild card |
uri_invoked | The URI that should match a wild card |
invoked_len | The URI length of the invoked URI |
int oc_uri_get_wildcard_value_as_int_after_underscore | ( | const char * | uri_resource, |
size_t | uri_len, | ||
const char * | uri_invoked, | ||
size_t | invoked_len | ||
) |
retrieve the integer after the "_" (underscore) e.g.
retrieve 1 from fb333_1 as url and fb* as wild card
uri_resource | The URI with wild card |
uri_len | The length of the URI with wild card |
uri_invoked | The URI that should match a wild card |
invoked_len | The URI length of the invoked URI |
int oc_uri_get_wildcard_value_as_string | ( | const char * | uri_resource, |
size_t | uri_len, | ||
const char * | uri_invoked, | ||
size_t | invoked_len, | ||
const char ** | value | ||
) |
retrieve the wild card value as string The invoked URI is checked against the URI of a resource that might contain a wild card, if the resource URI contains a wild card then the invoked URI is compared against this URI and e.g.
resource URI: / abc / * invoked URI: / abc / y return will be y.
uri_resource | The URI with wild card |
uri_len | The length of the URI with wild card |
uri_invoked | The URI that should match a wild card |
invoked_len | The URI length of the invoked URI |
value | the actual value that represents the wild card |
int oc_url_cmp | ( | oc_string_t | string1, |
oc_string_t | string2 | ||
) |
url compare same as string compare but ignores the leading / of the urls
string1 | url to be compared |
string2 | url to be compared |