Mark Salyzyn | 0175b07 | 2014-02-26 09:50:16 -0800 | [diff] [blame] | 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_ELEMENT_H__ |
| 18 | #define _LOGD_LOG_BUFFER_ELEMENT_H__ |
| 19 | |
| 20 | #include <sys/types.h> |
| 21 | #include <sysutils/SocketClient.h> |
| 22 | #include <log/log.h> |
| 23 | #include <log/log_read.h> |
| 24 | |
| 25 | class LogBufferElement { |
| 26 | const log_id_t mLogId; |
| 27 | const uid_t mUid; |
| 28 | const pid_t mPid; |
Mark Salyzyn | b992d0d | 2014-03-20 16:09:38 -0700 | [diff] [blame] | 29 | const pid_t mTid; |
Mark Salyzyn | 0175b07 | 2014-02-26 09:50:16 -0800 | [diff] [blame] | 30 | char *mMsg; |
| 31 | const unsigned short mMsgLen; |
| 32 | const log_time mMonotonicTime; |
| 33 | const log_time mRealTime; |
| 34 | |
| 35 | public: |
Mark Salyzyn | 7e2f83c | 2014-03-05 07:41:49 -0800 | [diff] [blame] | 36 | LogBufferElement(log_id_t log_id, log_time realtime, |
Mark Salyzyn | b992d0d | 2014-03-20 16:09:38 -0700 | [diff] [blame] | 37 | uid_t uid, pid_t pid, pid_t tid, |
| 38 | const char *msg, unsigned short len); |
Mark Salyzyn | 0175b07 | 2014-02-26 09:50:16 -0800 | [diff] [blame] | 39 | virtual ~LogBufferElement(); |
| 40 | |
| 41 | log_id_t getLogId() const { return mLogId; } |
| 42 | uid_t getUid(void) const { return mUid; } |
| 43 | pid_t getPid(void) const { return mPid; } |
Mark Salyzyn | b992d0d | 2014-03-20 16:09:38 -0700 | [diff] [blame] | 44 | pid_t getTid(void) const { return mTid; } |
Mark Salyzyn | 0175b07 | 2014-02-26 09:50:16 -0800 | [diff] [blame] | 45 | unsigned short getMsgLen() const { return mMsgLen; } |
| 46 | log_time getMonotonicTime(void) const { return mMonotonicTime; } |
| 47 | log_time getRealTime(void) const { return mRealTime; } |
| 48 | |
Mark Salyzyn | 7e2f83c | 2014-03-05 07:41:49 -0800 | [diff] [blame] | 49 | static const log_time FLUSH_ERROR; |
| 50 | log_time flushTo(SocketClient *writer); |
Mark Salyzyn | 0175b07 | 2014-02-26 09:50:16 -0800 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | #endif |