|
reSIProcate/stack
9694
|
#include <MessageFilterRule.hxx>

Definition at line 10 of file MessageFilterRule.hxx.
| typedef std::vector<Data> resip::MessageFilterRule::EventList |
Definition at line 16 of file MessageFilterRule.hxx.
| typedef std::vector<Data> resip::MessageFilterRule::HostpartList |
Definition at line 14 of file MessageFilterRule.hxx.
| typedef std::vector<MethodTypes> resip::MessageFilterRule::MethodList |
Definition at line 17 of file MessageFilterRule.hxx.
| typedef std::vector<Data> resip::MessageFilterRule::SchemeList |
Definition at line 13 of file MessageFilterRule.hxx.
Definition at line 15 of file MessageFilterRule.hxx.
{ Any, HostIsMe, DomainIsMe, List }; // Note: HostIsMe is currently not implemented
| MessageFilterRule::MessageFilterRule | ( | SchemeList | schemeList = SchemeList(), |
| HostpartTypes | hostpartType = Any, |
||
| MethodList | methodList = MethodList(), |
||
| EventList | eventTypeList = EventList() |
||
| ) |
Definition at line 17 of file MessageFilterRule.cxx.
: mSchemeList(schemeList), mHostpartMatches(hostpartType), mMethodList(methodList), mEventList(eventList), mTransactionUser(0) { }
| MessageFilterRule::MessageFilterRule | ( | SchemeList | schemeList, |
| HostpartList | hostpartList, | ||
| MethodList | methodList = MethodList(), |
||
| EventList | eventList = EventList() |
||
| ) |
Definition at line 29 of file MessageFilterRule.cxx.
: mSchemeList(schemeList), mHostpartMatches(List), mHostpartList(hostpartList), mMethodList(methodList), mEventList(eventList), mTransactionUser(0) { }
| bool MessageFilterRule::eventIsInList | ( | const SipMessage & | msg | ) | const [private] |
Definition at line 135 of file MessageFilterRule.cxx.
References resip::SipMessage::exists(), resip::SipMessage::header(), and mEventList.
Referenced by matches().
{
// empty list means "match all"
if (mEventList.empty())
{
return true;
}
if (!msg.exists(h_Event))
{
return false;
}
Data event = msg.header(h_Event).value();
for (EventList::const_iterator i = mEventList.begin();
i != mEventList.end(); i++)
{
if (event == *i)
{
return true;
}
}
return false;
}

| bool MessageFilterRule::hostIsInList | ( | const Data & | hostpart | ) | const [private] |
Definition at line 163 of file MessageFilterRule.cxx.
References Any, DomainIsMe, HostIsMe, resip::isEqualNoCase(), resip::TransactionUser::isMyDomain(), List, mHostpartList, mHostpartMatches, and mTransactionUser.
Referenced by matches().
{
switch(mHostpartMatches)
{
case Any:
return true;
case HostIsMe:
// !abr! Waiting for TU support for this method.
// return (tu.hostIsMe(hostpart));
return false;
break;
case DomainIsMe:
if(mTransactionUser)
{
return mTransactionUser->isMyDomain(hostpart);
}
return false;
break;
case List:
// walk the list for specific matches
for (HostpartList::const_iterator i = mHostpartList.begin() ;
i != mHostpartList.end() ; ++i)
{
if (isEqualNoCase(*i, hostpart))
return true;
}
break;
default:
break;
}
return false;
}

| bool MessageFilterRule::matches | ( | const SipMessage & | msg | ) | const |
Definition at line 43 of file MessageFilterRule.cxx.
References DebugLog, eventIsInList(), resip::SipMessage::header(), resip::Uri::host(), hostIsInList(), resip::RequestLine::method(), methodIsInList(), resip::Uri::scheme(), schemeIsInList(), resip::Symbols::Tel, and resip::RequestLine::uri().
{
DebugLog(<< "Matching rule for: " << std::endl << std::endl << msg);
const Data scheme = msg.header(h_RequestLine).uri().scheme();
if (!schemeIsInList(scheme))
{
DebugLog(<< "Scheme is not in list. Rule does not match.");
return false;
}
if (msg.header(h_RequestLine).uri().scheme() != Symbols::Tel)
{
// !rwm! Should be hostport, not host
if (!hostIsInList( msg.header(h_RequestLine).uri().host()))
{
DebugLog(<< "Host is not in list. Rule does not match.");
return false;
}
}
MethodTypes method = msg.header(h_RequestLine).method();
if (!methodIsInList(method))
{
DebugLog(<< "Method is not in list. Rule does not match.");
return false;
}
else
{
switch(method)
{
case SUBSCRIBE:
case NOTIFY:
case PUBLISH:
if (!eventIsInList(msg))
{
DebugLog(<< "Event is not in list. Rule does not match.");
return false;
}
break;
default:
break;
}
}
return true;
}

| bool MessageFilterRule::methodIsInList | ( | MethodTypes | method | ) | const [private] |
Definition at line 114 of file MessageFilterRule.cxx.
References mMethodList.
Referenced by matches().
{
// empty list means "match all"
if (mMethodList.empty())
{
return true;
}
for (MethodList::const_iterator i = mMethodList.begin();
i != mMethodList.end(); i++)
{
if (method == *i)
{
return true;
}
}
return false;
}
| bool MessageFilterRule::schemeIsInList | ( | const Data & | scheme | ) | const [private] |
Definition at line 92 of file MessageFilterRule.cxx.
References mSchemeList, resip::Symbols::Sip, resip::Symbols::Sips, and resip::Symbols::Tel.
Referenced by matches().
{
// Emtpy list means "sip or sips"
if (mSchemeList.empty())
{
return (scheme == Symbols::Sip || scheme == Symbols::Sips || scheme == Symbols::Tel);
}
// step through mSchemeList looking for supported schemes
for (SchemeList::const_iterator i = mSchemeList.begin();
i != mSchemeList.end(); i++)
{
if (scheme == *i)
{
return true;
}
}
return false;
}
| void resip::MessageFilterRule::setTransactionUser | ( | TransactionUser * | tu | ) | [inline] |
Definition at line 30 of file MessageFilterRule.hxx.
References mTransactionUser.
{ mTransactionUser = tu; }
Definition at line 42 of file MessageFilterRule.hxx.
Referenced by eventIsInList().
Definition at line 40 of file MessageFilterRule.hxx.
Referenced by hostIsInList().
Definition at line 39 of file MessageFilterRule.hxx.
Referenced by hostIsInList().
Definition at line 41 of file MessageFilterRule.hxx.
Referenced by methodIsInList().
Definition at line 38 of file MessageFilterRule.hxx.
Referenced by schemeIsInList().
Definition at line 43 of file MessageFilterRule.hxx.
Referenced by hostIsInList(), and setTransactionUser().
1.7.5.1