constants.h | constants.h | |||
---|---|---|---|---|
skipping to change at line 67 | skipping to change at line 67 | |||
(STUN_ATTRIBUTE_LENGTH_POS + STUN_ATTRIBUTE_LENGTH_LEN) | (STUN_ATTRIBUTE_LENGTH_POS + STUN_ATTRIBUTE_LENGTH_LEN) | |||
#define STUN_ATTRIBUTE_HEADER_LENGTH STUN_ATTRIBUTE_VALUE_POS | #define STUN_ATTRIBUTE_HEADER_LENGTH STUN_ATTRIBUTE_VALUE_POS | |||
#define STUN_MAX_MESSAGE_SIZE_IPV4 576 | #define STUN_MAX_MESSAGE_SIZE_IPV4 576 | |||
#define STUN_MAX_MESSAGE_SIZE_IPV6 1280 | #define STUN_MAX_MESSAGE_SIZE_IPV6 1280 | |||
/* #define STUN_MAX_MESSAGE_SIZE STUN_MAX_MESSAGE_SIZE_IPV4 */ | /* #define STUN_MAX_MESSAGE_SIZE STUN_MAX_MESSAGE_SIZE_IPV4 */ | |||
#define STUN_ID_LEN 16 | #define STUN_ID_LEN 16 | |||
#define STUN_AGENT_MAX_SAVED_IDS 20 | #define STUN_AGENT_MAX_SAVED_IDS 200 | |||
#define STUN_AGENT_MAX_UNKNOWN_ATTRIBUTES 256 | #define STUN_AGENT_MAX_UNKNOWN_ATTRIBUTES 256 | |||
#define STUN_MAGIC_COOKIE 0x2112A442 | #define STUN_MAGIC_COOKIE 0x2112A442 | |||
#define TURN_MAGIC_COOKIE 0x72c64bc6 | #define TURN_MAGIC_COOKIE 0x72c64bc6 | |||
#ifndef TRUE | #ifndef TRUE | |||
#define TRUE (1 == 1) | #define TRUE (1 == 1) | |||
#endif | #endif | |||
#ifndef FALSE | #ifndef FALSE | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
stunagent.h | stunagent.h | |||
---|---|---|---|---|
skipping to change at line 426 | skipping to change at line 426 | |||
* stun_agent_finish_message: | * stun_agent_finish_message: | |||
* @agent: The #StunAgent | * @agent: The #StunAgent | |||
* @msg: The #StunMessage to finish | * @msg: The #StunMessage to finish | |||
* @key: The key to use for the MESSAGE-INTEGRITY attribute | * @key: The key to use for the MESSAGE-INTEGRITY attribute | |||
* @key_len: The length of the @key | * @key_len: The length of the @key | |||
* | * | |||
* This function will 'finish' a message and make it ready to be sent. It w ill | * This function will 'finish' a message and make it ready to be sent. It w ill | |||
* add the MESSAGE-INTEGRITY and FINGERPRINT attributes if necessary. If th e | * add the MESSAGE-INTEGRITY and FINGERPRINT attributes if necessary. If th e | |||
* STUN message has a #STUN_REQUEST class, it will save the transaction id of | * STUN message has a #STUN_REQUEST class, it will save the transaction id of | |||
* the message in the agent for future matching of the response. | * the message in the agent for future matching of the response. | |||
* Returns: The final size of the message built | * <para>See also: stun_agent_forget_transaction()</para> | |||
* Returns: The final size of the message built or 0 if an error occured | ||||
* <note> | ||||
<para> | ||||
The return value must always be checked. a value of 0 means the eith | ||||
er | ||||
the buffer's size is too small to contain the finishing attributes | ||||
(MESSAGE-INTEGRITY, FINGERPRINT), or that there is no more free slot | ||||
s | ||||
for saving the sent id in the agent's state. | ||||
</para> | ||||
<para> | ||||
Everytime stun_agent_finish_message() is called for a #STUN_REQUEST | ||||
message, you must make sure to call stun_agent_forget_transaction() | ||||
in | ||||
case the response times out and is never received. This is to avoid | ||||
filling up the #StunAgent's sent ids state preventing any further | ||||
use of the stun_agent_finish_message() | ||||
</para> | ||||
</note> | ||||
*/ | */ | |||
size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg, | size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg, | |||
const uint8_t *key, size_t key_len); | const uint8_t *key, size_t key_len); | |||
/** | ||||
* 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. | ||||
* <para> | ||||
* This function should be called when a STUN request was previously | ||||
* created with stun_agent_finish_message() and for which no response was e | ||||
ver | ||||
* received (timed out). The #StunAgent keeps a list of the sent transactio | ||||
ns | ||||
* in order to validate the responses received. If the response is never re | ||||
ceived | ||||
* this will allow the #StunAgent to forget about the timed out transaction | ||||
and | ||||
* free its slot for future transactions. | ||||
* </para> | ||||
* Returns: %TRUE if the transaction was found, %FALSE otherwise | ||||
*/ | ||||
bool stun_agent_forget_transaction (StunAgent *agent, StunTransactionId id) | ||||
; | ||||
#endif /* _STUN_AGENT_H */ | #endif /* _STUN_AGENT_H */ | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 44 lines changed or added | |||
stunmessage.h | stunmessage.h | |||
---|---|---|---|---|
skipping to change at line 442 | skipping to change at line 442 | |||
STUN_MESSAGE_RETURN_NOT_FOUND, | STUN_MESSAGE_RETURN_NOT_FOUND, | |||
STUN_MESSAGE_RETURN_INVALID, | STUN_MESSAGE_RETURN_INVALID, | |||
STUN_MESSAGE_RETURN_NOT_ENOUGH_SPACE, | STUN_MESSAGE_RETURN_NOT_ENOUGH_SPACE, | |||
STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS | STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS | |||
} StunMessageReturn; | } StunMessageReturn; | |||
#include "stunagent.h" | #include "stunagent.h" | |||
/** | /** | |||
* STUN_MAX_MESSAGE_SIZE: | * STUN_MAX_MESSAGE_SIZE: | |||
* | ||||
* The Maximum size of a STUN message | * The Maximum size of a STUN message | |||
*/ | */ | |||
#define STUN_MAX_MESSAGE_SIZE 65552 | #define STUN_MAX_MESSAGE_SIZE 65552 | |||
/** | /** | |||
* StunMessage: | * StunMessage: | |||
* @agent: The agent that created or validated this message | * @agent: The agent that created or validated this message | |||
* @buffer: The buffer containing the STUN message | * @buffer: The buffer containing the STUN message | |||
* @buffer_len: The length of the buffer (not the size of the message) | * @buffer_len: The length of the buffer (not the size of the message) | |||
* @key: The short term credentials key to use for authentication validatio n | * @key: The short term credentials key to use for authentication validatio n | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||