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 filters
hr = 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 whitelist
hr = filters->Reset();
if(FAILED(hr))
goto error;
// invert the single whitelist filter to create the blacklist
hr = filters->Remove(0);
if(FAILED(hr))
goto error;
{
// obtain the server IP address and create the filter range
CComPtr<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 range
hr = filters->Add(CComBSTR(ipfirst), CComBSTR(iplast), VARIANT_TRUE);
if(FAILED(hr))
goto error;
// copy the filters to the server
hr = 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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.