feat: wi-fi - join WPA2/WPA3-PSK networks and carry traffic like ethernet
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
namespace kcp {
|
||||
class Spinlock {
|
||||
std::atomic_flag f{ATOMIC_FLAG_INIT};
|
||||
public:
|
||||
void Acquire() { while (f.test_and_set(std::memory_order_acquire)) {} }
|
||||
void Release() { f.clear(std::memory_order_release); }
|
||||
};
|
||||
// The kernel's Mutex is the non-interrupt-disabling variant; on the host
|
||||
// there is nothing to disable, so the two are the same here.
|
||||
class Mutex {
|
||||
std::atomic_flag f{ATOMIC_FLAG_INIT};
|
||||
public:
|
||||
void Acquire() { while (f.test_and_set(std::memory_order_acquire)) {} }
|
||||
void Release() { f.clear(std::memory_order_release); }
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
namespace base { struct Manip {}; inline Manip hex, dec; }
|
||||
@@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include <cstring>
|
||||
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
// Only the type name is needed: the MLME never touches PCI.
|
||||
namespace Pci { struct PciDevice { uint8_t Bus, Device, Function; }; }
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdio>
|
||||
#include <cstdint>
|
||||
namespace Kt {
|
||||
enum KernelLogLevel { INFO, OK, WARNING, ERROR };
|
||||
class KernelLogStream {
|
||||
public:
|
||||
KernelLogStream(KernelLogLevel l, const char* c) { fprintf(stderr, " [%s] ", c); (void)l; }
|
||||
~KernelLogStream() { fprintf(stderr, "\n"); }
|
||||
KernelLogStream& operator<<(const char* s) { fprintf(stderr, "%s", s); return *this; }
|
||||
KernelLogStream& operator<<(uint64_t v) { fprintf(stderr, "%llu", (unsigned long long)v); return *this; }
|
||||
KernelLogStream& operator<<(int v) { fprintf(stderr, "%d", v); return *this; }
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
namespace Timekeeping { uint64_t GetMilliseconds(); }
|
||||
Reference in New Issue
Block a user