| 1 | /* | 
|---|
| 2 | * synergy -- mouse and keyboard sharing utility | 
|---|
| 3 | * Copyright (C) 2002 Chris Schoeneman | 
|---|
| 4 | * | 
|---|
| 5 | * This package is free software you can redistribute it and/or | 
|---|
| 6 | * modify it under the terms of the GNU General Public License | 
|---|
| 7 | * found in the file COPYING that should have accompanied this file. | 
|---|
| 8 | * | 
|---|
| 9 | * This package is distributed in the hope that it will be useful, | 
|---|
| 10 | * but WITHOUT ANY WARRANTY without even the implied warranty of | 
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 12 | * GNU General Public License for more details. | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | #include "common.h" | 
|---|
| 16 | #include "CArch.h" | 
|---|
| 17 |  | 
|---|
| 18 | #undef ARCH_CONSOLE | 
|---|
| 19 | #undef ARCH_DAEMON | 
|---|
| 20 | #undef ARCH_FILE | 
|---|
| 21 | #undef ARCH_LOG | 
|---|
| 22 | #undef ARCH_MULTITHREAD | 
|---|
| 23 | #undef ARCH_NETWORK | 
|---|
| 24 | #undef ARCH_SLEEP | 
|---|
| 25 | #undef ARCH_STRING | 
|---|
| 26 | #undef ARCH_SYSTEM | 
|---|
| 27 | #undef ARCH_TASKBAR | 
|---|
| 28 | #undef ARCH_TIME | 
|---|
| 29 |  | 
|---|
| 30 | // include appropriate architecture implementation | 
|---|
| 31 | #if SYSAPI_WIN32 | 
|---|
| 32 | #       include "CArchConsoleWindows.h" | 
|---|
| 33 | #       include "CArchDaemonWindows.h" | 
|---|
| 34 | #       include "CArchFileWindows.h" | 
|---|
| 35 | #       include "CArchLogWindows.h" | 
|---|
| 36 | #       include "CArchMiscWindows.h" | 
|---|
| 37 | #       include "CArchMultithreadWindows.h" | 
|---|
| 38 | #       include "CArchNetworkWinsock.h" | 
|---|
| 39 | #       include "CArchSleepWindows.h" | 
|---|
| 40 | #       include "CArchStringWindows.h" | 
|---|
| 41 | #       include "CArchSystemWindows.h" | 
|---|
| 42 | #       include "CArchTaskBarWindows.h" | 
|---|
| 43 | #       include "CArchTimeWindows.h" | 
|---|
| 44 | #elif SYSAPI_UNIX | 
|---|
| 45 | #       include "CArchConsoleUnix.h" | 
|---|
| 46 | #   ifdef __OS2__ | 
|---|
| 47 | #               include "CArchDaemonNone.h" | 
|---|
| 48 | #       else | 
|---|
| 49 | #               include "CArchDaemonUnix.h" | 
|---|
| 50 | #       endif | 
|---|
| 51 | #       include "CArchFileUnix.h" | 
|---|
| 52 | #       include "CArchLogUnix.h" | 
|---|
| 53 | #       if HAVE_PTHREAD | 
|---|
| 54 | #               include "CArchMultithreadPosix.h" | 
|---|
| 55 | #       endif | 
|---|
| 56 | #       include "CArchNetworkBSD.h" | 
|---|
| 57 | #       include "CArchSleepUnix.h" | 
|---|
| 58 | #       include "CArchStringUnix.h" | 
|---|
| 59 | #       include "CArchSystemUnix.h" | 
|---|
| 60 | #   ifdef __OS2__ /// @todo isn't this really WINAPI? | 
|---|
| 61 | #               include "CArchTaskBarOS2.h" | 
|---|
| 62 | #       else | 
|---|
| 63 | #               include "CArchTaskBarXWindows.h" | 
|---|
| 64 | #       endif | 
|---|
| 65 | #       include "CArchTimeUnix.h" | 
|---|
| 66 | #endif | 
|---|
| 67 |  | 
|---|
| 68 | #if !defined(ARCH_CONSOLE) | 
|---|
| 69 | #       error unsupported platform for console | 
|---|
| 70 | #endif | 
|---|
| 71 |  | 
|---|
| 72 | #if !defined(ARCH_DAEMON) | 
|---|
| 73 | #       error unsupported platform for daemon | 
|---|
| 74 | #endif | 
|---|
| 75 |  | 
|---|
| 76 | #if !defined(ARCH_FILE) | 
|---|
| 77 | #       error unsupported platform for file | 
|---|
| 78 | #endif | 
|---|
| 79 |  | 
|---|
| 80 | #if !defined(ARCH_LOG) | 
|---|
| 81 | #       error unsupported platform for logging | 
|---|
| 82 | #endif | 
|---|
| 83 |  | 
|---|
| 84 | #if !defined(ARCH_MULTITHREAD) | 
|---|
| 85 | #       error unsupported platform for multithreading | 
|---|
| 86 | #endif | 
|---|
| 87 |  | 
|---|
| 88 | #if !defined(ARCH_NETWORK) | 
|---|
| 89 | #       error unsupported platform for network | 
|---|
| 90 | #endif | 
|---|
| 91 |  | 
|---|
| 92 | #if !defined(ARCH_SLEEP) | 
|---|
| 93 | #       error unsupported platform for sleep | 
|---|
| 94 | #endif | 
|---|
| 95 |  | 
|---|
| 96 | #if !defined(ARCH_STRING) | 
|---|
| 97 | #       error unsupported platform for string | 
|---|
| 98 | #endif | 
|---|
| 99 |  | 
|---|
| 100 | #if !defined(ARCH_SYSTEM) | 
|---|
| 101 | #       error unsupported platform for system | 
|---|
| 102 | #endif | 
|---|
| 103 |  | 
|---|
| 104 | #if !defined(ARCH_TASKBAR) | 
|---|
| 105 | #       error unsupported platform for taskbar | 
|---|
| 106 | #endif | 
|---|
| 107 |  | 
|---|
| 108 | #if !defined(ARCH_TIME) | 
|---|
| 109 | #       error unsupported platform for time | 
|---|
| 110 | #endif | 
|---|
| 111 |  | 
|---|
| 112 | // | 
|---|
| 113 | // CArch | 
|---|
| 114 | // | 
|---|
| 115 |  | 
|---|
| 116 | CArch*                                  CArch::s_instance = NULL; | 
|---|
| 117 |  | 
|---|
| 118 | CArch::CArch(ARCH_ARGS* args) | 
|---|
| 119 | { | 
|---|
| 120 | // only once instance of CArch | 
|---|
| 121 | assert(s_instance == NULL); | 
|---|
| 122 | s_instance = this; | 
|---|
| 123 |  | 
|---|
| 124 | // create architecture implementation objects | 
|---|
| 125 | m_mt      = new ARCH_MULTITHREAD; | 
|---|
| 126 | m_system  = new ARCH_SYSTEM; | 
|---|
| 127 | m_file    = new ARCH_FILE; | 
|---|
| 128 | m_log     = new ARCH_LOG; | 
|---|
| 129 | m_net     = new ARCH_NETWORK; | 
|---|
| 130 | m_sleep   = new ARCH_SLEEP; | 
|---|
| 131 | m_string  = new ARCH_STRING; | 
|---|
| 132 | m_time    = new ARCH_TIME; | 
|---|
| 133 | m_console = new ARCH_CONSOLE(args); | 
|---|
| 134 | m_daemon  = new ARCH_DAEMON; | 
|---|
| 135 | m_taskbar = new ARCH_TASKBAR(args); | 
|---|
| 136 |  | 
|---|
| 137 | #if SYSAPI_WIN32 | 
|---|
| 138 | CArchMiscWindows::init(); | 
|---|
| 139 | #endif | 
|---|
| 140 | } | 
|---|
| 141 |  | 
|---|
| 142 | CArch::~CArch() | 
|---|
| 143 | { | 
|---|
| 144 | // clean up | 
|---|
| 145 | delete m_taskbar; | 
|---|
| 146 | delete m_daemon; | 
|---|
| 147 | delete m_console; | 
|---|
| 148 | delete m_time; | 
|---|
| 149 | delete m_string; | 
|---|
| 150 | delete m_sleep; | 
|---|
| 151 | delete m_net; | 
|---|
| 152 | delete m_log; | 
|---|
| 153 | delete m_file; | 
|---|
| 154 | delete m_system; | 
|---|
| 155 | delete m_mt; | 
|---|
| 156 |  | 
|---|
| 157 | // no instance | 
|---|
| 158 | s_instance = NULL; | 
|---|
| 159 | } | 
|---|
| 160 |  | 
|---|
| 161 | CArch* | 
|---|
| 162 | CArch::getInstance() | 
|---|
| 163 | { | 
|---|
| 164 | assert(s_instance != NULL); | 
|---|
| 165 |  | 
|---|
| 166 | return s_instance; | 
|---|
| 167 | } | 
|---|
| 168 |  | 
|---|
| 169 | void | 
|---|
| 170 | CArch::openConsole(const char* title) | 
|---|
| 171 | { | 
|---|
| 172 | m_console->openConsole(title); | 
|---|
| 173 | } | 
|---|
| 174 |  | 
|---|
| 175 | void | 
|---|
| 176 | CArch::closeConsole() | 
|---|
| 177 | { | 
|---|
| 178 | m_console->closeConsole(); | 
|---|
| 179 | } | 
|---|
| 180 |  | 
|---|
| 181 | void | 
|---|
| 182 | CArch::showConsole(bool showIfEmpty) | 
|---|
| 183 | { | 
|---|
| 184 | m_console->showConsole(showIfEmpty); | 
|---|
| 185 | } | 
|---|
| 186 |  | 
|---|
| 187 | void | 
|---|
| 188 | CArch::writeConsole(const char* str) | 
|---|
| 189 | { | 
|---|
| 190 | m_console->writeConsole(str); | 
|---|
| 191 | } | 
|---|
| 192 |  | 
|---|
| 193 | const char* | 
|---|
| 194 | CArch::getNewlineForConsole() | 
|---|
| 195 | { | 
|---|
| 196 | return m_console->getNewlineForConsole(); | 
|---|
| 197 | } | 
|---|
| 198 |  | 
|---|
| 199 | void | 
|---|
| 200 | CArch::installDaemon(const char* name, | 
|---|
| 201 | const char* description, | 
|---|
| 202 | const char* pathname, | 
|---|
| 203 | const char* commandLine, | 
|---|
| 204 | const char* dependencies, | 
|---|
| 205 | bool allUsers) | 
|---|
| 206 | { | 
|---|
| 207 | m_daemon->installDaemon(name, description, pathname, | 
|---|
| 208 | commandLine, dependencies, allUsers); | 
|---|
| 209 | } | 
|---|
| 210 |  | 
|---|
| 211 | void | 
|---|
| 212 | CArch::uninstallDaemon(const char* name, bool allUsers) | 
|---|
| 213 | { | 
|---|
| 214 | m_daemon->uninstallDaemon(name, allUsers); | 
|---|
| 215 | } | 
|---|
| 216 |  | 
|---|
| 217 | int | 
|---|
| 218 | CArch::daemonize(const char* name, DaemonFunc func) | 
|---|
| 219 | { | 
|---|
| 220 | return m_daemon->daemonize(name, func); | 
|---|
| 221 | } | 
|---|
| 222 |  | 
|---|
| 223 | bool | 
|---|
| 224 | CArch::canInstallDaemon(const char* name, bool allUsers) | 
|---|
| 225 | { | 
|---|
| 226 | return m_daemon->canInstallDaemon(name, allUsers); | 
|---|
| 227 | } | 
|---|
| 228 |  | 
|---|
| 229 | bool | 
|---|
| 230 | CArch::isDaemonInstalled(const char* name, bool allUsers) | 
|---|
| 231 | { | 
|---|
| 232 | return m_daemon->isDaemonInstalled(name, allUsers); | 
|---|
| 233 | } | 
|---|
| 234 |  | 
|---|
| 235 | const char* | 
|---|
| 236 | CArch::getBasename(const char* pathname) | 
|---|
| 237 | { | 
|---|
| 238 | return m_file->getBasename(pathname); | 
|---|
| 239 | } | 
|---|
| 240 |  | 
|---|
| 241 | std::string | 
|---|
| 242 | CArch::getUserDirectory() | 
|---|
| 243 | { | 
|---|
| 244 | return m_file->getUserDirectory(); | 
|---|
| 245 | } | 
|---|
| 246 |  | 
|---|
| 247 | std::string | 
|---|
| 248 | CArch::getSystemDirectory() | 
|---|
| 249 | { | 
|---|
| 250 | return m_file->getSystemDirectory(); | 
|---|
| 251 | } | 
|---|
| 252 |  | 
|---|
| 253 | std::string | 
|---|
| 254 | CArch::concatPath(const std::string& prefix, const std::string& suffix) | 
|---|
| 255 | { | 
|---|
| 256 | return m_file->concatPath(prefix, suffix); | 
|---|
| 257 | } | 
|---|
| 258 |  | 
|---|
| 259 | void | 
|---|
| 260 | CArch::openLog(const char* name) | 
|---|
| 261 | { | 
|---|
| 262 | m_log->openLog(name); | 
|---|
| 263 | } | 
|---|
| 264 |  | 
|---|
| 265 | void | 
|---|
| 266 | CArch::closeLog() | 
|---|
| 267 | { | 
|---|
| 268 | m_log->closeLog(); | 
|---|
| 269 | } | 
|---|
| 270 |  | 
|---|
| 271 | void | 
|---|
| 272 | CArch::showLog(bool showIfEmpty) | 
|---|
| 273 | { | 
|---|
| 274 | m_log->showLog(showIfEmpty); | 
|---|
| 275 | } | 
|---|
| 276 |  | 
|---|
| 277 | void | 
|---|
| 278 | CArch::writeLog(ELevel level, const char* msg) | 
|---|
| 279 | { | 
|---|
| 280 | m_log->writeLog(level, msg); | 
|---|
| 281 | } | 
|---|
| 282 |  | 
|---|
| 283 | CArchCond | 
|---|
| 284 | CArch::newCondVar() | 
|---|
| 285 | { | 
|---|
| 286 | return m_mt->newCondVar(); | 
|---|
| 287 | } | 
|---|
| 288 |  | 
|---|
| 289 | void | 
|---|
| 290 | CArch::closeCondVar(CArchCond cond) | 
|---|
| 291 | { | 
|---|
| 292 | m_mt->closeCondVar(cond); | 
|---|
| 293 | } | 
|---|
| 294 |  | 
|---|
| 295 | void | 
|---|
| 296 | CArch::signalCondVar(CArchCond cond) | 
|---|
| 297 | { | 
|---|
| 298 | m_mt->signalCondVar(cond); | 
|---|
| 299 | } | 
|---|
| 300 |  | 
|---|
| 301 | void | 
|---|
| 302 | CArch::broadcastCondVar(CArchCond cond) | 
|---|
| 303 | { | 
|---|
| 304 | m_mt->broadcastCondVar(cond); | 
|---|
| 305 | } | 
|---|
| 306 |  | 
|---|
| 307 | bool | 
|---|
| 308 | CArch::waitCondVar(CArchCond cond, CArchMutex mutex, double timeout) | 
|---|
| 309 | { | 
|---|
| 310 | return m_mt->waitCondVar(cond, mutex, timeout); | 
|---|
| 311 | } | 
|---|
| 312 |  | 
|---|
| 313 | CArchMutex | 
|---|
| 314 | CArch::newMutex() | 
|---|
| 315 | { | 
|---|
| 316 | return m_mt->newMutex(); | 
|---|
| 317 | } | 
|---|
| 318 |  | 
|---|
| 319 | void | 
|---|
| 320 | CArch::closeMutex(CArchMutex mutex) | 
|---|
| 321 | { | 
|---|
| 322 | m_mt->closeMutex(mutex); | 
|---|
| 323 | } | 
|---|
| 324 |  | 
|---|
| 325 | void | 
|---|
| 326 | CArch::lockMutex(CArchMutex mutex) | 
|---|
| 327 | { | 
|---|
| 328 | m_mt->lockMutex(mutex); | 
|---|
| 329 | } | 
|---|
| 330 |  | 
|---|
| 331 | void | 
|---|
| 332 | CArch::unlockMutex(CArchMutex mutex) | 
|---|
| 333 | { | 
|---|
| 334 | m_mt->unlockMutex(mutex); | 
|---|
| 335 | } | 
|---|
| 336 |  | 
|---|
| 337 | CArchThread | 
|---|
| 338 | CArch::newThread(ThreadFunc func, void* data) | 
|---|
| 339 | { | 
|---|
| 340 | return m_mt->newThread(func, data); | 
|---|
| 341 | } | 
|---|
| 342 |  | 
|---|
| 343 | CArchThread | 
|---|
| 344 | CArch::newCurrentThread() | 
|---|
| 345 | { | 
|---|
| 346 | return m_mt->newCurrentThread(); | 
|---|
| 347 | } | 
|---|
| 348 |  | 
|---|
| 349 | CArchThread | 
|---|
| 350 | CArch::copyThread(CArchThread thread) | 
|---|
| 351 | { | 
|---|
| 352 | return m_mt->copyThread(thread); | 
|---|
| 353 | } | 
|---|
| 354 |  | 
|---|
| 355 | void | 
|---|
| 356 | CArch::closeThread(CArchThread thread) | 
|---|
| 357 | { | 
|---|
| 358 | m_mt->closeThread(thread); | 
|---|
| 359 | } | 
|---|
| 360 |  | 
|---|
| 361 | void | 
|---|
| 362 | CArch::cancelThread(CArchThread thread) | 
|---|
| 363 | { | 
|---|
| 364 | m_mt->cancelThread(thread); | 
|---|
| 365 | } | 
|---|
| 366 |  | 
|---|
| 367 | void | 
|---|
| 368 | CArch::setPriorityOfThread(CArchThread thread, int n) | 
|---|
| 369 | { | 
|---|
| 370 | m_mt->setPriorityOfThread(thread, n); | 
|---|
| 371 | } | 
|---|
| 372 |  | 
|---|
| 373 | void | 
|---|
| 374 | CArch::testCancelThread() | 
|---|
| 375 | { | 
|---|
| 376 | m_mt->testCancelThread(); | 
|---|
| 377 | } | 
|---|
| 378 |  | 
|---|
| 379 | bool | 
|---|
| 380 | CArch::wait(CArchThread thread, double timeout) | 
|---|
| 381 | { | 
|---|
| 382 | return m_mt->wait(thread, timeout); | 
|---|
| 383 | } | 
|---|
| 384 |  | 
|---|
| 385 | bool | 
|---|
| 386 | CArch::isSameThread(CArchThread thread1, CArchThread thread2) | 
|---|
| 387 | { | 
|---|
| 388 | return m_mt->isSameThread(thread1, thread2); | 
|---|
| 389 | } | 
|---|
| 390 |  | 
|---|
| 391 | bool | 
|---|
| 392 | CArch::isExitedThread(CArchThread thread) | 
|---|
| 393 | { | 
|---|
| 394 | return m_mt->isExitedThread(thread); | 
|---|
| 395 | } | 
|---|
| 396 |  | 
|---|
| 397 | void* | 
|---|
| 398 | CArch::getResultOfThread(CArchThread thread) | 
|---|
| 399 | { | 
|---|
| 400 | return m_mt->getResultOfThread(thread); | 
|---|
| 401 | } | 
|---|
| 402 |  | 
|---|
| 403 | IArchMultithread::ThreadID | 
|---|
| 404 | CArch::getIDOfThread(CArchThread thread) | 
|---|
| 405 | { | 
|---|
| 406 | return m_mt->getIDOfThread(thread); | 
|---|
| 407 | } | 
|---|
| 408 |  | 
|---|
| 409 | void | 
|---|
| 410 | CArch::setSignalHandler(ESignal signal, SignalFunc func, void* userData) | 
|---|
| 411 | { | 
|---|
| 412 | m_mt->setSignalHandler(signal, func, userData); | 
|---|
| 413 | } | 
|---|
| 414 |  | 
|---|
| 415 | void | 
|---|
| 416 | CArch::raiseSignal(ESignal signal) | 
|---|
| 417 | { | 
|---|
| 418 | m_mt->raiseSignal(signal); | 
|---|
| 419 | } | 
|---|
| 420 |  | 
|---|
| 421 | CArchSocket | 
|---|
| 422 | CArch::newSocket(EAddressFamily family, ESocketType type) | 
|---|
| 423 | { | 
|---|
| 424 | return m_net->newSocket(family, type); | 
|---|
| 425 | } | 
|---|
| 426 |  | 
|---|
| 427 | CArchSocket | 
|---|
| 428 | CArch::copySocket(CArchSocket s) | 
|---|
| 429 | { | 
|---|
| 430 | return m_net->copySocket(s); | 
|---|
| 431 | } | 
|---|
| 432 |  | 
|---|
| 433 | void | 
|---|
| 434 | CArch::closeSocket(CArchSocket s) | 
|---|
| 435 | { | 
|---|
| 436 | m_net->closeSocket(s); | 
|---|
| 437 | } | 
|---|
| 438 |  | 
|---|
| 439 | void | 
|---|
| 440 | CArch::closeSocketForRead(CArchSocket s) | 
|---|
| 441 | { | 
|---|
| 442 | m_net->closeSocketForRead(s); | 
|---|
| 443 | } | 
|---|
| 444 |  | 
|---|
| 445 | void | 
|---|
| 446 | CArch::closeSocketForWrite(CArchSocket s) | 
|---|
| 447 | { | 
|---|
| 448 | m_net->closeSocketForWrite(s); | 
|---|
| 449 | } | 
|---|
| 450 |  | 
|---|
| 451 | void | 
|---|
| 452 | CArch::bindSocket(CArchSocket s, CArchNetAddress addr) | 
|---|
| 453 | { | 
|---|
| 454 | m_net->bindSocket(s, addr); | 
|---|
| 455 | } | 
|---|
| 456 |  | 
|---|
| 457 | void | 
|---|
| 458 | CArch::listenOnSocket(CArchSocket s) | 
|---|
| 459 | { | 
|---|
| 460 | m_net->listenOnSocket(s); | 
|---|
| 461 | } | 
|---|
| 462 |  | 
|---|
| 463 | CArchSocket | 
|---|
| 464 | CArch::acceptSocket(CArchSocket s, CArchNetAddress* addr) | 
|---|
| 465 | { | 
|---|
| 466 | return m_net->acceptSocket(s, addr); | 
|---|
| 467 | } | 
|---|
| 468 |  | 
|---|
| 469 | bool | 
|---|
| 470 | CArch::connectSocket(CArchSocket s, CArchNetAddress name) | 
|---|
| 471 | { | 
|---|
| 472 | return m_net->connectSocket(s, name); | 
|---|
| 473 | } | 
|---|
| 474 |  | 
|---|
| 475 | int | 
|---|
| 476 | CArch::pollSocket(CPollEntry pe[], int num, double timeout) | 
|---|
| 477 | { | 
|---|
| 478 | return m_net->pollSocket(pe, num, timeout); | 
|---|
| 479 | } | 
|---|
| 480 |  | 
|---|
| 481 | void | 
|---|
| 482 | CArch::unblockPollSocket(CArchThread thread) | 
|---|
| 483 | { | 
|---|
| 484 | m_net->unblockPollSocket(thread); | 
|---|
| 485 | } | 
|---|
| 486 |  | 
|---|
| 487 | size_t | 
|---|
| 488 | CArch::readSocket(CArchSocket s, void* buf, size_t len) | 
|---|
| 489 | { | 
|---|
| 490 | return m_net->readSocket(s, buf, len); | 
|---|
| 491 | } | 
|---|
| 492 |  | 
|---|
| 493 | size_t | 
|---|
| 494 | CArch::writeSocket(CArchSocket s, const void* buf, size_t len) | 
|---|
| 495 | { | 
|---|
| 496 | return m_net->writeSocket(s, buf, len); | 
|---|
| 497 | } | 
|---|
| 498 |  | 
|---|
| 499 | void | 
|---|
| 500 | CArch::throwErrorOnSocket(CArchSocket s) | 
|---|
| 501 | { | 
|---|
| 502 | m_net->throwErrorOnSocket(s); | 
|---|
| 503 | } | 
|---|
| 504 |  | 
|---|
| 505 | bool | 
|---|
| 506 | CArch::setNoDelayOnSocket(CArchSocket s, bool noDelay) | 
|---|
| 507 | { | 
|---|
| 508 | return m_net->setNoDelayOnSocket(s, noDelay); | 
|---|
| 509 | } | 
|---|
| 510 |  | 
|---|
| 511 | bool | 
|---|
| 512 | CArch::setReuseAddrOnSocket(CArchSocket s, bool reuse) | 
|---|
| 513 | { | 
|---|
| 514 | return m_net->setReuseAddrOnSocket(s, reuse); | 
|---|
| 515 | } | 
|---|
| 516 |  | 
|---|
| 517 | std::string | 
|---|
| 518 | CArch::getHostName() | 
|---|
| 519 | { | 
|---|
| 520 | return m_net->getHostName(); | 
|---|
| 521 | } | 
|---|
| 522 |  | 
|---|
| 523 | CArchNetAddress | 
|---|
| 524 | CArch::newAnyAddr(EAddressFamily family) | 
|---|
| 525 | { | 
|---|
| 526 | return m_net->newAnyAddr(family); | 
|---|
| 527 | } | 
|---|
| 528 |  | 
|---|
| 529 | CArchNetAddress | 
|---|
| 530 | CArch::copyAddr(CArchNetAddress addr) | 
|---|
| 531 | { | 
|---|
| 532 | return m_net->copyAddr(addr); | 
|---|
| 533 | } | 
|---|
| 534 |  | 
|---|
| 535 | CArchNetAddress | 
|---|
| 536 | CArch::nameToAddr(const std::string& name) | 
|---|
| 537 | { | 
|---|
| 538 | return m_net->nameToAddr(name); | 
|---|
| 539 | } | 
|---|
| 540 |  | 
|---|
| 541 | void | 
|---|
| 542 | CArch::closeAddr(CArchNetAddress addr) | 
|---|
| 543 | { | 
|---|
| 544 | m_net->closeAddr(addr); | 
|---|
| 545 | } | 
|---|
| 546 |  | 
|---|
| 547 | std::string | 
|---|
| 548 | CArch::addrToName(CArchNetAddress addr) | 
|---|
| 549 | { | 
|---|
| 550 | return m_net->addrToName(addr); | 
|---|
| 551 | } | 
|---|
| 552 |  | 
|---|
| 553 | std::string | 
|---|
| 554 | CArch::addrToString(CArchNetAddress addr) | 
|---|
| 555 | { | 
|---|
| 556 | return m_net->addrToString(addr); | 
|---|
| 557 | } | 
|---|
| 558 |  | 
|---|
| 559 | IArchNetwork::EAddressFamily | 
|---|
| 560 | CArch::getAddrFamily(CArchNetAddress addr) | 
|---|
| 561 | { | 
|---|
| 562 | return m_net->getAddrFamily(addr); | 
|---|
| 563 | } | 
|---|
| 564 |  | 
|---|
| 565 | void | 
|---|
| 566 | CArch::setAddrPort(CArchNetAddress addr, int port) | 
|---|
| 567 | { | 
|---|
| 568 | m_net->setAddrPort(addr, port); | 
|---|
| 569 | } | 
|---|
| 570 |  | 
|---|
| 571 | int | 
|---|
| 572 | CArch::getAddrPort(CArchNetAddress addr) | 
|---|
| 573 | { | 
|---|
| 574 | return m_net->getAddrPort(addr); | 
|---|
| 575 | } | 
|---|
| 576 |  | 
|---|
| 577 | bool | 
|---|
| 578 | CArch::isAnyAddr(CArchNetAddress addr) | 
|---|
| 579 | { | 
|---|
| 580 | return m_net->isAnyAddr(addr); | 
|---|
| 581 | } | 
|---|
| 582 |  | 
|---|
| 583 | bool | 
|---|
| 584 | CArch::isEqualAddr(CArchNetAddress a, CArchNetAddress b) | 
|---|
| 585 | { | 
|---|
| 586 | return m_net->isEqualAddr(a, b); | 
|---|
| 587 | } | 
|---|
| 588 |  | 
|---|
| 589 | void | 
|---|
| 590 | CArch::sleep(double timeout) | 
|---|
| 591 | { | 
|---|
| 592 | m_sleep->sleep(timeout); | 
|---|
| 593 | } | 
|---|
| 594 |  | 
|---|
| 595 | int | 
|---|
| 596 | CArch::vsnprintf(char* str, int size, const char* fmt, va_list ap) | 
|---|
| 597 | { | 
|---|
| 598 | return m_string->vsnprintf(str, size, fmt, ap); | 
|---|
| 599 | } | 
|---|
| 600 |  | 
|---|
| 601 | int | 
|---|
| 602 | CArch::convStringMBToWC(wchar_t* dst, const char* src, UInt32 n, bool* errors) | 
|---|
| 603 | { | 
|---|
| 604 | return m_string->convStringMBToWC(dst, src, n, errors); | 
|---|
| 605 | } | 
|---|
| 606 |  | 
|---|
| 607 | int | 
|---|
| 608 | CArch::convStringWCToMB(char* dst, const wchar_t* src, UInt32 n, bool* errors) | 
|---|
| 609 | { | 
|---|
| 610 | return m_string->convStringWCToMB(dst, src, n, errors); | 
|---|
| 611 | } | 
|---|
| 612 |  | 
|---|
| 613 | IArchString::EWideCharEncoding | 
|---|
| 614 | CArch::getWideCharEncoding() | 
|---|
| 615 | { | 
|---|
| 616 | return m_string->getWideCharEncoding(); | 
|---|
| 617 | } | 
|---|
| 618 |  | 
|---|
| 619 | std::string | 
|---|
| 620 | CArch::getOSName() const | 
|---|
| 621 | { | 
|---|
| 622 | return m_system->getOSName(); | 
|---|
| 623 | } | 
|---|
| 624 |  | 
|---|
| 625 | void | 
|---|
| 626 | CArch::addReceiver(IArchTaskBarReceiver* receiver) | 
|---|
| 627 | { | 
|---|
| 628 | m_taskbar->addReceiver(receiver); | 
|---|
| 629 | } | 
|---|
| 630 |  | 
|---|
| 631 | void | 
|---|
| 632 | CArch::removeReceiver(IArchTaskBarReceiver* receiver) | 
|---|
| 633 | { | 
|---|
| 634 | m_taskbar->removeReceiver(receiver); | 
|---|
| 635 | } | 
|---|
| 636 |  | 
|---|
| 637 | void | 
|---|
| 638 | CArch::updateReceiver(IArchTaskBarReceiver* receiver) | 
|---|
| 639 | { | 
|---|
| 640 | m_taskbar->updateReceiver(receiver); | 
|---|
| 641 | } | 
|---|
| 642 |  | 
|---|
| 643 | double | 
|---|
| 644 | CArch::time() | 
|---|
| 645 | { | 
|---|
| 646 | return m_time->time(); | 
|---|
| 647 | } | 
|---|