- fixed bugs

This commit is contained in:
Jan Hutter
2005-12-01 19:53:48 +00:00
parent 257fa50386
commit 1b3f92d28d
12 changed files with 356 additions and 137 deletions
+27 -55
View File
@@ -25,6 +25,7 @@
#define _ID_PAYLOAD_H_
#include <types.h>
#include <utils/identification.h>
#include <encoding/payloads/payload.h>
/**
@@ -35,61 +36,6 @@
#define ID_PAYLOAD_HEADER_LENGTH 8
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, "[email protected]". 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 id_payload_t id_payload_t;
/**
@@ -143,6 +89,18 @@ struct id_payload_t {
*/
chunk_t (*get_data) (id_payload_t *this);
/**
* @brief Creates an identification object of this id payload.
*
* Returned object has to get destroyed by the caller.
*
* @param this calling id_payload_t object
* @return
* - identification_t object
* - NULL if ID type not supported
*/
identification_t *(*get_identification) (id_payload_t *this);
/**
* @brief Get the type of ID payload (IDi or IDr).
*
@@ -186,5 +144,19 @@ struct id_payload_t {
*/
id_payload_t *id_payload_create(bool is_initiator);
/**
* @brief Creates an id_payload_t from an existing identification_t object.
*
* @param is_initiator
* - TRUE if this payload is of type IDi
* - FALSE if this payload is of type IDr
* @param identification identification_t object
* @return created id_payload_t object
*
* @ingroup payloads
*/
id_payload_t *id_payload_create_from_identification(bool is_initiator,identification_t *identification);
#endif //_ID_PAYLOAD_H_