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