Moved data structures to new collections subfolder
authorTobias Brunner <tobias@strongswan.org>
Tue, 16 Oct 2012 12:54:16 +0000 (14:54 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 24 Oct 2012 14:00:49 +0000 (16:00 +0200)
237 files changed:
src/checksum/checksum_builder.c
src/dumm/bridge.c
src/dumm/bridge.h
src/dumm/cowfs.c
src/dumm/dumm.c
src/dumm/dumm.h
src/dumm/ext/dumm.c
src/dumm/guest.c
src/dumm/guest.h
src/dumm/iface.c
src/dumm/iface.h
src/dumm/main.c
src/frontends/android/jni/libandroidbridge/charonservice.h
src/libcharon/config/backend.h
src/libcharon/config/backend_manager.c
src/libcharon/config/ike_cfg.h
src/libcharon/config/peer_cfg.c
src/libcharon/config/peer_cfg.h
src/libcharon/config/proposal.c
src/libcharon/config/proposal.h
src/libcharon/encoding/generator.c
src/libcharon/encoding/message.h
src/libcharon/encoding/parser.c
src/libcharon/encoding/payloads/cp_payload.c
src/libcharon/encoding/payloads/cp_payload.h
src/libcharon/encoding/payloads/encryption_payload.c
src/libcharon/encoding/payloads/ke_payload.h
src/libcharon/encoding/payloads/notify_payload.h
src/libcharon/encoding/payloads/proposal_substructure.c
src/libcharon/encoding/payloads/proposal_substructure.h
src/libcharon/encoding/payloads/sa_payload.c
src/libcharon/encoding/payloads/sa_payload.h
src/libcharon/encoding/payloads/traffic_selector_substructure.c
src/libcharon/encoding/payloads/transform_substructure.c
src/libcharon/encoding/payloads/transform_substructure.h
src/libcharon/encoding/payloads/ts_payload.c
src/libcharon/encoding/payloads/ts_payload.h
src/libcharon/network/socket.h
src/libcharon/network/socket_manager.c
src/libcharon/plugins/android/android_handler.c
src/libcharon/plugins/certexpire/certexpire_export.c
src/libcharon/plugins/certexpire/certexpire_export.h
src/libcharon/plugins/dhcp/dhcp_provider.c
src/libcharon/plugins/dhcp/dhcp_socket.c
src/libcharon/plugins/dhcp/dhcp_transaction.c
src/libcharon/plugins/duplicheck/duplicheck_listener.c
src/libcharon/plugins/duplicheck/duplicheck_notify.c
src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
src/libcharon/plugins/eap_radius/eap_radius_accounting.c
src/libcharon/plugins/eap_radius/eap_radius_forward.c
src/libcharon/plugins/eap_sim_file/eap_sim_file_triplets.c
src/libcharon/plugins/eap_sim_file/eap_sim_file_triplets.h
src/libcharon/plugins/eap_simaka_pseudonym/eap_simaka_pseudonym_card.c
src/libcharon/plugins/eap_simaka_pseudonym/eap_simaka_pseudonym_provider.c
src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_card.c
src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_provider.c
src/libcharon/plugins/farp/farp_listener.c
src/libcharon/plugins/ha/ha_attribute.c
src/libcharon/plugins/ha/ha_cache.c
src/libcharon/plugins/ha/ha_cache.h
src/libcharon/plugins/ha/ha_segments.c
src/libcharon/plugins/lookip/lookip_listener.c
src/libcharon/plugins/lookip/lookip_socket.c
src/libcharon/plugins/medcli/medcli_creds.c
src/libcharon/plugins/medsrv/medsrv_creds.c
src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c
src/libcharon/plugins/stroke/stroke_attribute.c
src/libcharon/plugins/stroke/stroke_ca.c
src/libcharon/plugins/stroke/stroke_cred.c
src/libcharon/plugins/stroke/stroke_cred.h
src/libcharon/plugins/stroke/stroke_handler.c
src/libcharon/plugins/stroke/stroke_list.c
src/libcharon/plugins/stroke/stroke_socket.c
src/libcharon/plugins/tnc_imc/tnc_imc.c
src/libcharon/plugins/tnc_imc/tnc_imc_manager.c
src/libcharon/plugins/tnc_imv/tnc_imv.c
src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.c
src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.h
src/libcharon/plugins/tnc_pdp/tnc_pdp_connections.c
src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c
src/libcharon/plugins/tnccs_11/batch/tnccs_batch.c
src/libcharon/plugins/tnccs_11/messages/tnccs_msg.h
src/libcharon/plugins/tnccs_20/batch/pb_tnc_batch.c
src/libcharon/plugins/tnccs_20/tnccs_20.c
src/libcharon/plugins/uci/uci_parser.h
src/libcharon/plugins/unit_tester/tests/test_enumerator.c
src/libcharon/plugins/unit_tester/tests/test_hashtable.c
src/libcharon/plugins/unit_tester/tests/test_med_db.c
src/libcharon/plugins/unit_tester/tests/test_mysql.c
src/libcharon/plugins/unit_tester/tests/test_sqlite.c
src/libcharon/plugins/unity/unity_handler.c
src/libcharon/plugins/updown/updown_handler.c
src/libcharon/plugins/whitelist/whitelist_listener.c
src/libcharon/processing/jobs/mediation_job.h
src/libcharon/sa/eap/eap_manager.c
src/libcharon/sa/ike_sa.c
src/libcharon/sa/ike_sa_manager.c
src/libcharon/sa/ikev1/keymat_v1.c
src/libcharon/sa/ikev1/phase1.c
src/libcharon/sa/ikev2/connect_manager.c
src/libcharon/sa/ikev2/mediation_manager.c
src/libcharon/sa/shunt_manager.c
src/libcharon/sa/shunt_manager.h
src/libcharon/sa/trap_manager.c
src/libcharon/sa/trap_manager.h
src/libcharon/sa/xauth/xauth_manager.c
src/libfast/dispatcher.c
src/libfast/session.c
src/libhydra/attributes/attribute_handler.h
src/libhydra/attributes/attribute_manager.c
src/libhydra/attributes/attribute_provider.h
src/libhydra/attributes/mem_pool.c
src/libhydra/kernel/kernel_interface.c
src/libhydra/kernel/kernel_net.h
src/libhydra/plugins/attr/attr_provider.c
src/libhydra/plugins/kernel_klips/kernel_klips_ipsec.c
src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c
src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
src/libimcv/ietf/ietf_attr_attr_request.c
src/libimcv/ietf/ietf_attr_installed_packages.c
src/libimcv/ietf/ietf_attr_port_filter.c
src/libimcv/imc/imc_agent.h
src/libimcv/imc/imc_msg.c
src/libimcv/imv/imv_agent.h
src/libimcv/imv/imv_msg.c
src/libimcv/os_info/os_info.c
src/libimcv/pa_tnc/pa_tnc_attr_manager.c
src/libimcv/pa_tnc/pa_tnc_msg.c
src/libimcv/plugins/imc_test/imc_test_state.c
src/libimcv/plugins/imv_os/imv_os.c
src/libimcv/plugins/imv_scanner/imv_scanner.c
src/libimcv/plugins/imv_test/imv_test_state.c
src/libipsec/ipsec_event_relay.c
src/libipsec/ipsec_policy_mgr.c
src/libipsec/ipsec_policy_mgr.h
src/libipsec/ipsec_processor.c
src/libipsec/ipsec_sa_mgr.c
src/libpts/plugins/imc_attestation/imc_attestation.c
src/libpts/plugins/imc_attestation/imc_attestation_state.c
src/libpts/plugins/imv_attestation/imv_attestation.c
src/libpts/plugins/imv_attestation/imv_attestation_process.h
src/libpts/plugins/imv_attestation/imv_attestation_state.c
src/libpts/pts/components/pts_component_manager.c
src/libpts/pts/pts.h
src/libpts/pts/pts_file_meas.c
src/libpts/pts/pts_file_meta.c
src/libpts/tcg/tcg_pts_attr_file_meas.c
src/libpts/tcg/tcg_pts_attr_req_func_comp_evid.c
src/libpts/tcg/tcg_pts_attr_unix_file_meta.c
src/libradius/radius_client.c
src/libradius/radius_config.c
src/libsimaka/simaka_manager.c
src/libsimaka/simaka_manager.h
src/libsimaka/simaka_message.c
src/libstrongswan/Android.mk
src/libstrongswan/Makefile.am
src/libstrongswan/collections/blocking_queue.c [new file with mode: 0644]
src/libstrongswan/collections/blocking_queue.h [new file with mode: 0644]
src/libstrongswan/collections/enumerator.c [new file with mode: 0644]
src/libstrongswan/collections/enumerator.h [new file with mode: 0644]
src/libstrongswan/collections/hashtable.c [new file with mode: 0644]
src/libstrongswan/collections/hashtable.h [new file with mode: 0644]
src/libstrongswan/collections/linked_list.c [new file with mode: 0644]
src/libstrongswan/collections/linked_list.h [new file with mode: 0644]
src/libstrongswan/credentials/auth_cfg.c
src/libstrongswan/credentials/auth_cfg.h
src/libstrongswan/credentials/certificates/pkcs10.h
src/libstrongswan/credentials/certificates/x509.h
src/libstrongswan/credentials/cred_encoding.c
src/libstrongswan/credentials/credential_factory.c
src/libstrongswan/credentials/credential_manager.c
src/libstrongswan/credentials/credential_manager.h
src/libstrongswan/credentials/ietf_attributes/ietf_attributes.c
src/libstrongswan/credentials/keys/shared_key.h
src/libstrongswan/credentials/sets/cert_cache.c
src/libstrongswan/credentials/sets/mem_cred.c
src/libstrongswan/credentials/sets/mem_cred.h
src/libstrongswan/crypto/crypto_factory.c
src/libstrongswan/crypto/crypto_tester.c
src/libstrongswan/crypto/pkcs7.c
src/libstrongswan/crypto/pkcs7.h
src/libstrongswan/crypto/pkcs9.c
src/libstrongswan/crypto/proposal/proposal_keywords.c
src/libstrongswan/database/database.h
src/libstrongswan/database/database_factory.c
src/libstrongswan/fetcher/fetcher_manager.c
src/libstrongswan/library.c
src/libstrongswan/library.h
src/libstrongswan/networking/host_resolver.c
src/libstrongswan/plugins/constraints/constraints_validator.c
src/libstrongswan/plugins/mysql/mysql_database.c
src/libstrongswan/plugins/openssl/openssl_crl.c
src/libstrongswan/plugins/openssl/openssl_x509.c
src/libstrongswan/plugins/pkcs11/pkcs11_creds.c
src/libstrongswan/plugins/pkcs11/pkcs11_library.c
src/libstrongswan/plugins/pkcs11/pkcs11_library.h
src/libstrongswan/plugins/pkcs11/pkcs11_manager.c
src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
src/libstrongswan/plugins/plugin_loader.c
src/libstrongswan/plugins/plugin_loader.h
src/libstrongswan/plugins/x509/x509_ac.c
src/libstrongswan/plugins/x509/x509_cert.c
src/libstrongswan/plugins/x509/x509_crl.c
src/libstrongswan/plugins/x509/x509_ocsp_request.c
src/libstrongswan/plugins/x509/x509_ocsp_response.c
src/libstrongswan/plugins/x509/x509_pkcs10.c
src/libstrongswan/processing/jobs/callback_job.c
src/libstrongswan/processing/processor.c
src/libstrongswan/selectors/traffic_selector.c
src/libstrongswan/settings.c
src/libstrongswan/settings.h
src/libstrongswan/threading/thread.c
src/libstrongswan/utils.c
src/libstrongswan/utils/backtrace.c
src/libstrongswan/utils/blocking_queue.c [deleted file]
src/libstrongswan/utils/blocking_queue.h [deleted file]
src/libstrongswan/utils/enumerator.c [deleted file]
src/libstrongswan/utils/enumerator.h [deleted file]
src/libstrongswan/utils/hashtable.c [deleted file]
src/libstrongswan/utils/hashtable.h [deleted file]
src/libstrongswan/utils/identification.h
src/libstrongswan/utils/leak_detective.c
src/libstrongswan/utils/linked_list.c [deleted file]
src/libstrongswan/utils/linked_list.h [deleted file]
src/libtls/tls_alert.c
src/libtls/tls_cache.c
src/manager/gateway.h
src/manager/manager.c
src/manager/storage.h
src/manager/xml.h
src/pki/commands/issue.c
src/pki/commands/req.c
src/pki/commands/self.c
src/pki/commands/signcrl.c
src/scepclient/scepclient.c

index b083d54..0d9e8fd 100644 (file)
@@ -21,7 +21,7 @@
 #include <library.h>
 #include <hydra.h>
 #include <daemon.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 /* we need to fake the pluto symbol to dlopen() the xauth plugin */
 void *pluto;
index 85b6471..3f4fdce 100644 (file)
@@ -17,7 +17,7 @@
 #include <libbridge.h>
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include "bridge.h"
 
index c557de9..9d48092 100644 (file)
@@ -17,7 +17,7 @@
 #define BRIDGE_H
 
 #include <library.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 typedef struct bridge_t bridge_t;
 
index f708a29..a6152bf 100644 (file)
@@ -37,7 +37,7 @@
 #include <debug.h>
 #include <threading/thread.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /** define _XOPEN_SOURCE 500 fails when using libstrongswan, define popen */
 extern ssize_t pread(int fd, void *buf, size_t count, off_t offset);
index 59751fa..4d0ca9b 100644 (file)
@@ -24,7 +24,7 @@
 #include <errno.h>
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include "dumm.h"
 
index 4bd2080..7c7923c 100644 (file)
@@ -20,7 +20,7 @@
 #include <signal.h>
 
 #include <library.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 #include "guest.h"
 #include "bridge.h"
index ca9b293..4c6a148 100644 (file)
@@ -22,7 +22,7 @@
 #include <library.h>
 #include <dumm.h>
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #undef PACKAGE_NAME
 #undef PACKAGE_TARNAME
index 336f6ef..752d307 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdarg.h>
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include "dumm.h"
 #include "guest.h"
index 789f231..0da05d8 100644 (file)
@@ -18,7 +18,7 @@
 #define GUEST_H
 
 #include <library.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 typedef enum guest_state_t guest_state_t;
 typedef struct guest_t guest_t;
index 214387e..7ac3b71 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/if_tun.h>
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include "iface.h"
 
index c43113a..ae886ac 100644 (file)
@@ -17,7 +17,7 @@
 #define IFACE_H
 
 #include <library.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <networking/host.h>
 
 #define TAP_DEVICE "/dev/net/tun"
index 37e7ba8..4cdf468 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "dumm.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include <sys/types.h>
 #include <unistd.h>
index 4b5839f..7391ea6 100644 (file)
@@ -35,7 +35,7 @@
 #include "kernel/network_manager.h"
 
 #include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef enum android_vpn_state_t android_vpn_state_t;
 typedef struct charonservice_t charonservice_t;
index 458abc3..aca3352 100644 (file)
@@ -26,7 +26,7 @@ typedef struct backend_t backend_t;
 #include <library.h>
 #include <config/ike_cfg.h>
 #include <config/peer_cfg.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /**
  * The interface for a configuration backend.
index f82b511..f47d571 100644 (file)
@@ -18,7 +18,7 @@
 #include <sys/types.h>
 
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 
index dc58329..fa2aaa3 100644 (file)
@@ -27,7 +27,7 @@ typedef struct ike_cfg_t ike_cfg_t;
 
 #include <library.h>
 #include <networking/host.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <utils/identification.h>
 #include <config/proposal.h>
 #include <crypto/diffie_hellman.h>
index 5b3d869..3d4ff20 100644 (file)
@@ -22,7 +22,7 @@
 #include <daemon.h>
 
 #include <threading/mutex.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <utils/identification.h>
 
 ENUM(cert_policy_names, CERT_ALWAYS_SEND, CERT_NEVER_SEND,
index 121f758..80913be 100644 (file)
@@ -29,7 +29,7 @@ typedef struct peer_cfg_t peer_cfg_t;
 
 #include <library.h>
 #include <utils/identification.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <selectors/traffic_selector.h>
 #include <config/proposal.h>
 #include <config/ike_cfg.h>
index 4738d05..e12fed7 100644 (file)
@@ -19,7 +19,7 @@
 #include "proposal.h"
 
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <utils/identification.h>
 
 #include <crypto/transform.h>
index ff6267d..77e200a 100644 (file)
@@ -27,7 +27,7 @@ typedef struct proposal_t proposal_t;
 
 #include <library.h>
 #include <utils/identification.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <networking/host.h>
 #include <crypto/transform.h>
 #include <crypto/crypters/crypter.h>
index 2dfaf43..2b6825c 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <library.h>
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <encoding/payloads/payload.h>
 #include <encoding/payloads/proposal_substructure.h>
 #include <encoding/payloads/transform_substructure.h>
index 5329838..2c11e45 100644 (file)
@@ -32,7 +32,7 @@ typedef struct message_t message_t;
 #include <sa/keymat.h>
 #include <sa/ike_sa_id.h>
 #include <networking/packet.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /**
  * This class is used to represent an IKE-Message.
index e4b140c..9e7f831 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <library.h>
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <encoding/payloads/encodings.h>
 #include <encoding/payloads/payload.h>
 #include <encoding/payloads/sa_payload.h>
index 40f6ae4..f6f373f 100644 (file)
@@ -20,7 +20,7 @@
 #include "cp_payload.h"
 
 #include <encoding/payloads/encodings.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 ENUM(config_type_names, CFG_REQUEST, CFG_ACK,
        "CFG_REQUEST",
index 5eb1e06..c23bc0b 100644 (file)
@@ -28,7 +28,7 @@ typedef struct cp_payload_t cp_payload_t;
 #include <library.h>
 #include <encoding/payloads/payload.h>
 #include <encoding/payloads/configuration_attribute.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 /**
  * Config Type of an Configuration Payload.
index 02e7b8b..6ba1b23 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <daemon.h>
 #include <encoding/payloads/encodings.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <encoding/generator.h>
 #include <encoding/parser.h>
 
index 5942954..d3aa184 100644 (file)
@@ -27,7 +27,7 @@ typedef struct ke_payload_t ke_payload_t;
 #include <library.h>
 #include <encoding/payloads/payload.h>
 #include <encoding/payloads/transform_substructure.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <crypto/diffie_hellman.h>
 
 /**
index beec1e2..498c659 100644 (file)
@@ -30,7 +30,7 @@ typedef struct notify_payload_t notify_payload_t;
 #include <library.h>
 #include <encoding/payloads/payload.h>
 #include <encoding/payloads/proposal_substructure.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /**
  * Notify message types for IKEv2, and a subset for IKEv1.
index 653f51a..1616e82 100644 (file)
@@ -22,7 +22,7 @@
 #include <encoding/payloads/encodings.h>
 #include <encoding/payloads/transform_substructure.h>
 #include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <daemon.h>
 
 /**
index 5d42a61..bfa8b9d 100644 (file)
@@ -29,7 +29,7 @@ typedef struct proposal_substructure_t proposal_substructure_t;
 #include <encoding/payloads/payload.h>
 #include <encoding/payloads/transform_substructure.h>
 #include <config/proposal.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <kernel/kernel_ipsec.h>
 #include <sa/authenticator.h>
 
index adf19aa..3a8d3a7 100644 (file)
@@ -20,7 +20,7 @@
 #include "sa_payload.h"
 
 #include <encoding/payloads/encodings.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <daemon.h>
 
 /* IKEv1 situation */
index 9a88ccc..dac3043 100644 (file)
@@ -27,7 +27,7 @@ typedef struct sa_payload_t sa_payload_t;
 #include <library.h>
 #include <encoding/payloads/payload.h>
 #include <encoding/payloads/proposal_substructure.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <kernel/kernel_ipsec.h>
 #include <sa/authenticator.h>
 
index 378f5bb..15f791b 100644 (file)
@@ -18,7 +18,7 @@
 #include "traffic_selector_substructure.h"
 
 #include <encoding/payloads/encodings.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_traffic_selector_substructure_t private_traffic_selector_substructure_t;
 
index a4a920b..a850275 100644 (file)
@@ -22,7 +22,7 @@
 #include <encoding/payloads/transform_attribute.h>
 #include <encoding/payloads/encodings.h>
 #include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <daemon.h>
 
 typedef struct private_transform_substructure_t private_transform_substructure_t;
index 947df24..97717e6 100644 (file)
@@ -27,7 +27,7 @@ typedef struct transform_substructure_t transform_substructure_t;
 #include <library.h>
 #include <encoding/payloads/payload.h>
 #include <encoding/payloads/transform_attribute.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <crypto/diffie_hellman.h>
 #include <crypto/signers/signer.h>
 #include <crypto/prfs/prf.h>
index a7678da..8dfa47b 100644 (file)
@@ -20,7 +20,7 @@
 #include "ts_payload.h"
 
 #include <encoding/payloads/encodings.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_ts_payload_t private_ts_payload_t;
 
index 5a92655..933245c 100644 (file)
@@ -25,7 +25,7 @@
 typedef struct ts_payload_t ts_payload_t;
 
 #include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <selectors/traffic_selector.h>
 #include <encoding/payloads/payload.h>
 #include <encoding/payloads/traffic_selector_substructure.h>
index 2eccc4d..f6c8a86 100644 (file)
@@ -28,7 +28,7 @@ typedef struct socket_t socket_t;
 
 #include <library.h>
 #include <networking/packet.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <plugins/plugin.h>
 
 /**
index d2736de..bf1fe5b 100644 (file)
@@ -20,7 +20,7 @@
 #include <daemon.h>
 #include <threading/thread.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_socket_manager_t private_socket_manager_t;
 
index c5e98d3..29dbbbf 100644 (file)
@@ -17,7 +17,7 @@
 #include "android_handler.h"
 
 #include <networking/host.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include <cutils/properties.h>
 
index 8e046d0..1b91217 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <debug.h>
 #include <daemon.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 #include <threading/mutex.h>
 #include <credentials/certificates/x509.h>
 
index 64281d0..7b75f2c 100644 (file)
@@ -23,7 +23,7 @@
 
 typedef struct certexpire_export_t certexpire_export_t;
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /**
  * Caches and exports trustchain information to CSV files.
index 8bc5474..f83efda 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "dhcp_provider.h"
 
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 #include <threading/mutex.h>
 
 typedef struct private_dhcp_provider_t private_dhcp_provider_t;
index f469c5a..46d4c64 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/if_ether.h>
 #include <linux/filter.h>
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <utils/identification.h>
 #include <threading/mutex.h>
 #include <threading/condvar.h>
index 83f822d..22d3f3f 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "dhcp_transaction.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_dhcp_transaction_t private_dhcp_transaction_t;
 
index 4f59e03..7c6c137 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <daemon.h>
 #include <threading/mutex.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 #include <encoding/payloads/delete_payload.h>
 #include <processing/jobs/delete_ike_sa_job.h>
 
index 06a88ed..cd5d497 100644 (file)
@@ -25,7 +25,7 @@
 #include <daemon.h>
 #include <threading/mutex.h>
 #include <threading/thread.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <processing/jobs/callback_job.h>
 
 #define DUPLICHECK_SOCKET IPSEC_PIDDIR "/charon.dck"
index 0d71c3d..96f4375 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <daemon.h>
 #include <library.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <crypto/crypters/crypter.h>
 #include <crypto/hashers/hasher.h>
 
index f164f67..7bff989 100644 (file)
@@ -21,7 +21,7 @@
 #include <radius_message.h>
 #include <radius_client.h>
 #include <daemon.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 #include <threading/mutex.h>
 
 typedef struct private_eap_radius_accounting_t private_eap_radius_accounting_t;
index 2dd38ea..e912487 100644 (file)
@@ -16,8 +16,8 @@
 #include "eap_radius_forward.h"
 
 #include <daemon.h>
-#include <utils/linked_list.h>
-#include <utils/hashtable.h>
+#include <collections/linked_list.h>
+#include <collections/hashtable.h>
 #include <threading/mutex.h>
 
 typedef struct private_eap_radius_forward_t private_eap_radius_forward_t;
index de3b693..ec16869 100644 (file)
@@ -19,7 +19,7 @@
 #include <errno.h>
 
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/mutex.h>
 #include <simaka_manager.h>
 
index c8e9e03..3fa0ea3 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef EAP_SIM_FILE_TRIPLETS_H_
 #define EAP_SIM_FILE_TRIPLETS_H_
 
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 typedef struct eap_sim_file_triplets_t eap_sim_file_triplets_t;
 
index 5f78c96..b5bbdd6 100644 (file)
@@ -16,7 +16,7 @@
 #include "eap_simaka_pseudonym_card.h"
 
 #include <daemon.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 
 typedef struct private_eap_simaka_pseudonym_card_t private_eap_simaka_pseudonym_card_t;
 
index 3070b80..32225d2 100644 (file)
@@ -16,7 +16,7 @@
 #include "eap_simaka_pseudonym_provider.h"
 
 #include <debug.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 
 typedef struct private_eap_simaka_pseudonym_provider_t private_eap_simaka_pseudonym_provider_t;
 
index 870d727..5bc5fd3 100644 (file)
@@ -16,7 +16,7 @@
 #include "eap_simaka_reauth_card.h"
 
 #include <daemon.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 
 typedef struct private_eap_simaka_reauth_card_t private_eap_simaka_reauth_card_t;
 
index b1a9a7f..937095e 100644 (file)
@@ -16,7 +16,7 @@
 #include "eap_simaka_reauth_provider.h"
 
 #include <daemon.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 
 typedef struct private_eap_simaka_reauth_provider_t private_eap_simaka_reauth_provider_t;
 
index d1df4cc..81d5d24 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "farp_listener.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_farp_listener_t private_farp_listener_t;
index ae62964..981def6 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "ha_attribute.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/mutex.h>
 
 typedef struct private_ha_attribute_t private_ha_attribute_t;
index e21b461..ce1afe6 100644 (file)
@@ -15,8 +15,8 @@
 
 #include "ha_cache.h"
 
-#include <utils/hashtable.h>
-#include <utils/linked_list.h>
+#include <collections/hashtable.h>
+#include <collections/linked_list.h>
 #include <threading/mutex.h>
 #include <processing/jobs/callback_job.h>
 
index 39f1947..5e3936a 100644 (file)
@@ -27,7 +27,7 @@ typedef struct ha_cache_t ha_cache_t;
 #include "ha_kernel.h"
 #include "ha_socket.h"
 
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 #include <sa/ike_sa.h>
 
index fb07809..688e09b 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <threading/mutex.h>
 #include <threading/condvar.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/thread.h>
 #include <processing/jobs/callback_job.h>
 
index 91d1235..d2388f6 100644 (file)
@@ -16,8 +16,8 @@
 #include "lookip_listener.h"
 
 #include <daemon.h>
-#include <utils/hashtable.h>
-#include <utils/linked_list.h>
+#include <collections/hashtable.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_lookip_listener_t private_lookip_listener_t;
index 5c6e0e3..dc1a80b 100644 (file)
@@ -25,7 +25,7 @@
 #include <daemon.h>
 #include <threading/thread.h>
 #include <threading/mutex.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <processing/jobs/callback_job.h>
 
 #include "lookip_msg.h"
index 9c4a0b7..677229b 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <daemon.h>
 #include <library.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 typedef struct private_medcli_creds_t private_medcli_creds_t;
 
index 3ae80f6..0d99c4f 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <daemon.h>
 #include <library.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 typedef struct private_medsrv_creds_t private_medsrv_creds_t;
 
index 33f16cc..a5e9193 100644 (file)
@@ -40,7 +40,7 @@
 #include <daemon.h>
 #include <threading/thread.h>
 #include <threading/rwlock.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 
 /* Maximum size of a packet */
 #define MAX_PACKET 10000
index 85fb94e..0f3c389 100644 (file)
@@ -17,7 +17,7 @@
 #include "stroke_attribute.h"
 
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_stroke_attribute_t private_stroke_attribute_t;
index 763b4cc..f802687 100644 (file)
@@ -18,7 +18,7 @@
 #include "stroke_cred.h"
 
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <crypto/hashers/hasher.h>
 
 #include <daemon.h>
index de80327..4ecb63d 100644 (file)
@@ -34,7 +34,7 @@
 #include <credentials/certificates/ac.h>
 #include <credentials/sets/mem_cred.h>
 #include <credentials/sets/callback_cred.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <utils/lexparser.h>
 #include <threading/rwlock.h>
 #include <daemon.h>
index 83e6488..c37d058 100644 (file)
@@ -27,7 +27,7 @@
 #include <stroke_msg.h>
 #include <credentials/credential_set.h>
 #include <credentials/certificates/certificate.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct stroke_cred_t stroke_cred_t;
 
index 523151e..fef8cab 100644 (file)
@@ -16,7 +16,7 @@
 #include "stroke_handler.h"
 
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_stroke_handler_t private_stroke_handler_t;
index c012ff2..b3a20a6 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <hydra.h>
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <plugins/plugin.h>
 #include <credentials/certificates/x509.h>
 #include <credentials/certificates/ac.h>
index 14f36cd..2771f01 100644 (file)
@@ -29,7 +29,7 @@
 #include <threading/mutex.h>
 #include <threading/thread.h>
 #include <threading/condvar.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <processing/jobs/callback_job.h>
 
 #include "stroke_config.h"
index a1f2d77..d8e9d09 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <debug.h>
 #include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/mutex.h>
 
 typedef struct private_tnc_imc_t private_tnc_imc_t;
index 65ec81d..20ad208 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <tncifimc.h>
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 #include <daemon.h>
 
index f0b1507..e82cfc9 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <debug.h>
 #include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/mutex.h>
 
 typedef struct private_tnc_imv_t private_tnc_imv_t;
index 396d5d8..11b98d8 100644 (file)
@@ -22,7 +22,7 @@
 #include <tnc/imv/imv_recommendations.h>
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_tnc_imv_recommendations_t private_tnc_imv_recommendations_t;
 typedef struct recommendation_entry_t recommendation_entry_t;
index 6d65a25..66d03b2 100644 (file)
@@ -23,7 +23,7 @@
 #define TNC_IMV_RECOMMENDATIONS_H_
 
 #include <tnc/imv/imv_recommendations.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /**
  * Create an IMV empty recommendations instance
index bca4398..79aac45 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "tnc_pdp_connections.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_tnc_pdp_connections_t private_tnc_pdp_connections_t;
index 515e858..2094ec5 100644 (file)
@@ -21,7 +21,7 @@
 #include <tnc/imv/imv_manager.h>
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_tnc_tnccs_manager_t private_tnc_tnccs_manager_t;
@@ -454,7 +454,7 @@ METHOD(tnccs_manager_t, get_attribute, TNC_Result,
        enumerator_t *enumerator;
        tnccs_connection_entry_t *entry;
        bool attribute_match = FALSE, entry_found = FALSE;
-       
+
        if (is_imc)
        {
                switch (attribute_id)
@@ -520,7 +520,7 @@ METHOD(tnccs_manager_t, get_attribute, TNC_Result,
                                return TNC_RESULT_INVALID_PARAMETER;
                }
        }
-       
+
        /* attributes specific to the TNCC or TNCS are unsupported */
        if (id == TNC_CONNECTIONID_ANY)
        {
@@ -577,10 +577,10 @@ METHOD(tnccs_manager_t, get_attribute, TNC_Result,
                                                                  entry->max_msg_len);
                case TNC_ATTRIBUTEID_HAS_LONG_TYPES:
                case TNC_ATTRIBUTEID_HAS_EXCLUSIVE:
-                       return bool_attribute(buffer_len, buffer, value_len, 
+                       return bool_attribute(buffer_len, buffer, value_len,
                                                                  entry->type == TNCCS_2_0);
                case TNC_ATTRIBUTEID_HAS_SOH:
-                       return bool_attribute(buffer_len, buffer, value_len, 
+                       return bool_attribute(buffer_len, buffer, value_len,
                                                                  entry->type == TNCCS_SOH);
                case TNC_ATTRIBUTEID_IFTNCCS_PROTOCOL:
                {
index c939772..1f63de3 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <tnc/tnccs/tnccs.h>
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 #include <libxml/parser.h>
index e0b5444..88d6f07 100644 (file)
@@ -25,7 +25,7 @@ typedef enum tnccs_msg_type_t tnccs_msg_type_t;
 typedef struct tnccs_msg_t tnccs_msg_t;
 
 #include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <libxml/parser.h>
 
 /**
index 2f93263..3bf048a 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <tnc/tnccs/tnccs.h>
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <bio/bio_writer.h>
 #include <bio/bio_reader.h>
 #include <pen/pen.h>
@@ -172,12 +172,12 @@ METHOD(pb_tnc_batch_t, build, void,
        bio_writer_t *writer;
 
        /* build PB-TNC batch header */
-       writer = bio_writer_create(this->batch_len);    
+       writer = bio_writer_create(this->batch_len);
        writer->write_uint8 (writer, PB_TNC_VERSION);
        writer->write_uint8 (writer, this->is_server ?
                                                                 PB_TNC_BATCH_FLAG_D : PB_TNC_BATCH_FLAG_NONE);
        writer->write_uint16(writer, this->type);
-       writer->write_uint32(writer, this->batch_len); 
+       writer->write_uint32(writer, this->batch_len);
 
        /* build PB-TNC messages */
        enumerator = this->messages->create_enumerator(this->messages);
@@ -297,7 +297,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this,
 
 fatal:
        this->errors->insert_last(this->errors, msg);
-       return FAILED;  
+       return FAILED;
 }
 
 static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
@@ -329,7 +329,7 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
        reader->destroy(reader);
 
        noskip_flag = (flags & PB_TNC_FLAG_NOSKIP) != PB_TNC_FLAG_NONE;
-       
+
        if (msg_len > data.len)
        {
                DBG1(DBG_TNC, "%u bytes insufficient to parse PB-TNC message", data.len);
@@ -455,7 +455,7 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
 
 fatal:
        this->errors->insert_last(this->errors, msg);
-       return FAILED;  
+       return FAILED;
 }
 
 METHOD(pb_tnc_batch_t, process, status_t,
index 44e1d27..4d917ed 100644 (file)
@@ -37,7 +37,7 @@
 #include <debug.h>
 #include <daemon.h>
 #include <threading/mutex.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <pen/pen.h>
 
 typedef struct private_tnccs_20_t private_tnccs_20_t;
index 7217e50..230c35e 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef UCI_PARSER_H_
 #define UCI_PARSER_H_
 
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 typedef struct uci_parser_t uci_parser_t;
 
index edbf0f5..83b78c0 100644 (file)
@@ -13,7 +13,7 @@
  * for more details.
  */
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 
 /*******************************************************************************
index bd79e12..5513f67 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #include <library.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 
 static u_int hash(char *key)
 {
index ae1d08e..75244ab 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <library.h>
 #include <daemon.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 #include <unistd.h>
 
index 252441e..eda2386 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <library.h>
 #include <daemon.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 /*******************************************************************************
  * mysql simple test
index dd8d195..99490b5 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <library.h>
 #include <daemon.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 #include <unistd.h>
 
index b2aeba6..446f512 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <daemon.h>
 #include <threading/mutex.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <processing/jobs/callback_job.h>
 
 typedef struct private_unity_handler_t private_unity_handler_t;
index b2ac02e..3a64438 100644 (file)
@@ -16,7 +16,7 @@
 #include "updown_handler.h"
 
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_updown_handler_t private_updown_handler_t;
index 64ef048..382ee3b 100644 (file)
@@ -16,7 +16,7 @@
 #include "whitelist_listener.h"
 
 #include <daemon.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 #include <threading/rwlock.h>
 
 typedef struct private_whitelist_listener_t private_whitelist_listener_t;
index 41485cb..6a14751 100644 (file)
@@ -26,7 +26,7 @@ typedef struct mediation_job_t mediation_job_t;
 #include <library.h>
 #include <processing/jobs/job.h>
 #include <utils/identification.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /**
  * Class representing a MEDIATION Job.
index 520c0ce..1886307 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "eap_manager.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_eap_manager_t private_eap_manager_t;
index d9118fc..0005188 100644 (file)
@@ -26,7 +26,7 @@
 #include <library.h>
 #include <hydra.h>
 #include <daemon.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <utils/lexparser.h>
 #include <processing/jobs/retransmit_job.h>
 #include <processing/jobs/delete_ike_sa_job.h>
index cccf5d0..38c5b4a 100644 (file)
@@ -26,7 +26,7 @@
 #include <threading/condvar.h>
 #include <threading/mutex.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <crypto/hashers/hasher.h>
 
 /* the default size of the hash table (MUST be a power of 2) */
index cff344a..eb64210 100644 (file)
@@ -18,7 +18,7 @@
 #include <daemon.h>
 #include <encoding/generator.h>
 #include <encoding/payloads/nonce_payload.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_keymat_v1_t private_keymat_v1_t;
 
index 4096141..636e06a 100644 (file)
@@ -22,7 +22,7 @@
 #include <sa/ikev1/keymat_v1.h>
 #include <encoding/payloads/ke_payload.h>
 #include <encoding/payloads/nonce_payload.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_phase1_t private_phase1_t;
 
index 5fdcea1..c4e5ea7 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <daemon.h>
 #include <threading/mutex.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <crypto/hashers/hasher.h>
 
 #include <processing/jobs/callback_job.h>
index 60eeb5d..bf5b2f4 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <daemon.h>
 #include <threading/mutex.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <processing/jobs/mediation_job.h>
 
 typedef struct peer_t peer_t;
index 5af43fb..94be7d4 100644 (file)
@@ -18,7 +18,7 @@
 #include <hydra.h>
 #include <daemon.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 
 typedef struct private_shunt_manager_t private_shunt_manager_t;
index 12ff085..28a795d 100644 (file)
@@ -22,7 +22,7 @@
 #define SHUNT_MANAGER_H_
 
 #include <library.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <config/child_cfg.h>
 
 typedef struct shunt_manager_t shunt_manager_t;
index d068ce4..69b23e1 100644 (file)
@@ -19,7 +19,7 @@
 #include <hydra.h>
 #include <daemon.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 
 typedef struct private_trap_manager_t private_trap_manager_t;
index 928b2a4..e3d3556 100644 (file)
@@ -22,7 +22,7 @@
 #define TRAP_MANAGER_H_
 
 #include <library.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <config/peer_cfg.h>
 
 typedef struct trap_manager_t trap_manager_t;
index 432c9c0..f0602a6 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "xauth_manager.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_xauth_manager_t private_xauth_manager_t;
index 63c872e..6b89635 100644 (file)
@@ -26,8 +26,8 @@
 #include <threading/thread.h>
 #include <threading/condvar.h>
 #include <threading/mutex.h>
-#include <utils/linked_list.h>
-#include <utils/hashtable.h>
+#include <collections/linked_list.h>
+#include <collections/hashtable.h>
 
 /** Intervall to check for expired sessions, in seconds */
 #define CLEANUP_INTERVAL 30
index cf14dbe..87a157b 100644 (file)
@@ -21,7 +21,7 @@
 #include <fcgiapp.h>
 #include <stdio.h>
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #define COOKIE_LEN 16
 
index 6014ef0..91fa4e5 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <chunk.h>
 #include <utils/identification.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include "attributes.h"
 
index 000d2e0..dd3963b 100644 (file)
@@ -16,7 +16,7 @@
 #include "attribute_manager.h"
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_attribute_manager_t private_attribute_manager_t;
index 82d0ee3..adfd4a5 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <networking/host.h>
 #include <utils/identification.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct attribute_provider_t attribute_provider_t;
 
index 1e150c7..1c5ea53 100644 (file)
@@ -17,8 +17,8 @@
 #include "mem_pool.h"
 
 #include <debug.h>
-#include <utils/hashtable.h>
-#include <utils/linked_list.h>
+#include <collections/hashtable.h>
+#include <collections/linked_list.h>
 #include <threading/mutex.h>
 
 #define POOL_LIMIT (sizeof(uintptr_t)*8)
index 5320ee2..79a2ab9 100644 (file)
@@ -42,7 +42,7 @@
 #include <hydra.h>
 #include <debug.h>
 #include <threading/mutex.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_kernel_interface_t private_kernel_interface_t;
 
index 0de93ea..0f2e31c 100644 (file)
@@ -25,7 +25,7 @@
 typedef struct kernel_net_t kernel_net_t;
 typedef enum kernel_address_type_t kernel_address_type_t;
 
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <networking/host.h>
 #include <plugins/plugin.h>
 
index c1c3cd8..ca32219 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <hydra.h>
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 #define SERVER_MAX             2
index d875dab..2c1d7e9 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <hydra.h>
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/thread.h>
 #include <threading/mutex.h>
 #include <processing/jobs/callback_job.h>
index a6aa34b..8cd19a2 100644 (file)
@@ -39,8 +39,8 @@
 #include <debug.h>
 #include <threading/thread.h>
 #include <threading/mutex.h>
-#include <utils/hashtable.h>
-#include <utils/linked_list.h>
+#include <collections/hashtable.h>
+#include <collections/linked_list.h>
 #include <processing/jobs/callback_job.h>
 
 /** Required for Linux 2.6.26 kernel and later */
index e5f070e..b39ffa3 100644 (file)
@@ -55,8 +55,8 @@
 #include <threading/rwlock.h>
 #include <threading/rwlock_condvar.h>
 #include <threading/spinlock.h>
-#include <utils/hashtable.h>
-#include <utils/linked_list.h>
+#include <collections/hashtable.h>
+#include <collections/linked_list.h>
 #include <processing/jobs/callback_job.h>
 
 /** delay before firing roam events (ms) */
index ed541ad..e1a8384 100644 (file)
@@ -60,8 +60,8 @@
 #include <hydra.h>
 #include <debug.h>
 #include <networking/host.h>
-#include <utils/linked_list.h>
-#include <utils/hashtable.h>
+#include <collections/linked_list.h>
+#include <collections/hashtable.h>
 #include <threading/thread.h>
 #include <threading/mutex.h>
 #include <processing/jobs/callback_job.h>
index 0ead657..6d52456 100644 (file)
@@ -29,8 +29,8 @@
 #include <threading/thread.h>
 #include <threading/mutex.h>
 #include <threading/rwlock.h>
-#include <utils/hashtable.h>
-#include <utils/linked_list.h>
+#include <collections/hashtable.h>
+#include <collections/linked_list.h>
 #include <processing/jobs/callback_job.h>
 
 #ifndef HAVE_STRUCT_SOCKADDR_SA_LEN
index 44ad70a..1b09319 100644 (file)
@@ -19,7 +19,7 @@
 #include <pa_tnc/pa_tnc_msg.h>
 #include <bio/bio_writer.h>
 #include <bio/bio_reader.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include <debug.h>
 
@@ -114,12 +114,12 @@ METHOD(pa_tnc_attr_t, build, void,
        {
                return;
        }
-       writer = bio_writer_create(ATTR_REQUEST_ENTRY_SIZE * 
+       writer = bio_writer_create(ATTR_REQUEST_ENTRY_SIZE *
                                                           this->list->get_count(this->list));
 
        enumerator = this->list->create_enumerator(this->list);
        while (enumerator->enumerate(enumerator, &entry))
-       {       
+       {
                writer->write_uint32(writer, entry->vendor_id);
                writer->write_uint32(writer, entry->type);
        }
@@ -161,7 +161,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
        reader = bio_reader_create(this->value);
        while (count--)
        {
-               reader->read_uint8 (reader, &reserved); 
+               reader->read_uint8 (reader, &reserved);
                reader->read_uint24(reader, &vendor_id);
                reader->read_uint32(reader, &type);
 
index 786051d..e0ff748 100644 (file)
@@ -20,7 +20,7 @@
 #include <pa_tnc/pa_tnc_msg.h>
 #include <bio/bio_writer.h>
 #include <bio/bio_reader.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 
@@ -87,7 +87,7 @@ struct package_entry_t {
        chunk_t version;
 };
 
-/** 
+/**
  * Free a package entry
  */
 static void free_package_entry(package_entry_t *entry)
@@ -169,7 +169,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
        reader->read_uint16(reader, &reserved);
        reader->read_uint16(reader, &count);
        *offset = INSTALLED_PACKAGES_MIN_SIZE;
-               
+
        while (reader->remaining(reader))
        {
                if (!reader->read_data8(reader, &name))
@@ -190,7 +190,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
                {
                        DBG1(DBG_TNC, "insufficient data for IETF installed package version");
                        goto end;
-               }       
+               }
                pos = memchr(version.ptr, '\0', version.len);
                if (pos)
                {
@@ -199,8 +199,8 @@ METHOD(pa_tnc_attr_t, process, status_t,
                        goto end;
                }
                *offset += 1 + version.len;
-       
-               entry = malloc_thing(package_entry_t);  
+
+               entry = malloc_thing(package_entry_t);
                entry->name = chunk_clone(name);
                entry->version = chunk_clone(version);
                this->packages->insert_last(this->packages, entry);
@@ -216,7 +216,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
 
 end:
        reader->destroy(reader);
-       return status;  
+       return status;
 }
 
 METHOD(pa_tnc_attr_t, get_ref, pa_tnc_attr_t*,
@@ -249,7 +249,7 @@ METHOD(ietf_attr_installed_packages_t, add, void,
        entry = malloc_thing(package_entry_t);
        entry->name = chunk_clone(name);
        entry->version = chunk_clone(version);
-       this->packages->insert_last(this->packages, entry);     
+       this->packages->insert_last(this->packages, entry);
 }
 
 /**
index 811ccbc..34bcf89 100644 (file)
@@ -17,7 +17,7 @@
 #include <pa_tnc/pa_tnc_msg.h>
 #include <bio/bio_writer.h>
 #include <bio/bio_reader.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 
@@ -152,7 +152,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
 
        while (reader->remaining(reader))
        {
-               entry = malloc_thing(port_entry_t);     
+               entry = malloc_thing(port_entry_t);
                reader->read_uint8 (reader, &blocked);
                entry->blocked = blocked & 0x01;
                reader->read_uint8 (reader, &entry->protocol);
@@ -161,7 +161,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
        }
        reader->destroy(reader);
 
-       return SUCCESS; 
+       return SUCCESS;
 }
 
 METHOD(pa_tnc_attr_t, get_ref, pa_tnc_attr_t*,
@@ -192,7 +192,7 @@ METHOD(ietf_attr_port_filter_t, add_port, void,
        entry->blocked = blocked;
        entry->protocol = protocol;
        entry->port = port;
-       this->ports->insert_last(this->ports, entry);   
+       this->ports->insert_last(this->ports, entry);
 }
 
 /**
index 7c36136..aef10c0 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <tncifimc.h>
 #include <pen/pen.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include <library.h>
 
index 80fc520..48a2955 100644 (file)
@@ -21,7 +21,7 @@
 #include <tncif_names.h>
 
 #include <pen/pen.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_imc_msg_t private_imc_msg_t;
index 4a4e718..0ef7840 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <tncifimv.h>
 #include <pen/pen.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include <library.h>
 
index 9781c28..e69121a 100644 (file)
@@ -21,7 +21,7 @@
 #include <tncif_names.h>
 
 #include <pen/pen.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_imv_msg_t private_imv_msg_t;
index 576d27c..8846c84 100644 (file)
@@ -18,7 +18,7 @@
 #include <sys/utsname.h>
 #include <stdio.h>
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_os_info_t private_os_info_t;
@@ -132,13 +132,13 @@ METHOD(os_info_t, get_uptime, time_t,
        if (!file)
        {
                DBG1(DBG_IMC, "failed to open \"%s\"", proc_uptime);
-               return 0;       
+               return 0;
        }
        if (fscanf(file, "%u", &uptime) != 1)
        {
                DBG1(DBG_IMC, "failed to read file \"%s\"", proc_uptime);
                uptime = 0;
-       }               
+       }
        fclose(file);
 
        return uptime;
@@ -229,7 +229,7 @@ static bool extract_platform_info(chunk_t *name, chunk_t *version)
                {
                        case RELEASE_LSB:
                        {
-                               /* Determine Distribution ID */                         
+                               /* Determine Distribution ID */
                                pos = strstr(buf, lsb_distrib_id);
                                if (!pos)
                                {
@@ -249,7 +249,7 @@ static bool extract_platform_info(chunk_t *name, chunk_t *version)
 
                                os_name.len = pos - os_name.ptr;
 
-                               /* Determine Distribution Release */                            
+                               /* Determine Distribution Release */
                                pos = strstr(buf, lsb_distrib_release);
                                if (!pos)
                                {
@@ -270,7 +270,7 @@ static bool extract_platform_info(chunk_t *name, chunk_t *version)
                                os_version.len = pos - os_version.ptr;
 
                                break;
-                       }                        
+                       }
                        case RELEASE_DEBIAN:
                        {
                                char str_debian[] = "Debian";
@@ -344,7 +344,7 @@ static bool extract_platform_info(chunk_t *name, chunk_t *version)
        *pos++ = ' ';
        memcpy(pos, uninfo.machine, strlen(uninfo.machine));
 
-       return TRUE;    
+       return TRUE;
 }
 
 /**
@@ -356,9 +356,9 @@ os_info_t *os_info_create(void)
        chunk_t name, version;
 
        /* As an opton OS name and OS version can be configured manually */
-       name.ptr = lib->settings->get_str(lib->settings, 
+       name.ptr = lib->settings->get_str(lib->settings,
                                                                          "libimcv.os_info.name", NULL);
-       version.ptr = lib->settings->get_str(lib->settings, 
+       version.ptr = lib->settings->get_str(lib->settings,
                                                                          "libimcv.os_info.version", NULL);
        if (name.ptr && version.ptr)
        {
@@ -366,7 +366,7 @@ os_info_t *os_info_create(void)
                name = chunk_clone(name);
 
                version.len = strlen(version.ptr);
-               version = chunk_clone(version); 
+               version = chunk_clone(version);
        }
        else
        {
index 1de89d8..3df660e 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "pa_tnc_attr_manager.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_pa_tnc_attr_manager_t private_pa_tnc_attr_manager_t;
@@ -46,7 +46,7 @@ struct private_pa_tnc_attr_manager_t {
 };
 
 METHOD(pa_tnc_attr_manager_t, add_vendor, void,
-       private_pa_tnc_attr_manager_t *this, pen_t vendor_id, 
+       private_pa_tnc_attr_manager_t *this, pen_t vendor_id,
        pa_tnc_attr_create_t attr_create, enum_name_t *attr_names)
 {
        entry_t *entry;
@@ -128,7 +128,7 @@ METHOD(pa_tnc_attr_manager_t, create, pa_tnc_attr_t*,
 METHOD(pa_tnc_attr_manager_t, destroy, void,
        private_pa_tnc_attr_manager_t *this)
 {
-       this->list->destroy_function(this->list, free); 
+       this->list->destroy_function(this->list, free);
        free(this);
 }
 
index b324a69..b7cdd37 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <bio/bio_writer.h>
 #include <bio/bio_reader.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <pen/pen.h>
 #include <debug.h>
 
@@ -42,7 +42,7 @@ typedef struct private_pa_tnc_msg_t private_pa_tnc_msg_t;
 #define PA_TNC_RESERVED                0x000000
 
 /**
- *  PA-TNC attribute 
+ *  PA-TNC attribute
  *
  *                       1                   2                   3
  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@@ -229,7 +229,7 @@ METHOD(pa_tnc_msg_t, process, status_t,
                error = ietf_attr_pa_tnc_error_create(error_code, this->encoding);
                goto err;
        }
-       
+
        /* offset of the first PA-TNC attribute in the PA-TNC message */
        offset = PA_TNC_HEADER_SIZE;
 
@@ -280,8 +280,8 @@ METHOD(pa_tnc_msg_t, process, status_t,
                        DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute value");
                        error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
                                                this->encoding, offset + PA_TNC_ATTR_INFO_SIZE);
-                       goto err; 
-               } 
+                       goto err;
+               }
                DBG3(DBG_TNC, "%B", &value);
 
                attr = imcv_pa_tnc_attributes->create(imcv_pa_tnc_attributes,
@@ -416,7 +416,7 @@ METHOD(pa_tnc_msg_t, destroy, void,
        private_pa_tnc_msg_t *this)
 {
        this->attributes->destroy_offset(this->attributes,
-                                                                        offsetof(pa_tnc_attr_t, destroy)); 
+                                                                        offsetof(pa_tnc_attr_t, destroy));
        this->errors->destroy_offset(this->errors,
                                                                         offsetof(pa_tnc_attr_t, destroy));
        free(this->encoding.ptr);
index 7d2db7c..fba018d 100644 (file)
@@ -18,7 +18,7 @@
 #include <tncif_names.h>
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_imc_test_state_t private_imc_test_state_t;
 typedef struct entry_t entry_t;
@@ -82,7 +82,7 @@ struct private_imc_test_state_t {
         * Do a handshake retry
         */
        bool handshake_retry;
-       
+
 };
 
 /**
@@ -280,7 +280,7 @@ imc_state_t *imc_test_state_create(TNC_ConnectionID connection_id,
                .first_handshake = TRUE,
                .handshake_retry = retry,
        );
-       
+
        return &this->public.interface;
 }
 
index c56c735..3bfe89d 100644 (file)
@@ -34,7 +34,7 @@
 #include <tncif_pa_subtypes.h>
 
 #include <pen/pen.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 /* IMV definitions */
@@ -208,7 +208,7 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
                                break;
                        }
                        case IETF_ATTR_INSTALLED_PACKAGES:
-                       { 
+                       {
                                ietf_attr_installed_packages_t *attr_cast;
                                enumerator_t *e;
                                chunk_t name, version;
@@ -224,13 +224,13 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
 
                                state->set_recommendation(state,
                                                                          TNC_IMV_ACTION_RECOMMENDATION_ALLOW,
-                                                                         TNC_IMV_EVALUATION_RESULT_COMPLIANT); 
+                                                                         TNC_IMV_EVALUATION_RESULT_COMPLIANT);
                                assessment = TRUE;
                                break;
                        }
                        default:
                                break;
-               }               
+               }
        }
        enumerator->destroy(enumerator);
 
@@ -263,7 +263,7 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
                        assessment = TRUE;
                }
                else
-               {       
+               {
                        DBG1(DBG_IMV, "requesting installed packages for '%s'",
                                                   product_info);
                        attr = ietf_attr_attr_request_create(PEN_IETF,
index ad7591b..4d9762c 100644 (file)
@@ -25,7 +25,7 @@
 #include <tncif_pa_subtypes.h>
 
 #include <pen/pen.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <utils/lexparser.h>
 #include <debug.h>
 
@@ -47,7 +47,7 @@ struct port_range_t {
 
 
 /**
- * Default port policy 
+ * Default port policy
  *
  * TRUE:  all server ports on the TNC client must be closed
  * FALSE: any server port on the TNC client is allowed to be open
@@ -207,7 +207,7 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
                        char buf[BUF_LEN], *pos = buf;
                        size_t len = BUF_LEN;
                        bool blocked, compliant = TRUE;
-       
+
                        attr_port_filter = (ietf_attr_port_filter_t*)attr;
                        enumerator = attr_port_filter->create_port_enumerator(attr_port_filter);
                        while (enumerator->enumerate(enumerator, &blocked, &protocol, &port))
@@ -237,7 +237,7 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
                                e->destroy(e);
 
                                passed = (closed_port_policy == found);
-                               DBG2(DBG_IMV, "%s port %5u %s: %s", 
+                               DBG2(DBG_IMV, "%s port %5u %s: %s",
                                        (protocol == IPPROTO_TCP) ? "tcp" : "udp", port,
                                         blocked ? "closed" : "open", passed ? "ok" : "fatal");
                                if (!passed)
@@ -253,14 +253,14 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
                                        pos += written;
                                        len -= written;
                                }
-                       } 
+                       }
                        enumerator->destroy(enumerator);
 
                        if (compliant)
                        {
                                state->set_recommendation(state,
                                                                TNC_IMV_ACTION_RECOMMENDATION_ALLOW,
-                                                               TNC_IMV_EVALUATION_RESULT_COMPLIANT);   
+                                                               TNC_IMV_EVALUATION_RESULT_COMPLIANT);
                        }
                        else
                        {
@@ -270,9 +270,9 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
                                imv_scanner_state->set_violating_ports(imv_scanner_state, buf);
                                state->set_recommendation(state,
                                                                TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS,
-                                                               TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR);  
-                       }                 
-               }               
+                                                               TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR);
+                       }
+               }
        }
        enumerator->destroy(enumerator);
 
index 67f22c0..53d4c07 100644 (file)
@@ -16,7 +16,7 @@
 #include "imv_test_state.h"
 
 #include <utils/lexparser.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_imv_test_state_t private_imv_test_state_t;
@@ -94,7 +94,7 @@ struct entry_t {
 };
 
 /**
- * Table of multi-lingual reason string entries 
+ * Table of multi-lingual reason string entries
  */
 static entry_t reasons[] = {
        { "en", "IMC Test was not configured with \"command = allow\"" },
@@ -191,7 +191,7 @@ METHOD(imv_state_t, get_reason_string, bool,
                        if (chunk_equals(lang, pref_lang))
                        {
                                *reason_language = lang;
-                               *reason_string = chunk_create(reasons[i].string, 
+                               *reason_string = chunk_create(reasons[i].string,
                                                                                strlen(reasons[i].string));
                                return TRUE;
                        }
@@ -201,7 +201,7 @@ METHOD(imv_state_t, get_reason_string, bool,
        /* no preferred language match found - use the default language */
        *reason_string =   chunk_create(reasons[0].string,
                                                                        strlen(reasons[0].string));
-       *reason_language = chunk_create(reasons[0].lang, 
+       *reason_language = chunk_create(reasons[0].lang,
                                                                        strlen(reasons[0].lang));
        return TRUE;
 }
@@ -274,8 +274,8 @@ METHOD(imv_test_state_t, another_round, bool,
                }
        }
        enumerator->destroy(enumerator);
-       
-       return not_finished;    
+
+       return not_finished;
 }
 
 /**
@@ -310,7 +310,7 @@ imv_state_t *imv_test_state_create(TNC_ConnectionID connection_id)
                .connection_id = connection_id,
                .imcs = linked_list_create(),
        );
-       
+
        return &this->public.interface;
 }
 
index 3422225..19643d5 100644 (file)
@@ -20,8 +20,8 @@
 #include <library.h>
 #include <debug.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
-#include <utils/blocking_queue.h>
+#include <collections/linked_list.h>
+#include <collections/blocking_queue.h>
 #include <processing/jobs/callback_job.h>
 
 typedef struct private_ipsec_event_relay_t private_ipsec_event_relay_t;
index 41ba792..dd904ba 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <debug.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /** Base priority for installed policies */
 #define PRIO_BASE 512
index ae0a298..dfa4b12 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <library.h>
 #include <networking/host.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <ipsec/ipsec_types.h>
 #include <selectors/traffic_selector.h>
 
index 353f0e7..4d3649d 100644 (file)
@@ -19,7 +19,7 @@
 #include <debug.h>
 #include <library.h>
 #include <threading/rwlock.h>
-#include <utils/blocking_queue.h>
+#include <collections/blocking_queue.h>
 #include <processing/jobs/callback_job.h>
 
 typedef struct private_ipsec_processor_t private_ipsec_processor_t;
index 35ad6c1..32f2cdb 100644 (file)
@@ -23,8 +23,8 @@
 #include <processing/jobs/callback_job.h>
 #include <threading/condvar.h>
 #include <threading/mutex.h>
-#include <utils/hashtable.h>
-#include <utils/linked_list.h>
+#include <collections/hashtable.h>
+#include <collections/linked_list.h>
 
 typedef struct private_ipsec_sa_mgr_t private_ipsec_sa_mgr_t;
 
index ee3d5c8..9086f72 100644 (file)
@@ -37,7 +37,7 @@
 
 #include <pen/pen.h>
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /* IMC definitions */
 
@@ -85,7 +85,7 @@ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
        }
 
        libpts_init();
-       
+
        if (min_version > TNC_IFIMC_VERSION_1 || max_version < TNC_IFIMC_VERSION_1)
        {
                DBG1(DBG_IMC, "no common IF-IMC version");
index b3d3510..5ff50c0 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <tncif_names.h>
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_imc_attestation_state_t private_imc_attestation_state_t;
@@ -237,7 +237,7 @@ imc_state_t *imc_attestation_state_create(TNC_ConnectionID connection_id)
                .components = linked_list_create(),
                .list = linked_list_create(),
        );
-       
+
        return &this->public.interface;
 }
 
index a5175d9..e3536d1 100644 (file)
@@ -38,7 +38,7 @@
 #include <pen/pen.h>
 #include <debug.h>
 #include <credentials/credential_manager.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /* IMV definitions */
 
@@ -104,7 +104,7 @@ TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
        }
 
        libpts_init();
-       
+
        if (min_version > TNC_IFIMV_VERSION_1 || max_version < TNC_IFIMV_VERSION_1)
        {
                DBG1(DBG_IMV, "no common IF-IMV version");
index b809ccf..73b4251 100644 (file)
@@ -25,7 +25,7 @@
 #include "imv_attestation_state.h"
 
 #include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <credentials/credential_manager.h>
 #include <crypto/hashers/hasher.h>
 
index aa91bf2..d5724f6 100644 (file)
@@ -18,7 +18,7 @@
 #include <libpts.h>
 
 #include <utils/lexparser.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_imv_attestation_state_t private_imv_attestation_state_t;
@@ -44,7 +44,7 @@ struct private_imv_attestation_state_t {
         * TNCCS connection state
         */
        TNC_ConnectionState state;
-       
+
        /**
         * Does the TNCCS connection support long message types?
         */
@@ -139,7 +139,7 @@ struct entry_t {
 };
 
 /**
- * Table of multi-lingual reason string entries 
+ * Table of multi-lingual reason string entries
  */
 static entry_t reasons[] = {
        { "en", "IMV Attestation: Incorrect/pending file measurement/component"
@@ -302,7 +302,7 @@ METHOD(imv_attestation_state_t, check_off_file_meas_request, bool,
        enumerator_t *enumerator;
        file_meas_request_t *request;
        bool found = FALSE;
-       
+
        enumerator = this->file_meas_requests->create_enumerator(this->file_meas_requests);
        while (enumerator->enumerate(enumerator, &request))
        {
index e330aee..40fea1c 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "pts/components/pts_component_manager.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_pts_component_manager_t private_pts_component_manager_t;
@@ -56,7 +56,7 @@ struct vendor_entry_t {
 
        /**
         * List of vendor-specific registered Functional Components
-        */     
+        */
        linked_list_t *components;
 };
 
@@ -103,7 +103,7 @@ struct private_pts_component_manager_t {
 };
 
 METHOD(pts_component_manager_t, add_vendor, void,
-       private_pts_component_manager_t *this, pen_t vendor_id, 
+       private_pts_component_manager_t *this, pen_t vendor_id,
        enum_name_t *comp_func_names, int qualifier_type_size,
        char *qualifier_flag_names, enum_name_t *qualifier_type_names)
 {
@@ -285,7 +285,7 @@ METHOD(pts_component_manager_t, create, pts_component_t*,
 METHOD(pts_component_manager_t, destroy, void,
        private_pts_component_manager_t *this)
 {
-       this->list->destroy_function(this->list, (void *)vendor_entry_destroy); 
+       this->list->destroy_function(this->list, (void *)vendor_entry_destroy);
        free(this);
 }
 
index aad73c4..423a4c8 100644 (file)
@@ -35,7 +35,7 @@ typedef struct pts_t pts_t;
 #include "components/pts_comp_func_name.h"
 
 #include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /**
  * UTF-8 encoding of the character used to delimiter the filename
index 4fece6b..344914f 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "pts_file_meas.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 #include <sys/stat.h>
@@ -179,7 +179,7 @@ METHOD(pts_file_meas_t, verify, bool,
                        }
                }
                enumerator->destroy(enumerator);
-               
+
                if (!found)
                {
                        DBG1(DBG_PTS, "  no measurement found for '%s'", filename);
@@ -200,7 +200,7 @@ METHOD(pts_file_meas_t, verify, bool,
                        break;
                }
        }
-       return success; 
+       return success;
 }
 
 METHOD(pts_file_meas_t, destroy, void,
index 6ed1c01..c97c2d7 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "pts_file_meta.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_pts_file_meta_t private_pts_file_meta_t;
index 01c4361..8138a5f 100644 (file)
@@ -18,7 +18,7 @@
 #include <pa_tnc/pa_tnc_msg.h>
 #include <bio/bio_writer.h>
 #include <bio/bio_reader.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_tcg_pts_attr_file_meas_t private_tcg_pts_attr_file_meas_t;
@@ -26,7 +26,7 @@ typedef struct private_tcg_pts_attr_file_meas_t private_tcg_pts_attr_file_meas_t
 /**
  * File Measurement
  * see section 3.19.2 of PTS Protocol: Binding to TNC IF-M Specification
- * 
+ *
  *                                        1                               2                               3
  *   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -72,12 +72,12 @@ struct private_tcg_pts_attr_file_meas_t {
         * Attribute value
         */
        chunk_t value;
-       
+
        /**
         * Noskip flag
         */
        bool noskip_flag;
-       
+
        /**
         * PTS File Measurements
         */
@@ -123,7 +123,7 @@ METHOD(pa_tnc_attr_t, build, void,
        char *filename;
        chunk_t measurement;
        bool first = TRUE;
-       
+
        if (this->value.ptr)
        {
                return;
@@ -169,7 +169,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
        chunk_t measurement, filename;
        char buf[BUF_LEN];
        status_t status = FAILED;
-       
+
        if (this->value.len < PTS_FILE_MEAS_SIZE)
        {
                DBG1(DBG_TNC, "insufficient data for PTS file measurement header");
@@ -181,9 +181,9 @@ METHOD(pa_tnc_attr_t, process, status_t,
        reader->read_uint64(reader, &number_of_files);
        reader->read_uint16(reader, &request_id);
        reader->read_uint16(reader, &meas_len);
-       
+
        this->measurements = pts_file_meas_create(request_id);
-       
+
        while (number_of_files--)
        {
                if (!reader->read_data(reader, meas_len, &measurement))
index a631e98..3781683 100644 (file)
@@ -18,7 +18,7 @@
 #include <pa_tnc/pa_tnc_msg.h>
 #include <bio/bio_writer.h>
 #include <bio/bio_reader.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_tcg_pts_attr_req_func_comp_evid_t private_tcg_pts_attr_req_func_comp_evid_t;
@@ -47,7 +47,7 @@ typedef struct private_tcg_pts_attr_req_func_comp_evid_t private_tcg_pts_attr_re
  */
 
 /**
- * Component Functional Name Structure 
+ * Component Functional Name Structure
  * (see section 5.1 of PTS Protocol: Binding to TNC IF-M Specification)
  *
  *                                        1                               2                               3
@@ -58,7 +58,7 @@ typedef struct private_tcg_pts_attr_req_func_comp_evid_t private_tcg_pts_attr_re
  *  |                   Component Functional Name                   |
  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  */
+
 #define PTS_REQ_FUNC_COMP_EVID_SIZE            12
 #define PTS_REQ_FUNC_COMP_FAMILY_MASK  0xC0
 
@@ -81,7 +81,7 @@ struct private_tcg_pts_attr_req_func_comp_evid_t {
         * Attribute value
         */
        chunk_t value;
-       
+
        /**
         * Noskip flag
         */
@@ -249,7 +249,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
                entry->flags = flags;
                entry->depth = depth;
                entry->name = pts_comp_func_name_create(vendor_id, name, qualifier);
-               
+
                this->list->insert_last(this->list, entry);
        }
        status = SUCCESS;
index 4f93ee8..51088e6 100644 (file)
@@ -18,7 +18,7 @@
 #include <pa_tnc/pa_tnc_msg.h>
 #include <bio/bio_writer.h>
 #include <bio/bio_reader.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <debug.h>
 
 typedef struct private_tcg_pts_attr_file_meta_t private_tcg_pts_attr_file_meta_t;
@@ -26,7 +26,7 @@ typedef struct private_tcg_pts_attr_file_meta_t private_tcg_pts_attr_file_meta_t
 /**
  * Unix-Style File Metadata
  * see section 3.17.3 of PTS Protocol: Binding to TNC IF-M Specification
- * 
+ *
  *                                        1                               2                               3
  *   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -88,12 +88,12 @@ struct private_tcg_pts_attr_file_meta_t {
         * Attribute value
         */
        chunk_t value;
-       
+
        /**
         * Noskip flag
         */
        bool noskip_flag;
-       
+
        /**
         * PTS File Metadata
         */
@@ -136,7 +136,7 @@ METHOD(pa_tnc_attr_t, build, void,
        enumerator_t *enumerator;
        pts_file_metadata_t *entry;
        u_int64_t number_of_files;
-       
+
        if (this->value.ptr)
        {
                return;
@@ -163,7 +163,7 @@ METHOD(pa_tnc_attr_t, build, void,
                                                                                                  strlen(entry->filename)));
        }
        enumerator->destroy(enumerator);
-       
+
        this->value = chunk_clone(writer->get_buf(writer));
        writer->destroy(writer);
 }
@@ -179,7 +179,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
        u_int64_t owner, group;
        chunk_t filename;
        status_t status = FAILED;
-       
+
        if (this->value.len < PTS_FILE_META_SIZE)
        {
                DBG1(DBG_TNC, "insufficient data for PTS Unix-Style file metadata header");
@@ -190,7 +190,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
        reader->read_uint64(reader, &number_of_files);
 
        this->metadata = pts_file_meta_create();
-       
+
        while (number_of_files--)
        {
                if (!reader->read_uint16(reader, &len))
@@ -243,7 +243,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
                        DBG1(DBG_TNC, "insufficient data for filename");
                        goto end;
                }
-               
+
                entry = malloc_thing(pts_file_metadata_t);
                entry->type = type;
                entry->filesize = filesize;
index 143cfa1..442cb12 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <debug.h>
 #include <networking/host.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/condvar.h>
 #include <threading/mutex.h>
 
index 6e3394b..5dbd1d7 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <threading/mutex.h>
 #include <threading/condvar.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_radius_config_t private_radius_config_t;
 
index 65de1c5..e10ab21 100644 (file)
@@ -16,7 +16,7 @@
 #include "simaka_manager.h"
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_simaka_manager_t private_simaka_manager_t;
index 64a67e5..810cb06 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <crypto/hashers/hasher.h>
 #include <utils/identification.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <plugins/plugin.h>
 
 typedef struct simaka_manager_t simaka_manager_t;
index aa36a09..e7c7a0a 100644 (file)
@@ -18,7 +18,7 @@
 #include "simaka_manager.h"
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_simaka_message_t private_simaka_message_t;
 typedef struct hdr_t hdr_t;
index c627447..094e1bc 100644 (file)
@@ -5,6 +5,8 @@ include $(CLEAR_VARS)
 LOCAL_SRC_FILES := \
 library.c chunk.c debug.c enum.c settings.c printf_hook.c \
 asn1/asn1.c asn1/asn1_parser.c asn1/oid.c bio/bio_reader.c bio/bio_writer.c \
+collections/blocking_queue.c collections/enumerator.c collections/hashtable.c \
+collections/linked_list.c \
 crypto/crypters/crypter.c crypto/hashers/hasher.c crypto/pkcs7.c crypto/pkcs9.c \
 crypto/proposal/proposal_keywords.c crypto/proposal/proposal_keywords_static.c \
 crypto/prfs/prf.c crypto/prfs/mac_prf.c \
@@ -29,7 +31,6 @@ processing/jobs/callback_job.c processing/processor.c processing/scheduler.c \
 selectors/traffic_selector.c threading/thread.c threading/thread_value.c \
 threading/mutex.c threading/semaphore.c threading/rwlock.c threading/spinlock.c \
 utils.c utils/identification.c utils/lexparser.c \
-utils/linked_list.c utils/blocking_queue.c utils/hashtable.c utils/enumerator.c \
 utils/optionsfrom.c utils/capabilities.c utils/backtrace.c
 
 # adding the plugin source files
index 62649d9..2fa9dab 100644 (file)
@@ -3,6 +3,8 @@ ipseclib_LTLIBRARIES = libstrongswan.la
 libstrongswan_la_SOURCES = \
 library.c chunk.c debug.c enum.c settings.c printf_hook.c \
 asn1/asn1.c asn1/asn1_parser.c asn1/oid.c bio/bio_reader.c bio/bio_writer.c \
+collections/blocking_queue.c collections/enumerator.c collections/hashtable.c \
+collections/linked_list.c \
 crypto/crypters/crypter.c crypto/hashers/hasher.c crypto/pkcs7.c crypto/pkcs9.c \
 crypto/proposal/proposal_keywords.c crypto/proposal/proposal_keywords_static.c \
 crypto/prfs/prf.c crypto/prfs/mac_prf.c \
@@ -27,7 +29,6 @@ processing/jobs/callback_job.c processing/processor.c processing/scheduler.c \
 selectors/traffic_selector.c threading/thread.c threading/thread_value.c \
 threading/mutex.c threading/semaphore.c threading/rwlock.c threading/spinlock.c \
 utils.c utils/identification.c utils/lexparser.c \
-utils/linked_list.c utils/blocking_queue.c utils/hashtable.c utils/enumerator.c \
 utils/optionsfrom.c utils/capabilities.c utils/backtrace.c
 
 if USE_DEV_HEADERS
@@ -35,6 +36,8 @@ strongswan_includedir = ${dev_headers}
 nobase_strongswan_include_HEADERS = \
 library.h chunk.h debug.h enum.h settings.h printf_hook.h \
 asn1/asn1.h asn1/asn1_parser.h asn1/oid.h bio/bio_reader.h bio/bio_writer.h \
+collections/blocking_queue.h collections/enumerator.h collections/hashtable.h \
+collections/linked_list.h \
 crypto/crypters/crypter.h crypto/hashers/hasher.h crypto/mac.h \
 crypto/pkcs7.h crypto/pkcs9.h crypto/proposal/proposal_keywords.h \
 crypto/proposal/proposal_keywords_static.h \
@@ -66,7 +69,6 @@ threading/thread.h threading/thread_value.h \
 threading/mutex.h threading/condvar.h threading/spinlock.h threading/semaphore.h \
 threading/rwlock.h threading/rwlock_condvar.h threading/lock_profiler.h \
 utils.h utils/identification.h utils/lexparser.h \
-utils/linked_list.h utils/blocking_queue.h utils/hashtable.h utils/enumerator.h \
 utils/optionsfrom.h utils/capabilities.h utils/backtrace.h \
 utils/leak_detective.h integrity_checker.h
 endif
diff --git a/src/libstrongswan/collections/blocking_queue.c b/src/libstrongswan/collections/blocking_queue.c
new file mode 100644 (file)
index 0000000..da33569
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2012 Tobias Brunner
+ * Copyright (C) 2012 Giuliano Grassi
+ * Copyright (C) 2012 Ralf Sager
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+#include "blocking_queue.h"
+
+#include <threading/mutex.h>
+#include <threading/thread.h>
+#include <threading/condvar.h>
+#include <collections/linked_list.h>
+
+typedef struct private_blocking_queue_t private_blocking_queue_t;
+
+/**
+ * Private data of a blocking_queue_t object.
+ */
+struct private_blocking_queue_t {
+
+       /**
+        * Public part
+        */
+       blocking_queue_t public;
+
+       /**
+        * Linked list containing all items in the queue
+        */
+       linked_list_t *list;
+
+       /**
+        * Mutex used to synchronize access to the queue
+        */
+       mutex_t *mutex;
+
+       /**
+        * Condvar used to wait for items
+        */
+       condvar_t *condvar;
+
+};
+
+METHOD(blocking_queue_t, enqueue, void,
+       private_blocking_queue_t *this, void *item)
+{
+       this->mutex->lock(this->mutex);
+       this->list->insert_first(this->list, item);
+       this->condvar->signal(this->condvar);
+       this->mutex->unlock(this->mutex);
+}
+
+METHOD(blocking_queue_t, dequeue, void*,
+       private_blocking_queue_t *this)
+{
+       bool oldstate;
+       void *item;
+
+
+       this->mutex->lock(this->mutex);
+       thread_cleanup_push((thread_cleanup_t)this->mutex->unlock, this->mutex);
+       /* ensure that a canceled thread does not dequeue any items */
+       thread_cancellation_point();
+       while (this->list->remove_last(this->list, &item) != SUCCESS)
+       {
+               oldstate = thread_cancelability(TRUE);
+               this->condvar->wait(this->condvar, this->mutex);
+               thread_cancelability(oldstate);
+       }
+       thread_cleanup_pop(TRUE);
+       return item;
+}
+
+METHOD(blocking_queue_t, destroy, void,
+       private_blocking_queue_t *this)
+{
+       this->list->destroy(this->list);
+       this->condvar->destroy(this->condvar);
+       this->mutex->destroy(this->mutex);
+       free(this);
+}
+
+METHOD(blocking_queue_t, destroy_offset, void,
+       private_blocking_queue_t *this, size_t offset)
+{
+       this->list->invoke_offset(this->list, offset);
+       destroy(this);
+}
+
+METHOD(blocking_queue_t, destroy_function, void,
+       private_blocking_queue_t *this, void (*fn)(void*))
+{
+       this->list->invoke_function(this->list, (linked_list_invoke_t)fn);
+       destroy(this);
+}
+
+/*
+ * Described in header.
+ */
+blocking_queue_t *blocking_queue_create()
+{
+       private_blocking_queue_t *this;
+
+       INIT(this,
+               .public = {
+                       .enqueue = _enqueue,
+                       .dequeue = _dequeue,
+                       .destroy = _destroy,
+                       .destroy_offset = _destroy_offset,
+                       .destroy_function = _destroy_function,
+               },
+               .list = linked_list_create(),
+               .mutex = mutex_create(MUTEX_TYPE_DEFAULT),
+               .condvar = condvar_create(CONDVAR_TYPE_DEFAULT),
+       );
+
+       return &this->public;
+}
+
diff --git a/src/libstrongswan/collections/blocking_queue.h b/src/libstrongswan/collections/blocking_queue.h
new file mode 100644 (file)
index 0000000..9b014f7
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 Tobias Brunner
+ * Copyright (C) 2012 Giuliano Grassi
+ * Copyright (C) 2012 Ralf Sager
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+/**
+ * @defgroup blocking_queue blocking_queue
+ * @{ @ingroup collections
+ */
+
+#ifndef BLOCKING_QUEUE_H_
+#define BLOCKING_QUEUE_H_
+
+typedef struct blocking_queue_t blocking_queue_t;
+
+#include <library.h>
+
+/**
+ * Class implementing a synchronized blocking queue based on linked_list_t
+ */
+struct blocking_queue_t {
+
+       /**
+        * Inserts a new item at the tail of the queue
+        *
+        * @param item          item to insert in queue
+        */
+       void (*enqueue)(blocking_queue_t *this, void *item);
+
+       /**
+        * Removes the first item in the queue and returns its value.
+        * If the queue is empty, this call blocks until a new item is inserted.
+        *
+        * @note This is a thread cancellation point
+        *
+        * @return                      removed item
+        */
+       void *(*dequeue)(blocking_queue_t *this);
+
+       /**
+        * Destroys a blocking_queue_t object.
+        *
+        * @note No thread must wait in dequeue() when this function is called
+        */
+       void (*destroy)(blocking_queue_t *this);
+
+       /**
+        * Destroys a queue and its objects using the given destructor.
+        *
+        * If a queue and the contained objects should be destroyed, use
+        * destroy_offset. The supplied offset specifies the destructor to
+        * call on each object. The offset may be calculated using the offsetof
+        * macro, e.g.: queue->destroy_offset(queue, offsetof(object_t, destroy));
+        *
+        * @note No thread must wait in dequeue() when this function is called
+        *
+        * @param offset        offset of the objects destructor
+        */
+       void (*destroy_offset)(blocking_queue_t *this, size_t offset);
+
+       /**
+        * Destroys a queue and its objects using a cleanup function.
+        *
+        * If a queue and its contents should get destroyed using a specific
+        * cleanup function, use destroy_function. This is useful when the
+        * list contains malloc()-ed blocks which should get freed,
+        * e.g.: queue->destroy_function(queue, free);
+        *
+        * @note No thread must wait in dequeue() when this function is called
+        *
+        * @param function      function to call on each object
+        */
+       void (*destroy_function)(blocking_queue_t *this, void (*)(void*));
+
+};
+
+/**
+ * Creates an empty queue object.
+ *
+ * @return             blocking_queue_t object.
+ */
+blocking_queue_t *blocking_queue_create();
+
+#endif /** BLOCKING_QUEUE_H_ @}*/
+
diff --git a/src/libstrongswan/collections/enumerator.c b/src/libstrongswan/collections/enumerator.c
new file mode 100644 (file)
index 0000000..53c94f9
--- /dev/null
@@ -0,0 +1,560 @@
+/*
+ * Copyright (C) 2008 Tobias Brunner
+ * Copyright (C) 2007 Martin Willi
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+#include "enumerator.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <limits.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <errno.h>
+#include <string.h>
+
+#include <debug.h>
+
+/**
+ * Implementation of enumerator_create_empty().enumerate
+ */
+static bool enumerate_empty(enumerator_t *enumerator, ...)
+{
+       return FALSE;
+}
+
+/**
+ * See header
+ */
+enumerator_t* enumerator_create_empty()
+{
+       enumerator_t *this = malloc_thing(enumerator_t);
+       this->enumerate = enumerate_empty;
+       this->destroy = (void*)free;
+       return this;
+}
+
+/**
+ * Enumerator implementation for directory enumerator
+ */
+typedef struct {
+       /** implements enumerator_t */
+       enumerator_t public;
+       /** directory handle */
+       DIR *dir;
+       /** absolute path of current file */
+       char full[PATH_MAX];
+       /** where directory part of full ends and relative file gets written */
+       char *full_end;
+} dir_enum_t;
+
+/**
+ * Implementation of enumerator_create_directory().destroy
+ */
+static void destroy_dir_enum(dir_enum_t *this)
+{
+       closedir(this->dir);
+       free(this);
+}
+
+/**
+ * Implementation of enumerator_create_directory().enumerate
+ */
+static bool enumerate_dir_enum(dir_enum_t *this, char **relative,
+                                                          char **absolute, struct stat *st)
+{
+       struct dirent *entry = readdir(this->dir);
+       size_t remaining;
+       int len;
+
+       if (!entry)
+       {
+               return FALSE;
+       }
+       if (streq(entry->d_name, ".") || streq(entry->d_name, ".."))
+       {
+               return enumerate_dir_enum(this, relative, absolute, st);
+       }
+       if (relative)
+       {
+               *relative = entry->d_name;
+       }
+       if (absolute || st)
+       {
+               remaining = sizeof(this->full) - (this->full_end - this->full);
+               len = snprintf(this->full_end, remaining, "%s", entry->d_name);
+               if (len < 0 || len >= remaining)
+               {
+                       DBG1(DBG_LIB, "buffer too small to enumerate file '%s'",
+                                entry->d_name);
+                       return FALSE;
+               }
+               if (absolute)
+               {
+                       *absolute = this->full;
+               }
+               if (st)
+               {
+                       if (stat(this->full, st))
+                       {
+                               DBG1(DBG_LIB, "stat() on '%s' failed: %s", this->full,
+                                        strerror(errno));
+                               return FALSE;
+                       }
+               }
+       }
+       return TRUE;
+}
+
+/**
+ * See header
+ */
+enumerator_t* enumerator_create_directory(const char *path)
+{
+       int len;
+       dir_enum_t *this = malloc_thing(dir_enum_t);
+       this->public.enumerate = (void*)enumerate_dir_enum;
+       this->public.destroy = (void*)destroy_dir_enum;
+
+       if (*path == '\0')
+       {
+               path = "./";
+       }
+       len = snprintf(this->full, sizeof(this->full)-1, "%s", path);
+       if (len < 0 || len >= sizeof(this->full)-1)
+       {
+               DBG1(DBG_LIB, "path string '%s' too long", path);
+               free(this);
+               return NULL;
+       }
+       /* append a '/' if not already done */
+       if (this->full[len-1] != '/')
+       {
+               this->full[len++] = '/';
+               this->full[len] = '\0';
+       }
+       this->full_end = &this->full[len];
+
+       this->dir = opendir(path);
+       if (this->dir == NULL)
+       {
+               DBG1(DBG_LIB, "opening directory '%s' failed: %s", path, strerror(errno));
+               free(this);
+               return NULL;
+       }
+       return &this->public;
+}
+
+/**
+ * Enumerator implementation for directory enumerator
+ */
+typedef struct {
+       /** implements enumerator_t */
+       enumerator_t public;
+       /** string to parse */
+       char *string;
+       /** current position */
+       char *pos;
+       /** separater chars */
+       const char *sep;
+       /** trim chars */
+       const char *trim;
+} token_enum_t;
+
+/**
+ * Implementation of enumerator_create_token().destroy
+ */
+static void destroy_token_enum(token_enum_t *this)
+{
+       free(this->string);
+       free(this);
+}
+
+/**
+ * Implementation of enumerator_create_token().enumerate
+ */
+static bool enumerate_token_enum(token_enum_t *this, char **token)
+{
+       const char *sep, *trim;
+       char *pos = NULL, *tmp;
+       bool last = FALSE;
+
+       /* trim leading characters/separators */
+       while (*this->pos)
+       {
+               trim = this->trim;
+               while (*trim)
+               {
+                       if (*trim == *this->pos)
+                       {
+                               this->pos++;
+                               break;
+                       }
+                       trim++;
+               }
+               sep = this->sep;
+               while (*sep)
+               {
+                       if (*sep == *this->pos)
+                       {
+                               this->pos++;
+                               break;
+                       }
+                       sep++;
+               }
+               if (!*trim && !*sep)
+               {
+                       break;
+               }
+       }
+
+       switch (*this->pos)
+       {
+               case '"':
+               case '\'':
+               {
+                       /* read quoted token */
+                       tmp = strchr(this->pos + 1, *this->pos);
+                       if (tmp)
+                       {
+                               *token = this->pos + 1;
+                               *tmp = '\0';
+                               this->pos = tmp + 1;
+                               return TRUE;
+                       }
+                       /* unterminated string, FALL-THROUGH */
+               }
+               default:
+               {
+                       /* find nearest separator */
+                       sep = this->sep;
+                       while (*sep)
+                       {
+                               tmp = strchr(this->pos, *sep);
+                               if (tmp && (pos == NULL || tmp < pos))
+                               {
+                                       pos = tmp;
+                               }
+                               sep++;
+                       }
+                       *token = this->pos;
+                       if (pos)
+                       {
+                               *pos = '\0';
+                               this->pos = pos + 1;
+                       }
+                       else
+                       {
+                               last = TRUE;
+                               pos = this->pos = strchr(this->pos, '\0');
+                       }
+                       break;
+               }
+       }
+
+       /* trim trailing characters/separators */
+       pos--;
+       while (pos >= *token)
+       {
+               trim = this->trim;
+               while (*trim)
+               {
+                       if (*trim == *pos)
+                       {
+                               *(pos--) = '\0';
+                               break;
+                       }
+                       trim++;
+               }
+               sep = this->sep;
+               while (*sep)
+               {
+                       if (*sep == *pos)
+                       {
+                               *(pos--) = '\0';
+                               break;
+                       }
+                       sep++;
+               }
+               if (!*trim && !*sep)
+               {
+                       break;
+               }
+       }
+
+       if (!last || pos >= *token)
+       {
+               return TRUE;
+       }
+       return FALSE;
+}
+
+/**
+ * See header
+ */
+enumerator_t* enumerator_create_token(const char *string, const char *sep,
+                                                                         const char *trim)
+{
+       token_enum_t *enumerator = malloc_thing(token_enum_t);
+
+       enumerator->public.enumerate = (void*)enumerate_token_enum;
+       enumerator->public.destroy = (void*)destroy_token_enum;
+       enumerator->string = strdup(string);
+       enumerator->pos = enumerator->string;
+       enumerator->sep = sep;
+       enumerator->trim = trim;
+
+       return &enumerator->public;
+}
+
+/**
+ * enumerator for nested enumerations
+ */
+typedef struct {
+       /* implements enumerator_t */
+       enumerator_t public;
+       /* outer enumerator */
+       enumerator_t *outer;
+       /* inner enumerator */
+       enumerator_t *inner;
+       /* constructor for inner enumerator */
+       enumerator_t *(*create_inner)(void *outer, void *data);
+       /* data to pass to constructor above */
+       void *data;
+       /* destructor for data */
+       void (*destroy_data)(void *data);
+} nested_enumerator_t;
+
+
+/**
+ * Implementation of enumerator_create_nested().enumerate()
+ */
+static bool enumerate_nested(nested_enumerator_t *this, void *v1, void *v2,
+                                                        void *v3, void *v4, void *v5)
+{
+       while (TRUE)
+       {
+               while (this->inner == NULL)
+               {
+                       void *outer;
+
+                       if (!this->outer->enumerate(this->outer, &outer))
+                       {
+                               return FALSE;
+                       }
+                       this->inner = this->create_inner(outer, this->data);
+               }
+               if (this->inner->enumerate(this->inner, v1, v2, v3, v4, v5))
+               {
+                       return TRUE;
+               }
+               this->inner->destroy(this->inner);
+               this->inner = NULL;
+       }
+}
+
+/**
+ * Implementation of enumerator_create_nested().destroy()
+ **/
+static void destroy_nested(nested_enumerator_t *this)
+{
+       if (this->destroy_data)
+       {
+               this->destroy_data(this->data);
+       }
+       DESTROY_IF(this->inner);
+       this->outer->destroy(this->outer);
+       free(this);
+}
+
+/**
+ * See header
+ */
+enumerator_t *enumerator_create_nested(enumerator_t *outer,
+                                       enumerator_t *(inner_constructor)(void *outer, void *data),
+                                       void *data, void (*destroy_data)(void *data))
+{
+       nested_enumerator_t *enumerator = malloc_thing(nested_enumerator_t);
+
+       enumerator->public.enumerate = (void*)enumerate_nested;
+       enumerator->public.destroy = (void*)destroy_nested;
+       enumerator->outer = outer;
+       enumerator->inner = NULL;
+       enumerator->create_inner = (void*)inner_constructor;
+       enumerator->data = data;
+       enumerator->destroy_data = destroy_data;
+
+       return &enumerator->public;
+}
+
+/**
+ * enumerator for filtered enumerator
+ */
+typedef struct {
+       enumerator_t public;
+       enumerator_t *unfiltered;
+       void *data;
+       bool (*filter)(void *data, ...);
+       void (*destructor)(void *data);
+} filter_enumerator_t;
+
+/**
+ * Implementation of enumerator_create_filter().destroy
+ */
+static void destroy_filter(filter_enumerator_t *this)
+{
+       if (this->destructor)
+       {
+               this->destructor(this->data);
+       }
+       this->unfiltered->destroy(this->unfiltered);
+       free(this);
+}
+
+/**
+ * Implementation of enumerator_create_filter().enumerate
+ */
+static bool enumerate_filter(filter_enumerator_t *this, void *o1, void *o2,
+                                                        void *o3, void *o4, void *o5)
+{
+       void *i1, *i2, *i3, *i4, *i5;
+
+       while (this->unfiltered->enumerate(this->unfiltered, &i1, &i2, &i3, &i4, &i5))
+       {
+               if (this->filter(this->data, &i1, o1, &i2, o2, &i3, o3, &i4, o4, &i5, o5))
+               {
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
+/**
+ * see header
+ */
+enumerator_t *enumerator_create_filter(enumerator_t *unfiltered,
+                                                                          bool (*filter)(void *data, ...),
+                                                                          void *data, void (*destructor)(void *data))
+{
+       filter_enumerator_t *this = malloc_thing(filter_enumerator_t);
+
+       this->public.enumerate = (void*)enumerate_filter;
+       this->public.destroy = (void*)destroy_filter;
+       this->unfiltered = unfiltered;
+       this->filter = filter;
+       this->data = data;
+       this->destructor = destructor;
+
+       return &this->public;
+}
+
+/**
+ * enumerator for cleaner enumerator
+ */
+typedef struct {
+       enumerator_t public;
+       enumerator_t *wrapped;
+       void (*cleanup)(void *data);
+       void *data;
+} cleaner_enumerator_t;
+
+/**
+ * Implementation of enumerator_create_cleanup().destroy
+ */
+static void destroy_cleaner(cleaner_enumerator_t *this)
+{
+       this->cleanup(this->data);
+       this->wrapped->destroy(this->wrapped);
+       free(this);
+}
+
+/**
+ * Implementation of enumerator_create_cleaner().enumerate
+ */
+static bool enumerate_cleaner(cleaner_enumerator_t *this, void *v1, void *v2,
+                                                         void *v3, void *v4, void *v5)
+{
+       return this->wrapped->enumerate(this->wrapped, v1, v2, v3, v4, v5);
+}
+
+/**
+ * see header
+ */
+enumerator_t *enumerator_create_cleaner(enumerator_t *wrapped,
+                                                                               void (*cleanup)(void *data), void *data)
+{
+       cleaner_enumerator_t *this = malloc_thing(cleaner_enumerator_t);
+
+       this->public.enumerate = (void*)enumerate_cleaner;
+       this->public.destroy = (void*)destroy_cleaner;
+       this->wrapped = wrapped;
+       this->cleanup = cleanup;
+       this->data = data;
+
+       return &this->public;
+}
+
+/**
+ * enumerator for single enumerator
+ */
+typedef struct {
+       enumerator_t public;
+       void *item;
+       void (*cleanup)(void *item);
+       bool done;
+} single_enumerator_t;
+
+/**
+ * Implementation of enumerator_create_single().destroy
+ */
+static void destroy_single(single_enumerator_t *this)
+{
+       if (this->cleanup)
+       {
+               this->cleanup(this->item);
+       }
+       free(this);
+}
+
+/**
+ * Implementation of enumerator_create_single().enumerate
+ */
+static bool enumerate_single(single_enumerator_t *this, void **item)
+{
+       if (this->done)
+       {
+               return FALSE;
+       }
+       *item = this->item;
+       this->done = TRUE;
+       return TRUE;
+}
+
+/**
+ * see header
+ */
+enumerator_t *enumerator_create_single(void *item, void (*cleanup)(void *item))
+{
+       single_enumerator_t *this = malloc_thing(single_enumerator_t);
+
+       this->public.enumerate = (void*)enumerate_single;
+       this->public.destroy = (void*)destroy_single;
+       this->item = item;
+       this->cleanup = cleanup;
+       this->done = FALSE;
+
+       return &this->public;
+}
+
diff --git a/src/libstrongswan/collections/enumerator.h b/src/libstrongswan/collections/enumerator.h
new file mode 100644 (file)
index 0000000..900c973
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2007 Martin Willi
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+/**
+ * @defgroup enumerator enumerator
+ * @{ @ingroup collections
+ */
+
+#ifndef ENUMERATOR_H_
+#define ENUMERATOR_H_
+
+typedef struct enumerator_t enumerator_t;
+
+#include "../utils.h"
+
+/**
+ * Enumerator interface, allows enumeration over collections.
+ */
+struct enumerator_t {
+
+       /**
+        * Enumerate collection.
+        *
+        * The enumerate function takes a variable argument list containing
+        * pointers where the enumerated values get written.
+        *
+        * @param ...   variable list of enumerated items, implementation dependent
+        * @return              TRUE if pointers returned
+        */
+       bool (*enumerate)(enumerator_t *this, ...);
+
+       /**
+        * Destroy a enumerator instance.
+        */
+       void (*destroy)(enumerator_t *this);
+};
+
+/**
+ * Create an enumerator which enumerates over nothing
+ *
+ * @return                     an enumerator over no values
+ */
+enumerator_t* enumerator_create_empty();
+
+/**
+ * Create an enumerator which enumerates over a single item
+ *
+ * @param item         item to enumerate
+ * @param cleanup      cleanup function called on destroy with the item
+ * @return                     an enumerator over a single value
+ */
+enumerator_t *enumerator_create_single(void *item, void (*cleanup)(void *item));
+
+/**
+ * Create an enumerator over files/subdirectories in a directory.
+ *
+ * This enumerator_t.enumerate() function returns a (to the directory) relative
+ * filename (as a char*), an absolute filename (as a char*) and a file status
+ * (to a struct stat), which all may be NULL. "." and ".." entries are
+ * skipped. Example:
+ *
+ * @code
+       char *rel, *abs;
+       struct stat st;
+       enumerator_t *e;
+
+       e = enumerator_create_directory("/tmp");
+       if (e)
+       {
+               while (e->enumerate(e, &rel, &abs, &st))
+               {
+                       if (S_ISDIR(st.st_mode) && *rel != '.')
+                       {
+                               printf("%s\n", abs);
+                       }
+               }
+               e->destroy(e);
+       }
+   @endcode
+ *
+ * @param path         path of the directory
+ * @return                     the directory enumerator, NULL on failure
+ */
+enumerator_t* enumerator_create_directory(const char *path);
+
+/**
+ * Create an enumerator over tokens of a string.
+ *
+ * Tokens are separated by one of the characters in sep and trimmed by the
+ * characters in trim.
+ *
+ * @param string       string to parse
+ * @param sep          separator characters
+ * @param trim         characters to trim from tokens
+ * @return                     enumerator over char* tokens
+ */
+enumerator_t* enumerator_create_token(const char *string, const char *sep,
+                                                                         const char *trim);
+
+/**
+ * Creates an enumerator which enumerates over enumerated enumerators :-).
+ *
+ * The variable argument list of enumeration values is limit to 5.
+ *
+ * @param outer                                        outer enumerator
+ * @param inner_constructor            constructor to inner enumerator
+ * @param data                                 data to pass to each inner_constructor call
+ * @param destroy_data                 destructor to pass to data
+ * @return                                             the nested enumerator
+ */
+enumerator_t *enumerator_create_nested(enumerator_t *outer,
+                                       enumerator_t *(*inner_constructor)(void *outer, void *data),
+                                       void *data, void (*destroy_data)(void *data));
+
+/**
+ * Creates an enumerator which filters output of another enumerator.
+ *
+ * The filter function receives the user supplied "data" followed by a
+ * unfiltered enumeration item, followed by an output pointer where to write
+ * the filtered data. Then the next input/output pair follows.
+ * It returns TRUE to deliver the
+ * values to the caller of enumerate(), FALSE to filter this enumeration.
+ *
+ * The variable argument list of enumeration values is limit to 5.
+ *
+ * @param unfiltered                   unfiltered enumerator to wrap, gets destroyed
+ * @param filter                               filter function
+ * @param data                                 user data to supply to filter
+ * @param destructor                   destructor function to clean up data after use
+ * @return                                             the filtered enumerator
+ */
+enumerator_t *enumerator_create_filter(enumerator_t *unfiltered,
+                                       bool (*filter)(void *data, ...),
+                                       void *data, void (*destructor)(void *data));
+
+/**
+ * Create an enumerator wrapper which does a cleanup on destroy.
+ *
+ * @param wrapped                              wrapped enumerator
+ * @param cleanup                              cleanup function called on destroy
+ * @param data                                 user data to supply to cleanup
+ * @return                                             the enumerator with cleanup
+ */
+enumerator_t *enumerator_create_cleaner(enumerator_t *wrapped,
+                                       void (*cleanup)(void *data), void *data);
+
+#endif /** ENUMERATOR_H_ @}*/
diff --git a/src/libstrongswan/collections/hashtable.c b/src/libstrongswan/collections/hashtable.c
new file mode 100644 (file)
index 0000000..d181d8e
--- /dev/null
@@ -0,0 +1,444 @@
+/*
+ * Copyright (C) 2008-2012 Tobias Brunner
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+
+#include "hashtable.h"
+
+/** The maximum capacity of the hash table (MUST be a power of 2) */
+#define MAX_CAPACITY (1 << 30)
+
+typedef struct pair_t pair_t;
+
+/**
+ * This pair holds a pointer to the key and value it represents.
+ */
+struct pair_t {
+       /**
+        * Key of a hash table item.
+        */
+       void *key;
+
+       /**
+        * Value of a hash table item.
+        */
+       void *value;
+
+       /**
+        * Cached hash (used in case of a resize).
+        */
+       u_int hash;
+
+       /**
+        * Next pair in an overflow list.
+        */
+       pair_t *next;
+};
+
+/**
+ * Creates an empty pair object.
+ */
+static inline pair_t *pair_create(void *key, void *value, u_int hash)
+{
+       pair_t *this;
+
+       INIT(this,
+               .key = key,
+               .value = value,
+               .hash = hash,
+       );
+
+       return this;
+}
+
+typedef struct private_hashtable_t private_hashtable_t;
+
+/**
+ * Private data of a hashtable_t object.
+ *
+ */
+struct private_hashtable_t {
+       /**
+        * Public part of hash table.
+        */
+       hashtable_t public;
+
+       /**
+        * The number of items in the hash table.
+        */
+       u_int count;
+
+       /**
+        * The current capacity of the hash table (always a power of 2).
+        */
+       u_int capacity;
+
+       /**
+        * The current mask to calculate the row index (capacity - 1).
+        */
+       u_int mask;
+
+       /**
+        * The load factor.
+        */
+       float load_factor;
+
+       /**
+        * The actual table.
+        */
+       pair_t **table;
+
+       /**
+        * The hashing function.
+        */
+       hashtable_hash_t hash;
+
+       /**
+        * The equality function.
+        */
+       hashtable_equals_t equals;
+};
+
+typedef struct private_enumerator_t private_enumerator_t;
+
+/**
+ * hash table enumerator implementation
+ */
+struct private_enumerator_t {
+
+       /**
+        * implements enumerator interface
+        */
+       enumerator_t enumerator;
+
+       /**
+        * associated hash table
+        */
+       private_hashtable_t *table;
+
+       /**
+        * current row index
+        */
+       u_int row;
+
+       /**
+        * number of remaining items in hashtable
+        */
+       u_int count;
+
+       /**
+        * current pair
+        */
+       pair_t *current;
+
+       /**
+        * previous pair (used by remove_at)
+        */
+       pair_t *prev;
+
+};
+
+/**
+ * This function returns the next-highest power of two for the given number.
+ * The algorithm works by setting all bits on the right-hand side of the most
+ * significant 1 to 1 and then increments the whole number so it rolls over
+ * to the nearest power of two. Note: returns 0 for n == 0
+ */
+static u_int get_nearest_powerof2(u_int n)
+{
+       u_int i;
+
+       --n;
+       for (i = 1; i < sizeof(u_int) * 8; i <<= 1)
+       {
+               n |= n >> i;
+       }
+       return ++n;
+}
+
+/**
+ * Init hash table parameters
+ */
+static void init_hashtable(private_hashtable_t *this, u_int capacity)
+{
+       capacity = max(1, min(capacity, MAX_CAPACITY));
+       this->capacity = get_nearest_powerof2(capacity);
+       this->mask = this->capacity - 1;
+       this->load_factor = 0.75;
+
+       this->table = calloc(this->capacity, sizeof(pair_t*));
+}
+
+/**
+ * Double the size of the hash table and rehash all the elements.
+ */
+static void rehash(private_hashtable_t *this)
+{
+       pair_t **old_table;
+       u_int row, old_capacity;
+
+       if (this->capacity >= MAX_CAPACITY)
+       {
+               return;
+       }
+
+       old_capacity = this->capacity;
+       old_table = this->table;
+
+       init_hashtable(this, old_capacity << 1);
+
+       for (row = 0; row < old_capacity; row++)
+       {
+               pair_t *pair, *next;
+               u_int new_row;
+
+               pair = old_table[row];
+               while (pair)
+               {       /* insert pair at the front of new bucket*/
+                       next = pair->next;
+                       new_row = pair->hash & this->mask;
+                       pair->next = this->table[new_row];
+                       this->table[new_row] = pair;
+                       pair = next;
+               }
+       }
+       free(old_table);
+}
+
+METHOD(hashtable_t, put, void*,
+          private_hashtable_t *this, void *key, void *value)
+{
+       void *old_value = NULL;
+       pair_t *pair;
+       u_int hash, row;
+
+       hash = this->hash(key);
+       row = hash & this->mask;
+       pair = this->table[row];
+       while (pair)
+       {       /* search existing bucket for key */
+               if (this->equals(key, pair->key))
+               {
+                       old_value = pair->value;
+                       pair->value = value;
+                       pair->key = key;
+                       break;
+               }
+               pair = pair->next;
+       }
+       if (!pair)
+       {       /* insert at the front of bucket */
+               pair = pair_create(key, value, hash);
+               pair->next = this->table[row];
+               this->table[row] = pair;
+               this->count++;
+       }
+       if (this->count >= this->capacity * this->load_factor)
+       {
+               rehash(this);
+       }
+       return old_value;
+}
+
+static void *get_internal(private_hashtable_t *this, void *key,
+                                                 hashtable_equals_t equals)
+{
+       void *value = NULL;
+       pair_t *pair;
+
+       if (!this->count)
+       {       /* no need to calculate the hash */
+               return NULL;
+       }
+
+       pair = this->table[this->hash(key) & this->mask];
+       while (pair)
+       {
+               if (equals(key, pair->key))
+               {
+                       value = pair->value;
+                       break;
+               }
+               pair = pair->next;
+       }
+       return value;
+}
+
+METHOD(hashtable_t, get, void*,
+          private_hashtable_t *this, void *key)
+{
+       return get_internal(this, key, this->equals);
+}
+
+METHOD(hashtable_t, get_match, void*,
+          private_hashtable_t *this, void *key, hashtable_equals_t match)
+{
+       return get_internal(this, key, match);
+}
+
+METHOD(hashtable_t, remove_, void*,
+          private_hashtable_t *this, void *key)
+{
+       void *value = NULL;
+       pair_t *pair, *prev = NULL;
+       u_int row;
+
+       row = this->hash(key) & this->mask;
+       pair = this->table[row];
+       while (pair)
+       {
+               if (this->equals(key, pair->key))
+               {
+                       if (prev)
+                       {
+                               prev->next = pair->next;
+                       }
+                       else
+                       {
+                               this->table[row] = pair->next;
+                       }
+                       value = pair->value;
+                       this->count--;
+                       free(pair);
+                       break;
+               }
+               prev = pair;
+               pair = pair->next;
+       }
+       return value;
+}
+
+METHOD(hashtable_t, remove_at, void,
+          private_hashtable_t *this, private_enumerator_t *enumerator)
+{
+       if (enumerator->table == this && enumerator->current)
+       {
+               pair_t *current = enumerator->current;
+               if (enumerator->prev)
+               {
+                       enumerator->prev->next = current->next;
+               }
+               else
+               {
+                       this->table[enumerator->row] = current->next;
+               }
+               enumerator->current = enumerator->prev;
+               free(current);
+               this->count--;
+       }
+}
+
+METHOD(hashtable_t, get_count, u_int,
+          private_hashtable_t *this)
+{
+       return this->count;
+}
+
+METHOD(enumerator_t, enumerate, bool,
+          private_enumerator_t *this, void **key, void **value)
+{
+       while (this->count && this->row < this->table->capacity)
+       {
+               this->prev = this->current;
+               if (this->current)
+               {
+                       this->current = this->current->next;
+               }
+               else
+               {
+                       this->current = this->table->table[this->row];
+               }
+               if (this->current)
+               {
+                       if (key)
+                       {
+                               *key = this->current->key;
+                       }
+                       if (value)
+                       {
+                               *value = this->current->value;
+                       }
+                       this->count--;
+                       return TRUE;
+               }
+               this->row++;
+       }
+       return FALSE;
+}
+
+METHOD(hashtable_t, create_enumerator, enumerator_t*,
+          private_hashtable_t *this)
+{
+       private_enumerator_t *enumerator;
+
+       INIT(enumerator,
+               .enumerator = {
+                       .enumerate = (void*)_enumerate,
+                       .destroy = (void*)free,
+               },
+               .table = this,
+               .count = this->count,
+       );
+
+       return &enumerator->enumerator;
+}
+
+METHOD(hashtable_t, destroy, void,
+          private_hashtable_t *this)
+{
+       pair_t *pair, *next;
+       u_int row;
+
+       for (row = 0; row < this->capacity; row++)
+       {
+               pair = this->table[row];
+               while (pair)
+               {
+                       next = pair->next;
+                       free(pair);
+                       pair = next;
+               }
+       }
+       free(this->table);
+       free(this);
+}
+
+/*
+ * Described in header.
+ */
+hashtable_t *hashtable_create(hashtable_hash_t hash, hashtable_equals_t equals,
+                                                         u_int capacity)
+{
+       private_hashtable_t *this;
+
+       INIT(this,
+               .public = {
+                       .put = _put,
+                       .get = _get,
+                       .get_match = _get_match,
+                       .remove = _remove_,
+                       .remove_at = (void*)_remove_at,
+                       .get_count = _get_count,
+                       .create_enumerator = _create_enumerator,
+                       .destroy = _destroy,
+               },
+               .hash = hash,
+               .equals = equals,
+       );
+
+       init_hashtable(this, capacity);
+
+       return &this->public;
+}
+
diff --git a/src/libstrongswan/collections/hashtable.h b/src/libstrongswan/collections/hashtable.h
new file mode 100644 (file)
index 0000000..e38850d
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2008-2012 Tobias Brunner
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+/**
+ * @defgroup hashtable hashtable
+ * @{ @ingroup collections
+ */
+
+#ifndef HASHTABLE_H_
+#define HASHTABLE_H_
+
+#include <collections/enumerator.h>
+
+typedef struct hashtable_t hashtable_t;
+
+/**
+ * Prototype for a function that computes the hash code from the given key.
+ *
+ * @param key                  key to hash
+ * @return                             hash code
+ */
+typedef u_int (*hashtable_hash_t)(void *key);
+
+/**
+ * Prototype for a function that compares the two keys for equality.
+ *
+ * @param key                  first key (the one we are looking for)
+ * @param other_key            second key
+ * @return                             TRUE if the keys are equal
+ */
+typedef bool (*hashtable_equals_t)(void *key, void *other_key);
+
+/**
+ * Class implementing a hash table.
+ *
+ * General purpose hash table. This hash table is not synchronized.
+ */
+struct hashtable_t {
+
+       /**
+        * Create an enumerator over the hash table key/value pairs.
+        *
+        * @return                      enumerator over (void *key, void *value)
+        */
+       enumerator_t *(*create_enumerator) (hashtable_t *this);
+
+       /**
+        * Adds the given value with the given key to the hash table, if there
+        * exists no entry with that key. NULL is returned in this case.
+        * Otherwise the existing value is replaced and the function returns the
+        * old value.
+        *
+        * @param key           the key to store
+        * @param value         the value to store
+        * @return                      NULL if no item was replaced, the old value otherwise
+        */
+       void *(*put) (hashtable_t *this, void *key, void *value);
+
+       /**
+        * Returns the value with the given key, if the hash table contains such an
+        * entry, otherwise NULL is returned.
+        *
+        * @param key           the key of the requested value
+        * @return                      the value, NULL if not found
+        */
+       void *(*get) (hashtable_t *this, void *key);
+
+       /**
+        * Returns the value with a matching key, if the hash table contains such an
+        * entry, otherwise NULL is returned.
+        *
+        * Compared to get() the given match function is used to compare the keys
+        * for equality.  The hash function does have to be deviced properly in
+        * order to make this work if the match function compares keys differently
+        * than the equals function provided to the constructor.  This basically
+        * allows to enumerate all entries with the same hash value.
+        *
+        * @param key           the key to match against
+        * @param match         match function to be used when comparing keys
+        * @return                      the value, NULL if not found
+        */
+       void *(*get_match) (hashtable_t *this, void *key, hashtable_equals_t match);
+
+       /**
+        * Removes the value with the given key from the hash table and returns the
+        * removed value (or NULL if no such value existed).
+        *
+        * @param key           the key of the value to remove
+        * @return                      the removed value, NULL if not found
+        */
+       void *(*remove) (hashtable_t *this, void *key);
+
+       /**
+        * Removes the key and value pair from the hash table at which the given
+        * enumerator currently points.
+        *
+        * @param enumerator    enumerator, from create_enumerator
+        */
+       void (*remove_at) (hashtable_t *this, enumerator_t *enumerator);
+
+       /**
+        * Gets the number of items in the hash table.
+        *
+        * @return                      number of items
+        */
+       u_int (*get_count) (hashtable_t *this);
+
+       /**
+        * Destroys a hash table object.
+        */
+       void (*destroy) (hashtable_t *this);
+
+};
+
+/**
+ * Creates an empty hash table object.
+ *
+ * @param hash                 hash function
+ * @param equals               equals function
+ * @param capacity             initial capacity
+ * @return                             hashtable_t object.
+ */
+hashtable_t *hashtable_create(hashtable_hash_t hash, hashtable_equals_t equals,
+                                                         u_int capacity);
+
+#endif /** HASHTABLE_H_ @}*/
diff --git a/src/libstrongswan/collections/linked_list.c b/src/libstrongswan/collections/linked_list.c
new file mode 100644 (file)
index 0000000..1ff8099
--- /dev/null
@@ -0,0 +1,615 @@
+/*
+ * Copyright (C) 2007-2011 Tobias Brunner
+ * Copyright (C) 2005-2006 Martin Willi
+ * Copyright (C) 2005 Jan Hutter
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "linked_list.h"
+
+typedef struct element_t element_t;
+
+/**
+ * This element holds a pointer to the value it represents.
+ */
+struct element_t {
+
+       /**
+        * Value of a list item.
+        */
+       void *value;
+
+       /**
+        * Previous list element.
+        *
+        * NULL if first element in list.
+        */
+       element_t *previous;
+
+       /**
+        * Next list element.
+        *
+        * NULL if last element in list.
+        */
+       element_t *next;
+};
+
+/**
+ * Creates an empty linked list object.
+ */
+element_t *element_create(void *value)
+{
+       element_t *this;
+       INIT(this,
+               .value = value,
+       );
+       return this;
+}
+
+
+typedef struct private_linked_list_t private_linked_list_t;
+
+/**
+ * Private data of a linked_list_t object.
+ *
+ */
+struct private_linked_list_t {
+       /**
+        * Public part of linked list.
+        */
+       linked_list_t public;
+
+       /**
+        * Number of items in the list.
+        */
+       int count;
+
+       /**
+        * First element in list.
+        * NULL if no elements in list.
+        */
+       element_t *first;
+
+       /**
+        * Last element in list.
+        * NULL if no elements in list.
+        */
+       element_t *last;
+};
+
+typedef struct private_enumerator_t private_enumerator_t;
+
+/**
+ * linked lists enumerator implementation
+ */
+struct private_enumerator_t {
+
+       /**
+        * implements enumerator interface
+        */
+       enumerator_t enumerator;
+
+       /**
+        * associated linked list
+        */
+       private_linked_list_t *list;
+
+       /**
+        * current item
+        */
+       element_t *current;
+
+       /**
+        * enumerator has enumerated all items
+        */
+       bool finished;
+};
+
+METHOD(enumerator_t, enumerate, bool,
+       private_enumerator_t *this, void **item)
+{
+       if (this->finished)
+       {
+               return FALSE;
+       }
+       if (!this->current)
+       {
+               this->current = this->list->first;
+       }
+       else
+       {
+               this->current = this->current->next;
+       }
+       if (!this->current)
+       {
+               this->finished = TRUE;
+               return FALSE;
+       }
+       *item = this->current->value;
+       return TRUE;
+}
+
+METHOD(linked_list_t, create_enumerator, enumerator_t*,
+       private_linked_list_t *this)
+{
+       private_enumerator_t *enumerator;
+
+       INIT(enumerator,
+               .enumerator = {
+                       .enumerate = (void*)_enumerate,
+                       .destroy = (void*)free,
+               },
+               .list = this,
+       );
+
+       return &enumerator->enumerator;
+}
+
+METHOD(linked_list_t, reset_enumerator, void,
+       private_linked_list_t *this, private_enumerator_t *enumerator)
+{
+       enumerator->current = NULL;
+       enumerator->finished = FALSE;
+}
+
+METHOD(linked_list_t, has_more, bool,
+       private_linked_list_t *this, private_enumerator_t *enumerator)
+{
+       if (enumerator->current)
+       {
+               return enumerator->current->next != NULL;
+       }
+       return !enumerator->finished && this->first != NULL;
+}
+
+METHOD(linked_list_t, get_count, int,
+       private_linked_list_t *this)
+{
+       return this->count;
+}
+
+METHOD(linked_list_t, insert_first, void,
+       private_linked_list_t *this, void *item)
+{
+       element_t *element;
+
+       element = element_create(item);
+       if (this->count == 0)
+       {
+               /* first entry in list */
+               this->first = element;
+               this->last = element;
+       }
+       else
+       {
+               element->next = this->first;
+               this->first->previous = element;
+               this->first = element;
+       }
+       this->count++;
+}
+
+/**
+ * unlink an element form the list, returns following element
+ */
+static element_t* remove_element(private_linked_list_t *this,
+                                                                element_t *element)
+{
+       element_t *next, *previous;
+
+       next = element->next;
+       previous = element->previous;
+       free(element);
+       if (next)
+       {
+               next->previous = previous;
+       }
+       else
+       {
+               this->last = previous;
+       }
+       if (previous)
+       {
+               previous->next = next;
+       }
+       else
+       {
+               this->first = next;
+       }
+       if (--this->count == 0)
+       {
+               this->first = NULL;
+               this->last = NULL;
+       }
+       return next;
+}
+
+METHOD(linked_list_t, get_first, status_t,
+       private_linked_list_t *this, void **item)
+{
+       if (this->count == 0)
+       {
+               return NOT_FOUND;
+       }
+       *item = this->first->value;
+       return SUCCESS;
+}
+
+METHOD(linked_list_t, remove_first, status_t,
+       private_linked_list_t *this, void **item)
+{
+       if (get_first(this, item) == SUCCESS)
+       {
+               remove_element(this, this->first);
+               return SUCCESS;
+       }
+       return NOT_FOUND;
+}
+
+METHOD(linked_list_t, insert_last, void,
+       private_linked_list_t *this, void *item)
+{
+       element_t *element;
+
+       element = element_create(item);
+       if (this->count == 0)
+       {
+               /* first entry in list */
+               this->first = element;
+               this->last = element;
+       }
+       else
+       {
+               element->previous = this->last;
+               this->last->next = element;
+               this->last = element;
+       }
+       this->count++;
+}
+
+METHOD(linked_list_t, insert_before, void,
+       private_linked_list_t *this, private_enumerator_t *enumerator,
+       void *item)
+{
+       element_t *current, *element;
+
+       current = enumerator->current;
+       if (!current)
+       {
+               if (enumerator->finished)
+               {
+                       this->public.insert_last(&this->public, item);
+               }
+               else
+               {
+                       this->public.insert_first(&this->public, item);
+               }
+               return;
+       }
+       element = element_create(item);
+       if (current->previous)
+       {
+               current->previous->next = element;
+               element->previous = current->previous;
+               current->previous = element;
+               element->next = current;
+       }
+       else
+       {
+               current->previous = element;
+               element->next = current;
+               this->first = element;
+       }
+       this->count++;
+}
+
+METHOD(linked_list_t, replace, void*,
+       private_linked_list_t *this, private_enumerator_t *enumerator,
+       void *item)
+{
+       void *old = NULL;
+
+       if (enumerator->current)
+       {
+               old = enumerator->current->value;
+               enumerator->current->value = item;
+       }
+       return old;
+}
+
+METHOD(linked_list_t, get_last, status_t,
+       private_linked_list_t *this, void **item)
+{
+       if (this->count == 0)
+       {
+               return NOT_FOUND;
+       }
+       *item = this->last->value;
+       return SUCCESS;
+}
+
+METHOD(linked_list_t, remove_last, status_t,
+       private_linked_list_t *this, void **item)
+{
+       if (get_last(this, item) == SUCCESS)
+       {
+               remove_element(this, this->last);
+               return SUCCESS;
+       }
+       return NOT_FOUND;
+}
+
+METHOD(linked_list_t, remove_, int,
+       private_linked_list_t *this, void *item, bool (*compare)(void*,void*))
+{
+       element_t *current = this->first;
+       int removed = 0;
+
+       while (current)
+       {
+               if ((compare && compare(current->value, item)) ||
+                       (!compare && current->value == item))
+               {
+                       removed++;
+                       current = remove_element(this, current);
+               }
+               else
+               {
+                       current = current->next;
+               }
+       }
+       return removed;
+}
+
+METHOD(linked_list_t, remove_at, void,
+          private_linked_list_t *this, private_enumerator_t *enumerator)
+{
+       element_t *current;
+
+       if (enumerator->current)
+       {
+               current = enumerator->current;
+               enumerator->current = current->previous;
+               remove_element(this, current);
+       }
+}
+
+METHOD(linked_list_t, find_first, status_t,
+       private_linked_list_t *this, linked_list_match_t match,
+       void **item, void *d1, void *d2, void *d3, void *d4, void *d5)
+{
+       element_t *current = this->first;
+
+       while (current)
+       {
+               if ((match && match(current->value, d1, d2, d3, d4, d5)) ||
+                       (!match && item && current->value == *item))
+               {
+                       if (item != NULL)
+                       {
+                               *item = current->value;
+                       }
+                       return SUCCESS;
+               }
+               current = current->next;
+       }
+       return NOT_FOUND;
+}
+
+METHOD(linked_list_t, find_last, status_t,
+       private_linked_list_t *this, linked_list_match_t match,
+       void **item, void *d1, void *d2, void *d3, void *d4, void *d5)
+{
+       element_t *current = this->last;
+
+       while (current)
+       {
+               if ((match && match(current->value, d1, d2, d3, d4, d5)) ||
+                       (!match && item && current->value == *item))
+               {
+                       if (item != NULL)
+                       {
+                               *item = current->value;
+                       }
+                       return SUCCESS;
+               }
+               current = current->previous;
+       }
+       return NOT_FOUND;
+}
+
+METHOD(linked_list_t, invoke_offset, void,
+       private_linked_list_t *this, size_t offset,
+       void *d1, void *d2, void *d3, void *d4, void *d5)
+{
+       element_t *current = this->first;
+       linked_list_invoke_t *method;
+
+       while (current)
+       {
+               method = current->value + offset;
+               (*method)(current->value, d1, d2, d3, d4, d5);
+               current = current->next;
+       }
+}
+
+METHOD(linked_list_t, invoke_function, void,
+       private_linked_list_t *this, linked_list_invoke_t fn,
+       void *d1, void *d2, void *d3, void *d4, void *d5)
+{
+       element_t *current = this->first;
+
+       while (current)
+       {
+               fn(current->value, d1, d2, d3, d4, d5);
+               current = current->next;
+       }
+}
+
+METHOD(linked_list_t, clone_offset, linked_list_t*,
+       private_linked_list_t *this, size_t offset)
+{
+       element_t *current = this->first;
+       linked_list_t *clone;
+
+       clone = linked_list_create();
+       while (current)
+       {
+               void* (**method)(void*) = current->value + offset;
+               clone->insert_last(clone, (*method)(current->value));
+               current = current->next;
+       }
+
+       return clone;
+}
+
+METHOD(linked_list_t, clone_function, linked_list_t*,
+       private_linked_list_t *this, void* (*fn)(void*))
+{
+       element_t *current = this->first;
+       linked_list_t *clone;
+
+       clone = linked_list_create();
+       while (current)
+       {
+               clone->insert_last(clone, fn(current->value));
+               current = current->next;
+       }
+       return clone;
+}
+
+METHOD(linked_list_t, destroy, void,
+       private_linked_list_t *this)
+{
+       void *value;
+
+       /* Remove all list items before destroying list */
+       while (remove_first(this, &value) == SUCCESS)
+       {
+               /* values are not destroyed so memory leaks are possible
+                * if list is not empty when deleting */
+       }
+       free(this);
+}
+
+METHOD(linked_list_t, destroy_offset, void,
+       private_linked_list_t *this, size_t offset)
+{
+       element_t *current = this->first, *next;
+
+       while (current)
+       {
+               void (**method)(void*) = current->value + offset;
+               (*method)(current->value);
+               next = current->next;
+               free(current);
+               current = next;
+       }
+       free(this);
+}
+
+METHOD(linked_list_t, destroy_function, void,
+       private_linked_list_t *this, void (*fn)(void*))
+{
+       element_t *current = this->first, *next;
+
+       while (current)
+       {
+               fn(current->value);
+               next = current->next;
+               free(current);
+               current = next;
+       }
+       free(this);
+}
+
+/*
+ * Described in header.
+ */
+linked_list_t *linked_list_create()
+{
+       private_linked_list_t *this;
+
+       INIT(this,
+               .public = {
+                       .get_count = _get_count,
+                       .create_enumerator = _create_enumerator,
+                       .reset_enumerator = (void*)_reset_enumerator,
+                       .has_more = (void*)_has_more,
+                       .get_first = _get_first,
+                       .get_last = _get_last,
+                       .find_first = (void*)_find_first,
+                       .find_last = (void*)_find_last,
+                       .insert_first = _insert_first,
+                       .insert_last = _insert_last,
+                       .insert_before = (void*)_insert_before,
+                       .replace = (void*)_replace,
+                       .remove_first = _remove_first,
+                       .remove_last = _remove_last,
+                       .remove = _remove_,
+                       .remove_at = (void*)_remove_at,
+                       .invoke_offset = (void*)_invoke_offset,
+                       .invoke_function = (void*)_invoke_function,
+                       .clone_offset = _clone_offset,
+                       .clone_function = _clone_function,
+                       .destroy = _destroy,
+                       .destroy_offset = _destroy_offset,
+                       .destroy_function = _destroy_function,
+               },
+       );
+
+       return &this->public;
+}
+
+/*
+ * See header.
+ */
+linked_list_t *linked_list_create_from_enumerator(enumerator_t *enumerator)
+{
+       linked_list_t *list;
+       void *item;
+
+       list = linked_list_create();
+
+       while (enumerator->enumerate(enumerator, &item))
+       {
+               list->insert_last(list, item);
+       }
+       enumerator->destroy(enumerator);
+
+       return list;
+}
+
+/*
+ * See header.
+ */
+linked_list_t *linked_list_create_with_items(void *item, ...)
+{
+       linked_list_t *list;
+       va_list args;
+
+       list = linked_list_create();
+
+       va_start(args, item);
+       while (item)
+       {
+               list->insert_last(list, item);
+               item = va_arg(args, void*);
+       }
+       va_end(args);
+
+       return list;
+}
diff --git a/src/libstrongswan/collections/linked_list.h b/src/libstrongswan/collections/linked_list.h
new file mode 100644 (file)
index 0000000..da539a2
--- /dev/null
@@ -0,0 +1,319 @@
+/*
+ * Copyright (C) 2007-2011 Tobias Brunner
+ * Copyright (C) 2005-2008 Martin Willi
+ * Copyright (C) 2005 Jan Hutter
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+/**
+ * @defgroup linked_list linked_list
+ * @{ @ingroup collections
+ */
+
+#ifndef LINKED_LIST_H_
+#define LINKED_LIST_H_
+
+typedef struct linked_list_t linked_list_t;
+
+#include <collections/enumerator.h>
+
+/**
+ * Method to match elements in a linked list (used in find_* functions)
+ *
+ * @param item                 current list item
+ * @param ...                  user supplied data (only pointers, at most 5)
+ * @return
+ *                                             - TRUE, if the item matched
+ *                                             - FALSE, otherwise
+ */
+typedef bool (*linked_list_match_t)(void *item, ...);
+
+/**
+ * Method to be invoked on elements in a linked list (used in invoke_* functions)
+ *
+ * @param item                 current list item
+ * @param ...                  user supplied data (only pointers, at most 5)
+ */
+typedef void (*linked_list_invoke_t)(void *item, ...);
+
+/**
+ * Class implementing a double linked list.
+ *
+ * General purpose linked list. This list is not synchronized.
+ */
+struct linked_list_t {
+
+       /**
+        * Gets the count of items in the list.
+        *
+        * @return                      number of items in list
+        */
+       int (*get_count) (linked_list_t *this);
+
+       /**
+        * Create an enumerator over the list.
+        *
+        * @note The enumerator's position is invalid before the first call
+        * to enumerate().
+        *
+        * @return                      enumerator over list items
+        */
+       enumerator_t* (*create_enumerator)(linked_list_t *this);
+
+       /**
+        * Resets the enumerator's current position to the beginning of the list.
+        *
+        * @param enumerator    enumerator to reset
+        */
+       void (*reset_enumerator)(linked_list_t *this, enumerator_t *enumerator);
+
+       /**
+        * Checks if there are more elements following after the enumerator's
+        * current position.
+        *
+        * @param enumerator    enumerator to check
+        */
+       bool (*has_more)(linked_list_t *this, enumerator_t *enumerator);
+
+       /**
+        * Inserts a new item at the beginning of the list.
+        *
+        * @param item          item value to insert in list
+        */
+       void (*insert_first) (linked_list_t *this, void *item);
+
+       /**
+        * Removes the first item in the list and returns its value.
+        *
+        * @param item          returned value of first item, or NULL
+        * @return                      SUCCESS, or NOT_FOUND if list is empty
+        */
+       status_t (*remove_first) (linked_list_t *this, void **item);
+
+       /**
+        * Inserts a new item before the item the enumerator currently points to.
+        *
+        * If this method is called before starting the enumeration the item is
+        * inserted first. If it is called after all items have been enumerated
+        * the item is inserted last. This is helpful when inserting items into
+        * a sorted list.
+        *
+        * @note The position of the enumerator is not changed.
+        *
+        * @param enumerator    enumerator with position
+        * @param item                  item value to insert in list
+        */
+       void (*insert_before)(linked_list_t *this, enumerator_t *enumerator,
+                                                 void *item);
+
+       /**
+        * Replaces the item the enumerator currently points to with the given item.
+        *
+        * @param enumerator    enumerator with position
+        * @param item                  item value to replace current item with
+        * @return                              current item or NULL if the enumerator is at an
+        *                                              invalid position
+        */
+       void *(*replace)(linked_list_t *this, enumerator_t *enumerator, void *item);
+
+       /**
+        * Remove an item from the list where the enumerator points to.
+        *
+        * @param enumerator enumerator with position
+        */
+       void (*remove_at)(linked_list_t *this, enumerator_t *enumerator);
+
+       /**
+        * Remove items from the list matching the given item.
+        *
+        * If a compare function is given, it is called for each item, with the
+        * first parameter being the current list item and the second parameter
+        * being the supplied item. Return TRUE from the compare function to remove
+        * the item, return FALSE to keep it in the list.
+        *
+        * If compare is NULL, comparison is done by pointers.
+        *
+        * @param item          item to remove/pass to comparator
+        * @param compare       compare function, or NULL
+        * @return                      number of removed items
+        */
+       int (*remove)(linked_list_t *this, void *item, bool (*compare)(void*,void*));
+
+       /**
+        * Returns the value of the first list item without removing it.
+        *
+        * @param item          returned value of first item
+        * @return                      SUCCESS, NOT_FOUND if list is empty
+        */
+       status_t (*get_first) (linked_list_t *this, void **item);
+
+       /**
+        * Inserts a new item at the end of the list.
+        *
+        * @param item          value to insert into list
+        */
+       void (*insert_last) (linked_list_t *this, void *item);
+
+       /**
+        * Removes the last item in the list and returns its value.
+        *
+        * @param item          returned value of last item, or NULL
+        * @return                      SUCCESS, NOT_FOUND if list is empty
+        */
+       status_t (*remove_last) (linked_list_t *this, void **item);
+
+       /**
+        * Returns the value of the last list item without removing it.
+        *
+        * @param item          returned value of last item
+        * @return                      SUCCESS, NOT_FOUND if list is empty
+        */
+       status_t (*get_last) (linked_list_t *this, void **item);
+
+       /** Find the first matching element in the list.
+        *
+        * The first object passed to the match function is the current list item,
+        * followed by the user supplied data.
+        * If the supplied function returns TRUE this function returns SUCCESS, and
+        * the current object is returned in the third parameter, otherwise,
+        * the next item is checked.
+        *
+        * If match is NULL, *item and the current object are compared.
+        *
+        * @warning Only use pointers as user supplied data.
+        *
+        * @param match                 comparison function to call on each object, or NULL
+        * @param item                  the list item, if found
+        * @param ...                   user data to supply to match function (limited to 5 arguments)
+        * @return                              SUCCESS if found, NOT_FOUND otherwise
+        */
+       status_t (*find_first) (linked_list_t *this, linked_list_match_t match,
+                                                       void **item, ...);
+
+       /** Find the last matching element in the list.
+        *
+        * The first object passed to the match function is the current list item,
+        * followed by the user supplied data.
+        * If the supplied function returns TRUE this function returns SUCCESS, and
+        * the current object is returned in the third parameter, otherwise,
+        * the next item is checked.
+        *
+        * If match is NULL, *item and the current object are compared.
+        *
+        * @warning Only use pointers as user supplied data.
+        *
+        * @param match                 comparison function to call on each object, or NULL
+        * @param item                  the list item, if found
+        * @param ...                   user data to supply to match function (limited to 5 arguments)
+        * @return                              SUCCESS if found, NOT_FOUND otherwise
+        */
+       status_t (*find_last) (linked_list_t *this, linked_list_match_t match,
+                                                  void **item, ...);
+
+       /**
+        * Invoke a method on all of the contained objects.
+        *
+        * If a linked list contains objects with function pointers,
+        * invoke() can call a method on each of the objects. The
+        * method is specified by an offset of the function pointer,
+        * which can be evalutated at compile time using the offsetof
+        * macro, e.g.: list->invoke(list, offsetof(object_t, method));
+        *
+        * @warning Only use pointers as user supplied data.
+        *
+        * @param offset        offset of the method to invoke on objects
+        * @param ...           user data to supply to called function (limited to 5 arguments)
+        */
+       void (*invoke_offset) (linked_list_t *this, size_t offset, ...);
+
+       /**
+        * Invoke a function on all of the contained objects.
+        *
+        * @warning Only use pointers as user supplied data.
+        *
+        * @param function      offset of the method to invoke on objects
+        * @param ...           user data to supply to called function (limited to 5 arguments)
+        */
+       void (*invoke_function) (linked_list_t *this, linked_list_invoke_t function, ...);
+
+       /**
+        * Clones a list and its objects using the objects' clone method.
+        *
+        * @param offset        offset ot the objects clone function
+        * @return                      cloned list
+        */
+       linked_list_t *(*clone_offset) (linked_list_t *this, size_t offset);
+
+       /**
+        * Clones a list and its objects using a given function.
+        *
+        * @param function      function that clones an object
+        * @return                      cloned list
+        */
+       linked_list_t *(*clone_function) (linked_list_t *this, void*(*)(void*));
+
+       /**
+        * Destroys a linked_list object.
+        */
+       void (*destroy) (linked_list_t *this);
+
+       /**
+        * Destroys a list and its objects using the destructor.
+        *
+        * If a linked list and the contained objects should be destroyed, use
+        * destroy_offset. The supplied offset specifies the destructor to
+        * call on each object. The offset may be calculated using the offsetof
+        * macro, e.g.: list->destroy_offset(list, offsetof(object_t, destroy));
+        *
+        * @param offset        offset of the objects destructor
+        */
+       void (*destroy_offset) (linked_list_t *this, size_t offset);
+
+       /**
+        * Destroys a list and its contents using a a cleanup function.
+        *
+        * If a linked list and its contents should get destroyed using a specific
+        * cleanup function, use destroy_function. This is useful when the
+        * list contains malloc()-ed blocks which should get freed,
+        * e.g.: list->destroy_function(list, free);
+        *
+        * @param function      function to call on each object
+        */
+       void (*destroy_function) (linked_list_t *this, void (*)(void*));
+};
+
+/**
+ * Creates an empty linked list object.
+ *
+ * @return             linked_list_t object.
+ */
+linked_list_t *linked_list_create(void);
+
+/**
+ * Creates a linked list from an enumerator.
+ *
+ * @param enumerator   enumerator over void*, gets destroyed
+ * @return                             linked_list_t object, containing enumerated values
+ */
+linked_list_t *linked_list_create_from_enumerator(enumerator_t *enumerator);
+
+/**
+ * Creates a linked list from a NULL terminated vararg list of items.
+ *
+ * @param first                        first item
+ * @param ...                  subsequent items, terminated by NULL
+ * @return                             linked_list_t object, containing passed items
+ */
+linked_list_t *linked_list_create_with_items(void *first, ...);
+
+#endif /** LINKED_LIST_H_ @}*/
index 6ee4f9b..9d17143 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <library.h>
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <utils/identification.h>
 #include <eap/eap.h>
 #include <credentials/certificates/certificate.h>
index 79484a0..d879355 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef AUTH_CFG_H_
 #define AUTH_CFG_H_
 
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 typedef struct auth_cfg_t auth_cfg_t;
 typedef enum auth_rule_t auth_rule_t;
index 9a49797..2f35eb6 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef PKCS10_H_
 #define PKCS10_H_
 
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <credentials/certificates/certificate.h>
 
 typedef struct pkcs10_t pkcs10_t;
index 00171a7..4e8d431 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef X509_H_
 #define X509_H_
 
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <credentials/certificates/certificate.h>
 
 /* constraints are currently restricted to the range 0..127 */
index 4865984..53ac13c 100644 (file)
@@ -17,8 +17,8 @@
 
 #include <stdint.h>
 
-#include <utils/linked_list.h>
-#include <utils/hashtable.h>
+#include <collections/linked_list.h>
+#include <collections/hashtable.h>
 #include <threading/rwlock.h>
 
 typedef struct private_cred_encoding_t private_cred_encoding_t;
index ff62101..cb52b41 100644 (file)
@@ -18,7 +18,7 @@
 #include "credential_factory.h"
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/thread_value.h>
 #include <threading/rwlock.h>
 #include <credentials/certificates/x509.h>
index a96abdc..32dadc7 100644 (file)
@@ -20,7 +20,7 @@
 #include <threading/thread_value.h>
 #include <threading/mutex.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <credentials/sets/cert_cache.h>
 #include <credentials/sets/auth_cfg_wrapper.h>
 #include <credentials/certificates/x509.h>
index d9a47b7..73c5857 100644 (file)
@@ -24,7 +24,7 @@
 typedef struct credential_manager_t credential_manager_t;
 
 #include <utils/identification.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <credentials/auth_cfg.h>
 #include <credentials/credential_set.h>
 #include <credentials/keys/private_key.h>
index fb18fb5..49af5a0 100644 (file)
@@ -17,7 +17,7 @@
 #include <asn1/oid.h>
 #include <asn1/asn1.h>
 #include <asn1/asn1_parser.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <utils/lexparser.h>
 
 #include "ietf_attributes.h"
index d00b8d1..900c661 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef SHARED_KEY_H_
 #define SHARED_KEY_H_
 
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <utils/identification.h>
 
 typedef struct shared_key_t shared_key_t;
index a7d0ed8..e8f0e7e 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <library.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /** cache size, a power of 2 for fast modulo */
 #define CACHE_SIZE 32
index e023e84..d697a56 100644 (file)
@@ -18,7 +18,7 @@
 #include "mem_cred.h"
 
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_mem_cred_t private_mem_cred_t;
 
index eb46b06..2044720 100644 (file)
@@ -27,7 +27,7 @@ typedef struct mem_cred_t mem_cred_t;
 
 #include <credentials/credential_set.h>
 #include <credentials/certificates/crl.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /**
  * Generic in-memory credential set.
index 3736ae3..48300b0 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <debug.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <crypto/crypto_tester.h>
 
 const char *default_plugin_name = "default";
index 01e84a1..56f0ded 100644 (file)
@@ -21,7 +21,7 @@
 #include "crypto_tester.h"
 
 #include <debug.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_crypto_tester_t private_crypto_tester_t;
 
index 0ec19f2..674fe04 100644 (file)
@@ -30,7 +30,7 @@
 #include <crypto/pkcs9.h>
 #include <crypto/hashers/hasher.h>
 #include <crypto/crypters/crypter.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include "pkcs7.h"
 
index 7c9a6b0..5af36d2 100644 (file)
@@ -28,7 +28,7 @@ typedef struct pkcs7_t pkcs7_t;
 #include <credentials/keys/private_key.h>
 #include <crypto/pkcs9.h>
 #include <crypto/crypters/crypter.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 /**
  * PKCS#7 contentInfo object.
index d24ab1b..f3cc5d2 100644 (file)
@@ -20,7 +20,7 @@
 #include <asn1/oid.h>
 #include <asn1/asn1.h>
 #include <asn1/asn1_parser.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 #include "pkcs9.h"
 
index 7356dc3..4db504e 100644 (file)
@@ -38,7 +38,7 @@
 #include "proposal_keywords.h"
 #include "proposal_keywords_static.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/rwlock.h>
 
 typedef struct private_proposal_keywords_t private_proposal_keywords_t;
index dda29b5..d46fc3d 100644 (file)
@@ -25,7 +25,7 @@ typedef enum db_type_t db_type_t;
 typedef enum db_driver_t db_driver_t;
 typedef struct database_t database_t;
 
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 
 /**
  * Database column types
index 909522d..6c714ba 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "database_factory.h"
 
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <threading/mutex.h>
 
 typedef struct private_database_factory_t private_database_factory_t;
index 9b363c7..ec1b5af 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <debug.h>
 #include <threading/rwlock.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 typedef struct private_fetcher_manager_t private_fetcher_manager_t;
 
index 90a865a..db0c845 100644 (file)
@@ -22,7 +22,7 @@
 #include <threading/thread.h>
 #include <utils/identification.h>
 #include <networking/host.h>
-#include <utils/hashtable.h>
+#include <collections/hashtable.h>
 #include <utils/backtrace.h>
 #include <selectors/traffic_selector.h>
 
index a2de749..557a7a0 100644 (file)
@@ -22,6 +22,9 @@
  * @defgroup bio bio
  * @ingroup libstrongswan
  *
+ * @defgroup collections collections
+ * @ingroup libstrongswan
+ *
  * @defgroup credentials credentials
  * @ingroup libstrongswan
  *
index 55b07d3..c12becc 100644 (file)
@@ -24,8 +24,8 @@
 #include <threading/condvar.h>
 #include <threading/mutex.h>
 #include <threading/thread.h>
-#include <utils/hashtable.h>
-#include <utils/linked_list.h>
+#include <collections/hashtable.h>
+#include <collections/linked_list.h>
 
 /**
  * Default minimum and maximum number of threads
index b54d813..5d697fd 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <debug.h>
 #include <asn1/asn1.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 #include <credentials/certificates/x509.h>
 
 typedef struct private_constraints_validator_t private_constraints_validator_t;
index 1a20a80..12a8ff5 100644 (file)
@@ -23,7 +23,7 @@
 #include <chunk.h>
 #include <threading/thread_value.h>
 #include <threading/mutex.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 /* Older mysql.h headers do not define it, but we need it. It is not returned
  * in in MySQL 4 by default, but by MySQL 5. To avoid this problem, we catch
index e529ff8..1956bf6 100644 (file)
@@ -43,7 +43,7 @@
 #include <openssl/x509v3.h>
 
 #include <debug.h>
-#include <utils/enumerator.h>
+#include <collections/enumerator.h>
 #include <credentials/certificates/x509.h>
 
 typedef struct private_openssl_crl_t private_openssl_crl_t;
index e85c5cc..a7c99a1 100644 (file)
@@ -49,7 +49,7 @@
 
 #include <debug.h>
 #include <asn1/oid.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
 
 
 typedef struct private_openssl_x509_t private_openssl_x509_t;