// // Procesing thread for incoming packets from the TNC. The TNC places a buffer // containing the incoming data into the channel's receive queue. This routine pulls // these frames from the queue for processing. // // Processing steps: // - Parse the raw incoming frame into an HDLC buffer. This process // removes the byte stuffing and verifies the packet CRC. // - Find the Data Link Provider handling incoming data for the Station ID // specified in the incoming address field of the packet. If no matching // dlp is registered, then we simply drop the packet. (Future: we add in support // for multi-cast packets, which will forward to all registered DLPs) // - Place the frame, source, and buffer type into a packet object and place it into the // receive queue of the target DLP. // void RecvFromPort() { Byte[] buf; while (runState.Equals(RunState.Running)) { try { buf = channel.Recv(); } catch { continue; } if (buf == null) { continue; } // // Parse raw buffer // AX25Frame.ParsedFrame pFrame = new AX25Frame.ParsedFrame(HDLCFramer.ParseHDLCFrame(buf)); AX25Frame.Packet pkt = new AX25Frame.Packet( AX25Frame.Packet.PacketType.ParsedFrame, AX25Frame.Packet.Source.Remote, pFrame); // // Look for the DLP handling this packet destination // DataLinkProvider dlp = GetProvider(pFrame.frameInfo.staLink.destinationAddr.stationIDString); if (dlp == null) { // // Ignore the packet and Loop if we cannot find a provider for the incoming frame // TODO - Add support for multi-cast // continue; } // // Send up to the data link provider handling the specified StationID // dlp.dataLinkProviderQ.Enqueue(pkt); } }
public static void Run() { try { if (ObjectManager.Instance.IsIngame && CurrentState.Equals(RunState.Running)) { stateMachine.DoWork(); } } catch (ThreadAbortException) { } catch (Exception e) { Logger.Log("Doh exception in the botting function: " + e); } }