Ulfius
HTTP Framework for REST Applications in C
|
Functions | |
int | ulfius_add_endpoint (struct _u_instance *u_instance, const struct _u_endpoint *u_endpoint) |
int | ulfius_add_endpoint_by_val (struct _u_instance *u_instance, const char *http_method, const char *url_prefix, const char *url_format, unsigned int priority, int(*callback_function)(const struct _u_request *request, struct _u_response *response, void *user_data), void *user_data) |
int | ulfius_add_endpoint_list (struct _u_instance *u_instance, const struct _u_endpoint **u_endpoint_list) |
int | ulfius_remove_endpoint (struct _u_instance *u_instance, const struct _u_endpoint *u_endpoint) |
int | ulfius_set_default_endpoint (struct _u_instance *u_instance, int(*callback_function)(const struct _u_request *request, struct _u_response *response, void *user_data), void *user_data) |
int | ulfius_remove_endpoint_by_val (struct _u_instance *u_instance, const char *http_method, const char *url_prefix, const char *url_format) |
const struct _u_endpoint * | ulfius_empty_endpoint () |
int | ulfius_copy_endpoint (struct _u_endpoint *dest, const struct _u_endpoint *source) |
struct _u_endpoint * | ulfius_duplicate_endpoint_list (const struct _u_endpoint *endpoint_list) |
void | ulfius_clean_endpoint (struct _u_endpoint *endpoint) |
void | ulfius_clean_endpoint_list (struct _u_endpoint *endpoint_list) |
int | ulfius_equals_endpoints (const struct _u_endpoint *endpoint1, const struct _u_endpoint *endpoint2) |
struct _u_endpoint management functions
int ulfius_add_endpoint | ( | struct _u_instance * | u_instance, |
const struct _u_endpoint * | u_endpoint | ||
) |
Add a struct _u_endpoint * to the specified u_instance Can be done during the execution of the webservice for injection
u_instance | pointer to a struct _u_instance that describe its port and bind address |
u_endpoint | pointer to a struct _u_endpoint that will be copied in the u_instance endpoint_list |
return | U_OK on success |
Add a struct _u_endpoint * to the specified u_instance Can be done during the execution of the webservice for injection u_instance: pointer to a struct _u_instance that describe its port and bind address u_endpoint: pointer to a struct _u_endpoint that will be copied in the u_instance endpoint_list return U_OK on success
int ulfius_add_endpoint_by_val | ( | struct _u_instance * | u_instance, |
const char * | http_method, | ||
const char * | url_prefix, | ||
const char * | url_format, | ||
unsigned int | priority, | ||
int(*)(const struct _u_request *request, struct _u_response *response, void *user_data) | callback_function, | ||
void * | user_data | ||
) |
Add a struct _u_endpoint * to the specified u_instance with its values specified Can be done during the execution of the webservice for injection
u_instance | pointer to a struct _u_instance that describe its port and bind address |
http_method | http verb (GET, POST, PUT, etc.) in upper case |
url_prefix | prefix for the url (optional) |
url_format | string used to define the endpoint format separate words with / to define a variable in the url, prefix it with @ or : example: /test/resource/:name/elements on an url_format that ends with '*', the rest of the url will not be tested |
priority | endpoint priority in descending order (0 is the higher priority) |
callback_function | a pointer to a function that will be executed each time the endpoint is called you must declare the function as described. |
user_data | a pointer to a data or a structure that will be available in callback_function |
Add a struct _u_endpoint * to the specified u_instance with its values specified Can be done during the execution of the webservice for injection u_instance: pointer to a struct _u_instance that describe its port and bind address http_method: http verb (GET, POST, PUT, etc.) in upper case url_prefix: prefix for the url (optional) url_format: string used to define the endpoint format separate words with / to define a variable in the url, prefix it with @ or : example: /test/resource/:name/elements on an url_format that ends with '*', the rest of the url will not be tested priority: endpoint priority in descending order (0 is the higher priority) callback_function: a pointer to a function that will be executed each time the endpoint is called you must declare the function as described. user_data: a pointer to a data or a structure that will be available in callback_function return U_OK on success
int ulfius_add_endpoint_list | ( | struct _u_instance * | u_instance, |
const struct _u_endpoint ** | u_endpoint_list | ||
) |
Add a struct _u_endpoint * list to the specified u_instance Can be done during the execution of the webservice for injection
u_instance | pointer to a struct _u_instance that describe its port and bind address |
u_endpoint_list | pointer to an array of struct _u_endpoint ending with a ulfius_empty_endpoint() that will be copied in the u_instance endpoint_list |
Add a struct _u_endpoint * list to the specified u_instance Can be done during the execution of the webservice for injection u_instance: pointer to a struct _u_instance that describe its port and bind address u_endpoint_list: pointer to a struct _u_endpoint that will be copied in the u_instance endpoint_list return U_OK on success
int ulfius_remove_endpoint | ( | struct _u_instance * | u_instance, |
const struct _u_endpoint * | u_endpoint | ||
) |
Remove a struct _u_endpoint * from the specified u_instance Can be done during the execution of the webservice for injection
u_instance | pointer to a struct _u_instance that describe its port and bind address |
u_endpoint | pointer to a struct _u_endpoint that will be removed in the u_instance endpoint_list The parameters _u_endpoint.http_method, _u_endpoint.url_prefix and _u_endpoint.url_format are strictly compared for the match If no endpoint is found, return U_ERROR_NOT_FOUND |
Remove a struct _u_endpoint * from the specified u_instance Can be done during the execution of the webservice for injection u_instance: pointer to a struct _u_instance that describe its port and bind address u_endpoint: pointer to a struct _u_endpoint that will be removed in the u_instance endpoint_list The parameters _u_endpoint.http_method, _u_endpoint.url_prefix and _u_endpoint.url_format are strictly compared for the match If no endpoint is found, return U_ERROR_NOT_FOUND return U_OK on success
int ulfius_set_default_endpoint | ( | struct _u_instance * | u_instance, |
int(*)(const struct _u_request *request, struct _u_response *response, void *user_data) | callback_function, | ||
void * | user_data | ||
) |
ulfius_set_default_endpoint Set the default endpoint This endpoint will be called if no endpoint match the url called
u_instance | pointer to a struct _u_instance that describe its port and bind address |
auth_function | a pointer to a function that will be executed prior to the callback for authentication you must declare the function as described. |
auth_data | a pointer to a data or a structure that will be available in auth_function |
auth_realm | realm value for authentication callback_function a pointer to a function that will be executed each time the endpoint is called you must declare the function as described. |
user_data | a pointer to a data or a structure that will be available in callback_function to remove a default endpoint, call ulfius_set_default_endpoint with NULL parameter for callback_function |
ulfius_set_default_endpoint Set the default endpoint This endpoint will be called if no endpoint match the url called callback_function: a pointer to a function that will be executed each time the endpoint is called you must declare the function as described. user_data: a pointer to a data or a structure that will be available in callback_function to remove a default endpoint function, call ulfius_set_default_endpoint with NULL parameter for callback_function return U_OK on success
int ulfius_remove_endpoint_by_val | ( | struct _u_instance * | u_instance, |
const char * | http_method, | ||
const char * | url_prefix, | ||
const char * | url_format | ||
) |
Remove a struct _u_endpoint * from the specified u_instance using the specified values used to identify an endpoint Can be done during the execution of the webservice for injection The parameters _u_endpoint.http_method, _u_endpoint.url_prefix and _u_endpoint.url_format are strictly compared for the match If no endpoint is found, return U_ERROR_NOT_FOUND
u_instance | pointer to a struct _u_instance that describe its port and bind address |
http_method | http_method used by the endpoint |
url_prefix | url_prefix used by the endpoint |
url_format | url_format used by the endpoint |
Remove a struct _u_endpoint * from the specified u_instance using the specified values used to identify an endpoint Can be done during the execution of the webservice for injection u_instance: pointer to a struct _u_instance that describe its port and bind address http_method: http_method used by the endpoint url_prefix: url_prefix used by the endpoint url_format: url_format used by the endpoint The parameters _u_endpoint.http_method, _u_endpoint.url_prefix and _u_endpoint.url_format are strictly compared for the match If no endpoint is found, return U_ERROR_NOT_FOUND return U_OK on success
const struct _u_endpoint* ulfius_empty_endpoint | ( | ) |
ulfius_empty_endpoint
ulfius_empty_endpoint return an empty endpoint that goes at the end of an endpoint list
int ulfius_copy_endpoint | ( | struct _u_endpoint * | dest, |
const struct _u_endpoint * | source | ||
) |
ulfius_copy_endpoint makes a copy of an endpoint with duplicate values
dest | the endpoint destination |
source | the endpoint source |
ulfius_copy_endpoint return a copy of an endpoint with duplicate values
struct _u_endpoint* ulfius_duplicate_endpoint_list | ( | const struct _u_endpoint * | endpoint_list | ) |
u_copy_endpoint_list makes a copy of an endpoint list with duplicate values
endpoint_list | an array of struct _u_endpoint * finishing with a ulfius_empty_endpoint() |
duplicate_endpoint_list return a copy of an endpoint list with duplicate values returned value must be free'd after use
void ulfius_clean_endpoint | ( | struct _u_endpoint * | endpoint | ) |
ulfius_clean_endpoint free allocated memory by an endpoint
endpoint | the endpoint to cleanup |
clean_endpoint free allocated memory by an endpoint
void ulfius_clean_endpoint_list | ( | struct _u_endpoint * | endpoint_list | ) |
ulfius_clean_endpoint_list free allocated memory by an endpoint list
endpoint_list | the list of endpoints to cleanup, finishing with a ulfius_empty_endpoint() |
ulfius_clean_endpoint_list free allocated memory by an endpoint list
int ulfius_equals_endpoints | ( | const struct _u_endpoint * | endpoint1, |
const struct _u_endpoint * | endpoint2 | ||
) |
ulfius_equals_endpoints Compare 2 endpoints
endpoint1 | the first endpoint to compare |
endpoint2 | the second endpoint to compare |
ulfius_equals_endpoints Compare 2 endpoints and return true if their method, prefix and format are the same or if both are NULL