use std::{fmt, io::Cursor};
use crate::error::HaProxRes;
pub mod protocol;
pub mod protocol_parser;
pub mod protocol_composer;
pub mod autogen;
pub trait PP2TlvUniqId: fmt::Display
{
fn into_bytes(&self) -> Vec<u8>;
fn as_slice<'a>(&'a self) -> &'a [u8];
fn get_len(&self) -> u16;
}
pub trait ProxyV2OpCode: fmt::Debug + Clone
{
const OPCODE: u8;
}
pub trait PP2TlvDump: fmt::Debug + fmt::Display
{
fn get_type(&self) -> u8;
fn dump(&self, cur: &mut Cursor<Vec<u8>>) -> HaProxRes<()>;
}
pub trait PP2TlvRestore<'zc>: fmt::Debug + fmt::Display + 'zc
{
type TlvTblRes;
fn is_in_range(tlv_type: u8, tlv_parent_type: Option<u8>) -> bool;
fn contains_subtype(item: &Self::TlvTblRes) -> bool;
fn restore(tlv_type: u8, cur: &mut Cursor<&'zc [u8]>) -> HaProxRes<Self::TlvTblRes>;
}