1 module eventcore.drivers.libasync; 2 3 version (Have_libasync): 4 5 import eventcore.driver; 6 import std.socket : Address; 7 import core.time : Duration; 8 9 10 final class LibasyncEventDriver : EventDriver { 11 @safe: /*@nogc:*/ nothrow: 12 13 private { 14 LibasyncEventDriverCore m_core; 15 LibasyncEventDriverFiles m_files; 16 LibasyncEventDriverSockets m_sockets; 17 LibasyncEventDriverDNS m_dns; 18 LibasyncEventDriverTimers m_timers; 19 LibasyncEventDriverEvents m_events; 20 LibasyncEventDriverSignals m_signals; 21 LibasyncEventDriverWatchers m_watchers; 22 } 23 24 this() 25 { 26 m_core = new LibasyncEventDriverCore(); 27 m_files = new LibasyncEventDriverFiles(); 28 m_sockets = new LibasyncEventDriverSockets(); 29 m_dns = new LibasyncEventDriverDNS(); 30 m_timers = new LibasyncEventDriverTimers(); 31 m_events = new LibasyncEventDriverEvents(); 32 m_signals = new LibasyncEventDriverSignals(); 33 m_watchers = new LibasyncEventDriverWatchers(); 34 } 35 36 override @property LibasyncEventDriverCore core() { return m_core; } 37 override @property LibasyncEventDriverFiles files() { return m_files; } 38 override @property LibasyncEventDriverSockets sockets() { return m_sockets; } 39 override @property LibasyncEventDriverDNS dns() { return m_dns; } 40 override @property LibasyncEventDriverTimers timers() { return m_timers; } 41 override @property LibasyncEventDriverEvents events() { return m_events; } 42 override @property shared(LibasyncEventDriverEvents) events() shared { return m_events; } 43 override @property LibasyncEventDriverSignals signals() { return m_signals; } 44 override @property LibasyncEventDriverWatchers watchers() { return m_watchers; } 45 46 override void dispose() 47 { 48 assert(false, "TODO!"); 49 } 50 } 51 52 final class LibasyncEventDriverCore : EventDriverCore { 53 @safe: /*@nogc:*/ nothrow: 54 override size_t waiterCount() 55 { 56 assert(false, "TODO!"); 57 } 58 59 override ExitReason processEvents(Duration timeout = Duration.max) 60 { 61 assert(false, "TODO!"); 62 } 63 64 override void exit() 65 { 66 assert(false, "TODO!"); 67 } 68 69 override void clearExitFlag() 70 { 71 assert(false, "TODO!"); 72 } 73 74 protected override void* rawUserData(StreamSocketFD descriptor, size_t size, DataInitializer initialize, DataInitializer destroy) @system 75 { 76 assert(false, "TODO!"); 77 } 78 79 protected override void* rawUserData(DatagramSocketFD descriptor, size_t size, DataInitializer initialize, DataInitializer destroy) @system 80 { 81 assert(false, "TODO!"); 82 } 83 } 84 85 final class LibasyncEventDriverSockets : EventDriverSockets { 86 @safe: /*@nogc:*/ nothrow: 87 override StreamSocketFD connectStream(scope Address peer_address, scope Address bind_address, ConnectCallback on_connect) 88 { 89 assert(false, "TODO!"); 90 } 91 92 override void cancelConnectStream(StreamSocketFD sock) 93 { 94 assert(false, "TODO!"); 95 } 96 97 override StreamSocketFD adoptStream(int socket) 98 { 99 assert(false, "TODO!"); 100 } 101 102 alias listenStream = EventDriverSockets.listenStream; 103 override StreamListenSocketFD listenStream(scope Address bind_address, StreamListenOptions options, AcceptCallback on_accept) 104 { 105 assert(false, "TODO!"); 106 } 107 108 override void waitForConnections(StreamListenSocketFD sock, AcceptCallback on_accept) 109 { 110 assert(false, "TODO!"); 111 } 112 113 override ConnectionState getConnectionState(StreamSocketFD sock) 114 { 115 assert(false, "TODO!"); 116 } 117 118 override bool getLocalAddress(SocketFD sock, scope RefAddress dst) 119 { 120 assert(false, "TODO!"); 121 } 122 123 override bool getRemoteAddress(SocketFD sock, scope RefAddress dst) 124 { 125 assert(false, "TODO!"); 126 } 127 128 override void setTCPNoDelay(StreamSocketFD socket, bool enable) 129 { 130 assert(false, "TODO!"); 131 } 132 133 override void setKeepAlive(StreamSocketFD socket, bool enable) 134 { 135 assert(false, "TODO!"); 136 } 137 138 override void read(StreamSocketFD socket, ubyte[] buffer, IOMode mode, IOCallback on_read_finish) 139 { 140 assert(false, "TODO!"); 141 } 142 143 override void write(StreamSocketFD socket, const(ubyte)[] buffer, IOMode mode, IOCallback on_write_finish) 144 { 145 assert(false, "TODO!"); 146 } 147 148 override void waitForData(StreamSocketFD socket, IOCallback on_data_available) 149 { 150 assert(false, "TODO!"); 151 } 152 153 override void shutdown(StreamSocketFD socket, bool shut_read = true, bool shut_write = true) 154 { 155 assert(false, "TODO!"); 156 } 157 158 override void cancelRead(StreamSocketFD socket) 159 { 160 assert(false, "TODO!"); 161 } 162 163 override void cancelWrite(StreamSocketFD socket) 164 { 165 assert(false, "TODO!"); 166 } 167 168 override DatagramSocketFD createDatagramSocket(scope Address bind_address, scope Address target_address) 169 { 170 assert(false, "TODO!"); 171 } 172 173 override DatagramSocketFD adoptDatagramSocket(int socket) 174 { 175 assert(false); 176 } 177 178 override void setTargetAddress(DatagramSocketFD socket, scope Address target_address) 179 { 180 assert(false); 181 } 182 183 override bool setBroadcast(DatagramSocketFD socket, bool enable) 184 { 185 assert(false, "TODO!"); 186 } 187 188 override void receive(DatagramSocketFD socket, ubyte[] buffer, IOMode mode, DatagramIOCallback on_receive_finish) 189 { 190 assert(false, "TODO!"); 191 } 192 193 override void cancelReceive(DatagramSocketFD socket) 194 { 195 assert(false, "TODO!"); 196 } 197 198 override void send(DatagramSocketFD socket, const(ubyte)[] buffer, IOMode mode, Address target_address, DatagramIOCallback on_send_finish) 199 { 200 assert(false, "TODO!"); 201 } 202 203 override void cancelSend(DatagramSocketFD socket) 204 { 205 assert(false, "TODO!"); 206 } 207 208 override void addRef(SocketFD descriptor) 209 { 210 assert(false, "TODO!"); 211 } 212 213 override bool releaseRef(SocketFD descriptor) 214 { 215 assert(false, "TODO!"); 216 } 217 } 218 219 final class LibasyncEventDriverDNS : EventDriverDNS { 220 @safe: /*@nogc:*/ nothrow: 221 222 DNSLookupID lookupHost(string name, DNSLookupCallback on_lookup_finished) 223 { 224 assert(false, "TODO!"); 225 } 226 227 void cancelLookup(DNSLookupID handle) 228 { 229 assert(false, "TODO!"); 230 } 231 } 232 233 234 final class LibasyncEventDriverFiles : EventDriverFiles { 235 @safe: /*@nogc:*/ nothrow: 236 override FileFD open(string path, FileOpenMode mode) 237 { 238 assert(false, "TODO!"); 239 } 240 241 override FileFD adopt(int system_file_handle) 242 { 243 assert(false, "TODO!"); 244 } 245 246 override void close(FileFD file) 247 { 248 assert(false, "TODO!"); 249 } 250 251 override ulong getSize(FileFD file) 252 { 253 assert(false, "TODO!"); 254 } 255 256 override void write(FileFD file, ulong offset, const(ubyte)[] buffer, IOMode mode, FileIOCallback on_write_finish) 257 { 258 assert(false, "TODO!"); 259 } 260 261 override void read(FileFD file, ulong offset, ubyte[] buffer, IOMode mode, FileIOCallback on_read_finish) 262 { 263 assert(false, "TODO!"); 264 } 265 266 override void cancelWrite(FileFD file) 267 { 268 assert(false, "TODO!"); 269 } 270 271 override void cancelRead(FileFD file) 272 { 273 assert(false, "TODO!"); 274 } 275 276 override void addRef(FileFD descriptor) 277 { 278 assert(false, "TODO!"); 279 } 280 281 override bool releaseRef(FileFD descriptor) 282 { 283 assert(false, "TODO!"); 284 } 285 } 286 287 final class LibasyncEventDriverEvents : EventDriverEvents { 288 @safe: /*@nogc:*/ nothrow: 289 override EventID create() 290 { 291 assert(false, "TODO!"); 292 } 293 294 override void trigger(EventID event, bool notify_all = true) 295 { 296 assert(false, "TODO!"); 297 } 298 299 override void trigger(EventID event, bool notify_all = true) shared 300 { 301 assert(false, "TODO!"); 302 } 303 304 override void wait(EventID event, EventCallback on_event) 305 { 306 assert(false, "TODO!"); 307 } 308 309 override void cancelWait(EventID event, EventCallback on_event) 310 { 311 assert(false, "TODO!"); 312 } 313 314 override void addRef(EventID descriptor) 315 { 316 assert(false, "TODO!"); 317 } 318 319 override bool releaseRef(EventID descriptor) 320 { 321 assert(false, "TODO!"); 322 } 323 } 324 325 final class LibasyncEventDriverSignals : EventDriverSignals { 326 @safe: /*@nogc:*/ nothrow: 327 override SignalListenID listen(int sig, SignalCallback on_signal) 328 { 329 assert(false, "TODO!"); 330 } 331 332 override void addRef(SignalListenID descriptor) 333 { 334 assert(false, "TODO!"); 335 } 336 337 override bool releaseRef(SignalListenID descriptor) 338 { 339 assert(false, "TODO!"); 340 } 341 } 342 343 final class LibasyncEventDriverTimers : EventDriverTimers { 344 @safe: /*@nogc:*/ nothrow: 345 override TimerID create() 346 { 347 assert(false, "TODO!"); 348 } 349 350 override void set(TimerID timer, Duration timeout, Duration repeat = Duration.zero) 351 { 352 assert(false, "TODO!"); 353 } 354 355 override void stop(TimerID timer) 356 { 357 assert(false, "TODO!"); 358 } 359 360 override bool isPending(TimerID timer) 361 { 362 assert(false, "TODO!"); 363 } 364 365 override bool isPeriodic(TimerID timer) 366 { 367 assert(false, "TODO!"); 368 } 369 370 override void wait(TimerID timer, TimerCallback callback) 371 { 372 assert(false, "TODO!"); 373 } 374 375 override void cancelWait(TimerID timer) 376 { 377 assert(false, "TODO!"); 378 } 379 380 override void addRef(TimerID descriptor) 381 { 382 assert(false, "TODO!"); 383 } 384 385 override bool releaseRef(TimerID descriptor) 386 { 387 assert(false, "TODO!"); 388 } 389 390 override bool isUnique(TimerID descriptor) const 391 { 392 assert(false, "TODO!"); 393 } 394 } 395 396 final class LibasyncEventDriverWatchers : EventDriverWatchers { 397 @safe: /*@nogc:*/ nothrow: 398 override WatcherID watchDirectory(string path, bool recursive, FileChangesCallback callback) 399 { 400 assert(false, "TODO!"); 401 } 402 403 override void addRef(WatcherID descriptor) 404 { 405 assert(false, "TODO!"); 406 } 407 408 override bool releaseRef(WatcherID descriptor) 409 { 410 assert(false, "TODO!"); 411 } 412 }