blob: 52b9e8352240ae4614ba942652d24289d7572b44 [file] [log] [blame]
Chad Brubakerd2617932013-06-21 15:26:35 -07001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17#ifndef _NETD_UIDMARKMAP_H
18#define _NETD_UIDMARKMAP_H
19
20#include <stddef.h>
21#include <stdint.h>
22#include <List.h>
23#include <utils/RWLock.h>
24
25class UidMarkMap {
26public:
27 bool add(int uid_start, int uid_end, int mark);
28 bool remove(int uid_start, int uid_end, int mark);
29 int getMark(int uid);
30
31private:
32 struct UidMarkEntry {
33 int uid_start;
34 int uid_end;
35 int mark;
36 UidMarkEntry(int uid_start, int uid_end, int mark);
37 };
38
39 android::RWLock mRWLock;
40 android::netd::List<UidMarkEntry*> mMap;
41};
42#endif