15#include <circle/device.h>
16#include <circle/net/ipaddress.h>
17#include <circle/net/netsubsystem.h>
18#include <circle/net/socket.h>
19#include <circle/sched/task.h>
20#include <circle/spinlock.h>
21#include <circle/string.h>
22#include <circle/types.h>
60 CWPASupplicant &supplicant,
78 void Send(
const char *buffer,
size_t length);
87 int Write(
const void *buffer,
size_t count)
override;
102 TelnetStateSubnegotiation,
103 TelnetStateSubnegotiationIAC
107 bool EnsureListenSocket();
111 void CloseClient(
const char *reason,
bool sendLocked =
false);
113 void HandleIncomingData();
115 void HandleIncomingByte(u8
byte);
117 void HandleCommandChar(
char ch);
119 bool HandleTelnetByte(u8
byte);
121 void SendTelnetCommand(u8 verb, u8 option);
123 void SendTelnetNegotiation();
125 void AnnounceConnection(
const CIPAddress &remoteIP, u16 remotePort);
127 void ResetConnectionState();
132 CBcm4343Device *m_pWlan;
133 CNetSubSystem *m_pNet;
135 CWPASupplicant *m_pSupplicant;
136 CDevice *m_pFallback;
139 CSocket *m_pListenSocket;
140 CSocket *m_pClientSocket;
144 bool m_StopRequested;
145 bool m_LoggerAttached;
146 bool m_RemoteLoggingActive;
147 bool m_HostModeActive;
148 bool m_CommandPromptVisible;
150 bool m_CloseRequested;
152 bool m_TelnetNegotiated;
153 ETelnetRxState m_TelnetRxState;
156 CString m_RxLineBuffer;
157 mutable CSpinLock m_ConnectionLock;
158 mutable CSpinLock m_SendLock;
Network logging endpoint streaming log traffic to remote clients.
Definition TWlanLog.h:47
bool IsHostModeActive() const
Check whether active session is in TCP host bridge mode.
Definition TWlanLog.cpp:245
bool Initialize(CBcm4343Device &wlan, CNetSubSystem &net, CWPASupplicant &supplicant, CLogger &logger, unsigned port, CDevice *fallback)
Initialize sockets, WLAN hardware access and logger integration.
Definition TWlanLog.cpp:121
virtual void ProcessLine(const char *line)
Hook for processing complete log lines before transmit.
Definition TWlanLog.cpp:576
static CTWlanLog * Get()
Access the singleton WLAN log device.
Definition TWlanLog.cpp:68
~CTWlanLog() override
Ensure graceful shutdown of sockets.
Definition TWlanLog.cpp:108
CTWlanLog()
Construct the WLAN logging task.
Definition TWlanLog.cpp:77
bool SendHostData(const char *buffer, size_t length)
Send host-bound data when host bridge mode is active.
Definition TWlanLog.cpp:287
bool Start()
Start accepting clients and attach to the logger.
Definition TWlanLog.cpp:197
void Run() override
Scheduler entry point handling socket activity.
Definition TWlanLog.cpp:403
void Stop()
Stop serving remote clients and detach from logger.
Definition TWlanLog.cpp:224
void SendCommandPrompt()
Send the command-mode prompt to the active client.
Definition TWlanLog.cpp:316
void SendLine(const char *line)
Send a newline-terminated string to the client.
Definition TWlanLog.cpp:303
int Write(const void *buffer, size_t count) override
Write intercepted log output to the remote client and fallback.
Definition TWlanLog.cpp:323
bool IsClientConnected() const
Check whether a remote client is currently connected.
Definition TWlanLog.cpp:237
void SetFallback(CDevice *fallback)
Change the fallback logging device for pass-through output.
Definition TWlanLog.cpp:192
void Send(const char *buffer, size_t length)
Send raw data to the active client if present.
Definition TWlanLog.cpp:250