VirtualBox

Changeset 91872 in vbox


Ignore:
Timestamp:
Oct 20, 2021 9:07:44 AM (3 years ago)
Author:
vboxsync
Message:

Devices/Network: Change the network drivers to access the CFGM API through the driver helper callback table only, bugref:10074

Location:
trunk/src/VBox/Devices/Network
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r90791 r91872  
    12921292                                   uint32_t fFixedFlag, uint32_t *pfFlags)
    12931293{
     1294    PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3;
     1295
    12941296    char szValue[64];
    1295     int rc = CFGMR3QueryString(pDrvIns->pCfg, pszName, szValue, sizeof(szValue));
     1297    int rc = pHlp->pfnCFGMQueryString(pDrvIns->pCfg, pszName, szValue, sizeof(szValue));
    12961298    if (RT_FAILURE(rc))
    12971299    {
     
    13541356    RT_NOREF(fFlags);
    13551357    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    1356     PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
     1358    PDRVINTNET      pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
     1359    PCPDMDRVHLPR3   pHlp = pDrvIns->pHlpR3;
    13571360    bool f;
    13581361
     
    14411444     * The name of the internal network to connect to.
    14421445     */
    1443     int rc = CFGMR3QueryString(pCfg, "Network", OpenReq.szNetwork, sizeof(OpenReq.szNetwork));
     1446    int rc = pHlp->pfnCFGMQueryString(pCfg, "Network", OpenReq.szNetwork, sizeof(OpenReq.szNetwork));
    14441447    if (RT_FAILURE(rc))
    14451448        return PDMDRV_SET_ERROR(pDrvIns, rc,
     
    14511454     */
    14521455    uint32_t u32TrunkType;
    1453     rc = CFGMR3QueryU32(pCfg, "TrunkType", &u32TrunkType);
     1456    rc = pHlp->pfnCFGMQueryU32(pCfg, "TrunkType", &u32TrunkType);
    14541457    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    14551458        u32TrunkType = kIntNetTrunkType_None;
     
    14621465     * The name of the trunk connection.
    14631466     */
    1464     rc = CFGMR3QueryString(pCfg, "Trunk", OpenReq.szTrunk, sizeof(OpenReq.szTrunk));
     1467    rc = pHlp->pfnCFGMQueryString(pCfg, "Trunk", OpenReq.szTrunk, sizeof(OpenReq.szTrunk));
    14651468    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    14661469        OpenReq.szTrunk[0] = '\0';
     
    14761479     */
    14771480    bool fSharedMacOnWire;
    1478     rc = CFGMR3QueryBoolDef(pCfg, "SharedMacOnWire", &fSharedMacOnWire, false);
     1481    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "SharedMacOnWire", &fSharedMacOnWire, false);
    14791482    if (RT_FAILURE(rc))
    14801483        return PDMDRV_SET_ERROR(pDrvIns, rc,
     
    14881491     * @deprecated Use AccessPolicy instead.
    14891492     */
    1490     rc = CFGMR3QueryBool(pCfg, "RestrictAccess", &f);
     1493    rc = pHlp->pfnCFGMQueryBool(pCfg, "RestrictAccess", &f);
    14911494    if (RT_SUCCESS(rc))
    14921495    {
     
    15071510     * restrictions from being lifted.  If no further policy changes are
    15081511     * desired, apply the relevant fixed flags. */
    1509     rc = CFGMR3QueryBoolDef(pCfg, "RequireExactPolicyMatch", &f, false);
     1512    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "RequireExactPolicyMatch", &f, false);
    15101513    if (RT_FAILURE(rc))
    15111514        return PDMDRV_SET_ERROR(pDrvIns, rc,
     
    15191522     * and prevent them  being lifted later on.
    15201523     */
    1521     rc = CFGMR3QueryBoolDef(pCfg, "RequireAsRestrictivePolicy", &f, false);
     1524    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "RequireAsRestrictivePolicy", &f, false);
    15221525    if (RT_FAILURE(rc))
    15231526        return PDMDRV_SET_ERROR(pDrvIns, rc,
     
    16271630     * The size of the receive buffer.
    16281631     */
    1629     rc = CFGMR3QueryU32(pCfg, "ReceiveBufferSize", &OpenReq.cbRecv);
     1632    rc = pHlp->pfnCFGMQueryU32(pCfg, "ReceiveBufferSize", &OpenReq.cbRecv);
    16301633    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    16311634        OpenReq.cbRecv = 318 * _1K ;
     
    16421645     * side of it and the code will get very upset about it all.
    16431646     */
    1644     rc = CFGMR3QueryU32(pCfg, "SendBufferSize", &OpenReq.cbSend);
     1647    rc = pHlp->pfnCFGMQueryU32(pCfg, "SendBufferSize", &OpenReq.cbSend);
    16451648    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    16461649        OpenReq.cbSend = RT_ALIGN_Z(VBOX_MAX_GSO_SIZE * 3, _1K);
     
    16581661     * a service such as LWIP/iSCSI it shouldn't suspend immediately like for a NIC.
    16591662     */
    1660     rc = CFGMR3QueryBool(pCfg, "IsService", &pThis->fActivateEarlyDeactivateLate);
     1663    rc = pHlp->pfnCFGMQueryBool(pCfg, "IsService", &pThis->fActivateEarlyDeactivateLate);
    16611664    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    16621665        pThis->fActivateEarlyDeactivateLate = false;
     
    16701673     * network. */
    16711674    bool fIgnoreConnectFailure;
    1672     rc = CFGMR3QueryBoolDef(pCfg, "IgnoreConnectFailure", &fIgnoreConnectFailure, false);
     1675    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "IgnoreConnectFailure", &fIgnoreConnectFailure, false);
    16731676    if (RT_FAILURE(rc))
    16741677        return PDMDRV_SET_ERROR(pDrvIns, rc,
     
    16921695    }
    16931696#endif
    1694     rc = CFGMR3QueryBoolDef(pCfg, "Workaround1", &fWorkaround1, fWorkaround1);
     1697    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "Workaround1", &fWorkaround1, fWorkaround1);
    16951698    if (RT_FAILURE(rc))
    16961699        return PDMDRV_SET_ERROR(pDrvIns, rc,
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r88553 r91872  
    7878#define VBOX_NAT_DELAY_HACK
    7979
    80 #define GET_EXTRADATA(pthis, node, name, rc, type, type_name, var)                                  \
     80#define GET_EXTRADATA(pdrvins, node, name, rc, type, type_name, var)                                  \
    8181do {                                                                                                \
    82     (rc) = CFGMR3Query ## type((node), name, &(var));                                               \
     82    (rc) = (pdrvins)->pHlpR3->pfnCFGMQuery ## type((node), name, &(var));                                               \
    8383    if (RT_FAILURE((rc)) && (rc) != VERR_CFGM_VALUE_NOT_FOUND)                                      \
    84         return PDMDrvHlpVMSetError((pthis)->pDrvIns, (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \
    85                                    (pthis)->pDrvIns->iInstance);                                    \
     84        return PDMDrvHlpVMSetError((pdrvins), (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \
     85                                   (pdrvins)->iInstance);                                    \
    8686} while (0)
    8787
    88 #define GET_ED_STRICT(pthis, node, name, rc, type, type_name, var)                                  \
     88#define GET_ED_STRICT(pdrvins, node, name, rc, type, type_name, var)                                  \
    8989do {                                                                                                \
    90     (rc) = CFGMR3Query ## type((node), name, &(var));                                               \
     90    (rc) = (pdrvins)->pHlpR3->pfnCFGMQuery ## type((node), name, &(var));                                               \
    9191    if (RT_FAILURE((rc)))                                                                           \
    92         return PDMDrvHlpVMSetError((pthis)->pDrvIns, (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \
    93                                   (pthis)->pDrvIns->iInstance);                                     \
     92        return PDMDrvHlpVMSetError((pdrvins), (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \
     93                                  (pdrvins)->iInstance);                                     \
    9494} while (0)
    9595
    96 #define GET_EXTRADATA_N(pthis, node, name, rc, type, type_name, var, var_size)                      \
     96#define GET_EXTRADATA_N(pdrvins, node, name, rc, type, type_name, var, var_size)                      \
    9797do {                                                                                                \
    98     (rc) = CFGMR3Query ## type((node), name, &(var), var_size);                                     \
     98    (rc) = (pdrvins)->pHlpR3->pfnCFGMQuery ## type((node), name, &(var), var_size);                                     \
    9999    if (RT_FAILURE((rc)) && (rc) != VERR_CFGM_VALUE_NOT_FOUND)                                      \
    100         return PDMDrvHlpVMSetError((pthis)->pDrvIns, (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \
    101                                   (pthis)->pDrvIns->iInstance);                                     \
     100        return PDMDrvHlpVMSetError((pdrvins), (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \
     101                                  (pdrvins)->iInstance);                                     \
    102102} while (0)
    103103
    104 #define GET_BOOL(rc, pthis, node, name, var) \
    105     GET_EXTRADATA(pthis, node, name, (rc), Bool, bolean, (var))
    106 #define GET_STRING(rc, pthis, node, name, var, var_size) \
    107     GET_EXTRADATA_N(pthis, node, name, (rc), String, string, (var), (var_size))
    108 #define GET_STRING_ALLOC(rc, pthis, node, name, var) \
    109     GET_EXTRADATA(pthis, node, name, (rc), StringAlloc, string, (var))
    110 #define GET_S32(rc, pthis, node, name, var) \
    111     GET_EXTRADATA(pthis, node, name, (rc), S32, int, (var))
    112 #define GET_S32_STRICT(rc, pthis, node, name, var) \
    113     GET_ED_STRICT(pthis, node, name, (rc), S32, int, (var))
     104#define GET_BOOL(rc, pdrvins, node, name, var) \
     105    GET_EXTRADATA(pdrvins, node, name, (rc), Bool, bolean, (var))
     106#define GET_STRING(rc, pdrvins, node, name, var, var_size) \
     107    GET_EXTRADATA_N(pdrvins, node, name, (rc), String, string, (var), (var_size))
     108#define GET_STRING_ALLOC(rc, pdrvins, node, name, var) \
     109    GET_EXTRADATA(pdrvins, node, name, (rc), StringAlloc, string, (var))
     110#define GET_S32(rc, pdrvins, node, name, var) \
     111    GET_EXTRADATA(pdrvins, node, name, (rc), S32, int, (var))
     112#define GET_S32_STRICT(rc, pdrvins, node, name, var) \
     113    GET_ED_STRICT(pdrvins, node, name, (rc), S32, int, (var))
    114114
    115115
     
    13201320static int drvNATConstructDNSMappings(unsigned iInstance, PDRVNAT pThis, PCFGMNODE pMappingsCfg)
    13211321{
     1322    PPDMDRVINS pDrvIns = pThis->pDrvIns;
     1323    PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3;
     1324
    13221325    RT_NOREF(iInstance);
    13231326    int rc = VINF_SUCCESS;
    13241327    LogFlowFunc(("ENTER: iInstance:%d\n", iInstance));
    1325     for (PCFGMNODE pNode = CFGMR3GetFirstChild(pMappingsCfg); pNode; pNode = CFGMR3GetNextChild(pNode))
    1326     {
    1327         if (!CFGMR3AreValuesValid(pNode, "HostName\0HostNamePattern\0HostIP\0"))
     1328    for (PCFGMNODE pNode = pHlp->pfnCFGMGetFirstChild(pMappingsCfg); pNode; pNode = pHlp->pfnCFGMGetNextChild(pNode))
     1329    {
     1330        if (!pHlp->pfnCFGMAreValuesValid(pNode, "HostName\0HostNamePattern\0HostIP\0"))
    13281331            return PDMDRV_SET_ERROR(pThis->pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,
    13291332                                    N_("Unknown configuration in dns mapping"));
     
    13311334        bool fPattern = false;
    13321335        RT_ZERO(szHostNameOrPattern);
    1333         GET_STRING(rc, pThis, pNode, "HostName", szHostNameOrPattern[0], sizeof(szHostNameOrPattern));
     1336        GET_STRING(rc, pDrvIns, pNode, "HostName", szHostNameOrPattern[0], sizeof(szHostNameOrPattern));
    13341337        if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    13351338        {
    1336             GET_STRING(rc, pThis, pNode, "HostNamePattern", szHostNameOrPattern[0], sizeof(szHostNameOrPattern));
     1339            GET_STRING(rc, pDrvIns, pNode, "HostNamePattern", szHostNameOrPattern[0], sizeof(szHostNameOrPattern));
    13371340            if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    13381341            {
    13391342                char szNodeName[225];
    13401343                RT_ZERO(szNodeName);
    1341                 CFGMR3GetName(pNode, szNodeName, sizeof(szNodeName));
     1344                pHlp->pfnCFGMGetName(pNode, szNodeName, sizeof(szNodeName));
    13421345                LogRel(("NAT: Neither 'HostName' nor 'HostNamePattern' is specified for mapping %s\n", szNodeName));
    13431346                continue;
     
    13471350        struct in_addr HostIP;
    13481351        RT_ZERO(HostIP);
    1349         GETIP_DEF(rc, pThis, pNode, HostIP, INADDR_ANY);
     1352        GETIP_DEF(rc, pDrvIns, pNode, HostIP, INADDR_ANY);
    13501353        if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    13511354        {
     
    13691372static int drvNATConstructRedir(unsigned iInstance, PDRVNAT pThis, PCFGMNODE pCfg, PRTNETADDRIPV4 pNetwork)
    13701373{
     1374    PPDMDRVINS pDrvIns = pThis->pDrvIns;
     1375    PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3;
     1376
    13711377    RT_NOREF(pNetwork); /** @todo figure why pNetwork isn't used */
    13721378
     
    13781384     * Enumerate redirections.
    13791385     */
    1380     for (PCFGMNODE pNode = CFGMR3GetFirstChild(pPFTree); pNode; pNode = CFGMR3GetNextChild(pNode))
     1386    for (PCFGMNODE pNode = pHlp->pfnCFGMGetFirstChild(pPFTree); pNode; pNode = pHlp->pfnCFGMGetNextChild(pNode))
    13811387    {
    13821388        /*
    13831389         * Validate the port forwarding config.
    13841390         */
    1385         if (!CFGMR3AreValuesValid(pNode, "Name\0Protocol\0UDP\0HostPort\0GuestPort\0GuestIP\0BindIP\0"))
    1386             return PDMDRV_SET_ERROR(pThis->pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,
     1391        if (!pHlp->pfnCFGMAreValuesValid(pNode, "Name\0Protocol\0UDP\0HostPort\0GuestPort\0GuestIP\0BindIP\0"))
     1392            return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,
    13871393                                    N_("Unknown configuration in port forwarding"));
    13881394
     
    13911397        char szProtocol[32];
    13921398        int rc;
    1393         GET_STRING(rc, pThis, pNode, "Protocol", szProtocol[0], sizeof(szProtocol));
     1399        GET_STRING(rc, pDrvIns, pNode, "Protocol", szProtocol[0], sizeof(szProtocol));
    13941400        if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    13951401        {
    13961402            fUDP = false;
    1397             GET_BOOL(rc, pThis, pNode, "UDP", fUDP);
     1403            GET_BOOL(rc, pDrvIns, pNode, "UDP", fUDP);
    13981404        }
    13991405        else if (RT_SUCCESS(rc))
     
    14041410                fUDP = true;
    14051411            else
    1406                 return PDMDrvHlpVMSetError(pThis->pDrvIns, VERR_INVALID_PARAMETER, RT_SRC_POS,
     1412                return PDMDrvHlpVMSetError(pDrvIns, VERR_INVALID_PARAMETER, RT_SRC_POS,
    14071413                    N_("NAT#%d: Invalid configuration value for \"Protocol\": \"%s\""),
    14081414                    iInstance, szProtocol);
    14091415        }
    14101416        else
    1411             return PDMDrvHlpVMSetError(pThis->pDrvIns, rc, RT_SRC_POS,
     1417            return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
    14121418                                       N_("NAT#%d: configuration query for \"Protocol\" failed"),
    14131419                                       iInstance);
    14141420        /* host port */
    14151421        int32_t iHostPort;
    1416         GET_S32_STRICT(rc, pThis, pNode, "HostPort", iHostPort);
     1422        GET_S32_STRICT(rc, pDrvIns, pNode, "HostPort", iHostPort);
    14171423
    14181424        /* guest port */
    14191425        int32_t iGuestPort;
    1420         GET_S32_STRICT(rc, pThis, pNode, "GuestPort", iGuestPort);
     1426        GET_S32_STRICT(rc, pDrvIns, pNode, "GuestPort", iGuestPort);
    14211427
    14221428        /* host address ("BindIP" name is rather unfortunate given "HostPort" to go with it) */
    14231429        struct in_addr BindIP;
    14241430        RT_ZERO(BindIP);
    1425         GETIP_DEF(rc, pThis, pNode, BindIP, INADDR_ANY);
     1431        GETIP_DEF(rc, pDrvIns, pNode, BindIP, INADDR_ANY);
    14261432
    14271433        /* guest address */
    14281434        struct in_addr GuestIP;
    14291435        RT_ZERO(GuestIP);
    1430         GETIP_DEF(rc, pThis, pNode, GuestIP, INADDR_ANY);
     1436        GETIP_DEF(rc, pDrvIns, pNode, GuestIP, INADDR_ANY);
    14311437
    14321438        /*
     
    15241530    RT_NOREF(fFlags);
    15251531    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    1526     PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT);
     1532    PDRVNAT         pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT);
     1533
    15271534    LogFlow(("drvNATConstruct:\n"));
    15281535
     
    15741581     * Validate the config.
    15751582     */
    1576     if (!CFGMR3AreValuesValid(pCfg,
    1577                               "PassDomain\0TFTPPrefix\0BootFile\0Network"
    1578                               "\0NextServer\0DNSProxy\0BindIP\0UseHostResolver\0"
    1579                               "SlirpMTU\0AliasMode\0"
    1580                               "SockRcv\0SockSnd\0TcpRcv\0TcpSnd\0"
    1581                               "ICMPCacheLimit\0"
    1582                               "SoMaxConnection\0"
    1583 #ifdef VBOX_WITH_DNSMAPPING_IN_HOSTRESOLVER
    1584                               "HostResolverMappings\0"
    1585 #endif
    1586                             ))
    1587         return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,
    1588                                 N_("Unknown NAT configuration option, only supports PassDomain,"
    1589                                 " TFTPPrefix, BootFile and Network"));
     1583    PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns,
     1584                                  "PassDomain"
     1585                                  "|TFTPPrefix"
     1586                                  "|BootFile"
     1587                                  "|Network"
     1588                                  "|NextServer"
     1589                                  "|DNSProxy"
     1590                                  "|BindIP"
     1591                                  "|UseHostResolver"
     1592                                  "|SlirpMTU"
     1593                                  "|AliasMode"
     1594                                  "|SockRcv"
     1595                                  "|SockSnd"
     1596                                  "|TcpRcv"
     1597                                  "|TcpSnd"
     1598                                  "|ICMPCacheLimit"
     1599                                  "|SoMaxConnection"
     1600//#ifdef VBOX_WITH_DNSMAPPING_IN_HOSTRESOLVER
     1601                                  "|HostResolverMappings"
     1602//#endif
     1603                                  , "");
    15901604
    15911605    /*
     
    15941608    int rc;
    15951609    bool fPassDomain = true;
    1596     GET_BOOL(rc, pThis, pCfg, "PassDomain", fPassDomain);
    1597 
    1598     GET_STRING_ALLOC(rc, pThis, pCfg, "TFTPPrefix", pThis->pszTFTPPrefix);
    1599     GET_STRING_ALLOC(rc, pThis, pCfg, "BootFile", pThis->pszBootFile);
    1600     GET_STRING_ALLOC(rc, pThis, pCfg, "NextServer", pThis->pszNextServer);
     1610    GET_BOOL(rc, pDrvIns, pCfg, "PassDomain", fPassDomain);
     1611
     1612    GET_STRING_ALLOC(rc, pDrvIns, pCfg, "TFTPPrefix", pThis->pszTFTPPrefix);
     1613    GET_STRING_ALLOC(rc, pDrvIns, pCfg, "BootFile", pThis->pszBootFile);
     1614    GET_STRING_ALLOC(rc, pDrvIns, pCfg, "NextServer", pThis->pszNextServer);
    16011615
    16021616    int fDNSProxy = 0;
    1603     GET_S32(rc, pThis, pCfg, "DNSProxy", fDNSProxy);
     1617    GET_S32(rc, pDrvIns, pCfg, "DNSProxy", fDNSProxy);
    16041618    int fUseHostResolver = 0;
    1605     GET_S32(rc, pThis, pCfg, "UseHostResolver", fUseHostResolver);
     1619    GET_S32(rc, pDrvIns, pCfg, "UseHostResolver", fUseHostResolver);
    16061620    int MTU = 1500;
    1607     GET_S32(rc, pThis, pCfg, "SlirpMTU", MTU);
     1621    GET_S32(rc, pDrvIns, pCfg, "SlirpMTU", MTU);
    16081622    int i32AliasMode = 0;
    16091623    int i32MainAliasMode = 0;
    1610     GET_S32(rc, pThis, pCfg, "AliasMode", i32MainAliasMode);
     1624    GET_S32(rc, pDrvIns, pCfg, "AliasMode", i32MainAliasMode);
    16111625    int iIcmpCacheLimit = 100;
    1612     GET_S32(rc, pThis, pCfg, "ICMPCacheLimit", iIcmpCacheLimit);
     1626    GET_S32(rc, pDrvIns, pCfg, "ICMPCacheLimit", iIcmpCacheLimit);
    16131627
    16141628    i32AliasMode |= (i32MainAliasMode & 0x1 ? 0x1 : 0);
     
    16161630    i32AliasMode |= (i32MainAliasMode & 0x4 ? 0x4 : 0);
    16171631    int i32SoMaxConn = 10;
    1618     GET_S32(rc, pThis, pCfg, "SoMaxConnection", i32SoMaxConn);
     1632    GET_S32(rc, pDrvIns, pCfg, "SoMaxConnection", i32SoMaxConn);
    16191633    /*
    16201634     * Query the network port interface.
     
    16331647    /* Generate a network address for this network card. */
    16341648    char szNetwork[32]; /* xxx.xxx.xxx.xxx/yy */
    1635     GET_STRING(rc, pThis, pCfg, "Network", szNetwork[0], sizeof(szNetwork));
     1649    GET_STRING(rc, pDrvIns, pCfg, "Network", szNetwork[0], sizeof(szNetwork));
    16361650    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    16371651        return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("NAT%d: Configuration error: missing network"),
     
    16621676
    16631677        char *pszBindIP = NULL;
    1664         GET_STRING_ALLOC(rc, pThis, pCfg, "BindIP", pszBindIP);
     1678        GET_STRING_ALLOC(rc, pDrvIns, pCfg, "BindIP", pszBindIP);
    16651679        slirp_set_binding_address(pThis->pNATState, pszBindIP);
    16661680        if (pszBindIP != NULL)
  • trunk/src/VBox/Devices/Network/DrvNetShaper.cpp

    r90346 r91872  
    415415static DECLCALLBACK(int) drvR3NetShaperConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
    416416{
     417    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    417418    PDRVNETSHAPER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSHAPER);
     419    PCPDMDRVHLPR3 pHlp  = pDrvIns->pHlpR3;
     420
    418421    LogFlow(("drvNetShaperConstruct:\n"));
    419     PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    420422
    421423    /*
     
    460462     * Validate the config.
    461463     */
    462     if (!CFGMR3AreValuesValid(pCfg, "BwGroup\0"))
    463         return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
     464    PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "BwGroup", "");
    464465
    465466    /*
    466467     * Find the bandwidth group we have to attach to.
    467468     */
    468     rc = CFGMR3QueryStringAlloc(pCfg, "BwGroup", &pThis->pszBwGroup);
     469    rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "BwGroup", &pThis->pszBwGroup);
    469470    if (RT_FAILURE(rc) && rc != VERR_CFGM_VALUE_NOT_FOUND)
    470471    {
  • trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp

    r82968 r91872  
    374374static DECLCALLBACK(int) drvNetSnifferConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
    375375{
    376     PDRVNETSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER);
     376    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     377    PDRVNETSNIFFER  pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER);
     378    PCPDMDRVHLPR3   pHlp  = pDrvIns->pHlpR3;
     379
    377380    LogFlow(("drvNetSnifferConstruct:\n"));
    378     PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    379381
    380382    /*
     
    415417     * Validate the config.
    416418     */
    417     if (!CFGMR3AreValuesValid(pCfg, "File\0"))
    418         return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    419 
    420     if (CFGMR3GetFirstChild(pCfg))
     419    PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "File", "");
     420
     421    if (pHlp->pfnCFGMGetFirstChild(pCfg))
    421422        LogRel(("NetSniffer: Found child config entries -- are you trying to redirect ports?\n"));
    422423
     
    424425     * Get the filename.
    425426     */
    426     rc = CFGMR3QueryString(pCfg, "File", pThis->szFilename, sizeof(pThis->szFilename));
     427    rc = pHlp->pfnCFGMQueryString(pCfg, "File", pThis->szFilename, sizeof(pThis->szFilename));
    427428    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    428429    {
  • trunk/src/VBox/Devices/Network/DrvTAP.cpp

    r82968 r91872  
    854854    RT_NOREF(fFlags);
    855855    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    856     PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP);
     856    PDRVTAP         pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP);
     857    PCPDMDRVHLPR3   pHlp  = pDrvIns->pHlpR3;
    857858
    858859    /*
     
    897898     * Validate the config.
    898899     */
    899     if (!CFGMR3AreValuesValid(pCfg, "Device\0InitProg\0TermProg\0FileHandle\0TAPSetupApplication\0TAPTerminateApplication\0MAC"))
    900         return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, "");
     900    PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "Device"
     901                                           "|FileHandle"
     902                                           "|TAPSetupApplication"
     903                                           "|TAPTerminateApplication"
     904                                           "|MAC",
     905                                           "");
    901906
    902907    /*
     
    920925    int rc;
    921926#if defined(RT_OS_SOLARIS)   /** @todo Other platforms' TAP code should be moved here from ConsoleImpl. */
    922     rc = CFGMR3QueryStringAlloc(pCfg, "TAPSetupApplication", &pThis->pszSetupApplication);
     927    rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "TAPSetupApplication", &pThis->pszSetupApplication);
    923928    if (RT_SUCCESS(rc))
    924929    {
     
    930935        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Configuration error: failed to query \"TAPTerminateApplication\""));
    931936
    932     rc = CFGMR3QueryStringAlloc(pCfg, "TAPTerminateApplication", &pThis->pszTerminateApplication);
     937    rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "TAPTerminateApplication", &pThis->pszTerminateApplication);
    933938    if (RT_SUCCESS(rc))
    934939    {
     
    940945        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Configuration error: failed to query \"TAPTerminateApplication\""));
    941946
    942     rc = CFGMR3QueryStringAlloc(pCfg, "Device", &pThis->pszDeviceName);
     947    rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "Device", &pThis->pszDeviceName);
    943948    if (RT_FAILURE(rc))
    944949        pThis->fStatic = false;
     
    963968
    964969    uint64_t u64File;
    965     rc = CFGMR3QueryU64(pCfg, "FileHandle", &u64File);
     970    rc = pHlp->pfnCFGMQueryU64(pCfg, "FileHandle", &u64File);
    966971    if (RT_FAILURE(rc))
    967972        return PDMDRV_SET_ERROR(pDrvIns, rc,
  • trunk/src/VBox/Devices/Network/DrvUDPTunnel.cpp

    r82968 r91872  
    454454    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    455455    PDRVUDPTUNNEL pThis = PDMINS_2_DATA(pDrvIns, PDRVUDPTUNNEL);
     456    PCPDMDRVHLPR3 pHlp  = pDrvIns->pHlpR3;
    456457
    457458    /*
     
    488489     * Validate the config.
    489490     */
    490     if (!CFGMR3AreValuesValid(pCfg, "sport\0dest\0dport"))
    491         return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, "");
     491    PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns,  "sport"
     492                                            "|dest"
     493                                            "|dport",
     494                                            "");
    492495
    493496    /*
     
    511514    int rc;
    512515    char szVal[16];
    513     rc = CFGMR3QueryStringDef(pCfg, "sport", szVal, sizeof(szVal), "4444");
     516    rc = pHlp->pfnCFGMQueryStringDef(pCfg, "sport", szVal, sizeof(szVal), "4444");
    514517    if (RT_FAILURE(rc))
    515518        rc = PDMDRV_SET_ERROR(pDrvIns, rc,
     
    522525        pThis->uSrcPort = 4444;
    523526
    524     rc = CFGMR3QueryStringDef(pCfg, "dport", szVal, sizeof(szVal), "4445");
     527    rc = pHlp->pfnCFGMQueryStringDef(pCfg, "dport", szVal, sizeof(szVal), "4445");
    525528    if (RT_FAILURE(rc))
    526529        rc = PDMDRV_SET_ERROR(pDrvIns, rc,
     
    533536        pThis->uDestPort = 4445;
    534537
    535     rc = CFGMR3QueryStringAllocDef(pCfg, "dest", &pThis->pszDestIP, "127.0.0.1");
     538    rc = pHlp->pfnCFGMQueryStringAllocDef(pCfg, "dest", &pThis->pszDestIP, "127.0.0.1");
    536539    if (RT_FAILURE(rc))
    537540        rc = PDMDRV_SET_ERROR(pDrvIns, rc,
  • trunk/src/VBox/Devices/Network/DrvVDE.cpp

    r82968 r91872  
    540540    RT_NOREF(fFlags);
    541541    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    542     PDRVVDE pThis = PDMINS_2_DATA(pDrvIns, PDRVVDE);
     542    PDRVVDE         pThis = PDMINS_2_DATA(pDrvIns, PDRVVDE);
     543    PCPDMDRVHLPR3   pHlp  = pDrvIns->pHlpR3;
    543544
    544545    /*
     
    576577     * Validate the config.
    577578     */
    578     if (!CFGMR3AreValuesValid(pCfg, "network"))
    579         return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, "");
     579    PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "network", "");
    580580
    581581    /*
     
    599599    int rc;
    600600    char szNetwork[RTPATH_MAX];
    601     rc = CFGMR3QueryString(pCfg, "network", szNetwork, sizeof(szNetwork));
     601    rc = pHlp->pfnCFGMQueryString(pCfg, "network", szNetwork, sizeof(szNetwork));
    602602    if (RT_FAILURE(rc))
    603603        *szNetwork=0;
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