HRESULT SetLocalNetworkFilter(IltmsServer* server){HRESULT hr;CComPtr<IltmsIPFilters> filters;CString ipfirst;CString iplast;// this routine will setup an IP filter that only allows local network connections// retrieve a copy of the current filtershr = server->GetIPFilters(&filters);if(FAILED(hr))goto error;// create a full range blacklist// equivalent to filters->Add(CComBSTR(L"0.0.0.0"), CComBSTR(L"255.255.255.255"), VARIANT_FALSE);// create a full range whitelisthr = filters->Reset();if(FAILED(hr))goto error;// invert the single whitelist filter to create the blacklisthr = filters->Remove(0);if(FAILED(hr))goto error;{// obtain the server IP address and create the filter rangeCComPtr<IltmsNetworkProperties> props;hr = server->GetNetworkProperties(&props);if(FAILED(hr))goto error;CComBSTR v;hr = props->get_ActualIPAddress(&v);if(FAILED(hr))goto error;CString t(v);t = t.Left(t.ReverseFind(_T('.')));ipfirst = t + _T(".0");iplast += t + _T(".255");}// now we will add a filter to allow for the local network IP rangehr = filters->Add(CComBSTR(ipfirst), CComBSTR(iplast), VARIANT_TRUE);if(FAILED(hr))goto error;// copy the filters to the serverhr = server->SetIPFilters(filters);if(FAILED(hr))goto error;error:return hr;}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
