1 /* 2 * Copyright (C) 2012-2014 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 _LOGD_LOG_BUFFER_INTERFACE_H__ 18 #define _LOGD_LOG_BUFFER_INTERFACE_H__ 19 20 #include <sys/types.h> 21 22 #include <android-base/macros.h> 23 #include <log/log_id.h> 24 #include <log/log_time.h> 25 26 // Abstract interface that handles log when log available. 27 class LogBufferInterface { 28 public: 29 LogBufferInterface(); 30 virtual ~LogBufferInterface(); 31 // Handles a log entry when available in LogListener. 32 // Returns the size of the handled log message. 33 virtual int log(log_id_t log_id, log_time realtime, uid_t uid, pid_t pid, 34 pid_t tid, const char* msg, unsigned short len) = 0; 35 36 virtual uid_t pidToUid(pid_t pid); 37 virtual pid_t tidToPid(pid_t tid); 38 39 private: 40 DISALLOW_COPY_AND_ASSIGN(LogBufferInterface); 41 }; 42 43 #endif // _LOGD_LOG_BUFFER_INTERFACE_H__ 44