/** Ending port in a range of ports
*/
long range_end;
+ /** Allow overlapped port ranges
+ */
+ bool overlapped;
+ /** Used to determine overlapping of ports
+ * without O(n) algorithm being used
+ */
+ std::map<long, bool> overlap_set;
+ /** Returns true if val overlaps an existing range
+ */
+ bool Overlaps(long val);
public:
/** Create a portparser and fill it with the provided data
+ * @param source The source text to parse from
+ * @param allow_overlapped Allow overlapped ranges
*/
- portparser(const std::string &source);
+ portparser(const std::string &source, bool allow_overlapped = true);
/** Frees the internal commasepstream object
*/
~portparser();
long GetToken();
};
+ typedef std::pair<size_t, unsigned char> bitfield;
+
+ class dynamicbitmask : public classbase
+ {
+ private:
+ unsigned char* bits;
+ unsigned char* freebits;
+ size_t bits_size;
+ public:
+ dynamicbitmask();
+
+ ~dynamicbitmask();
+
+ bitfield Allocate();
+
+ bool Deallocate(bitfield &pos);
+
+ void Toggle(bitfield &pos, bool state);
+ };
+
/** The irc_char_traits class is used for RFC-style comparison of strings.
* This class is used to implement irc::string, a case-insensitive, RFC-
* comparing string class.