blob: a4e52c4ebabd77a9c6a71a76236d094a847b5671 [file] [log] [blame]
Mark Salyzyn0175b072014-02-26 09:50:16 -08001/*
2 * Copyright (C) 2012-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
Tom Cherry6ec71e92020-05-04 12:53:36 -070017#pragma once
Mark Salyzyn0175b072014-02-26 09:50:16 -080018
19#include <sysutils/SocketListener.h>
Mark Salyzyn2ad0bd02016-02-23 08:55:43 -080020
Tom Cherry283c9a12020-05-14 19:25:05 -070021#include "LogBuffer.h"
Tom Cherry68630a02020-05-11 16:29:29 -070022#include "LogReaderList.h"
Tom Cherry6ec71e92020-05-04 12:53:36 -070023#include "LogReaderThread.h"
Hao Wangf6e22962017-12-04 14:10:40 +080024
Mark Salyzyn0175b072014-02-26 09:50:16 -080025class LogReader : public SocketListener {
Tom Cherry68630a02020-05-11 16:29:29 -070026 public:
27 explicit LogReader(LogBuffer* logbuf, LogReaderList* reader_list);
Mark Salyzyn0175b072014-02-26 09:50:16 -080028
Tom Cherry68630a02020-05-11 16:29:29 -070029 protected:
Mark Salyzyn501c3732017-03-10 14:31:54 -080030 virtual bool onDataAvailable(SocketClient* cli);
Mark Salyzyn0175b072014-02-26 09:50:16 -080031
Tom Cherry68630a02020-05-11 16:29:29 -070032 private:
Mark Salyzyndfc47e82014-03-24 10:26:47 -070033 static int getLogSocket();
34
Tom Cherry283c9a12020-05-14 19:25:05 -070035 bool DoSocketDelete(SocketClient* cli);
Tom Cherry68630a02020-05-11 16:29:29 -070036
37 LogBuffer* log_buffer_;
38 LogReaderList* reader_list_;
Mark Salyzyn0175b072014-02-26 09:50:16 -080039};