vfs: check userland buffers before reading them.
[haiku.git] / headers / private / storage / sniffer / Rule.h
blobd775dbc312b189067d1880d3c02702f8a2570c5e
1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the MIT License.
4 //---------------------------------------------------------------------
5 /*!
6 \file sniffer/Rule.h
7 Mime sniffer rule declarations
8 */
9 #ifndef _SNIFFER_RULE_H
10 #define _SNIFFER_RULE_H
12 #include <SupportDefs.h>
14 #include <sys/types.h>
15 #include <vector>
17 class BPositionIO;
19 namespace BPrivate {
20 namespace Storage {
21 namespace Sniffer {
23 class DisjList;
25 /*! \brief A priority and a list of expressions to be used for sniffing out the
26 type of an untyped file.
28 class Rule {
29 public:
30 Rule();
31 ~Rule();
33 status_t InitCheck() const;
34 double Priority() const;
35 bool Sniff(BPositionIO *data) const;
36 ssize_t BytesNeeded() const;
37 private:
38 friend class Parser;
40 void Unset();
41 void SetTo(double priority, std::vector<DisjList*>* list);
43 double fPriority;
44 std::vector<DisjList*> *fConjList; // A list of DisjLists to be ANDed
47 }; // namespace Sniffer
48 }; // namespace Storage
49 }; // namespace BPrivate
51 #endif // _SNIFFER_RULE_H