Macros, functions and structures used for data type recognition.
More...
Macros, functions and structures used for data type recognition.
struct ci_magics_db* ci_magic_db_load |
( |
const char * |
filename | ) |
|
Read the magics db from a file and create a ci_magics_db object.
The user normaly does not need to call this function inside c-icap server. It is not a thread safe function, should called only during icap library initialization before threads started.
- Parameters
-
filename | is the name of the file contains the db |
- Returns
- a pointer to a ci_magics_db object
int ci_magic_group_check |
( |
int |
type, |
|
|
int |
group |
|
) |
| |
Checks if a magic type belongs to a magic types group.
- Parameters
-
type | is the type id to check |
group | is the group id |
- Returns
- non zero if the type belongs to group, zero otherwise
int ci_magic_group_id |
( |
const char * |
group | ) |
|
Finds the group id from group name.
- Parameters
-
group | is the name of the group |
- Returns
- the group id
char* ci_magic_group_name |
( |
int |
group | ) |
|
Retrieve the name of a magic types group.
- Parameters
-
- Returns
- the name of the group or NULL if the group does not exists
int ci_magic_groups_count |
( |
| ) |
|
The number of groups stored in internal magic db.
- Returns
- the number of stored magic groups
int ci_magic_req_data_type |
( |
ci_request_t * |
req, |
|
|
int * |
isencoded |
|
) |
| |
Return the type of data of an c-icap request object.
This function checks the preview data of the request. If the data are encoded this function try to uncompress them before data type recognition
- Parameters
-
req | the c-icap request (ci_request_t) data |
isencoded | set to CI_ENCODE_GZIP, CI_ENCODE_DEFLATE or CI_ENCODE_UNKNOWN if the data are encoded with an unknown method |
- Returns
- the data type or -1 if the data type recognition fails for a reason (eg no preview data, of library not initialized)
char* ci_magic_type_descr |
( |
int |
type | ) |
|
Retrieve the short description of a magic type.
- Parameters
-
- Returns
- the short description if the type or NULL if the type does not exists
int ci_magic_type_id |
( |
const char * |
name | ) |
|
Finds the type id from type name.
- Parameters
-
name | is the name of the magic type |
- Returns
- the type id
char* ci_magic_type_name |
( |
int |
type | ) |
|
Retrieve the name of a magic type.
- Parameters
-
- Returns
- the name of the type or NULL if the type does not exists
int ci_magic_types_count |
( |
| ) |
|
The number of types stored in internal magic db.
- Returns
- the number of stored magic types