Commit 4f58b90a authored by Ghislain MARY's avatar Ghislain MARY

Implement TURN channel binding.

parent b3c29be5
......@@ -143,6 +143,7 @@ typedef struct _IceStunServerRequest {
MSList *transactions; /**< List of IceStunServerRequestTransaction structures. */
MSTimeSpec next_transmission_time;
MSStunAddress peer_address;
uint16_t channel_number;
uint16_t stun_method;
bool_t responded;
} IceStunServerRequest;
......@@ -639,37 +640,31 @@ MS2_PUBLIC void ice_check_list_set_remote_credentials(IceCheckList *cl, const ch
* Get the default local candidate for an ICE check list.
*
* @param cl A pointer to a check list
* @param rtp_addr A pointer to store the RTP address
* @param rtp_port A pointer to store the RTP port
* @param rtcp_addr A pointer to store the RTCP address
* @param rtcp_port A pointer to store the RTCP port
* @param rtp_candidate A pointer to store the RTP default local candidate
* @param rtcp_candidate A pointer to store the RTCP default local candidate
* @return TRUE if the information have been successfully retrieved, FALSE otherwise
*/
MS2_PUBLIC bool_t ice_check_list_default_local_candidate(const IceCheckList *cl, const char **rtp_addr, int *rtp_port, const char **rtcp_addr, int *rtcp_port);
MS2_PUBLIC bool_t ice_check_list_default_local_candidate(const IceCheckList *cl, IceCandidate **rtp_candidate, IceCandidate **rtcp_candidate);
/**
* Get the selected valid local candidate for an ICE check list.
*
* @param cl A pointer to a check list
* @param rtp_addr A pointer to store the RTP address
* @param rtp_port A pointer to store the RTP port
* @param rtcp_addr A pointer to store the RTCP address
* @param rtcp_port A pointer to store the RTCP port
* @param rtp_candidate A pointer to store the RTP valid local candidate
* @param rtcp_candidate A pointer to store the RTCP valid local candidate
* @return TRUE if the information have been successfully retrieved, FALSE otherwise
*/
MS2_PUBLIC bool_t ice_check_list_selected_valid_local_candidate(const IceCheckList *cl, const char **rtp_addr, int *rtp_port, const char **rtcp_addr, int *rtcp_port);
MS2_PUBLIC bool_t ice_check_list_selected_valid_local_candidate(const IceCheckList *cl, IceCandidate **rtp_candidate, IceCandidate **rtcp_candidate);
/**
* Get the selected valid remote candidate for an ICE check list.
*
* @param cl A pointer to a check list
* @param rtp_addr A pointer to store the RTP address
* @param rtp_port A pointer to store the RTP port
* @param rtcp_addr A pointer to store the RTCP address
* @param rtcp_port A pointer to store the RTCP port
* @param rtp_candidate A pointer to store the RTP valid remote candidate
* @param rtcp_candidate A pointer to store the RTCP valid remote candidate
* @return TRUE if the information have been successfully retrieved, FALSE otherwise
*/
MS2_PUBLIC bool_t ice_check_list_selected_valid_remote_candidate(const IceCheckList *cl, const char **rtp_addr, int *rtp_port, const char **rtcp_addr, int *rtcp_port);
MS2_PUBLIC bool_t ice_check_list_selected_valid_remote_candidate(const IceCheckList *cl, IceCandidate **rtp_candidate, IceCandidate **rtcp_candidate);
/**
* Get the type of the selected valid candidate for an ICE check list.
......
......@@ -148,6 +148,7 @@ typedef struct {
uint64_t ice_controlling;
uint64_t ice_controlled;
uint32_t lifetime;
uint16_t channel_number;
uint16_t data_length;
uint8_t requested_transport;
bool_t include_username_attribute;
......@@ -164,6 +165,7 @@ typedef struct {
bool_t has_ice_controlling;
bool_t has_ice_controlled;
bool_t has_lifetime;
bool_t has_channel_number;
bool_t has_requested_transport;
} MSStunMessage;
......@@ -172,7 +174,9 @@ typedef enum {
MS_TURN_CONTEXT_STATE_CREATING_ALLOCATION,
MS_TURN_CONTEXT_STATE_ALLOCATION_CREATED,
MS_TURN_CONTEXT_STATE_CREATING_PERMISSIONS,
MS_TURN_CONTEXT_STATE_RUNNING
MS_TURN_CONTEXT_STATE_PERMISSIONS_CREATED,
MS_TURN_CONTEXT_STATE_BINDING_CHANNEL,
MS_TURN_CONTEXT_STATE_CHANNEL_BOUND
} MSTurnContextState;
typedef enum {
......@@ -188,6 +192,7 @@ typedef struct {
char *password;
char *ha1;
uint32_t lifetime;
uint16_t channel_number;
MSTurnContextState state;
MSTurnContextType type;
MSStunAddress relay_addr;
......@@ -284,11 +289,15 @@ MS2_PUBLIC MSStunMessage * ms_turn_allocate_request_create(void);
MS2_PUBLIC MSStunMessage * ms_turn_refresh_request_create(uint32_t lifetime);
MS2_PUBLIC MSStunMessage * ms_turn_create_permission_request_create(MSStunAddress peer_address);
MS2_PUBLIC MSStunMessage * ms_turn_send_indication_create(MSStunAddress peer_address);
MS2_PUBLIC MSStunMessage * ms_turn_channel_bind_request_create(MSStunAddress peer_address, uint16_t channel_number);
MS2_PUBLIC bool_t ms_stun_message_has_requested_transport(const MSStunMessage *msg);
MS2_PUBLIC uint8_t ms_stun_message_get_requested_transport(const MSStunMessage *msg);
MS2_PUBLIC bool_t ms_stun_message_has_lifetime(const MSStunMessage *msg);
MS2_PUBLIC uint32_t ms_stun_message_get_lifetime(const MSStunMessage *msg);
MS2_PUBLIC void ms_stun_message_set_lifetime(MSStunMessage *msg, uint32_t lifetime);
MS2_PUBLIC bool_t ms_stun_message_has_channel_number(const MSStunMessage *msg);
MS2_PUBLIC uint16_t ms_stun_message_get_channel_number(const MSStunMessage *msg);
MS2_PUBLIC void ms_stun_message_set_channel_number(MSStunMessage *msg, uint16_t channel_number);
MS2_PUBLIC uint8_t * ms_stun_message_get_data(const MSStunMessage *msg);
MS2_PUBLIC uint16_t ms_stun_message_get_data_length(const MSStunMessage *msg);
MS2_PUBLIC void ms_stun_message_set_data(MSStunMessage *msg, uint8_t *data, uint16_t length);
......@@ -310,6 +319,8 @@ MS2_PUBLIC const char * ms_turn_context_get_ha1(const MSTurnContext *context);
MS2_PUBLIC void ms_turn_context_set_ha1(MSTurnContext *context, const char *ha1);
MS2_PUBLIC uint32_t ms_turn_context_get_lifetime(const MSTurnContext *context);
MS2_PUBLIC void ms_turn_context_set_lifetime(MSTurnContext *context, uint32_t lifetime);
MS2_PUBLIC uint16_t ms_turn_context_get_channel_number(const MSTurnContext *context);
MS2_PUBLIC void ms_turn_context_set_channel_number(MSTurnContext *context, uint16_t channel_number);
MS2_PUBLIC void ms_turn_context_set_allocated_relay_addr(MSTurnContext *context, MSStunAddress relay_addr);
MS2_PUBLIC void ms_turn_context_set_force_rtp_sending_via_relay(MSTurnContext *context, bool_t force);
MS2_PUBLIC RtpTransport * ms_turn_context_create_endpoint(MSTurnContext *context);
......
This diff is collapsed.
This diff is collapsed.
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