diff options
Diffstat (limited to 'Source/charon/utils')
-rw-r--r-- | Source/charon/utils/identification.c | 18 | ||||
-rw-r--r-- | Source/charon/utils/identification.h | 54 | ||||
-rw-r--r-- | Source/charon/utils/logger_manager.c | 1 |
3 files changed, 71 insertions, 2 deletions
diff --git a/Source/charon/utils/identification.c b/Source/charon/utils/identification.c index 124ae46fb..139fd4ac9 100644 --- a/Source/charon/utils/identification.c +++ b/Source/charon/utils/identification.c @@ -29,6 +29,22 @@ #include <utils/allocator.h> +/** + * String mappings for id_type_t. + */ +mapping_t id_type_m[] = { +{ID_IPV4_ADDR, "ID_IPV4_ADDR"}, +{ID_FQDN, "ID_FQDN"}, +{ID_RFC822_ADDR, "ID_RFC822_ADDR"}, +{ID_IPV6_ADDR, "ID_IPV6_ADDR"}, +{ID_DER_ASN1_DN, "ID_DER_ASN1_DN"}, +{ID_DER_ASN1_GN, "ID_DER_ASN1_GN"}, +{ID_KEY_ID, "ID_KEY_ID"}, +{MAPPING_END, NULL} +}; + + + typedef struct private_identification_t private_identification_t; /** @@ -136,6 +152,7 @@ static private_identification_t *identification_create() identification_t *identification_create_from_string(id_type_t type, char *string) { private_identification_t *this = identification_create(); + this->type = type; switch (type) { case ID_IPV4_ADDR: @@ -175,6 +192,7 @@ identification_t *identification_create_from_string(id_type_t type, char *string identification_t *identification_create_from_encoding(id_type_t type, chunk_t encoded) { private_identification_t *this = identification_create(); + this->type = type; switch (type) { case ID_IPV4_ADDR: diff --git a/Source/charon/utils/identification.h b/Source/charon/utils/identification.h index 0231721a5..199018382 100644 --- a/Source/charon/utils/identification.h +++ b/Source/charon/utils/identification.h @@ -27,7 +27,59 @@ #include "types.h" -#include <encoding/payloads/id_payload.h> +typedef enum id_type_t id_type_t; + +/** + * ID Types of a ID payload. + * + * @ingroup payloads + */ +enum id_type_t { + /** + * ID data is a single four (4) octet IPv4 address. + */ + ID_IPV4_ADDR = 1, + + /** + * ID data is a fully-qualified domain name string. + * An example of a ID_FQDN is, "example.com". + * The string MUST not contain any terminators (e.g., NULL, CR, etc.). + */ + ID_FQDN = 2, + + /** + * ID data is a fully-qualified RFC822 email address string, An example of + * a ID_RFC822_ADDR is, "jsmith@example.com". The string MUST + * not contain any terminators. + */ + ID_RFC822_ADDR = 3, + + /** + * ID data is a single sixteen (16) octet IPv6 address. + */ + ID_IPV6_ADDR = 5, + + /** + * ID data is the binary DER encoding of an ASN.1 X.500 Distinguished Name + * [X.501]. + */ + ID_DER_ASN1_DN = 9, + + /** + * ID data is the binary DER encoding of an ASN.1 X.500 GeneralName + * [X.509]. + */ + ID_DER_ASN1_GN = 10, + + /** + * ID data is an opaque octet stream which may be used to pass vendor- + * specific information necessary to do certain proprietary + * types of identification. + */ + ID_KEY_ID = 11 +}; + +extern mapping_t id_type_m[]; typedef struct identification_t identification_t; diff --git a/Source/charon/utils/logger_manager.c b/Source/charon/utils/logger_manager.c index cd73e8ac9..d030d5cbe 100644 --- a/Source/charon/utils/logger_manager.c +++ b/Source/charon/utils/logger_manager.c @@ -150,7 +150,6 @@ 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: |