@@ -58,8 +58,8 @@ extern "C" {
58
58
* the API was extracted to allow downstreams to override its
59
59
* implementation by defining the `SRTP_NO_STREAM_LIST` preprocessor
60
60
* 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.
63
63
*
64
64
* this is still an internal interface; there is no stability
65
65
* guarantee--downstreams should watch this file for changes in
@@ -69,7 +69,14 @@ extern "C" {
69
69
/**
70
70
* allocate and initialize a stream list instance
71
71
*/
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 );
73
80
74
81
/**
75
82
* insert a stream into the list
@@ -82,38 +89,33 @@ srtp_err_status_t srtp_stream_list_create(srtp_stream_list_t *list);
82
89
* behavior is undefined. if the SSRC field is mutated while the
83
90
* stream is inserted, further operations have undefined behavior
84
91
*/
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 ,
86
93
srtp_stream_t stream );
87
94
88
95
/*
89
96
* look up the stream corresponding to the specified SSRC and return it.
90
97
* if no such SSRC is found, NULL is returned.
91
98
*/
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 );
93
100
94
101
/**
95
- * delete the stream associated to the specified SSRC .
102
+ * remove the stream from the list .
96
103
*
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.
99
107
*/
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 );
101
109
102
110
/**
103
111
* iterate through all stored streams. while iterating, it is allowed to delete
104
112
* the current element; any other mutation to the list is undefined behavior.
105
113
* returning non-zero from callback aborts the iteration.
106
114
*/
107
- void srtp_stream_list_for_each (srtp_stream_list_t * list ,
115
+ void srtp_stream_list_for_each (srtp_stream_list_t list ,
108
116
int (* callback )(srtp_stream_t , void * ),
109
117
void * data );
110
118
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
-
117
119
#ifdef __cplusplus
118
120
}
119
121
#endif
0 commit comments