diff options
Diffstat (limited to 'Source/charon/utils')
-rw-r--r-- | Source/charon/utils/identification.c | 20 | ||||
-rw-r--r-- | Source/charon/utils/identification.h | 10 | ||||
-rw-r--r-- | Source/charon/utils/logger_manager.c | 1 |
3 files changed, 31 insertions, 0 deletions
diff --git a/Source/charon/utils/identification.c b/Source/charon/utils/identification.c index 270d96232..124ae46fb 100644 --- a/Source/charon/utils/identification.c +++ b/Source/charon/utils/identification.c @@ -81,6 +81,25 @@ static char *get_string(private_identification_t *this) } /** + * Implementation of identification_t.equals. + */ +static bool equals (private_identification_t *this,private_identification_t *other) +{ + if (this->type == other->type) + { + if (this->encoded.len != other->encoded.len) + { + return FALSE; + } + if (memcmp(this->encoded.ptr,other->encoded.ptr,this->encoded.len) == 0) + { + return TRUE; + } + } + return FALSE; +} + +/** * implements identification_t.destroy */ static void destroy(private_identification_t *this) @@ -99,6 +118,7 @@ static private_identification_t *identification_create() private_identification_t *this = allocator_alloc_thing(private_identification_t); /* assign methods */ + this->public.equals = (bool (*) (identification_t*,identification_t*))equals; this->public.get_encoding = (chunk_t (*) (identification_t*))get_encoding; this->public.get_type = (id_type_t (*) (identification_t*))get_type; this->public.get_string = (char* (*) (identification_t*))get_string; diff --git a/Source/charon/utils/identification.h b/Source/charon/utils/identification.h index 54e4e02da..0231721a5 100644 --- a/Source/charon/utils/identification.h +++ b/Source/charon/utils/identification.h @@ -76,6 +76,16 @@ struct identification_t { * @return string */ char *(*get_string) (identification_t *this); + + /** + * @brief Check if two identification_t objects are equal. + * + * @param this the identification_t_object + * @param other other identification_t_object + * @return string + */ + bool (*equals) (identification_t *this,identification_t *other); + /** * @brief Destroys a identification_t object. diff --git a/Source/charon/utils/logger_manager.c b/Source/charon/utils/logger_manager.c index d030d5cbe..cd73e8ac9 100644 --- a/Source/charon/utils/logger_manager.c +++ b/Source/charon/utils/logger_manager.c @@ -150,6 +150,7 @@ static logger_t *create_logger(private_logger_manager_t *this, logger_context_t case MESSAGE: case WORKER: logger_level |= ALL; + break; case PARSER: case GENERATOR: case THREAD_POOL: |