VBoxNetBaseService.h revision 77da7a074c86956d36759983037056c00cb87535
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync/* $Id$ */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync/** @file
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * VBoxNetUDP - IntNet Client Library.
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2009-2011 Oracle Corporation
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync *
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * available from http://www.virtualbox.org. This file is free software;
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * General Public License (GPL) as published by the Free Software
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync#ifndef ___VBoxNetBaseService_h___
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync#define ___VBoxNetBaseService_h___
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync#include <iprt/critsect.h>
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsyncclass VBoxNetBaseService
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync{
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsyncpublic:
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync VBoxNetBaseService();
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync virtual ~VBoxNetBaseService();
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync int parseArgs(int argc, char **argv);
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync int tryGoOnline(void);
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync void shutdown(void);
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync int syncEnter() { return RTCritSectEnter(&this->m_csThis);}
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync int syncLeave() { return RTCritSectLeave(&this->m_csThis);}
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync int waitForIntNetEvent(int cMillis);
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync int sendBufferOnWire(PCINTNETSEG pSg, int cSg, size_t cbBuffer);
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync void flushWire();
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync virtual void usage(void) = 0;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync virtual void run(void) = 0;
e2843ed205192b88e54eef60ad541d00bbbc932avboxsync virtual int init(void);
e2843ed205192b88e54eef60ad541d00bbbc932avboxsync virtual int parseOpt(int rc, const RTGETOPTUNION& getOptVal) = 0;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync inline void debugPrint( int32_t iMinLevel, bool fMsg, const char *pszFmt, ...) const;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync void debugPrintV(int32_t iMinLevel, bool fMsg, const char *pszFmt, va_list va) const;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsyncpublic:
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync /** @name The server configuration data members.
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * @{ */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync std::string m_Name;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync std::string m_Network;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync std::string m_TrunkName;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync INTNETTRUNKTYPE m_enmTrunkType;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync RTMAC m_MacAddress;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync RTNETADDRIPV4 m_Ipv4Address;
77da7a074c86956d36759983037056c00cb87535vboxsync RTNETADDRIPV4 m_Ipv4Netmask;
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync /* cs for syncing */
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync RTCRITSECT m_csThis;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync /** @} */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync /** @name The network interface
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * @{ */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync PSUPDRVSESSION m_pSession;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync uint32_t m_cbSendBuf;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync uint32_t m_cbRecvBuf;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync INTNETIFHANDLE m_hIf; /**< The handle to the network interface. */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync PINTNETBUF m_pIfBuf; /**< Interface buffer. */
e2843ed205192b88e54eef60ad541d00bbbc932avboxsync std::vector<PRTGETOPTDEF> m_vecOptionDefs;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync /** @} */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync /** @name Debug stuff
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * @{ */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync int32_t m_cVerbosity;
e2843ed205192b88e54eef60ad541d00bbbc932avboxsyncprivate:
e2843ed205192b88e54eef60ad541d00bbbc932avboxsync PRTGETOPTDEF getOptionsPtr();
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync /** @} */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync};
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync#endif