Commit c62fc437 authored by Youness Alaoui's avatar Youness Alaoui

Adding new stun API stun_agent_forget_transaction to forget a saved...

Adding new stun API stun_agent_forget_transaction to forget a saved transaction id when the transaction times out
parent 519c920b
......@@ -40,6 +40,7 @@ nice_interfaces_get_local_ips
stun_agent_build_unknown_attributes_error
stun_agent_default_validater
stun_agent_finish_message
stun_agent_forget_transaction
stun_agent_init
stun_agent_init_error
stun_agent_init_indication
......
......@@ -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)
......
......@@ -330,6 +330,24 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
const uint8_t *buffer, size_t buffer_len,
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment