+METHOD(tnccs_manager_t, create_connection, TNC_ConnectionID,
+ private_tnccs_manager_t *this, tnccs_t *tnccs)
+{
+ tnccs_connection_entry_t *entry = malloc_thing(tnccs_connection_entry_t);
+
+ entry->id = ++this->connection_id;
+ entry->tnccs = tnccs;
+
+ this->lock->write_lock(this->lock);
+ this->connections->insert_last(this->connections, entry);
+ this->lock->unlock(this->lock);
+
+ DBG1(DBG_TNC, "assigned TNCCS Connection ID %u", entry->id);
+ return entry->id;
+}
+
+METHOD(tnccs_manager_t, remove_connection, void,
+ private_tnccs_manager_t *this, TNC_ConnectionID id)
+{
+ enumerator_t *enumerator;
+ tnccs_connection_entry_t *entry;
+
+ this->lock->write_lock(this->lock);
+ enumerator = this->connections->create_enumerator(this->connections);
+ while (enumerator->enumerate(enumerator, &entry))
+ {
+ if (id == entry->id)
+ {
+ this->connections->remove_at(this->connections, enumerator);
+ free(entry);
+ DBG1(DBG_TNC, "removed TNCCS Connection ID %u", id);
+ }
+ }
+ enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
+}
+