2 * Copyright (C) 2014 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef _LOGD_LOG_WHITE_BLACK_LIST_H__
18 #define _LOGD_LOG_WHITE_BLACK_LIST_H__
20 #include <sys/types.h>
22 #include <utils/List.h>
24 #include <LogBufferElement.h>
26 // White and Blacklist
29 friend class PruneList;
33 int cmp(uid_t uid, pid_t pid) const;
36 static const uid_t uid_all = (uid_t) -1;
37 static const pid_t pid_all = (pid_t) -1;
39 Prune(uid_t uid, pid_t pid);
41 uid_t getUid() const { return mUid; }
42 pid_t getPid() const { return mPid; }
44 int cmp(LogBufferElement *e) const { return cmp(e->getUid(), e->getPid()); }
46 // *strp is malloc'd, use free to release
47 void format(char **strp);
50 typedef android::List<Prune *> PruneCollection;
53 PruneCollection mNaughty;
54 PruneCollection mNice;
55 bool mWorstUidEnabled;
63 bool naughty(LogBufferElement *element);
64 bool naughty(void) { return !mNaughty.empty(); }
65 bool nice(LogBufferElement *element);
66 bool nice(void) { return !mNice.empty(); }
67 bool worstUidEnabled() const { return mWorstUidEnabled; }
69 // *strp is malloc'd, use free to release
70 void format(char **strp);
73 #endif // _LOGD_LOG_WHITE_BLACK_LIST_H__