Exemplo n.º 1
0
void OpenHome::TestFramework::RandomiseUdn(Environment& aEnv, Bwh& aUdn)
{
    aUdn.Grow(aUdn.Bytes() + 1 + Ascii::kMaxUintStringBytes + 1);
    aUdn.Append('-');
    Bws<Ascii::kMaxUintStringBytes> buf;
    std::vector<NetworkAdapter*>* subnetList = aEnv.NetworkAdapterList().CreateSubnetList();
    TUint max = (subnetList->size() > 0? (*subnetList)[0]->Address() : UINT_MAX);
    aEnv.NetworkAdapterList().DestroySubnetList(subnetList);
    (void)Ascii::AppendDec(buf, aEnv.Random(max));
    aUdn.Append(buf);
    aUdn.PtrZ();
}
Exemplo n.º 2
0
static TIpAddress NetworkIf(Environment& aEnv, TUint aIndex)
{
    const std::vector<NetworkAdapter*>& ifs = aEnv.NetworkAdapterList().List();
    ASSERT(ifs.size() > 0 && aIndex < ifs.size());
    TIpAddress addr = ifs[aIndex]->Address();
    Endpoint endpt(0, addr);
    Endpoint::AddressBuf buf;
    endpt.AppendAddress(buf);
    Print("Using network interface %s\n\n", buf.Ptr());
    return ifs[aIndex]->Address();
}
Exemplo n.º 3
0
AutoNetworkAdapterRef::AutoNetworkAdapterRef(Environment& aEnv, const char* aCookie)
    : iCookie(aCookie)
{
    iAdapter = aEnv.NetworkAdapterList().CurrentAdapter(aCookie);
}