@@ -58,8 +58,8 @@ extern "C" {
5858 * the API was extracted to allow downstreams to override its
5959 * implementation by defining the `SRTP_NO_STREAM_LIST` preprocessor
6060 * directive, which removes the default implementation of these
61- * functions. if this is done, the `next` field is free for the
62- * implementation to use.
61+ * functions. if this is done, the `next` & `prev` fields are free for
62+ * the implementation to use.
6363 *
6464 * this is still an internal interface; there is no stability
6565 * guarantee--downstreams should watch this file for changes in
@@ -69,7 +69,14 @@ extern "C" {
6969/**
7070 * allocate and initialize a stream list instance
7171 */
72- srtp_err_status_t srtp_stream_list_create (srtp_stream_list_t * list );
72+ srtp_err_status_t srtp_stream_list_alloc (srtp_stream_list_t * list_ptr );
73+
74+ /**
75+ * deallocate a stream list instance
76+ *
77+ * the list must be empty or else an error is returned.
78+ */
79+ srtp_err_status_t srtp_stream_list_dealloc (srtp_stream_list_t list );
7380
7481/**
7582 * insert a stream into the list
@@ -82,38 +89,33 @@ srtp_err_status_t srtp_stream_list_create(srtp_stream_list_t *list);
8289 * behavior is undefined. if the SSRC field is mutated while the
8390 * stream is inserted, further operations have undefined behavior
8491 */
85- srtp_err_status_t srtp_stream_list_insert (srtp_stream_list_t * list ,
92+ srtp_err_status_t srtp_stream_list_insert (srtp_stream_list_t list ,
8693 srtp_stream_t stream );
8794
8895/*
8996 * look up the stream corresponding to the specified SSRC and return it.
9097 * if no such SSRC is found, NULL is returned.
9198 */
92- srtp_stream_t srtp_stream_list_get (srtp_stream_list_t * list , uint32_t ssrc );
99+ srtp_stream_t srtp_stream_list_get (srtp_stream_list_t list , uint32_t ssrc );
93100
94101/**
95- * delete the stream associated to the specified SSRC .
102+ * remove the stream from the list .
96103 *
97- * if a stream is found and removed, it's returned and ownership is
98- * transferred to the caller. if not found, NULL is returned.
104+ * ownership is transferred to the caller.
105+ *
106+ * if the stream is not in the list the behavior is undefined.
99107 */
100- srtp_stream_t srtp_stream_list_delete (srtp_stream_list_t * list , uint32_t ssrc );
108+ void srtp_stream_list_remove (srtp_stream_list_t list , srtp_stream_t stream );
101109
102110/**
103111 * iterate through all stored streams. while iterating, it is allowed to delete
104112 * the current element; any other mutation to the list is undefined behavior.
105113 * returning non-zero from callback aborts the iteration.
106114 */
107- void srtp_stream_list_for_each (srtp_stream_list_t * list ,
115+ void srtp_stream_list_for_each (srtp_stream_list_t list ,
108116 int (* callback )(srtp_stream_t , void * ),
109117 void * data );
110118
111- /**
112- * deallocate a stream list instance and all streams inserted in it
113- */
114- srtp_err_status_t srtp_stream_list_dealloc (srtp_stream_list_t * list ,
115- srtp_stream_t template_ );
116-
117119#ifdef __cplusplus
118120}
119121#endif
0 commit comments