diff --git a/runtime/src/moninj.rs b/runtime/src/moninj.rs index 6f539a9e..3802e7aa 100644 --- a/runtime/src/moninj.rs +++ b/runtime/src/moninj.rs @@ -59,6 +59,27 @@ async fn handle_connection(stream: &TcpStream) -> Result<()> { let message: HostMessage = FromPrimitive::from_i8(read_i8(&stream).await?) .ok_or(Error::UnrecognizedPacket)?; info!("{:?}", message); + match message { + HostMessage::MonitorProbe => { + let enable = read_bool(&stream).await?; + let channel = read_i32(&stream).await?; + let probe = read_i8(&stream).await?; + }, + HostMessage::Inject => { + let channel = read_i32(&stream).await?; + let overrd = read_i8(&stream).await?; + let value = read_i8(&stream).await?; + }, + HostMessage::GetInjectionStatus => { + let channel = read_i32(&stream).await?; + let overrd = read_i8(&stream).await?; + }, + HostMessage::MonitorInjection => { + let enable = read_bool(&stream).await?; + let channel = read_i32(&stream).await?; + let overrd = read_i8(&stream).await?; + }, + } } } diff --git a/runtime/src/proto.rs b/runtime/src/proto.rs index 30525051..f01dca2e 100644 --- a/runtime/src/proto.rs +++ b/runtime/src/proto.rs @@ -22,6 +22,12 @@ pub async fn expect(stream: &TcpStream, pattern: &[u8]) -> Result { }).await? } +pub async fn read_bool(stream: &TcpStream) -> Result { + Ok(stream.recv(|buf| { + Poll::Ready((1, buf[0] != 0)) + }).await?) +} + pub async fn read_i8(stream: &TcpStream) -> Result { Ok(stream.recv(|buf| { Poll::Ready((1, buf[0] as i8))