c-icap-doc
0.1
|
Is the structure which implements a service. More...
#include <service.h>
Data Fields | |
const char * | mod_name |
The service name. | |
const char * | mod_short_descr |
Service short description. | |
int | mod_type |
Service type. More... | |
int(* | mod_init_service )(ci_service_xdata_t *srv_xdata, struct ci_server_conf *server_conf) |
Pointer to the function called when the service loaded. More... | |
int(* | mod_post_init_service )(ci_service_xdata_t *srv_xdata, struct ci_server_conf *server_conf) |
Pointer to the function which called after the c-icap initialized, but before the c-icap start serves requests. More... | |
void(* | mod_close_service )() |
Pointer to the function which called on c-icap server shutdown. More... | |
void *(* | mod_init_request_data )(struct ci_request *req) |
Pointer to the function called when a new request for this services arrives to c-icap server. More... | |
void(* | mod_release_request_data )(void *srv_data) |
Pointer to the function which releases the service data. More... | |
int(* | mod_check_preview_handler )(char *preview_data, int preview_data_len, struct ci_request *req) |
Pointer to the function which is used to preview the ICAP client request. More... | |
int(* | mod_end_of_data_handler )(struct ci_request *req) |
Pointer to the function called when the icap client has send all the data to the service. More... | |
int(* | mod_service_io )(char *wbuf, int *wlen, char *rbuf, int *rlen, int iseof, struct ci_request *req) |
Pointer to the function called to read/send body data from/to icap client. More... | |
struct ci_conf_entry * | mod_conf_table |
Pointer to the config table of the service. More... | |
void * | mod_data |
NULL pointer. More... | |
Is the structure which implements a service.
To implement a service someones needs to implement the member functions of this struct. These functions will be called by c-icap as follows:
int(* ci_service_module::mod_check_preview_handler)(char *preview_data, int preview_data_len, struct ci_request *req) |
Pointer to the function which is used to preview the ICAP client request.
The client if supports preview sends some data for examination. The service using this function will decide if the client request must processed so the client must send more data or no processing is needed so the request ended here.
preview_data | Pointer to the preview data |
preview_data_len | The size of preview data |
req | Pointer to the related ci_request struct |
void(* ci_service_module::mod_close_service)() |
Pointer to the function which called on c-icap server shutdown.
This function can be used to release service allocated resources
struct ci_conf_entry* ci_service_module::mod_conf_table |
Pointer to the config table of the service.
Is an array which contains the definitions of configuration parameters used by the service. The configuration parameters defined in this array can be used in c-icap.conf file.
void* ci_service_module::mod_data |
NULL pointer.
This field does not used. Set it to NULL.
int(* ci_service_module::mod_end_of_data_handler)(struct ci_request *req) |
Pointer to the function called when the icap client has send all the data to the service.
This function called when the ICAP client has send all data.
req | pointer to the related ci_request struct |
void*(* ci_service_module::mod_init_request_data)(struct ci_request *req) |
Pointer to the function called when a new request for this services arrives to c-icap server.
This function should inititalize the data and structures required for serving the request.
req | a pointer to the related ci_request_t structure |
int(* ci_service_module::mod_init_service)(ci_service_xdata_t *srv_xdata, struct ci_server_conf *server_conf) |
Pointer to the function called when the service loaded.
This function called exactly when the service loaded by c-icap. Can be used to initialize the service.
srv_xdata | Pointer to the ci_service_xdata_t object of this service |
server_conf | Pointer to the struct holds the main c-icap server configuration |
int(* ci_service_module::mod_post_init_service)(ci_service_xdata_t *srv_xdata, struct ci_server_conf *server_conf) |
Pointer to the function which called after the c-icap initialized, but before the c-icap start serves requests.
This function can be used to initialize the service. Unlike to the ci_service_module::mod_init_service, when this function called the c-icap has initialized and it is known system parameters like the services and modules which are loaded, network ports and addresses the c-icap is listening to, etc.
srv_xdata | Pointer to the ci_service_xadata_t object of this service |
server_conf | Pointer to the struct holds the main c-icap server configuration |
void(* ci_service_module::mod_release_request_data)(void *srv_data) |
Pointer to the function which releases the service data.
This function called after the user request served to release the service data
srv_data | pointer to the service data returned by the ci_service_module::mod_init_request_data call |
int(* ci_service_module::mod_service_io)(char *wbuf, int *wlen, char *rbuf, int *rlen, int iseof, struct ci_request *req) |
Pointer to the function called to read/send body data from/to icap client.
This function reads body data from the ICAP client and sends back the modified body data. To allow c-icap send data to the ICAP client before all data received by the c-icap, a call to the ci_req_unlock_data function is required.
wbuf | The buffer for writing data to the ICAP client |
wlen | The size of the write buffer. It must modified to be the size of writing data. If the service has send all the data to the client, this parameter must set to CI_EOF. |
rbuf | Pointer to the data read from the ICAP client |
rlen | The lenght of the data read from the ICAP client. If this function for a reason can not read all the data, it must modify the rlen to be equal to the read data |
iseof | It has non zero value if the data in rbuf buffer are the last data from the ICAP client. |
req | pointer to the related ci_request struct |
int ci_service_module::mod_type |
Service type.
The service type can be ICAP_RESPMOD for a responce modification service, ICAP_REQMOD for request modification service or ICAP_RESPMOD|ICAP_REQMOD for a service implements both response and request modification