diff options
Diffstat (limited to 'include/asterisk/sdp_state.h')
-rw-r--r-- | include/asterisk/sdp_state.h | 101 |
1 files changed, 78 insertions, 23 deletions
diff --git a/include/asterisk/sdp_state.h b/include/asterisk/sdp_state.h index 14d3e7c04..e2f13eb61 100644 --- a/include/asterisk/sdp_state.h +++ b/include/asterisk/sdp_state.h @@ -19,9 +19,10 @@ #ifndef _ASTERISK_SDP_STATE_H #define _ASTERISK_SDP_STATE_H +#include "asterisk/stream.h" +#include "asterisk/sdp_options.h" + struct ast_sdp_state; -struct ast_sdp_options; -struct ast_stream_topology; /*! * \brief Allocate a new SDP state @@ -31,7 +32,8 @@ struct ast_stream_topology; * Ownership of the SDP options is taken on by the SDP state. * A good strategy is to call this during session creation. */ -struct ast_sdp_state *ast_sdp_state_alloc(struct ast_stream_topology *streams, struct ast_sdp_options *options); +struct ast_sdp_state *ast_sdp_state_alloc(struct ast_stream_topology *streams, + struct ast_sdp_options *options); /*! * \brief Free the SDP state. @@ -45,7 +47,8 @@ void ast_sdp_state_free(struct ast_sdp_state *sdp_state); * * Stream numbers correspond to the streams in the topology of the associated channel */ -struct ast_rtp_instance *ast_sdp_state_get_rtp_instance(struct ast_sdp_state *sdp_state, int stream_index); +struct ast_rtp_instance *ast_sdp_state_get_rtp_instance(const struct ast_sdp_state *sdp_state, + int stream_index); /*! * \brief Get the joint negotiated streams based on local and remote capabilities. @@ -53,44 +56,96 @@ struct ast_rtp_instance *ast_sdp_state_get_rtp_instance(struct ast_sdp_state *sd * If this is called prior to receiving a remote SDP, then this will just mirror * the local configured endpoint capabilities. */ -struct ast_stream_topology *ast_sdp_state_get_joint_topology(struct ast_sdp_state *sdp_state); +const struct ast_stream_topology *ast_sdp_state_get_joint_topology( + const struct ast_sdp_state *sdp_state); + +/*! + * \brief Get the local topology + * + */ +const struct ast_stream_topology *ast_sdp_state_get_local_topology( + const struct ast_sdp_state *sdp_state); + +/*! + * \brief Get the sdp_state options + * + */ +const struct ast_sdp_options *ast_sdp_state_get_options( + const struct ast_sdp_state *sdp_state); + /*! * \brief Get the local SDP. * - * If we have not received a remote SDP yet, this will be an SDP offer based - * on known streams and options If we have received a remote SDP, this will - * be the negotiated SDP based on the joint capabilities. The return type is - * a void pointer because the representation of the SDP is going to be determined based - * on the SDP options when allocating the SDP state. + * \param sdp_state + * + * \retval non-NULL Success + * \retval NULL Failure + * + * \note + * This function will allocate a new SDP with RTP instances if it has not already + * been allocated. + * + */ +const struct ast_sdp *ast_sdp_state_get_local_sdp(struct ast_sdp_state *sdp_state); + +/*! + * \brief Get the local SDP Implementation. + * + * \param sdp_state + * + * \retval non-NULL Success + * \retval NULL Failure + * + * \note + * This function calls ast_sdp_state_get_local_sdp then translates it into + * the defined implementation. + * + * The return here is const. The use case for this is so that a channel can add + * the SDP to an outgoing message. The API user should not attempt to modify the SDP. + * SDP modification should only be done through the API. + * + * \since 15 + */ +const void *ast_sdp_state_get_local_sdp_impl(struct ast_sdp_state *sdp_state); + +/*! + * \brief Set the remote SDP * - * This function will allocate RTP instances if RTP instances have not already - * been allocated for the streams. + * \param sdp_state + * \param sdp * - * The return here is const. The use case for this is so that a channel can add the SDP to an outgoing - * message. The API user should not attempt to modify the SDP. SDP modification should only be done through - * the API. + * \since 15 */ -const void *ast_sdp_state_get_local(struct ast_sdp_state *sdp_state); +void ast_sdp_state_set_remote_sdp(struct ast_sdp_state *sdp_state, struct ast_sdp *sdp); /*! - * \brief Set the remote SDP. + * \brief Set the remote SDP from an Implementation + * + * \param sdp_state + * \param remote The implementation's representation of an SDP. * - * This can be used for either a remote offer or answer. - * This can also be used whenever an UPDATE, re-INVITE, etc. arrives. - * The type of the "remote" parameter is dictated by whatever SDP representation - * was set in the ast_sdp_options used during ast_sdp_state allocation + * \retval 0 Success + * \retval non-0 Failure * - * This function will NOT allocate RTP instances. + * \since 15 */ -int ast_sdp_state_set_remote(struct ast_sdp_state *sdp_state, void *remote); +int ast_sdp_state_set_remote_sdp_from_impl(struct ast_sdp_state *sdp_state, void *remote); /*! * \brief Reset the SDP state and stream capabilities as if the SDP state had just been allocated. * + * \param sdp_state + * \param remote The implementation's representation of an SDP. + * + * \retval 0 Success + * + * \note * This is most useful for when a channel driver is sending a session refresh message * and needs to re-advertise its initial capabilities instead of the previously-negotiated * joint capabilities. + * + * \since 15 */ int ast_sdp_state_reset(struct ast_sdp_state *sdp_state); |