VirtualBox

Changeset 79899 in vbox


Ignore:
Timestamp:
Jul 19, 2019 5:56:08 PM (6 years ago)
Author:
vboxsync
Message:

VBox/com/com.h,Dhcpd: Split out the logging and home directory functions into utils.h so they can be used by Dhcpd without dragging in any COM stuff via com/defs.h. bugref:9288 bugref:9511

Location:
trunk
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.kmk

    r79896 r79899  
    832832        $(PATH_ROOT)/include/VBox/version.h \
    833833       \
    834         $(PATH_ROOT)/include/VBox/com/com.h
     834        $(PATH_ROOT)/include/VBox/com/com.h \
     835        $(PATH_ROOT)/include/VBox/com/utils.h
    835836
    836837VBOX_CORE_DOXYFILE_INPUT := \
  • trunk/include/VBox/com/com.h

    r78108 r79899  
    3131
    3232#include "VBox/com/defs.h"
     33#include "VBox/com/utils.h"
    3334
    3435/** @defgroup grp_com   MS COM / XPCOM Abstraction Layer
     
    8182void GetInterfaceNameByIID(const GUID &aIID, BSTR *aName);
    8283
    83 /**
    84  *  Returns the VirtualBox user home directory.
    85  *
    86  *  On failure, this function will return a path that caused a failure (or
    87  *  NULL if the failure is not path-related).
    88  *
    89  *  On success, this function will try to create the returned directory if it
    90  *  doesn't exist yet. This may also fail with the corresponding status code.
    91  *
    92  *  If @a aDirLen is smaller than RTPATH_MAX then there is a great chance that
    93  *  this method will return VERR_BUFFER_OVERFLOW.
    94  *
    95  *  @param aDir        Buffer to store the directory string in UTF-8 encoding.
    96  *  @param aDirLen     Length of the supplied buffer including space for the
    97  *                     terminating null character, in bytes.
    98  *  @param fCreateDir  Flag whether to create the returned directory on success if it
    99  *                     doesn't exist.
    100  *  @return            VBox status code.
    101  */
    102 int GetVBoxUserHomeDirectory(char *aDir, size_t aDirLen, bool fCreateDir = true);
    103 
    104 /**
    105  *  Creates a release log file, used both in VBoxSVC and in API clients.
    106  *
    107  *  @param pcszEntity       Human readable name of the program.
    108  *  @param pcszLogFile      Name of the release log file.
    109  *  @param fFlags           Logger instance flags.
    110  *  @param pcszGroupSettings Group logging settings.
    111  *  @param pcszEnvVarBase   Base environment variable name for the logger.
    112  *  @param fDestFlags       Logger destination flags.
    113  *  @param cMaxEntriesPerGroup Limit for log entries per group. UINT32_MAX for no limit.
    114  *  @param cHistory         Number of old log files to keep.
    115  *  @param uHistoryFileTime Maximum amount of time to put in a log file.
    116  *  @param uHistoryFileSize Maximum size of a log file before rotating.
    117  *  @param pErrInfo         Where to return extended error information.
    118  *                          Optional.
    119  *
    120  *  @return         VBox status code.
    121  */
    122 int VBoxLogRelCreate(const char *pcszEntity, const char *pcszLogFile,
    123                      uint32_t fFlags, const char *pcszGroupSettings,
    124                      const char *pcszEnvVarBase, uint32_t fDestFlags,
    125                      uint32_t cMaxEntriesPerGroup, uint32_t cHistory,
    126                      uint32_t uHistoryFileTime, uint64_t uHistoryFileSize,
    127                      PRTERRINFO pErrInfo);
    128 
    12984#ifdef RT_OS_WINDOWS
    13085void PatchComBugs(void);
  • trunk/include/VBox/com/utils.h

    r79882 r79899  
    2424 */
    2525
    26 #ifndef VBOX_INCLUDED_com_com_h
    27 #define VBOX_INCLUDED_com_com_h
     26#ifndef VBOX_INCLUDED_com_utils_h
     27#define VBOX_INCLUDED_com_utils_h
    2828#ifndef RT_WITHOUT_PRAGMA_ONCE
    2929# pragma once
    3030#endif
    3131
    32 #include "VBox/com/defs.h"
     32#include "iprt/types.h"
    3333
    34 /** @defgroup grp_com   MS COM / XPCOM Abstraction Layer
     34/** @addtogroup grp_com
    3535 * @{
    3636 */
     
    3939{
    4040
    41 /** @name VBOX_COM_INIT_F_XXX - flags for com::Initialize().
    42  * @{ */
    43 /** Windows: Caller is the GUI and needs a STA rather than MTA apartment. */
    44 #define VBOX_COM_INIT_F_GUI             RT_BIT_32(0)
    45 /** Windows: Auto registration updating, if privileged enough. */
    46 #define VBOX_COM_INIT_F_AUTO_REG_UPDATE RT_BIT_32(1)
    47 /** Windows: Opt-out of COM patching (client code should do this). */
    48 #define VBOX_COM_INIT_F_NO_COM_PATCHING RT_BIT_32(2)
    49 /** The default flags. */
    50 #define VBOX_COM_INIT_F_DEFAULT         (VBOX_COM_INIT_F_AUTO_REG_UPDATE)
    51 /** @} */
    52 
    5341/**
    54  *  Initializes the COM runtime.
     42 * Returns the VirtualBox user home directory.
    5543 *
    56  *  Must be called on the main thread, before any COM activity in any thread, and by any thread
    57  *  willing to perform COM operations.
     44 * On failure, this function will return a path that caused a failure (or
     45 * NULL if the failure is not path-related).
    5846 *
    59  *  @return COM result code
    60  */
    61 HRESULT Initialize(uint32_t fInitFlags = VBOX_COM_INIT_F_DEFAULT);
    62 
    63 /**
    64  *  Shuts down the COM runtime.
     47 * On success, this function will try to create the returned directory if it
     48 * doesn't exist yet. This may also fail with the corresponding status code.
    6549 *
    66  *  Must be called on the main thread before termination.
    67  *  No COM calls may be made in any thread after this method returns.
    68  */
    69 HRESULT Shutdown();
    70 
    71 /**
    72  *  Resolves a given interface ID to a string containing the interface name.
     50 * If @a aDirLen is smaller than RTPATH_MAX then there is a great chance that
     51 * this method will return VERR_BUFFER_OVERFLOW.
    7352 *
    74  *  If, for some reason, the given IID cannot be resolved to a name, a NULL
    75  *  string is returned. A non-NULL string returned by this function must be
    76  *  freed using SysFreeString().
    77  *
    78  *  @param aIID     ID of the interface to get a name for
    79  *  @param aName    Resolved interface name or @c NULL on error
    80  */
    81 void GetInterfaceNameByIID(const GUID &aIID, BSTR *aName);
    82 
    83 /**
    84  *  Returns the VirtualBox user home directory.
    85  *
    86  *  On failure, this function will return a path that caused a failure (or
    87  *  NULL if the failure is not path-related).
    88  *
    89  *  On success, this function will try to create the returned directory if it
    90  *  doesn't exist yet. This may also fail with the corresponding status code.
    91  *
    92  *  If @a aDirLen is smaller than RTPATH_MAX then there is a great chance that
    93  *  this method will return VERR_BUFFER_OVERFLOW.
    94  *
    95  *  @param aDir        Buffer to store the directory string in UTF-8 encoding.
    96  *  @param aDirLen     Length of the supplied buffer including space for the
    97  *                     terminating null character, in bytes.
    98  *  @param fCreateDir  Flag whether to create the returned directory on success if it
    99  *                     doesn't exist.
    100  *  @return            VBox status code.
     53 * @param   aDir        Buffer to store the directory string in UTF-8 encoding.
     54 * @param   aDirLen     Length of the supplied buffer including space for the
     55 *                      terminating null character, in bytes.
     56 * @param   fCreateDir  Flag whether to create the returned directory on success
     57 *                      if it doesn't exist.
     58 * @returns VBox status code.
    10159 */
    10260int GetVBoxUserHomeDirectory(char *aDir, size_t aDirLen, bool fCreateDir = true);
    10361
    10462/**
    105  *  Creates a release log file, used both in VBoxSVC and in API clients.
     63 * Creates a release log file, used both in VBoxSVC and in API clients.
    10664 *
    107  *  @param pcszEntity       Human readable name of the program.
    108  *  @param pcszLogFile      Name of the release log file.
    109  *  @param fFlags           Logger instance flags.
    110  *  @param pcszGroupSettings Group logging settings.
    111  *  @param pcszEnvVarBase   Base environment variable name for the logger.
    112  *  @param fDestFlags       Logger destination flags.
    113  *  @param cMaxEntriesPerGroup Limit for log entries per group. UINT32_MAX for no limit.
    114  *  @param cHistory         Number of old log files to keep.
    115  *  @param uHistoryFileTime Maximum amount of time to put in a log file.
    116  *  @param uHistoryFileSize Maximum size of a log file before rotating.
    117  *  @param pErrInfo         Where to return extended error information.
    118  *                          Optional.
     65 * @param   pszEntity        Human readable name of the program.
     66 * @param   pszLogFile       Name of the release log file.
     67 * @param  fFlags           Logger instance flags.
     68 * @param   pszGroupSettings Group logging settings.
     69 * @param   pszEnvVarBase    Base environment variable name for the logger.
     70 * @param  fDestFlags       Logger destination flags.
     71 * @param  cMaxEntriesPerGroup Limit for log entries per group. UINT32_MAX for no limit.
     72 * @param  cHistory         Number of old log files to keep.
     73 * @param  uHistoryFileTime Maximum amount of time to put in a log file.
     74 * @param  uHistoryFileSize Maximum size of a log file before rotating.
     75 * @param  pErrInfo         Where to return extended error information.
     76 *                           Optional.
    11977 *
    120  *  @return        VBox status code.
     78 * @returns VBox status code.
    12179 */
    122 int VBoxLogRelCreate(const char *pcszEntity, const char *pcszLogFile,
    123                      uint32_t fFlags, const char *pcszGroupSettings,
    124                      const char *pcszEnvVarBase, uint32_t fDestFlags,
     80int VBoxLogRelCreate(const char *pszEntity, const char *pszLogFile,
     81                     uint32_t fFlags, const char *pszGroupSettings,
     82                     const char *pszEnvVarBase, uint32_t fDestFlags,
    12583                     uint32_t cMaxEntriesPerGroup, uint32_t cHistory,
    12684                     uint32_t uHistoryFileTime, uint64_t uHistoryFileSize,
    12785                     PRTERRINFO pErrInfo);
    12886
    129 #ifdef RT_OS_WINDOWS
    130 void PatchComBugs(void);
    131 #endif
    132 
    13387} /* namespace com */
    13488
    13589/** @} */
    136 #endif /* !VBOX_INCLUDED_com_com_h */
     90#endif /* !VBOX_INCLUDED_com_utils_h */
    13791
  • trunk/src/VBox/NetworkServices/Dhcpd/Config.cpp

    r79868 r79899  
    3131#include <iprt/cpp/path.h>
    3232
    33 #include <VBox/com/com.h>       /* For log initialization. */
     33#include <VBox/com/utils.h>     /* For log initialization. */
    3434
    3535#include "Config.h"
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