Added identification constructor using a chunk of data, guessing id type
This commit is contained in:
@@ -1005,6 +1005,18 @@ identification_t *identification_create_from_string(char *string)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
identification_t * identification_create_from_data(chunk_t data)
|
||||
{
|
||||
char buf[data.len + 1];
|
||||
|
||||
/* use string constructor */
|
||||
snprintf(buf, sizeof(buf), "%.*s", data.len, data.ptr);
|
||||
return identification_create_from_string(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
|
||||
@@ -314,6 +314,14 @@ struct identification_t {
|
||||
*/
|
||||
identification_t * identification_create_from_string(char *string);
|
||||
|
||||
/**
|
||||
* Creates an identification from a chunk of data, guessing its type.
|
||||
*
|
||||
* @param data identification data
|
||||
* @return identification_t
|
||||
*/
|
||||
identification_t * identification_create_from_data(chunk_t data);
|
||||
|
||||
/**
|
||||
* Creates an identification_t object from an encoded chunk.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user