reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
FilterStore.hxx
Go to the documentation of this file.
1#if !defined(REPRO_FILTERSTORE_HXX)
2#define REPRO_FILTERSTORE_HXX
3
4#include <regex>
5
6#include <set>
7#include <list>
8
9#include "rutil/Data.hxx"
10#include "rutil/RWMutex.hxx"
11
12#include "repro/AbstractDb.hxx"
13
14namespace resip
15{
16 class SipMessage;
17}
18
19namespace repro
20{
21
23{
24 public:
26
33
36
41 const resip::Data& method,
42 const resip::Data& event,
43 short action,
45 const short order);
46
51 const resip::Data& method,
52 const resip::Data& event);
53 void eraseFilter(const resip::Data& key);
54
60 const resip::Data& method,
61 const resip::Data& event,
62 short action,
64 const short order);
65
67
68 Key getFirstKey();// return empty if no more
69 Key getNextKey(Key& key); // return empty if no more
70
72 short& action,
74
75 bool test(const resip::Data& cond1Header,
77 short& action,
79
80 private:
81 bool findKey(const Key& key); // move cursor to key
82
83 Key buildKey(const resip::Data& cond1Header,
87 const resip::Data& method,
88 const resip::Data& event) const;
89
90 void getHeaderFromSipMessage(const resip::SipMessage& msg,
91 const resip::Data& headerName,
92 std::list<resip::Data>& headerList);
93 bool applyRegex(int conditionNum,
94 const resip::Data& header,
95 const resip::Data& match,
96 std::regex *_regex,
98
99 AbstractDb& mDb;
100
101 class FilterOp
102 {
103 public:
104 Key key;
105 std::regex *pcond1;
106 std::regex *pcond2;
107 AbstractDb::FilterRecord filterRecord;
108 bool operator<(const FilterOp&) const;
109 };
110
111 resip::RWMutex mMutex;
112 typedef std::multiset<FilterOp> FilterOpList;
113 FilterOpList mFilterOperators;
114 FilterOpList::iterator mCursor;
115};
116
117 }
118#endif
119
120/* ====================================================================
121 * The Vovida Software License, Version 1.0
122 *
123 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
124 *
125 * Redistribution and use in source and binary forms, with or without
126 * modification, are permitted provided that the following conditions
127 * are met:
128 *
129 * 1. Redistributions of source code must retain the above copyright
130 * notice, this list of conditions and the following disclaimer.
131 *
132 * 2. Redistributions in binary form must reproduce the above copyright
133 * notice, this list of conditions and the following disclaimer in
134 * the documentation and/or other materials provided with the
135 * distribution.
136 *
137 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
138 * and "Vovida Open Communication Application Library (VOCAL)" must
139 * not be used to endorse or promote products derived from this
140 * software without prior written permission. For written
141 * permission, please contact vocal@vovida.org.
142 *
143 * 4. Products derived from this software may not be called "VOCAL", nor
144 * may "VOCAL" appear in their name, without prior written
145 * permission of Vovida Networks, Inc.
146 *
147 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
148 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
149 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
150 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
151 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
152 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
153 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
154 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
155 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
156 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
157 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
158 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
159 * DAMAGE.
160 *
161 * ====================================================================
162 */
bool updateFilter(const resip::Data &originalKey, const resip::Data &cond1Header, const resip::Data &cond1Regex, const resip::Data &cond2Header, const resip::Data &cond2Regex, const resip::Data &method, const resip::Data &event, short action, const resip::Data &actionData, const short order)
Key getNextKey(Key &key)
bool addFilter(const resip::Data &cond1Header, const resip::Data &cond1Regex, const resip::Data &cond2Header, const resip::Data &cond2Regex, const resip::Data &method, const resip::Data &event, short action, const resip::Data &actionData, const short order)
void eraseFilter(const resip::Data &cond1Header, const resip::Data &cond1Regex, const resip::Data &cond2Header, const resip::Data &cond2Regex, const resip::Data &method, const resip::Data &event)
bool test(const resip::Data &cond1Header, const resip::Data &cond2Header, short &action, resip::Data &actionData)
bool process(const resip::SipMessage &request, short &action, resip::Data &actionData)
AbstractDb::FilterRecord getFilterRecord(const resip::Data &key)
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Wraps the readers/writers mutex implementation on your platform.
Definition RWMutex.hxx:29
Represents a SIP message.
This Class is used to implement a primitive form of RPC using loose XML formatting.
dcm! – add UnusedChecking(_enum) below;
void list()
Definition userAdmin.cxx:66