VirtualBox

Ignore:
Timestamp:
Oct 27, 2015 4:30:34 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103701
Message:

IPRT/net: add RTNetStrIsIPv4AddrAny, RTNetStrIsIPv6AddrAny.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTNetIPv6.cpp

    r57358 r58438  
    7373
    7474
     75#define CHECKANY(String, fExpected)                                     \
     76    do {                                                                \
     77        bool fRc = RTNetStrIsIPv6AddrAny(String);                       \
     78        if (fRc != fExpected)                                           \
     79        {                                                               \
     80            RTTestIFailed("at line %d: '%s':"                           \
     81                          " expected %RTbool got %RTbool\n",            \
     82                          __LINE__, (String), fExpected, fRc);          \
     83        }                                                               \
     84    } while (0)
     85
     86#define IS_ANY(String)  CHECKANY((String), true)
     87#define NOT_ANY(String) CHECKANY((String), false)
     88
     89
    7590int main()
    7691{
     
    189204    GOODADDR(" ff01::1%net1.1\t", 0xff010000, 0, 0, 1);
    190205
     206
     207    IS_ANY("::");
     208    IS_ANY("::0.0.0.0");
     209    IS_ANY("0:0:0:0:0:0:0:0");
     210    IS_ANY("0000:0000:0000:0000:0000:0000:0000:0000");
     211
     212    IS_ANY("\t :: \t");
     213
     214    NOT_ANY("::1");
     215    NOT_ANY("0:0:0:0:0:0:0:1");
     216
     217    NOT_ANY(":: x");
     218    NOT_ANY("::%");
     219    NOT_ANY("::%eth0");         /* or is it? */
     220
    191221    return RTTestSummaryAndDestroy(hTest);
    192222}
Note: See TracChangeset for help on using the changeset viewer.

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