Crate hep[−][src]
Expand description
hep
use HEP3 Network Protocol Specification
HEP3 (Homer Encapsulation Protocol Version 3) transmits packets over UDP/TCP/SCTP connections.
Supprot HEPv1 HEPv2 HEP v3.
HEPv2 Just Support IPv4
author: MROJECT(ZhangLianJun z0413@outlook.com)
Examples
use hep::{Chunk,CapProtoType,parse_packet}; use std::net::UdpSocket; fn main() -> std::io::Result<()> { let socket = UdpSocket::bind("169.254.165.11:9060").expect("couldn't bind to address"); loop { let mut buffer = [0x0; 0xdbba0]; let (number_of_bytes, src_addr) = socket.recv_from(&mut buffer).expect("Didn't receive data"); let filled_buf = &mut buffer[..number_of_bytes]; let data = hep::parse_packet(&filled_buf); match data { Ok(chunk) => { println!("Message length:{}", &chunk.packet_payload.len()); if chunk.packet_payload.len() > 6 { println!( "Received Hep(sip) Message from IP:{}, CaptureId:{}\n{}", src_addr, chunk.capture_agent_id, chunk.packet_payload ); } else { println!( "Received Hep(Keepalive) Message from IP:{}, CaptureId:{}.\n", src_addr, chunk.capture_agent_id ); } } Err(_) => { println!( "Received Hep Message from IP:{}\n ignore data.\r\n\r\n", src_addr ); } } } }
Structs
Chunk | Chunk types with chunk vendor ID 0x0000 are called generic chunk types. The following |
Enums
CapProtoType | Hep Capture Protocol Type |
HepVersion | Hep Version enum |
Vendor | Vendor Id enum |
Functions
parse_packet | Entry Function |