use crate::{security::{framer::{ISecureFramer, NullFramer}, mechanism::ProcessTokenAction}, Metadata, ZmqError};
use super::{IDataCipher, Mechanism, MechanismStatus, cipher::PassThroughDataCipher};
#[derive(Debug)]
pub struct NullMechanism;
impl NullMechanism {
pub const NAME_BYTES: &'static [u8; 20] = b"NULL\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; pub const NAME: &'static str = "NULL";
}
impl Mechanism for NullMechanism {
fn name(&self) -> &'static str {
Self::NAME
}
fn process_token(&mut self, _token: &[u8]) -> Result<ProcessTokenAction, ZmqError> {
Ok(ProcessTokenAction::HandshakeComplete)
}
fn produce_token(&mut self) -> Result<Option<Vec<u8>>, ZmqError> {
Ok(None)
}
fn status(&self) -> MechanismStatus {
MechanismStatus::Ready
} fn peer_identity(&self) -> Option<Vec<u8>> {
None
}
fn metadata(&self) -> Option<Metadata> {
None
}
fn as_any(&self) -> &dyn std::any::Any {
self
}
fn set_error(&mut self, _reason: String) {
}
fn error_reason(&self) -> Option<&str> {
None }
fn zap_request_needed(&mut self) -> Option<Vec<Vec<u8>>> {
None
}
fn process_zap_reply(&mut self, _reply_frames: &[Vec<u8>]) -> Result<(), ZmqError> {
Ok(())
}
fn into_framer(self: Box<Self>) -> Result<(Box<dyn ISecureFramer>, Option<Vec<u8>>), ZmqError> {
Ok((Box::new(NullFramer::new()), None))
}
}