VirtualBox

Ignore:
Timestamp:
Jul 6, 2019 1:22:56 AM (5 years ago)
Author:
vboxsync
Message:

Dhcpd: Went over the Dhcpd and related code adding comments and doing some exception vetting. bugref:9288

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/Dhcpd/Config.cpp

    r79553 r79563  
    8888 * @returns IPRT status code.
    8989 */
    90 int Config::i_init()
     90int Config::i_init() RT_NOEXCEPT
    9191{
    9292    return i_homeInit();
     
    100100 * @todo Too many init functions?
    101101 */
    102 int Config::i_homeInit()
     102int Config::i_homeInit() RT_NOEXCEPT
    103103{
    104104    char szHome[RTPATH_MAX];
     
    121121 * @returns Config instance on success, NULL on failure.
    122122 */
    123 /*static*/ Config *Config::i_createInstanceAndCallInit()
     123/*static*/ Config *Config::i_createInstanceAndCallInit() RT_NOEXCEPT
    124124{
    125125    Config *pConfig;
     
    161161 * Interal worker for i_setNetwork() that sets m_strBaseName to sanitized the
    162162 * version of m_strNetwork suitable for use as a path component.
     163 *
     164 * @throws std::bad_alloc
    163165 */
    164166void Config::i_sanitizeBaseName()
     
    196198 * @todo make the log file directly configurable?
    197199 */
    198 int Config::i_logInit()
     200int Config::i_logInit() RT_NOEXCEPT
    199201{
    200202    if (m_strHome.isEmpty() || m_strBaseName.isEmpty())
     
    241243 * Post process and validate the configuration after it has been loaded.
    242244 */
    243 int Config::i_complete()
     245int Config::i_complete() RT_NOEXCEPT
    244246{
    245247    if (m_strNetwork.isEmpty())
     
    336338
    337339
    338 /*static*/ Config *Config::hardcoded()
     340/*static*/ Config *Config::hardcoded() RT_NOEXCEPT
    339341{
    340342    std::unique_ptr<Config> config(i_createInstanceAndCallInit());
     
    378380
    379381
    380 
     382/**
     383 * Old VBoxNetDHCP style command line parsing.
     384 *
     385 * @throws std::bad_alloc
     386 */
    381387/*static*/ Config *Config::compat(int argc, char **argv)
    382388{
     
    519525
    520526
    521 Config *Config::create(int argc, char **argv)
    522 {
    523 #define DHCPD_GETOPT_COMMENT 256 /* No short option for --comment */
     527Config *Config::create(int argc, char **argv) RT_NOEXCEPT
     528{
    524529    static const RTGETOPTDEF s_aOptions[] =
    525530    {
    526         { "--config",       'c',                  RTGETOPT_REQ_STRING },
    527         { "--comment",      DHCPD_GETOPT_COMMENT, RTGETOPT_REQ_STRING }
     531        { "--config",       'c', RTGETOPT_REQ_STRING },
     532        { "--comment",      '#', RTGETOPT_REQ_STRING }
    528533    };
    529534
     
    556561                break;
    557562
    558             case DHCPD_GETOPT_COMMENT: /* --comment */
     563            case '#': /* --comment */
    559564                /* The sole purpose of this option is to allow identification of DHCP
    560565                 * server instances in the process list. We ignore the required string
     
    589594 * @note The release log has is not operational when this method is called.
    590595 */
    591 Config *Config::i_read(const char *pszFileName)
     596Config *Config::i_read(const char *pszFileName) RT_NOEXCEPT
    592597{
    593598    if (pszFileName == NULL || pszFileName[0] == '\0')
     
    635640        return NULL;
    636641    }
     642    catch (std::bad_alloc &)
     643    {
     644        LogFunc(("std::bad_alloc\n"));
     645        RTMsgError("std::bad_alloc reading config\n");
     646        return NULL;
     647    }
    637648    catch (...)
    638649    {
     
    650661 * below it.
    651662 *
    652  * @throws stuff.
     663 * @param   pElmRoot    The root element.
     664 * @throws  std::bad_alloc, ConfigFileError
    653665 */
    654666void Config::i_parseConfig(const xml::ElementNode *pElmRoot)
     
    694706 *
    695707 * @param   pElmServer          The DHCPServer element.
    696  * @throws  ConfigFileError
     708 * @throws  std::bad_alloc, ConfigFileError
    697709 */
    698710void Config::i_parseServer(const xml::ElementNode *pElmServer)
     
    767779 *
    768780 * @param   pElmServer          The <Options> element.
    769  * @throws  ConfigFileError
     781 * @throws  std::bad_alloc, ConfigFileError
    770782 */
    771783void Config::i_parseGlobalOptions(const xml::ElementNode *options)
     
    792804 *
    793805 * @param   pElmServer          The <Config> element.
    794  * @throws  ConfigFileError
     806 * @throws  std::bad_alloc, ConfigFileError
    795807 */
    796808void Config::i_parseVMConfig(const xml::ElementNode *pElmConfig)
     
    841853 * @param   pElmServer          The <Option> element.
    842854 * @param   optmap              The option map to add the option to.
    843  * @throws  ConfigFileError
     855 * @throws  std::bad_alloc, ConfigFileError
    844856 */
    845857void Config::i_parseOption(const xml::ElementNode *pElmOption, optmap_t &optmap)
     
    946958 * @param   idVendorClass   The vendor class ID.
    947959 * @param   idUserClass     The user class ID.
     960 *
     961 * @throws  std::bad_alloc
    948962 */
    949963optmap_t &Config::getOptions(optmap_t &a_rRetOpts, const OptParameterRequest &reqOpts, const ClientId &id,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette