summaryrefslogtreecommitdiff
path: root/stun
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2009-03-27 17:57:56 -0400
committerYouness Alaoui <youness.alaoui@collabora.co.uk>2009-03-27 17:57:56 -0400
commitc62fc4377d39934f68bb8a48697e21fbf005aa1d (patch)
treead05f1b9790e640d702ba008c83ace26f82ed984 /stun
parent519c920b8b6d419d850ab10e5385d0b0e9920224 (diff)
downloadlibnice-c62fc4377d39934f68bb8a48697e21fbf005aa1d.tar.gz
Adding new stun API stun_agent_forget_transaction to forget a saved transaction id when the transaction times out
Diffstat (limited to 'stun')
-rw-r--r--stun/stunagent.c15
-rw-r--r--stun/stunagent.h18
2 files changed, 33 insertions, 0 deletions
diff --git a/stun/stunagent.c b/stun/stunagent.c
index 1194b17..3634422 100644
--- a/stun/stunagent.c
+++ b/stun/stunagent.c
@@ -319,6 +319,21 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
}
+bool stun_agent_forget_transaction (StunAgent *agent, StunTransactionId id)
+{
+ int i;
+
+ for (i = 0; i < STUN_AGENT_MAX_SAVED_IDS; i++) {
+ if (agent->sent_ids[i].valid == TRUE &&
+ memcmp (id, agent->sent_ids[i].id,
+ sizeof(StunTransactionId)) == 0) {
+ agent->sent_ids[i].valid = FALSE;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
bool stun_agent_init_request (StunAgent *agent, StunMessage *msg,
uint8_t *buffer, size_t buffer_len, StunMethod m)
diff --git a/stun/stunagent.h b/stun/stunagent.h
index 71059d9..b32fa3c 100644
--- a/stun/stunagent.h
+++ b/stun/stunagent.h
@@ -331,6 +331,24 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
StunMessageIntegrityValidate validater, void * validater_data);
/**
+ * stun_agent_forget_transaction:
+ * @agent: The #StunAgent
+ * @id: The #StunTransactionId of the transaction to forget
+ *
+ * This function is used to make the #StunAgent forget about a previously
+ * created transaction. <br/>
+ * This function should be called when a STUN request was previously
+ * created with stun_agent_finish_message() and for which no response was ever
+ * received (timed out). The #StunAgent keeps a list of the sent transactions
+ * in order to validate the responses received. If the response is never received
+ * this will allow the #StunAgent to forget about the timed out transaction and
+ * free its slot for future transactions.
+ * Returns: %TRUE if the transaction was found, %FALSE otherwise
+ */
+bool stun_agent_forget_transaction (StunAgent *agent, StunTransactionId id);
+
+
+/**
* stun_agent_init_request:
* @agent: The #StunAgent
* @msg: The #StunMessage to build