gstreamer-rs/gstreamer-rtsp/src/rtsp_auth_param.rs
olivierbabasse 60e8c44abb rtsp server: allow custom authentication
Enables subclassing gst_rtsp_server::RTSPAuth and overriding its
authenticate/check/generate_authenticate_header methods

Also add new methods in RTSPContext to retrieve RTSP request/response, and to
get/replace tokens.

Additionally, added RTSPMessage with methods to add an authentication
header to a request / retrieve authentication parameters from a
response.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1359>
2023-12-22 12:12:17 +02:00

26 lines
654 B
Rust

use glib::translate::*;
impl RTSPAuthParam {
pub fn name(&self) -> Option<&str> {
let ptr: *mut GstRTSPAuthParam = self.to_glib_none().0;
unsafe {
if (*ptr).name.is_null() {
None
} else {
std::ffi::CStr::from_ptr((*ptr).name).to_str().ok()
}
}
}
pub fn value(&self) -> Option<&str> {
let ptr: *mut GstRTSPAuthParam = self.to_glib_none().0;
unsafe {
if (*ptr).value.is_null() {
None
} else {
std::ffi::CStr::from_ptr((*ptr).value).to_str().ok()
}
}
}
}