Commit dbafd143 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

clear warning and unused;

parent 35dbe4ad
......@@ -92,6 +92,7 @@ where
fn echo_request_handler(&self, xid: u32, echo: EchoRequestEvent, stream: &mut TcpStream) {
self.send_msg(EchoReplyEvent::new(echo.payload), xid, stream);
}
#[allow(unused)]
fn switch_features_handler(
&self,
xid: u32,
......
use crate::{etherparser::MacAddr, openflow::ofp13::PseudoPort};
use byteorder::{BigEndian, WriteBytesExt};
use std::net::{Ipv4Addr, Ipv6Addr};
use std::{
io::Error,
net::{Ipv4Addr, Ipv6Addr},
};
use super::flow_mod::{
instructions::InstructActions,
......@@ -31,8 +34,9 @@ enum ActionType {
}
impl ActionType {
pub fn marshal(&self, bytes: &mut Vec<u8>) {
bytes.write_u16::<BigEndian>(self.clone().into());
pub fn marshal(&self, bytes: &mut Vec<u8>) -> Result<(), Error> {
bytes.write_u16::<BigEndian>(self.clone().into())?;
Ok(())
}
}
......@@ -42,6 +46,7 @@ impl From<ActionType> for u16 {
}
}
#[allow(unused)]
#[derive(Clone)]
#[repr(u16)]
enum ControllerMaxLen {
......@@ -55,31 +60,6 @@ impl From<ControllerMaxLen> for u16 {
}
}
struct ActionOutput {
typ: ActionType, // u16
port: PseudoPort, // u32
max_len: ControllerMaxLen,
}
impl ActionOutput {
pub const LEN: usize = 16;
pub fn marshal(&self, bytes: &mut Vec<u8>) {
self.typ.marshal(bytes);
self.port.marshal(bytes);
bytes.write_u16::<BigEndian>(self.max_len.clone().into());
// write padding 48 bytes [32 + 16]
bytes.write_u32::<BigEndian>(0);
bytes.write_u16::<BigEndian>(0);
}
pub fn new(port: PseudoPort, max_len: ControllerMaxLen) -> Self {
Self {
typ: ActionType::Output,
port,
max_len,
}
}
}
#[derive(Clone)]
pub enum SetField {
InPort(PseudoPort), // Ingress port. This may be a physical or switch-defined logical port.
......@@ -98,67 +78,68 @@ pub enum SetField {
}
impl SetField {
pub fn marshal(&self, bytes: &mut Vec<u8>) {
pub fn marshal(&self, bytes: &mut Vec<u8>) -> Result<(), Error> {
match &self {
SetField::InPort(port) => {
OxmHeader::new(OxmMatchFields::InPort, 4, false).marshal(bytes);
OxmHeader::new(OxmMatchFields::InPort, 4, false).marshal(bytes)?;
port.marshal(bytes);
}
SetField::EthDst(mac) => {
OxmHeader::new(OxmMatchFields::EthDst, 12, true).marshal(bytes);
OxmHeader::new(OxmMatchFields::EthDst, 12, true).marshal(bytes)?;
mac.marshal(bytes);
MacAddr::from(!0).marshal(bytes);
}
SetField::EthSrc(mac) => {
OxmHeader::new(OxmMatchFields::EthSrc, 12, true).marshal(bytes);
OxmHeader::new(OxmMatchFields::EthSrc, 12, true).marshal(bytes)?;
mac.marshal(bytes);
MacAddr::from(!0).marshal(bytes);
}
SetField::EthTyp(eth) => {
OxmHeader::new(OxmMatchFields::EthType, 2, false).marshal(bytes);
bytes.write_u16::<BigEndian>(*eth);
OxmHeader::new(OxmMatchFields::EthType, 2, false).marshal(bytes)?;
bytes.write_u16::<BigEndian>(*eth)?;
}
SetField::IpProto(proto) => {
OxmHeader::new(OxmMatchFields::IpProto, 1, false).marshal(bytes);
bytes.write_u8(*proto);
OxmHeader::new(OxmMatchFields::IpProto, 1, false).marshal(bytes)?;
bytes.write_u8(*proto)?;
}
SetField::Ipv4Src(ipv4) => {
OxmHeader::new(OxmMatchFields::Ipv4Src, 8, true).marshal(bytes);
bytes.write_u32::<BigEndian>(ipv4.clone().into());
bytes.write_u32::<BigEndian>(!0);
OxmHeader::new(OxmMatchFields::Ipv4Src, 8, true).marshal(bytes)?;
bytes.write_u32::<BigEndian>(ipv4.clone().into())?;
bytes.write_u32::<BigEndian>(!0)?;
}
SetField::Ipv4Dst(ipv4) => {
OxmHeader::new(OxmMatchFields::Ipv4Dst, 8, true).marshal(bytes);
bytes.write_u32::<BigEndian>(ipv4.clone().into());
bytes.write_u32::<BigEndian>(!0);
OxmHeader::new(OxmMatchFields::Ipv4Dst, 8, true).marshal(bytes)?;
bytes.write_u32::<BigEndian>(ipv4.clone().into())?;
bytes.write_u32::<BigEndian>(!0)?;
}
SetField::Ipv6Src(ipv6) => {
OxmHeader::new(OxmMatchFields::Ipv6Src, 32, true).marshal(bytes);
bytes.write_u128::<BigEndian>(ipv6.clone().into());
bytes.write_u128::<BigEndian>(!0);
OxmHeader::new(OxmMatchFields::Ipv6Src, 32, true).marshal(bytes)?;
bytes.write_u128::<BigEndian>(ipv6.clone().into())?;
bytes.write_u128::<BigEndian>(!0)?;
}
SetField::Ipv6Dst(ipv6) => {
OxmHeader::new(OxmMatchFields::Ipv6Dst, 32, true).marshal(bytes);
bytes.write_u128::<BigEndian>(ipv6.clone().into());
bytes.write_u128::<BigEndian>(!0);
OxmHeader::new(OxmMatchFields::Ipv6Dst, 32, true).marshal(bytes)?;
bytes.write_u128::<BigEndian>(ipv6.clone().into())?;
bytes.write_u128::<BigEndian>(!0)?;
}
SetField::TcpSrc(tcp) => {
OxmHeader::new(OxmMatchFields::TcpSrc, 2, false).marshal(bytes);
bytes.write_u16::<BigEndian>(*tcp);
OxmHeader::new(OxmMatchFields::TcpSrc, 2, false).marshal(bytes)?;
bytes.write_u16::<BigEndian>(*tcp)?;
}
SetField::TcpDst(tcp) => {
OxmHeader::new(OxmMatchFields::TcpDst, 2, false).marshal(bytes);
bytes.write_u16::<BigEndian>(*tcp);
OxmHeader::new(OxmMatchFields::TcpDst, 2, false).marshal(bytes)?;
bytes.write_u16::<BigEndian>(*tcp)?;
}
SetField::UdpSrc(udp) => {
OxmHeader::new(OxmMatchFields::UdpSrc, 2, false).marshal(bytes);
bytes.write_u16::<BigEndian>(*udp);
OxmHeader::new(OxmMatchFields::UdpSrc, 2, false).marshal(bytes)?;
bytes.write_u16::<BigEndian>(*udp)?;
}
SetField::UdpDst(udp) => {
OxmHeader::new(OxmMatchFields::UdpDst, 2, false).marshal(bytes);
bytes.write_u16::<BigEndian>(*udp);
OxmHeader::new(OxmMatchFields::UdpDst, 2, false).marshal(bytes)?;
bytes.write_u16::<BigEndian>(*udp)?;
}
}
Ok(())
}
}
......@@ -189,7 +170,7 @@ pub enum Action {
}
impl Action {
pub fn action_type(&self) -> ActionType {
fn action_type(&self) -> ActionType {
match &self {
Action::Oputput(_) => ActionType::Output,
Action::CopyTtlOut => ActionType::CopyTtlOut,
......@@ -210,78 +191,79 @@ impl Action {
Action::Experimenter(_) => ActionType::Experimenter,
}
}
pub fn marshal(&self, bytes: &mut Vec<u8>) {
pub fn marshal(&self, bytes: &mut Vec<u8>) -> Result<(), Error> {
match &self {
Action::Oputput(port) => {
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(16); // len
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(16)?; // len
port.marshal(bytes);
bytes.write_u16::<BigEndian>(ControllerMaxLen::NoBuffer.into());
bytes.write_u16::<BigEndian>(ControllerMaxLen::NoBuffer.into())?;
// padding 48bit
bytes.write_u32::<BigEndian>(0);
bytes.write_u16::<BigEndian>(0);
bytes.write_u32::<BigEndian>(0)?;
bytes.write_u16::<BigEndian>(0)?;
}
Action::SetMplsTtl(mpls_ttl) => {
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(8);
bytes.write_u8(*mpls_ttl);
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(8)?;
bytes.write_u8(*mpls_ttl)?;
// padding 24bit
bytes.write_u16::<BigEndian>(0);
bytes.write_u8(0);
bytes.write_u16::<BigEndian>(0)?;
bytes.write_u8(0)?;
}
Action::PushVlan(ethertype)
| Action::PushMpls(ethertype)
| Action::PushPbb(ethertype) => {
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(8);
bytes.write_u16::<BigEndian>(*ethertype);
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(8)?;
bytes.write_u16::<BigEndian>(*ethertype)?;
// padding 16 bit
bytes.write_u16::<BigEndian>(0);
bytes.write_u16::<BigEndian>(0)?;
}
Action::PopVlan(ethertype) | Action::PopMpls(ethertype) | Action::PopPbb(ethertype) => {
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(8);
bytes.write_u16::<BigEndian>(*ethertype);
bytes.write_u16::<BigEndian>(0);
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(8)?;
bytes.write_u16::<BigEndian>(*ethertype)?;
bytes.write_u16::<BigEndian>(0)?;
}
Action::SetQueue(queue_id) => {
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(8);
bytes.write_u32::<BigEndian>(*queue_id);
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(8)?;
bytes.write_u32::<BigEndian>(*queue_id)?;
}
Action::Group(group_id) => {
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(8);
bytes.write_u32::<BigEndian>(*group_id);
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(8)?;
bytes.write_u32::<BigEndian>(*group_id)?;
}
Action::SetNwTtl(nw_ttl) => {
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(8);
bytes.write_u8(*nw_ttl);
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(8)?;
bytes.write_u8(*nw_ttl)?;
// padding 24bit
bytes.write_u16::<BigEndian>(0);
bytes.write_u8(0);
bytes.write_u16::<BigEndian>(0)?;
bytes.write_u8(0)?;
}
Action::SetField(omx_field) => {
let mut field_bytes: Vec<u8> = Vec::new();
omx_field.marshal(&mut field_bytes);
omx_field.marshal(&mut field_bytes)?;
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(4 + field_bytes.len() as u16);
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(4 + field_bytes.len() as u16)?;
bytes.append(&mut field_bytes);
}
Action::Experimenter(exper_id) => {
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(8);
bytes.write_u32::<BigEndian>(*exper_id);
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(8)?;
bytes.write_u32::<BigEndian>(*exper_id)?;
}
Action::DecMplsTtl | Action::DecNwTtl | Action::CopyTtlOut | Action::CopyTtlIn => {
self.action_type().marshal(bytes);
bytes.write_u16::<BigEndian>(8);
self.action_type().marshal(bytes)?;
bytes.write_u16::<BigEndian>(8)?;
// padding 32 bit
bytes.write_u32::<BigEndian>(0);
bytes.write_u32::<BigEndian>(0)?;
}
}
Ok(())
}
// TODO
......
......@@ -366,10 +366,3 @@ impl TableFeaturesFailed {
}
}
}
#[derive(Debug)]
pub struct ErrorExperimenter {
typ: u16,
exp_typ: u16,
experimenter: u32,
}
......@@ -113,8 +113,8 @@ impl MessageMarshal for FlowModEvent {
self.flags.marshal(bytes);
// padding
bytes.write_u16::<BigEndian>(0);
self.match_fields.marshal(bytes);
let _ = bytes.write_u16::<BigEndian>(0);
let _ = self.match_fields.marshal(bytes);
self.instruction.marshal(bytes);
}
}
......@@ -20,7 +20,7 @@ pub enum InstructType {
impl InstructType {
pub fn marshal(&self, bytes: &mut Vec<u8>) {
bytes.write_u16::<BigEndian>(self.clone().into());
let _ = bytes.write_u16::<BigEndian>(self.clone().into());
}
}
......@@ -49,11 +49,11 @@ impl GotoTable {
impl InstructTrait for GotoTable {
fn marshal(&self, bytes: &mut Vec<u8>) {
self.typ.marshal(bytes);
bytes.write_u16::<BigEndian>(self.len);
bytes.write_u8(self.table_id);
let _ = bytes.write_u16::<BigEndian>(self.len);
let _ = bytes.write_u8(self.table_id);
// padding
bytes.write_u16::<BigEndian>(0);
bytes.write_u8(0);
let _ = bytes.write_u16::<BigEndian>(0);
let _ = bytes.write_u8(0);
}
}
......@@ -78,12 +78,12 @@ impl WriteMetadata {
impl InstructTrait for WriteMetadata {
fn marshal(&self, bytes: &mut Vec<u8>) {
self.typ.marshal(bytes);
bytes.write_u16::<BigEndian>(self.len);
let _ = bytes.write_u16::<BigEndian>(self.len);
// padding
bytes.write_u32::<BigEndian>(0);
let _ = bytes.write_u32::<BigEndian>(0);
// *******
bytes.write_u64::<BigEndian>(self.metadata);
bytes.write_u64::<BigEndian>(self.meta_mask);
let _ = bytes.write_u64::<BigEndian>(self.metadata);
let _ = bytes.write_u64::<BigEndian>(self.meta_mask);
}
}
......@@ -110,12 +110,12 @@ impl InstructTrait for InstructActions {
fn marshal(&self, bytes: &mut Vec<u8>) {
let mut builder = Vec::new();
for act in self.actions.iter() {
act.marshal(&mut builder);
let _ = act.marshal(&mut builder);
}
self.typ.marshal(bytes);
bytes.write_u16::<BigEndian>(self.len + (builder.len() as u16));
let _ = bytes.write_u16::<BigEndian>(self.len + (builder.len() as u16));
// padding
bytes.write_u32::<BigEndian>(0);
let _ = bytes.write_u32::<BigEndian>(0);
bytes.append(&mut builder);
}
}
......@@ -139,8 +139,8 @@ impl InstructMeter {
impl InstructTrait for InstructMeter {
fn marshal(&self, bytes: &mut Vec<u8>) {
self.typ.marshal(bytes);
bytes.write_u16::<BigEndian>(self.len);
bytes.write_u32::<BigEndian>(self.meter_id);
let _ = bytes.write_u16::<BigEndian>(self.len);
let _ = bytes.write_u32::<BigEndian>(self.meter_id);
}
}
......
......@@ -30,11 +30,13 @@ impl OfpMatch {
oxm_fields: Vec::new(),
}
}
pub fn marshal(&self, bytes: &mut Vec<u8>) {
bytes.write_u16::<BigEndian>(self.typ.clone().into());
bytes.write_u16::<BigEndian>(self.length + (self.oxm_fields.len() as u16));
pub fn marshal(&self, bytes: &mut Vec<u8>) -> Result<(), Error> {
bytes.write_u16::<BigEndian>(self.typ.clone().into())?;
bytes.write_u16::<BigEndian>(self.length + (self.oxm_fields.len() as u16))?;
bytes.append(&mut self.oxm_fields.clone());
bytes.write_u32::<BigEndian>(0);
// padding
bytes.write_u32::<BigEndian>(0)?;
Ok(())
}
}
......@@ -73,6 +75,7 @@ impl From<MatchType> for u16 {
*
*/
#[allow(unused)]
pub struct OxmHeader {
class: OxmClass, // Match class: member class or reserved class
field: OxmMatchFields, // 7bit Match field within the class
......@@ -91,14 +94,15 @@ impl OxmHeader {
experimenter: None,
}
}
pub fn marshal(&self, bytes: &mut Vec<u8>) {
bytes.write_u16::<BigEndian>(self.class.clone().into());
pub fn marshal(&self, bytes: &mut Vec<u8>) -> Result<(), Error> {
bytes.write_u16::<BigEndian>(self.class.clone().into())?;
let field: u8 = self.field.clone().into();
bytes.write_u8(field << 1 | if self.hasmask { 1 } else { 0 });
bytes.write_u8(self.length);
bytes.write_u8(field << 1 | if self.hasmask { 1 } else { 0 })?;
bytes.write_u8(self.length)?;
// if let Some(exp) = self.experimenter {
// bytes.write_u32::<BigEndian>(exp);
// }
Ok(())
}
}
......@@ -221,84 +225,85 @@ impl MatchFields {
udp_dst: None,
}
}
pub fn marshal(&self, bytes: &mut Vec<u8>) {
pub fn marshal(&self, bytes: &mut Vec<u8>) -> Result<(), Error>{
let mut ofp_match = OfpMatch::new();
let ofp_byte = ofp_match.oxm_fields.as_mut();
if let Some(in_port) = &self.in_port {
let header = OxmHeader::new(OxmMatchFields::InPort, 4, false);
header.marshal(ofp_byte);
ofp_byte.write_u32::<BigEndian>(*in_port);
header.marshal(ofp_byte)?;
ofp_byte.write_u32::<BigEndian>(*in_port)?;
}
if let Some(eth_dst) = &self.eth_dst {
let header = OxmHeader::new(OxmMatchFields::EthDst, 12, true);
header.marshal(ofp_byte);
header.marshal(ofp_byte)?;
eth_dst.marshal(ofp_byte);
// mac mask
MacAddr::from(!0).marshal(ofp_byte);
}
if let Some(eth_src) = &self.eth_src {
let header = OxmHeader::new(OxmMatchFields::EthSrc, 12, true);
header.marshal(ofp_byte);
header.marshal(ofp_byte)?;
eth_src.marshal(ofp_byte);
// mac mask
MacAddr::from(!0).marshal(ofp_byte);
}
if let Some(eth_typ) = &self.eth_typ {
OxmHeader::new(OxmMatchFields::EthType, 2, false).marshal(ofp_byte);
ofp_byte.write_u16::<BigEndian>(*eth_typ);
OxmHeader::new(OxmMatchFields::EthType, 2, false).marshal(ofp_byte)?;
ofp_byte.write_u16::<BigEndian>(*eth_typ)?;
}
if let Some(ip_proto) = &self.ip_proto {
OxmHeader::new(OxmMatchFields::IpProto, 1, false).marshal(ofp_byte);
ofp_byte.write_u8(*ip_proto);
OxmHeader::new(OxmMatchFields::IpProto, 1, false).marshal(ofp_byte)?;
ofp_byte.write_u8(*ip_proto)?;
}
if let Some(ipv4_src) = &self.ipv4_src {
OxmHeader::new(OxmMatchFields::Ipv4Src, 8, true).marshal(ofp_byte);
bytes.write_u32::<BigEndian>(ipv4_src.clone().into());
bytes.write_u32::<BigEndian>(!0);
OxmHeader::new(OxmMatchFields::Ipv4Src, 8, true).marshal(ofp_byte)?;
bytes.write_u32::<BigEndian>(ipv4_src.clone().into())?;
bytes.write_u32::<BigEndian>(!0)?;
}
if let Some(ipv4_dst) = &self.ipv4_dst {
OxmHeader::new(OxmMatchFields::Ipv4Dst, 8, true).marshal(ofp_byte);
bytes.write_u32::<BigEndian>(ipv4_dst.clone().into());
bytes.write_u32::<BigEndian>(!0);
OxmHeader::new(OxmMatchFields::Ipv4Dst, 8, true).marshal(ofp_byte)?;
bytes.write_u32::<BigEndian>(ipv4_dst.clone().into())?;
bytes.write_u32::<BigEndian>(!0)?;
}
if let Some(ipv6_src) = &self.ipv6_src {
OxmHeader::new(OxmMatchFields::Ipv6Src, 32, true).marshal(ofp_byte);
ofp_byte.write_u128::<BigEndian>(ipv6_src.clone().into());
ofp_byte.write_u128::<BigEndian>(!0);
OxmHeader::new(OxmMatchFields::Ipv6Src, 32, true).marshal(ofp_byte)?;
ofp_byte.write_u128::<BigEndian>(ipv6_src.clone().into())?;
ofp_byte.write_u128::<BigEndian>(!0)?;
}
if let Some(ipv6_dst) = &self.ipv6_dst {
OxmHeader::new(OxmMatchFields::Ipv6Dst, 32, true).marshal(ofp_byte);
ofp_byte.write_u128::<BigEndian>(ipv6_dst.clone().into());
ofp_byte.write_u128::<BigEndian>(!0);
OxmHeader::new(OxmMatchFields::Ipv6Dst, 32, true).marshal(ofp_byte)?;
ofp_byte.write_u128::<BigEndian>(ipv6_dst.clone().into())?;
ofp_byte.write_u128::<BigEndian>(!0)?;
}
if let Some(tcp_src) = &self.tcp_src {
OxmHeader::new(OxmMatchFields::TcpSrc, 2, false);
ofp_byte.write_u16::<BigEndian>(*tcp_src);
ofp_byte.write_u16::<BigEndian>(*tcp_src)?;
}
if let Some(tcp_dst) = &self.tcp_dst {
OxmHeader::new(OxmMatchFields::TcpDst, 2, false);
ofp_byte.write_u16::<BigEndian>(*tcp_dst);
ofp_byte.write_u16::<BigEndian>(*tcp_dst)?;
}
if let Some(udp_src) = &self.udp_src {
OxmHeader::new(OxmMatchFields::UdpSrc, 2, false);
ofp_byte.write_u16::<BigEndian>(*udp_src);
ofp_byte.write_u16::<BigEndian>(*udp_src)?;
}
if let Some(udp_dst) = &self.udp_dst {
OxmHeader::new(OxmMatchFields::UdpDst, 2, false);
ofp_byte.write_u16::<BigEndian>(*udp_dst);
ofp_byte.write_u16::<BigEndian>(*udp_dst)?;
}
ofp_match.marshal(bytes);
ofp_match.marshal(bytes)?;
Ok(())
}
pub fn parse(bytes: &mut Cursor<Vec<u8>>) -> Result<MatchFields, Error> {
let mut matcher = MatchFields::match_all();
let typ: MatchType = bytes.read_u16::<BigEndian>()?.into();
let _typ: MatchType = bytes.read_u16::<BigEndian>()?.into();
let length = bytes.read_u16::<BigEndian>()?;
let mut pkt_len = length - 4;
while pkt_len > 0 {
let oxm_class = bytes.read_u16::<BigEndian>()?;
let _oxm_class = bytes.read_u16::<BigEndian>()?;
let oxm_field = bytes.read_u8()?;
let hash_mask = oxm_field & 1 == 1;
let oxm_field: OxmMatchFields = (oxm_field >> 1).into();
......@@ -306,7 +311,7 @@ impl MatchFields {
match oxm_field {
OxmMatchFields::InPort => {
let port = bytes.read_u32::<BigEndian>()?;
let mask = if hash_mask {
let _mask = if hash_mask {
Some(bytes.read_u32::<BigEndian>())
} else {
None
......
......@@ -29,12 +29,12 @@ impl MessageMarshal for PacketOutEvent {
}
let mut action_byte: Vec<u8> = Vec::new();
for act in self.actions.iter() {
act.marshal(&mut action_byte);
let _ = act.marshal(&mut action_byte);
}
let _ = bytes.write_u16::<BigEndian>(action_byte.len() as u16);
// padding 48 bit
bytes.write_u32::<BigEndian>(0);
bytes.write_u16::<BigEndian>(0);
let _ = bytes.write_u32::<BigEndian>(0);
let _ = bytes.write_u16::<BigEndian>(0);
bytes.append(&mut action_byte);
self.payload.marshal(bytes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment